@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.
- package/dist/body.d.mts +6 -0
- package/dist/body.d.ts +6 -0
- package/dist/body.js +63 -0
- package/dist/body.mjs +8 -0
- package/dist/chunk-2WYPEVZV.mjs +62 -0
- package/dist/chunk-7LGGLG42.mjs +77 -0
- package/dist/chunk-ASQKAMBD.mjs +37 -0
- package/dist/chunk-D4KITWKW.mjs +34 -0
- package/dist/chunk-DKUTSUEJ.mjs +8 -0
- package/dist/chunk-FU2Y3XYA.mjs +70 -0
- package/dist/chunk-FXPPG3HJ.mjs +24 -0
- package/dist/chunk-MO6AFEOO.mjs +285 -0
- package/dist/chunk-NCQFKFXL.mjs +69 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-THCDEEFK.mjs +24 -0
- package/dist/close-button.d.mts +6 -0
- package/dist/close-button.d.ts +6 -0
- package/dist/close-button.js +60 -0
- package/dist/close-button.mjs +8 -0
- package/dist/content.d.mts +28 -0
- package/dist/content.d.ts +28 -0
- package/dist/content.js +359 -0
- package/dist/content.mjs +10 -0
- package/dist/footer.d.mts +6 -0
- package/dist/footer.d.ts +6 -0
- package/dist/footer.js +48 -0
- package/dist/footer.mjs +7 -0
- package/dist/header.d.mts +6 -0
- package/dist/header.d.ts +6 -0
- package/dist/header.js +48 -0
- package/dist/header.mjs +7 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +668 -0
- package/dist/index.mjs +34 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modal.d.mts +103 -0
- package/dist/modal.d.ts +103 -0
- package/dist/modal.js +191 -0
- package/dist/modal.mjs +10 -0
- package/dist/modules/modal.context.d.mts +11 -0
- package/dist/modules/modal.context.d.ts +11 -0
- package/dist/modules/modal.context.js +33 -0
- package/dist/modules/modal.context.mjs +9 -0
- package/dist/modules/modal.props.d.mts +64 -0
- package/dist/modules/modal.props.d.ts +64 -0
- package/dist/modules/modal.props.js +88 -0
- package/dist/modules/modal.props.mjs +11 -0
- package/dist/modules/useModal.d.mts +28 -0
- package/dist/modules/useModal.d.ts +28 -0
- package/dist/modules/useModal.js +321 -0
- package/dist/modules/useModal.mjs +12 -0
- package/dist/overlay.d.mts +6 -0
- package/dist/overlay.d.ts +6 -0
- package/dist/overlay.js +104 -0
- package/dist/overlay.mjs +8 -0
- package/package.json +47 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
modalContentProps
|
|
3
|
+
} from "./chunk-2WYPEVZV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
baseSizes,
|
|
6
|
+
useModalContent
|
|
7
|
+
} from "./chunk-MO6AFEOO.mjs";
|
|
8
|
+
|
|
9
|
+
// src/content.tsx
|
|
10
|
+
import { withDirectives as _withDirectives, createVNode as _createVNode, mergeProps as _mergeProps, vShow as _vShow } from "vue";
|
|
11
|
+
import { defineComponent, Transition } from "vue";
|
|
12
|
+
import { modalSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
|
|
13
|
+
var MpModalContent = defineComponent({
|
|
14
|
+
name: "MpModalContent",
|
|
15
|
+
props: modalContentProps,
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
setup(props, {
|
|
18
|
+
slots,
|
|
19
|
+
attrs
|
|
20
|
+
}) {
|
|
21
|
+
const {
|
|
22
|
+
wrapperEl,
|
|
23
|
+
isOpen,
|
|
24
|
+
isKeepAlive,
|
|
25
|
+
size,
|
|
26
|
+
inlineStyle,
|
|
27
|
+
onOverlayClick,
|
|
28
|
+
beforeEnterAnimation,
|
|
29
|
+
enterAnimation,
|
|
30
|
+
leaveAnimation
|
|
31
|
+
} = useModalContent(props);
|
|
32
|
+
return () => {
|
|
33
|
+
const {
|
|
34
|
+
contentRoot,
|
|
35
|
+
contentChild
|
|
36
|
+
} = modalSlotRecipe({
|
|
37
|
+
full: size.value === "full" ? true : false
|
|
38
|
+
});
|
|
39
|
+
const contentNode = _withDirectives(_createVNode("div", _mergeProps({
|
|
40
|
+
"data-pixel-component": "MpModalContent",
|
|
41
|
+
"class": contentChild,
|
|
42
|
+
"style": {
|
|
43
|
+
maxWidth: baseSizes[size.value],
|
|
44
|
+
...inlineStyle.value.contentStyle
|
|
45
|
+
},
|
|
46
|
+
"tabindex": "-1"
|
|
47
|
+
}, attrs), [slots.default && slots.default()]), [[_vShow, isOpen.value]]);
|
|
48
|
+
const conditionalRender = isOpen.value ? contentNode : null;
|
|
49
|
+
return _createVNode("div", {
|
|
50
|
+
"ref": wrapperEl,
|
|
51
|
+
"class": contentRoot,
|
|
52
|
+
"style": inlineStyle.value.wrapperStyle,
|
|
53
|
+
"onClick": onOverlayClick
|
|
54
|
+
}, [_createVNode(Transition, {
|
|
55
|
+
"css": false,
|
|
56
|
+
"appear": true,
|
|
57
|
+
"onBeforeEnter": (el) => beforeEnterAnimation(el),
|
|
58
|
+
"onEnter": (el, complete) => enterAnimation(el, complete),
|
|
59
|
+
"onLeave": (el, complete) => leaveAnimation(el, complete)
|
|
60
|
+
}, {
|
|
61
|
+
default: () => [isKeepAlive ? contentNode : conditionalRender]
|
|
62
|
+
})]);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
MpModalContent
|
|
69
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/footer.tsx
|
|
2
|
+
import { createVNode as _createVNode } from "vue";
|
|
3
|
+
import { defineComponent } from "vue";
|
|
4
|
+
import { modalSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
|
|
5
|
+
var MpModalFooter = defineComponent({
|
|
6
|
+
name: "MpModalFooter",
|
|
7
|
+
setup(_props, {
|
|
8
|
+
slots
|
|
9
|
+
}) {
|
|
10
|
+
const {
|
|
11
|
+
footer
|
|
12
|
+
} = modalSlotRecipe();
|
|
13
|
+
return () => {
|
|
14
|
+
return _createVNode("footer", {
|
|
15
|
+
"data-pixel-component": "MpModalFooter",
|
|
16
|
+
"class": footer
|
|
17
|
+
}, [slots.default && slots.default()]);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
MpModalFooter
|
|
24
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare const MpModalCloseButton: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
5
|
+
|
|
6
|
+
export { MpModalCloseButton };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare const MpModalCloseButton: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
5
|
+
|
|
6
|
+
export { MpModalCloseButton };
|
|
@@ -0,0 +1,60 @@
|
|
|
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/close-button.tsx
|
|
21
|
+
var close_button_exports = {};
|
|
22
|
+
__export(close_button_exports, {
|
|
23
|
+
MpModalCloseButton: () => MpModalCloseButton
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(close_button_exports);
|
|
26
|
+
var import_vue = require("vue");
|
|
27
|
+
var import_vue2 = require("vue");
|
|
28
|
+
var import_pixel3_button = require("@mekari/pixel3-button");
|
|
29
|
+
|
|
30
|
+
// src/modules/modal.context.ts
|
|
31
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
32
|
+
var [ModalProvider, useModalContext] = (0, import_pixel3_utils.usePixelCreateContext)("ModalContext");
|
|
33
|
+
|
|
34
|
+
// src/close-button.tsx
|
|
35
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
36
|
+
var MpModalCloseButton = (0, import_vue2.defineComponent)({
|
|
37
|
+
name: "MpModalCloseButton",
|
|
38
|
+
setup() {
|
|
39
|
+
const {
|
|
40
|
+
closeButton
|
|
41
|
+
} = (0, import_recipes.modalSlotRecipe)();
|
|
42
|
+
const {
|
|
43
|
+
onClose
|
|
44
|
+
} = useModalContext();
|
|
45
|
+
return () => {
|
|
46
|
+
return (0, import_vue.createVNode)(import_pixel3_button.MpButton, {
|
|
47
|
+
"data-pixel-component": "MpModalCloseButton",
|
|
48
|
+
"class": closeButton,
|
|
49
|
+
"leftIcon": "close",
|
|
50
|
+
"size": "sm",
|
|
51
|
+
"variant": "ghost",
|
|
52
|
+
"onClick": onClose
|
|
53
|
+
}, null);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
MpModalCloseButton
|
|
60
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
|
+
import { Placement } from './modules/modal.props.mjs';
|
|
3
|
+
import * as vue from 'vue';
|
|
4
|
+
|
|
5
|
+
declare const MpModalContent: vue.DefineComponent<{
|
|
6
|
+
type: {
|
|
7
|
+
type: vue.PropType<"modal" | "drawer">;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
placement: {
|
|
11
|
+
type: vue.PropType<Placement>;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
15
|
+
type: {
|
|
16
|
+
type: vue.PropType<"modal" | "drawer">;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
placement: {
|
|
20
|
+
type: vue.PropType<Placement>;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
}>>, {
|
|
24
|
+
type: "modal" | "drawer";
|
|
25
|
+
placement: Placement;
|
|
26
|
+
}, {}>;
|
|
27
|
+
|
|
28
|
+
export { MpModalContent };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
|
+
import { Placement } from './modules/modal.props.js';
|
|
3
|
+
import * as vue from 'vue';
|
|
4
|
+
|
|
5
|
+
declare const MpModalContent: vue.DefineComponent<{
|
|
6
|
+
type: {
|
|
7
|
+
type: vue.PropType<"modal" | "drawer">;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
placement: {
|
|
11
|
+
type: vue.PropType<Placement>;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
15
|
+
type: {
|
|
16
|
+
type: vue.PropType<"modal" | "drawer">;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
placement: {
|
|
20
|
+
type: vue.PropType<Placement>;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
}>>, {
|
|
24
|
+
type: "modal" | "drawer";
|
|
25
|
+
placement: Placement;
|
|
26
|
+
}, {}>;
|
|
27
|
+
|
|
28
|
+
export { MpModalContent };
|
package/dist/content.js
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/content.tsx
|
|
32
|
+
var content_exports = {};
|
|
33
|
+
__export(content_exports, {
|
|
34
|
+
MpModalContent: () => MpModalContent
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(content_exports);
|
|
37
|
+
var import_vue2 = require("vue");
|
|
38
|
+
var import_vue3 = require("vue");
|
|
39
|
+
|
|
40
|
+
// src/modules/useModal.ts
|
|
41
|
+
var import_vue = require("vue");
|
|
42
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
43
|
+
var import_body_scroll_lock = require("body-scroll-lock");
|
|
44
|
+
|
|
45
|
+
// src/modules/modal.context.ts
|
|
46
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
47
|
+
var [ModalProvider, useModalContext] = (0, import_pixel3_utils.usePixelCreateContext)("ModalContext");
|
|
48
|
+
|
|
49
|
+
// src/modules/useModal.ts
|
|
50
|
+
var import_animejs = __toESM(require("animejs"));
|
|
51
|
+
var import_pixel3_utils3 = require("@mekari/pixel3-utils");
|
|
52
|
+
var baseSizes = {
|
|
53
|
+
sm: "330px",
|
|
54
|
+
md: "448px",
|
|
55
|
+
lg: "684px",
|
|
56
|
+
xl: "920px",
|
|
57
|
+
"2xl": "1152px",
|
|
58
|
+
full: "100%"
|
|
59
|
+
};
|
|
60
|
+
function useModalContent(props) {
|
|
61
|
+
const {
|
|
62
|
+
props: modalProps,
|
|
63
|
+
onClose,
|
|
64
|
+
isModalOpen
|
|
65
|
+
} = useModalContext();
|
|
66
|
+
const {
|
|
67
|
+
isCloseOnOverlayClick,
|
|
68
|
+
isOpen,
|
|
69
|
+
isCloseOnEsc,
|
|
70
|
+
isKeepAlive,
|
|
71
|
+
size,
|
|
72
|
+
isCentered,
|
|
73
|
+
scrollBehavior
|
|
74
|
+
} = modalProps;
|
|
75
|
+
const wrapperEl = (0, import_vue.ref)();
|
|
76
|
+
const inlineStyle = (0, import_vue.computed)(() => {
|
|
77
|
+
let wrapperStyle = {};
|
|
78
|
+
let contentStyle = {};
|
|
79
|
+
if (isCentered == null ? void 0 : isCentered.value) {
|
|
80
|
+
wrapperStyle = {
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
justifyContent: "center"
|
|
84
|
+
};
|
|
85
|
+
} else {
|
|
86
|
+
contentStyle = {
|
|
87
|
+
top: "3.75rem",
|
|
88
|
+
mx: "auto"
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (scrollBehavior.value === "inside") {
|
|
92
|
+
wrapperStyle = {
|
|
93
|
+
...wrapperStyle,
|
|
94
|
+
maxHeight: "calc(100vh - 7.5rem)",
|
|
95
|
+
overflow: "hidden",
|
|
96
|
+
top: "3.75rem"
|
|
97
|
+
};
|
|
98
|
+
contentStyle = {
|
|
99
|
+
...contentStyle,
|
|
100
|
+
height: "100%",
|
|
101
|
+
top: 0
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
if (scrollBehavior.value === "outside") {
|
|
105
|
+
wrapperStyle = {
|
|
106
|
+
...wrapperStyle,
|
|
107
|
+
overflowY: "auto",
|
|
108
|
+
overflowX: "hidden"
|
|
109
|
+
};
|
|
110
|
+
contentStyle = {
|
|
111
|
+
...contentStyle,
|
|
112
|
+
my: "3.75rem",
|
|
113
|
+
top: 0
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (scrollBehavior.value === "auto") {
|
|
117
|
+
wrapperStyle = {
|
|
118
|
+
...wrapperStyle,
|
|
119
|
+
maxHeight: "calc(100vh - 7.5rem)",
|
|
120
|
+
overflow: "hidden",
|
|
121
|
+
top: "3.75rem"
|
|
122
|
+
};
|
|
123
|
+
contentStyle = {
|
|
124
|
+
...contentStyle,
|
|
125
|
+
height: "auto",
|
|
126
|
+
maxHeight: "calc(100vh - 7.5rem)",
|
|
127
|
+
top: 0
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (size.value === "full" || props.type === "drawer") {
|
|
131
|
+
wrapperStyle = {};
|
|
132
|
+
contentStyle = {};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
wrapperStyle,
|
|
136
|
+
contentStyle
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
const {
|
|
140
|
+
activate: activeFocusTrap,
|
|
141
|
+
deactivate: deactivateFocusTrap
|
|
142
|
+
} = (0, import_pixel3_utils3.useFocusTrap)(wrapperEl);
|
|
143
|
+
function onOverlayClick(e) {
|
|
144
|
+
if (isOpen.value && isCloseOnOverlayClick.value && e.target === wrapperEl.value) {
|
|
145
|
+
onClose();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
__name(onOverlayClick, "onOverlayClick");
|
|
149
|
+
const onKeydown = /* @__PURE__ */ __name((event) => {
|
|
150
|
+
if (event.key === "Escape" && isCloseOnEsc.value) {
|
|
151
|
+
onClose();
|
|
152
|
+
}
|
|
153
|
+
}, "onKeydown");
|
|
154
|
+
const getTransition = (0, import_vue.computed)(() => {
|
|
155
|
+
const duration = size.value === "full" ? 400 : 300;
|
|
156
|
+
let enter = {};
|
|
157
|
+
let leave = {};
|
|
158
|
+
if (props.type === "modal") {
|
|
159
|
+
enter = {
|
|
160
|
+
opacity: [0, 1],
|
|
161
|
+
scale: [0.95, 1],
|
|
162
|
+
translateY: ["16px", "0px"],
|
|
163
|
+
easing: "easeOutSine",
|
|
164
|
+
duration
|
|
165
|
+
};
|
|
166
|
+
leave = {
|
|
167
|
+
opacity: [1, 0],
|
|
168
|
+
scale: [1, 0.95],
|
|
169
|
+
translateY: ["0px", "16px"],
|
|
170
|
+
easing: "easeInSine",
|
|
171
|
+
duration: 300
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
enter,
|
|
175
|
+
leave
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (props.type === "drawer") {
|
|
179
|
+
if (props.placement === "right") {
|
|
180
|
+
enter = {
|
|
181
|
+
translateX(el) {
|
|
182
|
+
const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
|
|
183
|
+
return [translateWidth, "0px"];
|
|
184
|
+
},
|
|
185
|
+
easing: "easeInOutSine",
|
|
186
|
+
duration: 500
|
|
187
|
+
};
|
|
188
|
+
leave = {
|
|
189
|
+
translateX: ["0px", "100%"],
|
|
190
|
+
easing: "easeInOutSine",
|
|
191
|
+
duration: 500
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (props.placement === "left") {
|
|
195
|
+
enter = {
|
|
196
|
+
translateX(el) {
|
|
197
|
+
const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
|
|
198
|
+
return [`-${translateWidth}`, "0px"];
|
|
199
|
+
},
|
|
200
|
+
easing: "easeInOutSine",
|
|
201
|
+
duration: 500
|
|
202
|
+
};
|
|
203
|
+
leave = {
|
|
204
|
+
translateX: ["0px", "-100%"],
|
|
205
|
+
easing: "easeInOutSine",
|
|
206
|
+
duration: 500
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (props.placement === "top") {
|
|
210
|
+
enter = {
|
|
211
|
+
translateY(el) {
|
|
212
|
+
const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
|
|
213
|
+
return [`-${translateWidth}`, "0px"];
|
|
214
|
+
},
|
|
215
|
+
easing: "easeInOutSine",
|
|
216
|
+
duration: 500
|
|
217
|
+
};
|
|
218
|
+
leave = {
|
|
219
|
+
translateY: ["0px", "-100%"],
|
|
220
|
+
easing: "easeInOutSine",
|
|
221
|
+
duration: 500
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
if (props.placement === "bottom") {
|
|
225
|
+
enter = {
|
|
226
|
+
translateY(el) {
|
|
227
|
+
const translateWidth = size.value === "full" ? el.clientWidth : baseSizes[size.value];
|
|
228
|
+
return [`${translateWidth}`, "0px"];
|
|
229
|
+
},
|
|
230
|
+
easing: "easeInOutSine",
|
|
231
|
+
duration: 500
|
|
232
|
+
};
|
|
233
|
+
leave = {
|
|
234
|
+
translateY: ["0px", "100%"],
|
|
235
|
+
easing: "easeInOutSine",
|
|
236
|
+
duration: 500
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
enter,
|
|
242
|
+
leave
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
const beforeEnterAnimation = /* @__PURE__ */ __name((el) => {
|
|
246
|
+
el && el.style.setProperty("will-change", "opacity, transform", "scale");
|
|
247
|
+
}, "beforeEnterAnimation");
|
|
248
|
+
const enterAnimation = /* @__PURE__ */ __name((el, complete) => {
|
|
249
|
+
(0, import_animejs.default)({
|
|
250
|
+
targets: el,
|
|
251
|
+
...getTransition.value.enter,
|
|
252
|
+
complete: () => {
|
|
253
|
+
if (isOpen.value) {
|
|
254
|
+
complete();
|
|
255
|
+
document.addEventListener("keydown", onKeydown);
|
|
256
|
+
activeFocusTrap();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}, "enterAnimation");
|
|
261
|
+
const leaveAnimation = /* @__PURE__ */ __name((el, complete) => {
|
|
262
|
+
deactivateFocusTrap();
|
|
263
|
+
(0, import_animejs.default)({
|
|
264
|
+
targets: el,
|
|
265
|
+
...getTransition.value.leave,
|
|
266
|
+
complete: () => {
|
|
267
|
+
complete();
|
|
268
|
+
isModalOpen.value = false;
|
|
269
|
+
document.removeEventListener("keydown", onKeydown);
|
|
270
|
+
onClose();
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}, "leaveAnimation");
|
|
274
|
+
return {
|
|
275
|
+
wrapperEl,
|
|
276
|
+
isOpen,
|
|
277
|
+
isKeepAlive,
|
|
278
|
+
size,
|
|
279
|
+
inlineStyle,
|
|
280
|
+
onOverlayClick,
|
|
281
|
+
// Animation
|
|
282
|
+
beforeEnterAnimation,
|
|
283
|
+
enterAnimation,
|
|
284
|
+
leaveAnimation
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
__name(useModalContent, "useModalContent");
|
|
288
|
+
|
|
289
|
+
// src/modules/modal.props.ts
|
|
290
|
+
var modalContentProps = {
|
|
291
|
+
type: {
|
|
292
|
+
type: String,
|
|
293
|
+
default: "modal"
|
|
294
|
+
},
|
|
295
|
+
placement: {
|
|
296
|
+
type: String,
|
|
297
|
+
default: "right"
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// src/content.tsx
|
|
302
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
303
|
+
var MpModalContent = (0, import_vue3.defineComponent)({
|
|
304
|
+
name: "MpModalContent",
|
|
305
|
+
props: modalContentProps,
|
|
306
|
+
inheritAttrs: false,
|
|
307
|
+
setup(props, {
|
|
308
|
+
slots,
|
|
309
|
+
attrs
|
|
310
|
+
}) {
|
|
311
|
+
const {
|
|
312
|
+
wrapperEl,
|
|
313
|
+
isOpen,
|
|
314
|
+
isKeepAlive,
|
|
315
|
+
size,
|
|
316
|
+
inlineStyle,
|
|
317
|
+
onOverlayClick,
|
|
318
|
+
beforeEnterAnimation,
|
|
319
|
+
enterAnimation,
|
|
320
|
+
leaveAnimation
|
|
321
|
+
} = useModalContent(props);
|
|
322
|
+
return () => {
|
|
323
|
+
const {
|
|
324
|
+
contentRoot,
|
|
325
|
+
contentChild
|
|
326
|
+
} = (0, import_recipes.modalSlotRecipe)({
|
|
327
|
+
full: size.value === "full" ? true : false
|
|
328
|
+
});
|
|
329
|
+
const contentNode = (0, import_vue2.withDirectives)((0, import_vue2.createVNode)("div", (0, import_vue2.mergeProps)({
|
|
330
|
+
"data-pixel-component": "MpModalContent",
|
|
331
|
+
"class": contentChild,
|
|
332
|
+
"style": {
|
|
333
|
+
maxWidth: baseSizes[size.value],
|
|
334
|
+
...inlineStyle.value.contentStyle
|
|
335
|
+
},
|
|
336
|
+
"tabindex": "-1"
|
|
337
|
+
}, attrs), [slots.default && slots.default()]), [[import_vue2.vShow, isOpen.value]]);
|
|
338
|
+
const conditionalRender = isOpen.value ? contentNode : null;
|
|
339
|
+
return (0, import_vue2.createVNode)("div", {
|
|
340
|
+
"ref": wrapperEl,
|
|
341
|
+
"class": contentRoot,
|
|
342
|
+
"style": inlineStyle.value.wrapperStyle,
|
|
343
|
+
"onClick": onOverlayClick
|
|
344
|
+
}, [(0, import_vue2.createVNode)(import_vue3.Transition, {
|
|
345
|
+
"css": false,
|
|
346
|
+
"appear": true,
|
|
347
|
+
"onBeforeEnter": (el) => beforeEnterAnimation(el),
|
|
348
|
+
"onEnter": (el, complete) => enterAnimation(el, complete),
|
|
349
|
+
"onLeave": (el, complete) => leaveAnimation(el, complete)
|
|
350
|
+
}, {
|
|
351
|
+
default: () => [isKeepAlive ? contentNode : conditionalRender]
|
|
352
|
+
})]);
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
357
|
+
0 && (module.exports = {
|
|
358
|
+
MpModalContent
|
|
359
|
+
});
|
package/dist/content.mjs
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 MpModalFooter: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
5
|
+
|
|
6
|
+
export { MpModalFooter };
|
package/dist/footer.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 MpModalFooter: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
5
|
+
|
|
6
|
+
export { MpModalFooter };
|
package/dist/footer.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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/footer.tsx
|
|
21
|
+
var footer_exports = {};
|
|
22
|
+
__export(footer_exports, {
|
|
23
|
+
MpModalFooter: () => MpModalFooter
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(footer_exports);
|
|
26
|
+
var import_vue = require("vue");
|
|
27
|
+
var import_vue2 = require("vue");
|
|
28
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
29
|
+
var MpModalFooter = (0, import_vue2.defineComponent)({
|
|
30
|
+
name: "MpModalFooter",
|
|
31
|
+
setup(_props, {
|
|
32
|
+
slots
|
|
33
|
+
}) {
|
|
34
|
+
const {
|
|
35
|
+
footer
|
|
36
|
+
} = (0, import_recipes.modalSlotRecipe)();
|
|
37
|
+
return () => {
|
|
38
|
+
return (0, import_vue.createVNode)("footer", {
|
|
39
|
+
"data-pixel-component": "MpModalFooter",
|
|
40
|
+
"class": footer
|
|
41
|
+
}, [slots.default && slots.default()]);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
MpModalFooter
|
|
48
|
+
});
|