How to use the @instructure/uid function in @instructure/uid

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-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-toggle-details / src / components / Expandable / index.js View on Github external
constructor (props) {
     super()

     this.state = {
       expanded: this.isControlled(props) ? props.expanded : !!props.defaultExpanded
     }

     this._contentId = uid('Expandable__content')
   }
github instructure / instructure-ui / packages / ui-component-examples / src / generateComponentExamples.js View on Github external
const maybeAddExample = (props) => {
    const componentProps = getComponentProps(props)
    const exampleProps = getExampleProps(props)
    const key = uid()
    const propsString = JSON.stringify(componentProps)
    const ignore = (typeof filter === 'function') ? filter(componentProps) : false

    if (!ignore && !PROPS_CACHE.includes(propsString)) {
      exampleCount++

      if (exampleCount < maxExamples) {
        PROPS_CACHE.push(propsString)

        addExample(componentProps[sectionProp], {
          Component,
          componentProps,
          exampleProps,
          key
        })
      }
github instructure / instructure-ui / packages / media-capture / src / components / VideoPlayer / index.js View on Github external
constructor (props) {
    super(props)

    this.video = null
    this.state = {
      state: PAUSED,
      loadingSrc: true,
      showControls: true,
      videoId: uid('VideoPlayer')
    }
  }
github instructure / instructure-ui / packages / ui-core / src / components / PopoverMenu / index.js View on Github external
constructor (props) {
    super()

    this.state = {}

    if (typeof props.show === 'undefined') {
      this.state.show = props.defaultShow
    }

    this.labelId = uid('PopoverMenu')
    this.raf = []
  }

@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