Replies: 1 comment 2 replies
-
Nicely done on these composable! I have some comment here ya
|
Beta Was this translation helpful? Give feedback.
2 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
What is this?
I have a proposal for the modal components (dialogue, alert, popover...). As this is a big change, I think it is better to discuss it first, improve it and then work on it.
Composables
useEmitCancelableEvent
Implementation
We create an event and emit it. If the user calls
e.preventDefault()
on this event, the callback will not be called.Usage
useEventListener
Implementation
This will allow us to listen to events. Additionally, you can add a flag called
disabled
which will automatically remove the listener when it isfalse
and re-enable it when it istrue
.Usage
useModalInteraction
Implementation
It will handle the events that might occur when the modal opens or closes. Basically, the default behaviour with modals is:
Both of these events should be optional, and the user can cancel them. This composable basically handles that case and also locks the body if it is required.
Other options/features can be added to this composable whenever the modal is open/closed in the future
Usage
useFocusOutside
I haven't done anything related to this, but basically, detect when focus goes out and otherwise emit a cancelable event and close the modal.
useInjected
Not related specifically to modals, but to the whole package.
Implementation
Automatically inject values and return them as JSON. An error will be thrown if the key doesn't exist.
Usage
Beta Was this translation helpful? Give feedback.
All reactions