@wikicasa-dev/components 2.4.1-alpha.8 → 2.4.1-alpha.9
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as $, mergeModels as
|
|
2
|
-
import { CloseIcon as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as $, mergeModels as h, useModel as H, useTemplateRef as w, shallowRef as y, onUnmounted as O, createBlock as F, openBlock as k, Teleport as A, createVNode as C, Transition as K, withCtx as N, withDirectives as S, createElementVNode as l, normalizeClass as i, createElementBlock as p, createCommentVNode as x, renderSlot as d, withModifiers as U, unref as V, vShow as P } from "vue";
|
|
2
|
+
import { CloseIcon as R } from "@wikicasa-dev/svg-icons";
|
|
3
|
+
const G = ["id", "data-cy"], j = ["innerHTML"], Q = /* @__PURE__ */ $({
|
|
4
4
|
__name: "BaseModal",
|
|
5
|
-
props: /* @__PURE__ */
|
|
5
|
+
props: /* @__PURE__ */ h({
|
|
6
6
|
id: { default: "base-bt-modal" },
|
|
7
7
|
size: { default: "modal-md" },
|
|
8
8
|
customBackdropClasses: {},
|
|
@@ -25,16 +25,16 @@ const R = ["id", "data-cy"], S = ["innerHTML"], q = /* @__PURE__ */ $({
|
|
|
25
25
|
showModal: { type: Boolean, default: !0 },
|
|
26
26
|
showModalModifiers: {}
|
|
27
27
|
}),
|
|
28
|
-
emits: /* @__PURE__ */
|
|
28
|
+
emits: /* @__PURE__ */ h(["closed", "opened", "dialogClick"], ["update:showModal"]),
|
|
29
29
|
setup(e, { emit: g }) {
|
|
30
|
-
const
|
|
30
|
+
const r = g, o = H(e, "showModal"), m = w("backdrop"), s = w("modalDialog"), u = y(!1), c = y(!1), f = ({ key: t }) => {
|
|
31
31
|
t === "Escape" && a();
|
|
32
32
|
}, M = () => {
|
|
33
|
-
document?.body.addEventListener("keydown",
|
|
34
|
-
},
|
|
35
|
-
document?.body.removeEventListener("keydown",
|
|
33
|
+
document?.body.addEventListener("keydown", f);
|
|
34
|
+
}, b = () => {
|
|
35
|
+
document?.body.removeEventListener("keydown", f);
|
|
36
36
|
}, B = () => {
|
|
37
|
-
|
|
37
|
+
c.value || (console.log("DEBUG:onBeforeEnter called", {
|
|
38
38
|
timestamp: Date.now(),
|
|
39
39
|
showModal: o.value,
|
|
40
40
|
stack: new Error().stack
|
|
@@ -42,44 +42,44 @@ const R = ["id", "data-cy"], S = ["innerHTML"], q = /* @__PURE__ */ $({
|
|
|
42
42
|
"sm:uikit-pr-15px",
|
|
43
43
|
"sm:uikit-mr-0",
|
|
44
44
|
"uikit-overflow-hidden"
|
|
45
|
-
),
|
|
45
|
+
), c.value = !0);
|
|
46
46
|
}, E = () => {
|
|
47
|
-
|
|
47
|
+
r("opened"), e.autoClose !== void 0 && setTimeout(() => {
|
|
48
48
|
a();
|
|
49
49
|
}, e.autoClose);
|
|
50
50
|
}, I = () => {
|
|
51
|
-
|
|
51
|
+
b(), document?.body.classList.remove(
|
|
52
52
|
"sm:uikit-pr-15px",
|
|
53
53
|
"sm:uikit-mr-0",
|
|
54
54
|
"uikit-overflow-hidden"
|
|
55
|
-
),
|
|
55
|
+
), c.value = !1, r("closed");
|
|
56
56
|
}, a = () => {
|
|
57
57
|
o.value = !1;
|
|
58
58
|
}, L = (t) => {
|
|
59
|
-
s.value && s.value.contains(t.target) && (
|
|
59
|
+
s.value && s.value.contains(t.target) && (u.value = !0);
|
|
60
60
|
}, z = (t) => {
|
|
61
|
-
s.value && s.value.contains(t.target) && (
|
|
62
|
-
},
|
|
63
|
-
if (!(t.target !==
|
|
64
|
-
if (
|
|
65
|
-
|
|
61
|
+
s.value && s.value.contains(t.target) && (u.value = !1);
|
|
62
|
+
}, D = async (t) => {
|
|
63
|
+
if (!(t.target !== m.value && m.value?.contains(t.target)) && e.closeOnClickOut) {
|
|
64
|
+
if (u.value) {
|
|
65
|
+
u.value = !1;
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
a();
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
O(() => {
|
|
72
|
-
|
|
72
|
+
b(), document?.body.classList.remove(
|
|
73
73
|
"sm:uikit-pr-15px",
|
|
74
74
|
"sm:uikit-mr-0",
|
|
75
75
|
"uikit-overflow-hidden"
|
|
76
76
|
);
|
|
77
77
|
});
|
|
78
|
-
const
|
|
78
|
+
const T = (t) => {
|
|
79
79
|
s.value === t.target && t.stopPropagation();
|
|
80
80
|
};
|
|
81
|
-
return (t,
|
|
82
|
-
|
|
81
|
+
return (t, n) => (k(), F(A, { to: "body" }, [
|
|
82
|
+
C(K, {
|
|
83
83
|
appear: e.appear,
|
|
84
84
|
name: "modal-transition",
|
|
85
85
|
duration: { enter: 500, leave: 250 },
|
|
@@ -88,8 +88,7 @@ const R = ["id", "data-cy"], S = ["innerHTML"], q = /* @__PURE__ */ $({
|
|
|
88
88
|
onAfterLeave: I
|
|
89
89
|
}, {
|
|
90
90
|
default: N(() => [
|
|
91
|
-
|
|
92
|
-
key: 0,
|
|
91
|
+
S(l("div", {
|
|
93
92
|
ref: "backdrop",
|
|
94
93
|
class: i(["bbt-backdrop uikit-fixed uikit-left-0 uikit-top-0 uikit-z-50 uikit-h-full uikit-w-full", [
|
|
95
94
|
e.customBackdropClasses,
|
|
@@ -99,11 +98,11 @@ const R = ["id", "data-cy"], S = ["innerHTML"], q = /* @__PURE__ */ $({
|
|
|
99
98
|
{ "uikit-bg-transparent": !o.value },
|
|
100
99
|
{ "sm:uikit-pt-[30px]": !e.centered }
|
|
101
100
|
]]),
|
|
102
|
-
onClick:
|
|
101
|
+
onClick: D,
|
|
103
102
|
onMousedown: L,
|
|
104
103
|
onMouseup: z
|
|
105
104
|
}, [
|
|
106
|
-
|
|
105
|
+
l("dialog", {
|
|
107
106
|
id: e.id,
|
|
108
107
|
ref: "modalDialog",
|
|
109
108
|
"data-cy": e.dataCy,
|
|
@@ -117,48 +116,50 @@ const R = ["id", "data-cy"], S = ["innerHTML"], q = /* @__PURE__ */ $({
|
|
|
117
116
|
e.fullHeight ? "uikit-h-[95%]" : "uikit-h-auto"
|
|
118
117
|
]]),
|
|
119
118
|
tabindex: "-1",
|
|
120
|
-
onClick:
|
|
121
|
-
onFocusin:
|
|
119
|
+
onClick: n[1] || (n[1] = (v) => r("dialogClick", v)),
|
|
120
|
+
onFocusin: T
|
|
122
121
|
}, [
|
|
123
|
-
|
|
122
|
+
l("div", {
|
|
124
123
|
class: i(["default-header uikit-sticky uikit-top-0 uikit-z-10 uikit-rounded-t uikit-border-0 uikit-bg-white uikit-px-4 uikit-pb-10px uikit-pt-20px sm:uikit-px-6", [e.customModalHeaderClasses]])
|
|
125
124
|
}, [
|
|
126
|
-
e.withCloseIcon ? (
|
|
125
|
+
e.withCloseIcon ? (k(), p("button", {
|
|
127
126
|
key: 0,
|
|
128
127
|
id: "close-icon-btn",
|
|
129
128
|
"data-cy": "bbt-default-close-icon-btn",
|
|
130
129
|
class: i(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", e.closeIconBtnClasses]),
|
|
131
130
|
type: "button",
|
|
132
131
|
"aria-label": "Close",
|
|
133
|
-
onClick:
|
|
132
|
+
onClick: n[0] || (n[0] = U((v) => o.value = !1, ["prevent", "stop"]))
|
|
134
133
|
}, [
|
|
135
|
-
|
|
134
|
+
C(V(R), {
|
|
136
135
|
class: i(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
|
|
137
136
|
width: e.closeIcon?.size || 20,
|
|
138
137
|
height: e.closeIcon?.size || 20
|
|
139
138
|
}, null, 8, ["class", "width", "height"])
|
|
140
|
-
], 2)) :
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
], 2)) : x("", !0),
|
|
140
|
+
d(t.$slots, "header", { closeModal: a }, () => [
|
|
141
|
+
l("span", {
|
|
143
142
|
class: i(["uikit-w-auto uikit-text-18 uikit-font-semibold sm:uikit-text-22", e.titleClasses]),
|
|
144
143
|
innerHTML: e.headerTitle
|
|
145
|
-
}, null, 10,
|
|
144
|
+
}, null, 10, j)
|
|
146
145
|
])
|
|
147
146
|
], 2),
|
|
148
|
-
|
|
147
|
+
l("div", {
|
|
149
148
|
class: i(["uikit-bbt-body uikit-flex-auto uikit-overflow-y-auto uikit-overflow-x-hidden uikit-px-4 uikit-pb-0 uikit-no-scrollbar sm:uikit-px-6 sm:uikit-pb-25px", [e.customModalBodyClasses]])
|
|
150
149
|
}, [
|
|
151
|
-
|
|
150
|
+
d(t.$slots, "body", { closeModal: a })
|
|
152
151
|
], 2),
|
|
153
|
-
t.$slots.footer ? (
|
|
152
|
+
t.$slots.footer ? (k(), p("div", {
|
|
154
153
|
key: 0,
|
|
155
154
|
class: i(["uikit-bbt-footer uikit-sticky uikit-bottom-0 uikit-border-0 uikit-bg-white uikit-px-4 uikit-py-15px sm:uikit-px-6", e.customModalFooterClasses])
|
|
156
155
|
}, [
|
|
157
|
-
|
|
158
|
-
], 2)) :
|
|
159
|
-
|
|
160
|
-
], 42,
|
|
161
|
-
], 34)
|
|
156
|
+
d(t.$slots, "footer", { closeModal: a })
|
|
157
|
+
], 2)) : x("", !0),
|
|
158
|
+
d(t.$slots, "fixed-bottom")
|
|
159
|
+
], 42, G)
|
|
160
|
+
], 34), [
|
|
161
|
+
[P, o.value]
|
|
162
|
+
])
|
|
162
163
|
]),
|
|
163
164
|
_: 3
|
|
164
165
|
}, 8, ["appear"])
|
|
@@ -166,5 +167,5 @@ const R = ["id", "data-cy"], S = ["innerHTML"], q = /* @__PURE__ */ $({
|
|
|
166
167
|
}
|
|
167
168
|
});
|
|
168
169
|
export {
|
|
169
|
-
|
|
170
|
+
Q as default
|
|
170
171
|
};
|