How to use the @material/ripple/component.MDCRipple.attachTo 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 / packages / mdc-tabs / tab / component.ts View on Github external
set isActive(isActive) {
    this.foundation_.setActive(isActive);
  }

  get preventDefaultOnClick() {
    return this.foundation_.preventsDefaultOnClick();
  }

  set preventDefaultOnClick(preventDefaultOnClick) {
    this.foundation_.setPreventDefaultOnClick(preventDefaultOnClick);
  }

  protected root_!: HTMLElement; // assigned in MDCComponent constructor

  private ripple_ = MDCRipple.attachTo(this.root_);

  destroy() {
    this.ripple_.destroy();
    super.destroy();
  }

  getDefaultFoundation() {
    // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
    // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
    // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
    const adapter: MDCTabAdapter = {
      addClass: (className) => this.root_.classList.add(className),
      removeClass: (className) => this.root_.classList.remove(className),
      registerInteractionHandler: (type, handler) => this.listen(type, handler),
      deregisterInteractionHandler: (type, handler) => this.unlisten(type, handler),
      getOffsetWidth: () => this.root_.offsetWidth,
github SpringflowNL / aurelia-mdc-elements / node_modules / @material / top-app-bar / component.js View on Github external
        if (rippleFactory === void 0) { rippleFactory = function (el) { return MDCRipple.attachTo(el); }; }
        this.navIcon_ = this.root_.querySelector(strings.NAVIGATION_ICON_SELECTOR);
github material-components / material-components-web / packages / mdc-toolbar / component.ts View on Github external
[].forEach.call(this.root_.querySelectorAll(strings.ICON_SELECTOR), (icon: HTMLElement) => {
      const ripple = MDCRipple.attachTo(icon);
      ripple.unbounded = true;
      this.ripples_.push(ripple);
    });
  }
github material-components / material-components-web / packages / mdc-top-app-bar / component.ts View on Github external
  initialize(rippleFactory: MDCRippleFactory = (el) => MDCRipple.attachTo(el)) {
    this.navIcon_ = this.root_.querySelector(strings.NAVIGATION_ICON_SELECTOR);
github springtype-org / springtype / src / packages / material-ui / src / component / mwc-icon-button / mwc-icon-button.tsx View on Github external
toggleOnClick = () => {
        this.on = !this.on;
        if (this.ripple) {
            MDCRipple.attachTo(this.iconButton, {isUnbounded: true});
        }
    }
}