How to use @instructure/uid - 10 common examples

To help you get started, we’ve selected a few @instructure/uid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instructure / instructure-ui / packages / ui-tabs / src / TabList / index.js View on Github external
get tabIds () {
    // cache tab ids for better performance and to prevent errors with animations
    const ids = this._tabIds || []
    let diff = ids.length - this.tabs.length

    while (diff++ < 0) {
      ids.push(uid('Tab'))
    }

    this._tabIds = ids

    return ids
  }
github instructure / instructure-ui / packages / ui-media-player / src / components / VideoPlayer / index.js View on Github external
}

  mediaPlayerWrapper = null
  videoWrapper = null
  video = null
  state = {
    videoState: PAUSED,
    screenState: WINDOWED_SCREEN,
    muted: false,
    volume: 1,
    playbackSpeed: 1,
    loadingSrc: true,
    selectedSrc: this.getSourceFromProps(),
    sources: this.props.sources,
    showControls: true,
    videoId: uid('VideoPlayer')
  }

  componentDidMount () {
    this._registerEventHandlers()
  }

  componentWillUnmount () {
    screenfull.off('change', this.updateScreenState)
    MEDIA_ELEMENT_EVENTS.forEach((evt) => {
      this.video.removeEventListener(evt, this.getDerivedStateFromVideoProps)
    })
    // remove the video ref and stop applying video props
    this.video = null
    this.videoWrapper = null
    this.mediaPlayerWrapper = null
  }
github instructure / instructure-ui / packages / ui-tabs / src / components / Tabs / index.js View on Github external
get tabIds () {
    // cache tab ids for better performance and to prevent errors with animations
    const ids = this._tabIds || []
    let diff = ids.length - this.tabs.length

    while (diff++ < 0) {
      ids.push(uid('Tab'))
    }

    this._tabIds = ids

    return ids
  }
github instructure / instructure-ui / packages / ui-tabs / src / components / TabList / index.js View on Github external
get tabIds () {
    // cache tab ids for better performance and to prevent errors with animations
    const ids = this._tabIds || []
    let diff = ids.length - this.tabs.length

    while (diff++ < 0) {
      ids.push(uid('Tab'))
    }

    this._tabIds = ids

    return ids
  }
github instructure / instructure-ui / packages / ui-alerts / src / Alert / index.js View on Github external
createScreenreaderAlert () {
    const liveRegion = this.getLiveRegion()
    if (liveRegion) {
      this.srid = uid('Alert')

      const div = document.createElement('div')
      div.setAttribute('id', this.srid)

      const content = this.createScreenreaderContentNode()
      ReactDOM.render(content, div)
      liveRegion.appendChild(div)
    }
  }
github instructure / instructure-ui / packages / ui-code-editor / src / CodeEditor / index.js View on Github external
constructor (props) {
    super()
    this._id = uid('CodeEditor')

    if (typeof props.value === 'undefined') {
      this.state = {
        value: props.defaultValue
      }
    }
  }
github instructure / instructure-ui / packages / ui-svg-images / src / InlineSVG / index.js View on Github external
constructor () {
    super()

    this.titleId = uid('InlineSVG-title')
    this.descId = uid('InlineSVG-desc')
  }
github instructure / instructure-ui / packages / ui-file-drop / src / FileDrop / index.js View on Github external
constructor (props) {
    super(props)

    this.defaultId = uid('FileDrop')
    this.messagesId = uid('FileDrop-messages')
  }
github instructure / instructure-ui / packages / ui-forms / src / Select / SelectField / index.js View on Github external
constructor (props) {
    super(props)

    this.state = {
      focus: false,
      highlightedIndex: this.getSelectedIndex(props),
      expanded: false,
      positioned: false
    }

    this._defaultId = uid('Select')
    this._optionsId = uid('Select-Options')
    this._assistId = uid('Select-assistiveText')
  }
github instructure / instructure-ui / packages / ui-svg-images / src / InlineSVG / index.js View on Github external
constructor () {
    super()

    this.titleId = uid('InlineSVG-title')
    this.descId = uid('InlineSVG-desc')
  }

@instructure/uid

A unique (CSS-safe) id generator made by Instructure Inc.

MIT
Latest version published 7 days ago

Package Health Score

87 / 100
Full package analysis

Popular @instructure/uid functions

Similar packages