How to use the @rmwc/base.matches function in @rmwc/base

To help you get started, we’ve selected a few @rmwc/base 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 jamesmfriedman / rmwc / src / list / list.tsx View on Github external
handleClick(evt: React.MouseEvent) {
    this.props.onClick && this.props.onClick(evt);

    const index = this.getListItemIndex(evt);

    // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events.
    const toggleCheckbox = !matches(
      evt.target as HTMLElement,
      MDCListFoundation.strings.CHECKBOX_RADIO_SELECTOR
    );

    this.foundation.handleClick(index, toggleCheckbox);
  }
github jamesmfriedman / rmwc / src / list / foundation.tsx View on Github external
(evt: React.MouseEvent) => {
      props.onClick?.(evt);

      const index = getListItemIndex(evt);

      // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events.
      const toggleCheckbox = !matches(
        evt.target as HTMLElement,
        MDCListFoundation.strings.CHECKBOX_RADIO_SELECTOR
      );

      foundation.handleClick(index, toggleCheckbox);
    },
    [getListItemIndex, foundation, props.onClick]
github jamesmfriedman / rmwc / src / ripple / foundation.tsx View on Github external
isSurfaceActive: () => {
          if (rootEl.ref) {
            return matches(rootEl.ref, ':active');
          }
          return false;
        },
        isSurfaceDisabled: () => !!getProps().disabled,
github jamesmfriedman / rmwc / src / tabs / tab-scroller.tsx View on Github external
eventTargetMatchesSelector: (evtTarget: EventTarget, selector: string) =>
        matches(evtTarget as HTMLElement, selector),
      addClass: (className: string) => this.root.addClass(className),
github jamesmfriedman / rmwc / src / dialog / index.tsx View on Github external
eventTargetMatches: (target: HTMLElement, selector: string) =>
        matches(target, selector),
      trapFocus: () => {
github jamesmfriedman / rmwc / src / dialog / dialog.tsx View on Github external
eventTargetMatches: (target: HTMLElement, selector: string) =>
        matches(target, selector),
      trapFocus: () => {
github jamesmfriedman / rmwc / src / ripple / index.tsx View on Github external
isSurfaceActive: () => {
        if (this.root.ref) {
          return matches(this.root.ref, ':active');
        }
        return false;
      },
      isSurfaceDisabled: () => !!this.props.disabled,
github jamesmfriedman / rmwc / src / tabs / tab-scroller-foundation.tsx View on Github external
eventTargetMatchesSelector: (
          evtTarget: EventTarget,
          selector: string
        ) => matches(evtTarget as HTMLElement, selector),
        addClass: (className: string) => rootEl.addClass(className),