How to use the @material/snackbar/dist/mdc.snackbar.MDCSnackbarFoundation function in @material/snackbar

To help you get started, we’ve selected a few @material/snackbar 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 / Snackbar / Snackbar.js View on Github external
getDefaultFoundation() {
    // prettier-ignore
    return new MDCSnackbarFoundation({
      addClass: helper.addClass('rootProps', this),
      removeClass: helper.removeClass('rootProps', this),
      setAriaHidden: helper.setAttr('rootProps', this, 'aria-hidden', true),
      unsetAriaHidden: helper.rmAttr('rootProps', this, 'aria-hidden', false),
      setActionAriaHidden: helper.setAttr('actionButtonProps', this, 'aria-hidden', true),
      unsetActionAriaHidden: helper.rmAttr('actionButtonProps', this, 'aria-hidden', false),
      setActionText: actionText => this.setState({ actionText }),
      setMessageText: messageText => this.setState({ messageText }),
      setFocus: () => this.actionButton_.focus(),
      visibilityIsHidden: () => document.hidden,
      registerCapturedBlurHandler: helper.registerHandler('actionButtonProps', this, 'blur'),
      deregisterCapturedBlurHandler: helper.deregisterHandler('actionButtonProps', this, 'blur'),
      registerVisibilityChangeHandler: (handler) => document.addEventListener('visibilitychange', handler),
      deregisterVisibilityChangeHandler: (handler) => document.removeEventListener('visibilitychange', handler),
      registerCapturedInteractionHandler: (evt, handler) =>
        document.body.addEventListener(evt, handler, true),