@mekari/pixel3-modal 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/body.d.mts +6 -0
  2. package/dist/body.d.ts +6 -0
  3. package/dist/body.js +63 -0
  4. package/dist/body.mjs +8 -0
  5. package/dist/chunk-2WYPEVZV.mjs +62 -0
  6. package/dist/chunk-7LGGLG42.mjs +77 -0
  7. package/dist/chunk-ASQKAMBD.mjs +37 -0
  8. package/dist/chunk-D4KITWKW.mjs +34 -0
  9. package/dist/chunk-DKUTSUEJ.mjs +8 -0
  10. package/dist/chunk-FU2Y3XYA.mjs +70 -0
  11. package/dist/chunk-FXPPG3HJ.mjs +24 -0
  12. package/dist/chunk-MO6AFEOO.mjs +285 -0
  13. package/dist/chunk-NCQFKFXL.mjs +69 -0
  14. package/dist/chunk-QZ7VFGWC.mjs +6 -0
  15. package/dist/chunk-THCDEEFK.mjs +24 -0
  16. package/dist/close-button.d.mts +6 -0
  17. package/dist/close-button.d.ts +6 -0
  18. package/dist/close-button.js +60 -0
  19. package/dist/close-button.mjs +8 -0
  20. package/dist/content.d.mts +28 -0
  21. package/dist/content.d.ts +28 -0
  22. package/dist/content.js +359 -0
  23. package/dist/content.mjs +10 -0
  24. package/dist/footer.d.mts +6 -0
  25. package/dist/footer.d.ts +6 -0
  26. package/dist/footer.js +48 -0
  27. package/dist/footer.mjs +7 -0
  28. package/dist/header.d.mts +6 -0
  29. package/dist/header.d.ts +6 -0
  30. package/dist/header.js +48 -0
  31. package/dist/header.mjs +7 -0
  32. package/dist/index.d.mts +10 -0
  33. package/dist/index.d.ts +10 -0
  34. package/dist/index.js +668 -0
  35. package/dist/index.mjs +34 -0
  36. package/dist/metafile-cjs.json +1 -0
  37. package/dist/metafile-esm.json +1 -0
  38. package/dist/modal.d.mts +103 -0
  39. package/dist/modal.d.ts +103 -0
  40. package/dist/modal.js +191 -0
  41. package/dist/modal.mjs +10 -0
  42. package/dist/modules/modal.context.d.mts +11 -0
  43. package/dist/modules/modal.context.d.ts +11 -0
  44. package/dist/modules/modal.context.js +33 -0
  45. package/dist/modules/modal.context.mjs +9 -0
  46. package/dist/modules/modal.props.d.mts +64 -0
  47. package/dist/modules/modal.props.d.ts +64 -0
  48. package/dist/modules/modal.props.js +88 -0
  49. package/dist/modules/modal.props.mjs +11 -0
  50. package/dist/modules/useModal.d.mts +28 -0
  51. package/dist/modules/useModal.d.ts +28 -0
  52. package/dist/modules/useModal.js +321 -0
  53. package/dist/modules/useModal.mjs +12 -0
  54. package/dist/overlay.d.mts +6 -0
  55. package/dist/overlay.d.ts +6 -0
  56. package/dist/overlay.js +104 -0
  57. package/dist/overlay.mjs +8 -0
  58. package/package.json +47 -0
@@ -0,0 +1,6 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+
4
+ declare const MpModalBody: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
5
+
6
+ export { MpModalBody };
package/dist/body.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+
4
+ declare const MpModalBody: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
5
+
6
+ export { MpModalBody };
package/dist/body.js ADDED
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/body.tsx
21
+ var body_exports = {};
22
+ __export(body_exports, {
23
+ MpModalBody: () => MpModalBody
24
+ });
25
+ module.exports = __toCommonJS(body_exports);
26
+ var import_vue = require("vue");
27
+ var import_vue2 = require("vue");
28
+
29
+ // src/modules/modal.context.ts
30
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
31
+ var [ModalProvider, useModalContext] = (0, import_pixel3_utils.usePixelCreateContext)("ModalContext");
32
+
33
+ // src/body.tsx
34
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
35
+ var MpModalBody = (0, import_vue2.defineComponent)({
36
+ name: "MpModalBody",
37
+ setup(_props, {
38
+ slots
39
+ }) {
40
+ const {
41
+ body
42
+ } = (0, import_recipes.modalSlotRecipe)();
43
+ const {
44
+ props: modalProps
45
+ } = useModalContext();
46
+ const {
47
+ scrollBehavior
48
+ } = modalProps;
49
+ return () => {
50
+ return (0, import_vue.createVNode)("div", {
51
+ "data-pixel-component": "MpModalBody",
52
+ "class": body,
53
+ "style": {
54
+ overflowY: scrollBehavior.value === "inside" || scrollBehavior.value === "auto" ? "auto" : "inherit"
55
+ }
56
+ }, [slots.default && slots.default()]);
57
+ };
58
+ }
59
+ });
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ MpModalBody
63
+ });
package/dist/body.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import {
2
+ MpModalBody
3
+ } from "./chunk-ASQKAMBD.mjs";
4
+ import "./chunk-DKUTSUEJ.mjs";
5
+ import "./chunk-QZ7VFGWC.mjs";
6
+ export {
7
+ MpModalBody
8
+ };
@@ -0,0 +1,62 @@
1
+ // src/modules/modal.props.ts
2
+ var modalProps = {
3
+ id: {
4
+ type: String
5
+ },
6
+ isOpen: {
7
+ type: Boolean,
8
+ default: false
9
+ },
10
+ isBlockScrollOnMount: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ isCloseOnEsc: {
15
+ type: Boolean,
16
+ default: true
17
+ },
18
+ isCloseOnOverlayClick: {
19
+ type: Boolean,
20
+ default: true
21
+ },
22
+ isKeepAlive: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ isCentered: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ scrollBehavior: {
31
+ type: String,
32
+ default: "outside"
33
+ },
34
+ size: {
35
+ type: String,
36
+ default: "md"
37
+ },
38
+ isDisablePortal: {
39
+ type: Boolean,
40
+ default: false
41
+ }
42
+ };
43
+ var modalContentProps = {
44
+ type: {
45
+ type: String,
46
+ default: "modal"
47
+ },
48
+ placement: {
49
+ type: String,
50
+ default: "right"
51
+ }
52
+ };
53
+ var modalEmits = {
54
+ "open": (value) => value,
55
+ "close": (value) => value
56
+ };
57
+
58
+ export {
59
+ modalProps,
60
+ modalContentProps,
61
+ modalEmits
62
+ };
@@ -0,0 +1,77 @@
1
+ import {
2
+ modalEmits,
3
+ modalProps
4
+ } from "./chunk-2WYPEVZV.mjs";
5
+ import {
6
+ useModal
7
+ } from "./chunk-MO6AFEOO.mjs";
8
+ import {
9
+ ModalProvider
10
+ } from "./chunk-DKUTSUEJ.mjs";
11
+
12
+ // src/modal.tsx
13
+ import { Fragment as _Fragment, withDirectives as _withDirectives, mergeProps as _mergeProps, vShow as _vShow, createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
14
+ import { defineComponent, Teleport, toRefs, watch } from "vue";
15
+ import { modalSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
16
+ var MpModal = defineComponent({
17
+ name: "MpModal",
18
+ props: modalProps,
19
+ inheritAttrs: false,
20
+ emits: modalEmits,
21
+ setup(props, {
22
+ slots,
23
+ emit,
24
+ attrs
25
+ }) {
26
+ const {
27
+ modalEl,
28
+ getId,
29
+ onClose,
30
+ onOpen,
31
+ isModalOpen
32
+ } = useModal(props, emit);
33
+ ModalProvider({
34
+ props: toRefs(props),
35
+ modalEl,
36
+ getId,
37
+ onClose,
38
+ onOpen,
39
+ isModalOpen
40
+ });
41
+ watch(() => props.isOpen, () => {
42
+ if (props.isOpen) {
43
+ onOpen();
44
+ return;
45
+ }
46
+ }, {
47
+ immediate: true
48
+ });
49
+ return () => {
50
+ const {
51
+ root,
52
+ rootChild
53
+ } = modalSlotRecipe({
54
+ full: props.size === "full" ? true : false
55
+ });
56
+ const modalNode = _withDirectives(_createVNode("div", _mergeProps({
57
+ "ref": modalEl,
58
+ "data-pixel-component": "MpModal",
59
+ "class": root,
60
+ "id": `modal-${getId.value}`
61
+ }, attrs), [_createVNode("div", {
62
+ "class": rootChild
63
+ }, [_createTextVNode(" "), slots.default && slots.default(), _createTextVNode(" ")])]), [[_vShow, isModalOpen.value]]);
64
+ const renderModalNode = !props.isDisablePortal ? _createVNode(Teleport, {
65
+ "to": "body"
66
+ }, {
67
+ default: () => [_createTextVNode(" "), modalNode, _createTextVNode(" ")]
68
+ }) : modalNode;
69
+ const conditionalRenderNode = isModalOpen.value ? renderModalNode : null;
70
+ return _createVNode(_Fragment, null, [props.isKeepAlive ? renderModalNode : conditionalRenderNode]);
71
+ };
72
+ }
73
+ });
74
+
75
+ export {
76
+ MpModal
77
+ };
@@ -0,0 +1,37 @@
1
+ import {
2
+ useModalContext
3
+ } from "./chunk-DKUTSUEJ.mjs";
4
+
5
+ // src/body.tsx
6
+ import { createVNode as _createVNode } from "vue";
7
+ import { defineComponent } from "vue";
8
+ import { modalSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
9
+ var MpModalBody = defineComponent({
10
+ name: "MpModalBody",
11
+ setup(_props, {
12
+ slots
13
+ }) {
14
+ const {
15
+ body
16
+ } = modalSlotRecipe();
17
+ const {
18
+ props: modalProps
19
+ } = useModalContext();
20
+ const {
21
+ scrollBehavior
22
+ } = modalProps;
23
+ return () => {
24
+ return _createVNode("div", {
25
+ "data-pixel-component": "MpModalBody",
26
+ "class": body,
27
+ "style": {
28
+ overflowY: scrollBehavior.value === "inside" || scrollBehavior.value === "auto" ? "auto" : "inherit"
29
+ }
30
+ }, [slots.default && slots.default()]);
31
+ };
32
+ }
33
+ });
34
+
35
+ export {
36
+ MpModalBody
37
+ };
@@ -0,0 +1,34 @@
1
+ import {
2
+ useModalContext
3
+ } from "./chunk-DKUTSUEJ.mjs";
4
+
5
+ // src/close-button.tsx
6
+ import { createVNode as _createVNode } from "vue";
7
+ import { defineComponent } from "vue";
8
+ import { MpButton } from "@mekari/pixel3-button";
9
+ import { modalSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
10
+ var MpModalCloseButton = defineComponent({
11
+ name: "MpModalCloseButton",
12
+ setup() {
13
+ const {
14
+ closeButton
15
+ } = modalSlotRecipe();
16
+ const {
17
+ onClose
18
+ } = useModalContext();
19
+ return () => {
20
+ return _createVNode(MpButton, {
21
+ "data-pixel-component": "MpModalCloseButton",
22
+ "class": closeButton,
23
+ "leftIcon": "close",
24
+ "size": "sm",
25
+ "variant": "ghost",
26
+ "onClick": onClose
27
+ }, null);
28
+ };
29
+ }
30
+ });
31
+
32
+ export {
33
+ MpModalCloseButton
34
+ };
@@ -0,0 +1,8 @@
1
+ // src/modules/modal.context.ts
2
+ import { usePixelCreateContext } from "@mekari/pixel3-utils";
3
+ var [ModalProvider, useModalContext] = usePixelCreateContext("ModalContext");
4
+
5
+ export {
6
+ ModalProvider,
7
+ useModalContext
8
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ useModalContext
3
+ } from "./chunk-DKUTSUEJ.mjs";
4
+ import {
5
+ __name
6
+ } from "./chunk-QZ7VFGWC.mjs";
7
+
8
+ // src/overlay.tsx
9
+ import { withDirectives as _withDirectives, createVNode as _createVNode, vShow as _vShow } from "vue";
10
+ import { defineComponent, Transition } from "vue";
11
+ import anime from "animejs";
12
+ import { modalSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
13
+ var MpModalOverlay = defineComponent({
14
+ name: "MpModalOverlay",
15
+ setup(_props, {
16
+ slots
17
+ }) {
18
+ const {
19
+ overlay
20
+ } = modalSlotRecipe();
21
+ const {
22
+ props: modalProps
23
+ } = useModalContext();
24
+ const {
25
+ isOpen,
26
+ isKeepAlive
27
+ } = modalProps;
28
+ const handleBeforeEnter = /* @__PURE__ */ __name((el) => {
29
+ el && el.style.setProperty("will-change", "opacity, transform", "scale");
30
+ }, "handleBeforeEnter");
31
+ const enterAnimation = /* @__PURE__ */ __name((el, complete) => {
32
+ anime({
33
+ targets: el,
34
+ opacity: [0, 1],
35
+ easing: "easeOutSine",
36
+ duration: 300,
37
+ complete
38
+ });
39
+ }, "enterAnimation");
40
+ const leaveAnimation = /* @__PURE__ */ __name((el, complete) => {
41
+ anime({
42
+ targets: el,
43
+ opacity: [1, 0],
44
+ easing: "easeInSine",
45
+ duration: 300,
46
+ complete
47
+ });
48
+ }, "leaveAnimation");
49
+ return () => {
50
+ const overlayNode = _withDirectives(_createVNode("div", {
51
+ "data-pixel-component": "MpModalOverlay",
52
+ "class": overlay
53
+ }, [slots.default && slots.default()]), [[_vShow, isOpen.value]]);
54
+ const withConditionalRender = isOpen.value ? overlayNode : null;
55
+ return _createVNode(Transition, {
56
+ "css": false,
57
+ "appear": true,
58
+ "onBeforeEnter": (el) => handleBeforeEnter(el),
59
+ "onEnter": (el, complete) => enterAnimation(el, complete),
60
+ "onLeave": (el, complete) => leaveAnimation(el, complete)
61
+ }, {
62
+ default: () => [isKeepAlive.value ? overlayNode : withConditionalRender]
63
+ });
64
+ };
65
+ }
66
+ });
67
+
68
+ export {
69
+ MpModalOverlay
70
+ };
@@ -0,0 +1,24 @@
1
+ // src/header.tsx
2
+ import { createVNode as _createVNode } from "vue";
3
+ import { defineComponent } from "vue";
4
+ import { modalSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
5
+ var MpModalHeader = defineComponent({
6
+ name: "MpModalHeader",
7
+ setup(_props, {
8
+ slots
9
+ }) {
10
+ const {
11
+ header
12
+ } = modalSlotRecipe();
13
+ return () => {
14
+ return _createVNode("header", {
15
+ "data-pixel-component": "MpModalHeader",
16
+ "class": header
17
+ }, [slots.default && slots.default()]);
18
+ };
19
+ }
20
+ });
21
+
22
+ export {
23
+ MpModalHeader
24
+ };
@@ -0,0 +1,285 @@
1
+ import {
2
+ useModalContext
3
+ } from "./chunk-DKUTSUEJ.mjs";
4
+ import {
5
+ __name
6
+ } from "./chunk-QZ7VFGWC.mjs";
7
+
8
+ // src/modules/useModal.ts
9
+ import { ref, computed, nextTick } from "vue";
10
+ import { useId } from "@mekari/pixel3-utils";
11
+ import { enableBodyScroll, disableBodyScroll } from "body-scroll-lock";
12
+ import anime from "animejs";
13
+ import { useFocusTrap } from "@mekari/pixel3-utils";
14
+ var baseSizes = {
15
+ sm: "330px",
16
+ md: "448px",
17
+ lg: "684px",
18
+ xl: "920px",
19
+ "2xl": "1152px",
20
+ full: "100%"
21
+ };
22
+ function useModal(props, emit) {
23
+ const isModalOpen = ref(props.isOpen);
24
+ const modalEl = ref();
25
+ const getId = computed(() => props.id || useId(4));
26
+ function onOpen() {
27
+ isModalOpen.value = true;
28
+ if (props.isBlockScrollOnMount) {
29
+ nextTick(() => {
30
+ disableBodyScroll(modalEl.value);
31
+ });
32
+ }
33
+ emit("open", true);
34
+ }
35
+ __name(onOpen, "onOpen");
36
+ function onClose() {
37
+ if (props.isBlockScrollOnMount) {
38
+ enableBodyScroll(modalEl.value);
39
+ }
40
+ emit("close", true);
41
+ }
42
+ __name(onClose, "onClose");
43
+ return {
44
+ isModalOpen,
45
+ modalEl,
46
+ getId,
47
+ onOpen,
48
+ onClose
49
+ };
50
+ }
51
+ __name(useModal, "useModal");
52
+ function useModalContent(props) {
53
+ const {
54
+ props: modalProps,
55
+ onClose,
56
+ isModalOpen
57
+ } = useModalContext();
58
+ const {
59
+ isCloseOnOverlayClick,
60
+ isOpen,
61
+ isCloseOnEsc,
62
+ isKeepAlive,
63
+ size,
64
+ isCentered,
65
+ scrollBehavior
66
+ } = modalProps;
67
+ const wrapperEl = ref();
68
+ const inlineStyle = computed(() => {
69
+ let wrapperStyle = {};
70
+ let contentStyle = {};
71
+ if (isCentered == null ? void 0 : isCentered.value) {
72
+ wrapperStyle = {
73
+ display: "flex",
74
+ alignItems: "center",
75
+ justifyContent: "center"
76
+ };
77
+ } else {
78
+ contentStyle = {
79
+ top: "3.75rem",
80
+ mx: "auto"
81
+ };
82
+ }
83
+ if (scrollBehavior.value === "inside") {
84
+ wrapperStyle = {
85
+ ...wrapperStyle,
86
+ maxHeight: "calc(100vh - 7.5rem)",
87
+ overflow: "hidden",
88
+ top: "3.75rem"
89
+ };
90
+ contentStyle = {
91
+ ...contentStyle,
92
+ height: "100%",
93
+ top: 0
94
+ };
95
+ }
96
+ if (scrollBehavior.value === "outside") {
97
+ wrapperStyle = {
98
+ ...wrapperStyle,
99
+ overflowY: "auto",
100
+ overflowX: "hidden"
101
+ };
102
+ contentStyle = {
103
+ ...contentStyle,
104
+ my: "3.75rem",
105
+ top: 0
106
+ };
107
+ }
108
+ if (scrollBehavior.value === "auto") {
109
+ wrapperStyle = {
110
+ ...wrapperStyle,
111
+ maxHeight: "calc(100vh - 7.5rem)",
112
+ overflow: "hidden",
113
+ top: "3.75rem"
114
+ };
115
+ contentStyle = {
116
+ ...contentStyle,
117
+ height: "auto",
118
+ maxHeight: "calc(100vh - 7.5rem)",
119
+ top: 0
120
+ };
121
+ }
122
+ if (size.value === "full" || props.type === "drawer") {
123
+ wrapperStyle = {};
124
+ contentStyle = {};
125
+ }
126
+ return {
127
+ wrapperStyle,
128
+ contentStyle
129
+ };
130
+ });
131
+ const {
132
+ activate: activeFocusTrap,
133
+ deactivate: deactivateFocusTrap
134
+ } = useFocusTrap(wrapperEl);
135
+ function onOverlayClick(e) {
136
+ if (isOpen.value && isCloseOnOverlayClick.value && e.target === wrapperEl.value) {
137
+ onClose();
138
+ }
139
+ }
140
+ __name(onOverlayClick, "onOverlayClick");
141
+ const onKeydown = /* @__PURE__ */ __name((event) => {
142
+ if (event.key === "Escape" && isCloseOnEsc.value) {
143
+ onClose();
144
+ }
145
+ }, "onKeydown");
146
+ const getTransition = computed(() => {
147
+ const duration = size.value === "full" ? 400 : 300;
148
+ let enter = {};
149
+ let leave = {};
150
+ if (props.type === "modal") {
151
+ enter = {
152
+ opacity: [0, 1],
153
+ scale: [0.95, 1],
154
+ translateY: ["16px", "0px"],
155
+ easing: "easeOutSine",
156
+ duration
157
+ };
158
+ leave = {
159
+ opacity: [1, 0],
160
+ scale: [1, 0.95],
161
+ translateY: ["0px", "16px"],
162
+ easing: "easeInSine",
163
+ duration: 300
164
+ };
165
+ return {
166
+ enter,
167
+ leave
168
+ };
169
+ }
170
+ if (props.type === "drawer") {
171
+ if (props.placement === "right") {
172
+ enter = {
173
+ translateX(el) {
174
+ const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
175
+ return [translateWidth, "0px"];
176
+ },
177
+ easing: "easeInOutSine",
178
+ duration: 500
179
+ };
180
+ leave = {
181
+ translateX: ["0px", "100%"],
182
+ easing: "easeInOutSine",
183
+ duration: 500
184
+ };
185
+ }
186
+ if (props.placement === "left") {
187
+ enter = {
188
+ translateX(el) {
189
+ const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
190
+ return [`-${translateWidth}`, "0px"];
191
+ },
192
+ easing: "easeInOutSine",
193
+ duration: 500
194
+ };
195
+ leave = {
196
+ translateX: ["0px", "-100%"],
197
+ easing: "easeInOutSine",
198
+ duration: 500
199
+ };
200
+ }
201
+ if (props.placement === "top") {
202
+ enter = {
203
+ translateY(el) {
204
+ const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
205
+ return [`-${translateWidth}`, "0px"];
206
+ },
207
+ easing: "easeInOutSine",
208
+ duration: 500
209
+ };
210
+ leave = {
211
+ translateY: ["0px", "-100%"],
212
+ easing: "easeInOutSine",
213
+ duration: 500
214
+ };
215
+ }
216
+ if (props.placement === "bottom") {
217
+ enter = {
218
+ translateY(el) {
219
+ const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
220
+ return [`${translateWidth}`, "0px"];
221
+ },
222
+ easing: "easeInOutSine",
223
+ duration: 500
224
+ };
225
+ leave = {
226
+ translateY: ["0px", "100%"],
227
+ easing: "easeInOutSine",
228
+ duration: 500
229
+ };
230
+ }
231
+ }
232
+ return {
233
+ enter,
234
+ leave
235
+ };
236
+ });
237
+ const beforeEnterAnimation = /* @__PURE__ */ __name((el) => {
238
+ el && el.style.setProperty("will-change", "opacity, transform", "scale");
239
+ }, "beforeEnterAnimation");
240
+ const enterAnimation = /* @__PURE__ */ __name((el, complete) => {
241
+ anime({
242
+ targets: el,
243
+ ...getTransition.value.enter,
244
+ complete: () => {
245
+ if (isOpen.value) {
246
+ complete();
247
+ document.addEventListener("keydown", onKeydown);
248
+ activeFocusTrap();
249
+ }
250
+ }
251
+ });
252
+ }, "enterAnimation");
253
+ const leaveAnimation = /* @__PURE__ */ __name((el, complete) => {
254
+ deactivateFocusTrap();
255
+ anime({
256
+ targets: el,
257
+ ...getTransition.value.leave,
258
+ complete: () => {
259
+ complete();
260
+ isModalOpen.value = false;
261
+ document.removeEventListener("keydown", onKeydown);
262
+ onClose();
263
+ }
264
+ });
265
+ }, "leaveAnimation");
266
+ return {
267
+ wrapperEl,
268
+ isOpen,
269
+ isKeepAlive,
270
+ size,
271
+ inlineStyle,
272
+ onOverlayClick,
273
+ // Animation
274
+ beforeEnterAnimation,
275
+ enterAnimation,
276
+ leaveAnimation
277
+ };
278
+ }
279
+ __name(useModalContent, "useModalContent");
280
+
281
+ export {
282
+ baseSizes,
283
+ useModal,
284
+ useModalContent
285
+ };