How to use the @material/checkbox/foundation function in @material/checkbox

To help you get started, we’ve selected a few @material/checkbox 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 pgbross / vue-material-adapter / packages / mcwv-checkbox / checkbox.js View on Github external
setNativeControlAttr: (attr, value) => {
        this.$refs.control.setAttribute(attr, value);
      },
      removeNativeControlAttr: attr => {
        this.$refs.control.removeAttribute(attr);
      },
      isIndeterminate: () => this.$refs.control.indeterminate,
      isChecked: () => this.$refs.control.checked,
      hasNativeControl: () => true,
      setNativeControlDisabled: disabled =>
        (this.$refs.control.disabled = disabled),
      forceLayout: () => this.$refs.root.offsetWidth,
      isAttachedToDOM: () => true,
    };

    this.foundation = new MDCCheckboxFoundation(adapter);

    this.handleAnimationEnd_ = () => this.foundation.handleAnimationEnd();

    this.$el.addEventListener(
      getCorrectEventName(window, 'animationend'),
      this.handleAnimationEnd_,
    );

    this.installPropertyChangeHooks_();

    this.ripple = new RippleBase(this, {
      isUnbounded: () => true,
      isSurfaceActive: () => RippleBase.isSurfaceActive(this.$refs.control),
      registerInteractionHandler: (evt, handler) => {
        this.$refs.control.addEventListener(evt, handler, applyPassive());
      },
github pgbross / vue-material-adapter / packages / mcwv-checkbox / mdc-checkbox.js View on Github external
setNativeControlAttr: (attr, value) => {
        this.$refs.control.setAttribute(attr, value);
      },
      removeNativeControlAttr: attr => {
        this.$refs.control.removeAttribute(attr);
      },
      isIndeterminate: () => this.$refs.control.indeterminate,
      isChecked: () => this.$refs.control.checked,
      hasNativeControl: () => true,
      setNativeControlDisabled: disabled =>
        (this.$refs.control.disabled = disabled),
      forceLayout: () => this.$refs.root.offsetWidth,
      isAttachedToDOM: () => true,
    };

    this.foundation = new MDCCheckboxFoundation(adapter);

    this.handleAnimationEnd_ = () => this.foundation.handleAnimationEnd();

    this.$el.addEventListener(
      getCorrectEventName(window, 'animationend'),
      this.handleAnimationEnd_,
    );

    this.installPropertyChangeHooks_();

    this.ripple = new RippleBase(this, {
      isUnbounded: () => true,
      isSurfaceActive: () => RippleBase.isSurfaceActive(this.$refs.control),
      registerInteractionHandler: (evt, handler) => {
        this.$refs.control.addEventListener(evt, handler, applyPassive());
      },