square / maker

Maker Design System by Square

Home Page:https://square.github.io/maker/styleguide/latest-stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide A Method for a Dialog to Surface How It Was Closed + Other Info

tatems opened this issue ยท comments

Feature request

Currently, there is no way for a dialog to provide any information to the component when it is being closed.

Eg:

// in the dialog/modal
export default {
  ...
  methods: {
    handleClose() {
      this.dialogApi.close(this.someInternalState);
    },
  },
};

// in the opening parent component
export default {
  ...
  methods: {
    this.dialogApi.open(SomeDialogComponent, {
      beforeCloseHook(closeData) {
        return closeData !== SOME_FLAG_TO_BLOCK_CLOSING;
      },
    } 
  }
};

Why?

Currently, passing information from the dialog to its parent requires going through something like Vuex/Pinia, which causes a disconnect and can lead to hacky workarounds.

Alternatives

No response

Additional context

I am willing to write the needed code to get this working (I have a POC branch ready).

sounds reasonable to me, and your draft POC PR looks good, once you mark it ready for review I can review/approve it

๐ŸŽ‰ This issue has been resolved in version 12.3.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€