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