diff --git a/docs/docs/.vitepress/config.ts b/docs/docs/.vitepress/config.ts index fb6035e..4d2b300 100644 --- a/docs/docs/.vitepress/config.ts +++ b/docs/docs/.vitepress/config.ts @@ -59,7 +59,8 @@ export default defineConfig({ { text: 'Divider', link: '/guide/components/divider.md'}, { text: 'Icon', link: '/guide/components/icon.md'}, { text: 'Input', link: '/guide/components/input.md'}, - { text: 'Kbd', link: '/guide/components/kbd.md'} + { text: 'Kbd', link: '/guide/components/kbd.md'}, + { text: 'Modal', link: '/guide/components/modal.md'}, ] } ], diff --git a/docs/docs/components/Modal/modalBasic.vue b/docs/docs/components/Modal/modalBasic.vue new file mode 100644 index 0000000..746c2d0 --- /dev/null +++ b/docs/docs/components/Modal/modalBasic.vue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/docs/docs/components/Modal/modalDisableClose.vue b/docs/docs/components/Modal/modalDisableClose.vue new file mode 100644 index 0000000..52b9f77 --- /dev/null +++ b/docs/docs/components/Modal/modalDisableClose.vue @@ -0,0 +1,28 @@ + + + \ No newline at end of file diff --git a/docs/docs/components/Modal/modalDisableOverlay.vue b/docs/docs/components/Modal/modalDisableOverlay.vue new file mode 100644 index 0000000..c3a5335 --- /dev/null +++ b/docs/docs/components/Modal/modalDisableOverlay.vue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/docs/docs/components/Modal/modalDisableTransition.vue b/docs/docs/components/Modal/modalDisableTransition.vue new file mode 100644 index 0000000..d25c937 --- /dev/null +++ b/docs/docs/components/Modal/modalDisableTransition.vue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/docs/docs/guide/components/modal.md b/docs/docs/guide/components/modal.md new file mode 100644 index 0000000..f15e30a --- /dev/null +++ b/docs/docs/guide/components/modal.md @@ -0,0 +1,82 @@ +--- +title: Modal +lang: en-US +--- + +# Modal + +A `Modal` is a user interface element used to display content or options that require attention or interaction from the user. It is typically presented as a dialog box that appears on top of the main content, temporarily blocking interaction with the rest of the application or webpage. + +The `WModal` component is created using [@headlessui/vue's](https://headlessui.com/vue/dialog) `Dialog` component. + +## Basic Usage + +Use the `v-model` to control the state of the `WModal` component as shown below: + + + +## Disable transition + +You can disable the transition of the `WModal` component by using the `transition` prop. Setting it to `false` disables the modal's transition, resulting in the modal appearing and disappearing abruptly without any smooth animations, as demonstrated below: + + + +By default, the `WModal` component's transition is set to `true`. + +## Disable Overlay + +You can disable the overlay of the `WModal` component by using the `overlay` prop. By setting it to `false`, you prevent the background from blurring when the modal is active as shown below: + + + +By default, the `WModal` component's overlay is set to `true` . + +## Disable Close + +By using the `disableClose` prop, you can prevent the `WModal` component from closing when clicked outside. The modal will only be closed when a button or an icon inside it is clicked, as shown below: + + + +## Preset + +```js + WModal: { + base: { + root: 'relative z-50', + modalInner: 'fixed inset-0 overflow-y-auto', + modalContainer: 'flex min-h-full items-center justify-center text-center', + modalPadding: 'p-4', + modalBase: 'relative text-left rtl:text-right overflow-hidden sm:my-8 w-full flex flex-col', + modalShadow: 'shadow-xl', + modalWidth: 'sm:max-w-lg', + modalBackground: 'bg-white border dark:border-gray-600/40 dark:bg-black', + modalRing: '', + modalRounded: 'rounded-lg', + modalHeight: 'h-96', + modalOverlayBase: 'fixed inset-0 transition-opacity', + modalOverlayBackground: 'bg-gray-200/75 dark:bg-[#09090B] dark:bg-opacity-90', + modalOverlayTransition: { + enter: 'ease-out duration-300', + enterFrom: 'opacity-0', + enterTo: 'opacity-100', + leave: 'ease-in duration-200', + leaveFrom: 'opacity-100', + leaveTo: 'opacity-0', + }, + modalTransition: { + enter: 'ease-out duration-300', + enterFrom: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', + enterTo: 'opacity-100 translate-y-0 sm:scale-100', + leave: 'ease-in duration-200', + leaveFrom: 'opacity-100 translate-y-0 sm:scale-100', + leaveTo: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', + }, + + variants: { + default: { + modalBackground: 'bg-white border dark:border-gray-600/40 dark:bg-black', + }, + }, + }, + }, +``` \ No newline at end of file diff --git a/packages/windi/src/App.vue b/packages/windi/src/App.vue index 7353ac5..9703063 100644 --- a/packages/windi/src/App.vue +++ b/packages/windi/src/App.vue @@ -1,9 +1,15 @@