How to use the @material/dialog/constants.strings.CLOSE_ACTION function in @material/dialog

To help you get started, we’ve selected a few @material/dialog 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-react / packages / dialog / index.tsx View on Github external
foundation!: MDCDialogFoundation;
  dialogElement: React.RefObject = React.createRef();
  labelledBy?: string;
  describedBy?: string;

  static defaultProps: Partial> = {
    autoStackButtons: true,
    className: '',
    onOpening: () => {},
    onClosing: () => {},
    tag: 'div',
    id: 'mdc-dialog',
    open: false,
    role: 'alertdialog',
    escapeKeyAction: strings.CLOSE_ACTION,
    scrimClickAction: strings.CLOSE_ACTION,
  };

  state: DialogState = {classList: new Set()};

  componentDidMount() {
    const {open, autoStackButtons, escapeKeyAction, scrimClickAction} = this.props;
    this.foundation = new MDCDialogFoundation(this.adapter);
    this.foundation.init();

    if (open) {
      this.open();
    }
    if (!autoStackButtons) {
      this.foundation.setAutoStackButtons(autoStackButtons!);
    }
github material-components / material-components-web-react / packages / dialog / index.tsx View on Github external
focusTrap?: FocusTrap;
  foundation!: MDCDialogFoundation;
  dialogElement: React.RefObject = React.createRef();
  labelledBy?: string;
  describedBy?: string;

  static defaultProps: Partial> = {
    autoStackButtons: true,
    className: '',
    onOpening: () => {},
    onClosing: () => {},
    tag: 'div',
    id: 'mdc-dialog',
    open: false,
    role: 'alertdialog',
    escapeKeyAction: strings.CLOSE_ACTION,
    scrimClickAction: strings.CLOSE_ACTION,
  };

  state: DialogState = {classList: new Set()};

  componentDidMount() {
    const {open, autoStackButtons, escapeKeyAction, scrimClickAction} = this.props;
    this.foundation = new MDCDialogFoundation(this.adapter);
    this.foundation.init();

    if (open) {
      this.open();
    }
    if (!autoStackButtons) {
      this.foundation.setAutoStackButtons(autoStackButtons!);
    }