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