How to use the @material/select/dist/mdc.select.MDCSelectFoundation function in @material/select

To help you get started, we’ve selected a few @material/select 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 gutenye / react-mc / src / Select / Select.js View on Github external
getDefaultFoundation() {
    this.menuEl_ = this.root_.querySelector('.mdc-select__menu')
    // prettier-ignore
    return new MDCSelectFoundation({
      addClass: helper.addClass('rootProps', this),
      removeClass: helper.removeClass('rootProps', this),
      setAttr: helper.setAttr('rootProps', this),
      rmAttr: helper.rmAttr('rootProps', this),
      computeBoundingRect: () => this.root_.getBoundingClientRect(),
      // Don't use rootProps here for Event bubbling
      registerInteractionHandler: (type, handler) => this.root_.addEventListener(type, handler),
      deregisterInteractionHandler: (type, handler) => this.root_.removeEventListener(type, handler),
      focus: () => this.root_.focus(),
      makeTabbable: helper.setAttr('rootProps', this, 'tabIndex', 0),
      makeUntabbable: helper.setAttr('rootProps', this, 'tabIndex', -1),
      getComputedStyleValue: propertyName => window.getComputedStyle(this.root_).getPropertyValue(propertyName),
      setStyle: (propertyName, value) => this.root_.style.setProperty(propertyName, value),
      create2dRenderingContext: () => document.createElement('canvas').getContext('2d'),
      setMenuElStyle: (propertyName, value) => this.menuEl_.style.setProperty(propertyName, value),
      setMenuElAttr: helper.setAttr('menuProps', this),