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