How to use the @material/ripple/dist/mdc.ripple.MDCRippleFoundation function in @material/ripple

To help you get started, we’ve selected a few @material/ripple 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 material-components / material-components-web / framework-examples / react / src / Checkbox.js View on Github external
getNativeControl: () => {
      if (!this.refs.nativeCb) {
        throw new Error('Invalid state for operation');
      }
      return this.refs.nativeCb;
    },
    forceLayout: () => {
      if (this.refs.nativeCb) {
        this.refs.nativeCb.offsetWidth;
      }
    },
    isAttachedToDOM: () => Boolean(this.refs.nativeCb),
  });

  // For browser compatibility we extend the default adapter which checks for css variable support.
  rippleFoundation = new MDCRippleFoundation(Object.assign(MDCRipple.createAdapter(this), {
    isUnbounded: () => true,
    isSurfaceActive: () => this.refs.nativeCb[MATCHES](':active'),
    addClass: className => {
      this.setState(prevState => ({
        classes: prevState.classes.add(className)
      }));
    },
    removeClass: className => {
      this.setState(prevState => ({
        classes: prevState.classes.remove(className)
      }));
    },
    registerInteractionHandler: (evtType, handler) => {
      this.refs.nativeCb.addEventListener(evtType, handler);
    },
    deregisterInteractionHandler: (evtType, handler) => {
github material-components / material-components-web-react / packages / ripple / index.js View on Github external
initializeFoundation_ = (surface, activator) => {
      const adapter = this.createAdapter_(surface, activator);
      this.foundation_ = new MDCRippleFoundation(adapter);
      this.foundation_.init();
    }
github gutenye / react-mc / src / Button / Button.js View on Github external
initRipple_() {
    const adapter = Ripple.createAdapter(this)
    return new MDCRippleFoundation(adapter)
  }
github gutenye / react-mc / src / Checkbox / Checkbox.js View on Github external
deregisterInteractionHandler: (type, handler) =>
        this.nativeCb_.removeEventListener(type, handler),
      computeBoundingRect: () => {
        const { left, top } = this.root_.getBoundingClientRect()
        const DIM = 40
        return {
          top,
          left,
          right: left + DIM,
          bottom: top + DIM,
          width: DIM,
          height: DIM,
        }
      },
    })
    return new MDCRippleFoundation(adapter)
  }
github gutenye / react-mc / src / Fab / Fab.js View on Github external
initRipple_() {
    const adapter = Ripple.createAdapter(this)
    return new MDCRippleFoundation(adapter)
  }
github react-mdc / react-material-components-web / packages / ripple / src / index.tsx View on Github external
constructor(props) {
        super(props);
        this.adapter = new FoundationAdapter();
        this.foundation = new MDCRippleFoundation(this.adapter.toObject());
    }
github gutenye / react-mc / src / IconToggle / IconToggle.js View on Github external
isUnbounded: () => true,
      isSurfaceActive: () => this.foundation_.isKeyboardActivated(),
      computeBoundingRect: () => {
        const dim = 48
        const { left, top } = this.root_.getBoundingClientRect()
        return {
          left,
          top,
          width: dim,
          height: dim,
          right: left + dim,
          bottom: left + dim,
        }
      },
    })
    return new MDCRippleFoundation(adapter)
  }