@kiva/kv-components 6.64.0 → 6.65.0
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/vue/KvSideSheet.js +92 -88
- package/package.json +2 -2
package/dist/vue/KvSideSheet.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { toRefs as
|
|
2
|
-
import { mdiArrowLeft as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { toRefs as Q, ref as c, reactive as X, computed as j, watch as g, onMounted as Y, onBeforeUnmount as Z, onUnmounted as $, resolveComponent as ee, openBlock as p, createElementBlock as k, normalizeClass as b, withModifiers as te, createElementVNode as w, normalizeStyle as H, createVNode as z, createCommentVNode as x, toDisplayString as ne, renderSlot as D, nextTick as oe } from "vue";
|
|
2
|
+
import { mdiArrowLeft as ie, mdiClose as le, mdiOpenInNew as se } from "@mdi/js";
|
|
3
|
+
import ae from "./KvMaterialIcon.js";
|
|
4
|
+
import de from "../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const re = {
|
|
6
6
|
name: "KvSideSheet",
|
|
7
7
|
components: {
|
|
8
|
-
KvMaterialIcon:
|
|
8
|
+
KvMaterialIcon: ae
|
|
9
9
|
},
|
|
10
10
|
props: {
|
|
11
11
|
/**
|
|
@@ -65,7 +65,7 @@ const de = {
|
|
|
65
65
|
widthDimensions: {
|
|
66
66
|
type: [String, Object],
|
|
67
67
|
default: () => ({ default: "100%", md: "50%" }),
|
|
68
|
-
validator: (
|
|
68
|
+
validator: (n) => typeof n == "string" ? /^(\d+px|[\d.]+%|auto|inherit|initial)$/.test(n) : typeof n == "object" ? Object.keys(n).every((o) => ["default", "sm", "md", "lg", "xl", "2xl"].includes(o) && /^(\d+px|[\d.]+%|auto|inherit|initial)$/.test(n[o])) : !1
|
|
69
69
|
},
|
|
70
70
|
/**
|
|
71
71
|
* Whether to hide the background of the headline section on mobile (e.g., in Borrower Profile Sidesheet)
|
|
@@ -73,17 +73,25 @@ const de = {
|
|
|
73
73
|
hideHeadlineBgOnMobile: {
|
|
74
74
|
type: Boolean,
|
|
75
75
|
default: !1
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Whether to animate the opening of the side sheet
|
|
79
|
+
* */
|
|
80
|
+
isAnimated: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !0
|
|
76
83
|
}
|
|
77
84
|
},
|
|
78
85
|
emits: ["side-sheet-closed", "go-to-link"],
|
|
79
|
-
setup(
|
|
86
|
+
setup(n, { emit: o, slots: i }) {
|
|
80
87
|
const {
|
|
81
88
|
visible: t,
|
|
82
89
|
kvTrackFunction: I,
|
|
83
90
|
trackEventCategory: M,
|
|
84
91
|
widthDimensions: l,
|
|
85
|
-
hideHeadlineBgOnMobile: d
|
|
86
|
-
|
|
92
|
+
hideHeadlineBgOnMobile: d,
|
|
93
|
+
isAnimated: F
|
|
94
|
+
} = Q(n), r = c(!F.value), a = c({}), O = c(null), m = c(null), y = c(null), _ = c(null), N = c(null), S = c(null), B = c(null), v = X({
|
|
87
95
|
headline: 0,
|
|
88
96
|
controls: 0
|
|
89
97
|
}), V = j(() => {
|
|
@@ -98,15 +106,15 @@ const de = {
|
|
|
98
106
|
lg: 1024,
|
|
99
107
|
xl: 1280,
|
|
100
108
|
"2xl": 1536
|
|
101
|
-
}, s = N.value || window.innerWidth, f = Object.keys(l.value).filter((u) => u !== "default").sort((u, R) => e[R] - e[u]).find((u) => s >= e[u]);
|
|
109
|
+
}, s = N.value || (typeof window < "u" ? window.innerWidth : 0), f = Object.keys(l.value).filter((u) => u !== "default").sort((u, R) => e[R] - e[u]).find((u) => s >= e[u]);
|
|
102
110
|
return f ? l.value[f] : l.value.default || "100%";
|
|
103
|
-
}),
|
|
111
|
+
}), G = (e, s) => {
|
|
104
112
|
let f;
|
|
105
113
|
return (...u) => {
|
|
106
114
|
clearTimeout(f), f = setTimeout(() => e(...u), s);
|
|
107
115
|
};
|
|
108
116
|
}, C = () => {
|
|
109
|
-
_.value = window.innerHeight, N.value = window.innerWidth, setTimeout(() => {
|
|
117
|
+
_.value = typeof window < "u" ? window.innerHeight : 0, N.value = typeof window < "u" ? window.innerWidth : 0, setTimeout(() => {
|
|
110
118
|
oe(() => {
|
|
111
119
|
var e;
|
|
112
120
|
if (y.value) {
|
|
@@ -121,57 +129,20 @@ const de = {
|
|
|
121
129
|
v.controls = 0;
|
|
122
130
|
});
|
|
123
131
|
}, 300);
|
|
124
|
-
}, E =
|
|
132
|
+
}, E = G(C, 100), T = () => {
|
|
125
133
|
const e = "tw-overflow-hidden";
|
|
126
134
|
r.value ? document.body.classList.add(e) : document.body.classList.remove(e);
|
|
127
|
-
},
|
|
135
|
+
}, A = () => {
|
|
128
136
|
r.value = !1, T(), I.value(M.value, "click", "side-sheet-closed"), setTimeout(() => {
|
|
129
|
-
|
|
137
|
+
o("side-sheet-closed");
|
|
130
138
|
}, 300), document.removeEventListener("keyup", L);
|
|
131
|
-
},
|
|
132
|
-
|
|
139
|
+
}, q = () => {
|
|
140
|
+
o("go-to-link");
|
|
133
141
|
}, L = (e) => {
|
|
134
|
-
(e == null ? void 0 : e.key) === "Escape" &&
|
|
135
|
-
}
|
|
136
|
-
X(() => {
|
|
137
|
-
setTimeout(() => {
|
|
138
|
-
C();
|
|
139
|
-
}, 100), m.value && (S.value = new ResizeObserver(E), S.value.observe(m.value)), y.value && (B.value = new ResizeObserver(E), B.value.observe(y.value)), window.addEventListener("resize", E);
|
|
140
|
-
}), Y(() => {
|
|
141
|
-
r.value && document.body.classList.remove("tw-overflow-hidden");
|
|
142
|
-
}), Z(() => {
|
|
143
|
-
S.value && S.value.disconnect(), B.value && B.value.disconnect(), window.removeEventListener("resize", E);
|
|
144
|
-
const e = document.getElementById("side-sheet-styles");
|
|
145
|
-
e && e.remove();
|
|
146
|
-
}), g(() => {
|
|
147
|
-
var e;
|
|
148
|
-
return (e = i.controls) == null ? void 0 : e.call(i);
|
|
149
|
-
}, () => {
|
|
150
|
-
setTimeout(() => {
|
|
151
|
-
C();
|
|
152
|
-
}, 100);
|
|
153
|
-
}, { deep: !0 });
|
|
154
|
-
const q = j(() => ({
|
|
142
|
+
(e == null ? void 0 : e.key) === "Escape" && A();
|
|
143
|
+
}, J = j(() => ({
|
|
155
144
|
width: W.value
|
|
156
|
-
}))
|
|
157
|
-
g(t, (e) => {
|
|
158
|
-
typeof window < "u" && (e ? (document.addEventListener("keyup", L), a.value = {}, setTimeout(() => {
|
|
159
|
-
r.value = !0, T(), C();
|
|
160
|
-
}, 10)) : (r.value = !1, T(), document.removeEventListener("keyup", L), a.value = {}));
|
|
161
|
-
}, { immediate: !0 }), g(W, (e) => {
|
|
162
|
-
r.value && t.value && a.value && Object.keys(a.value).length > 0 && (a.value = {
|
|
163
|
-
...a.value,
|
|
164
|
-
width: e,
|
|
165
|
-
transition: "none"
|
|
166
|
-
// No animation for resize
|
|
167
|
-
}, setTimeout(() => {
|
|
168
|
-
a.value && Object.keys(a.value).length > 0 && (a.value = {
|
|
169
|
-
...a.value,
|
|
170
|
-
transition: "all 0.3s ease-in-out"
|
|
171
|
-
});
|
|
172
|
-
}, 50));
|
|
173
|
-
});
|
|
174
|
-
const U = () => {
|
|
145
|
+
})), K = () => {
|
|
175
146
|
if (typeof l.value == "object" && O.value) {
|
|
176
147
|
const e = "side-sheet-styles";
|
|
177
148
|
let s = document.getElementById(e);
|
|
@@ -182,55 +153,88 @@ const de = {
|
|
|
182
153
|
lg: "1024px",
|
|
183
154
|
xl: "1280px",
|
|
184
155
|
"2xl": "1536px"
|
|
185
|
-
}, R = Object.keys(l.value).filter((h) => h !== "default").sort((h,
|
|
186
|
-
const
|
|
187
|
-
return
|
|
156
|
+
}, R = Object.keys(l.value).filter((h) => h !== "default").sort((h, P) => {
|
|
157
|
+
const U = ["sm", "md", "lg", "xl", "2xl"];
|
|
158
|
+
return U.indexOf(h) - U.indexOf(P);
|
|
188
159
|
}).map((h) => `
|
|
189
160
|
@media (min-width: ${f[h]}) {
|
|
190
|
-
#side-sheet-${
|
|
161
|
+
#side-sheet-${n.trackEventCategory || "default"} {
|
|
191
162
|
width: ${l.value[h]} !important;
|
|
192
163
|
}
|
|
193
164
|
}
|
|
194
165
|
`).join("");
|
|
195
|
-
s.textContent = R, O.value.id = `side-sheet-${
|
|
166
|
+
s.textContent = R, O.value.id = `side-sheet-${n.trackEventCategory || "default"}`;
|
|
196
167
|
}
|
|
197
168
|
};
|
|
198
|
-
return g(
|
|
199
|
-
|
|
169
|
+
return g(t, (e) => {
|
|
170
|
+
typeof window < "u" && (e ? (document.addEventListener("keyup", L), a.value = {}, setTimeout(() => {
|
|
171
|
+
r.value = !0, T(), C();
|
|
172
|
+
}, 10)) : (r.value = !1, T(), document.removeEventListener("keyup", L), a.value = {}));
|
|
173
|
+
}, { immediate: !0 }), g(() => {
|
|
174
|
+
var e;
|
|
175
|
+
return (e = i.controls) == null ? void 0 : e.call(i);
|
|
176
|
+
}, () => {
|
|
177
|
+
setTimeout(() => {
|
|
178
|
+
C();
|
|
179
|
+
}, 100);
|
|
180
|
+
}, { deep: !0 }), g(W, (e) => {
|
|
181
|
+
r.value && t.value && a.value && Object.keys(a.value).length > 0 && (a.value = {
|
|
182
|
+
...a.value,
|
|
183
|
+
width: e,
|
|
184
|
+
transition: "none"
|
|
185
|
+
// No animation for resize
|
|
186
|
+
}, setTimeout(() => {
|
|
187
|
+
a.value && Object.keys(a.value).length > 0 && (a.value = {
|
|
188
|
+
...a.value,
|
|
189
|
+
transition: "all 0.3s ease-in-out"
|
|
190
|
+
});
|
|
191
|
+
}, 50));
|
|
192
|
+
}), g(l, () => {
|
|
193
|
+
r.value && K();
|
|
200
194
|
}, { immediate: !0 }), g(r, (e) => {
|
|
201
|
-
e &&
|
|
195
|
+
e && K();
|
|
196
|
+
}), Y(() => {
|
|
197
|
+
setTimeout(() => {
|
|
198
|
+
C();
|
|
199
|
+
}, 100), m.value && (S.value = new ResizeObserver(E), S.value.observe(m.value)), y.value && (B.value = new ResizeObserver(E), B.value.observe(y.value)), window.addEventListener("resize", E);
|
|
200
|
+
}), Z(() => {
|
|
201
|
+
r.value && document.body.classList.remove("tw-overflow-hidden");
|
|
202
|
+
}), $(() => {
|
|
203
|
+
S.value && S.value.disconnect(), B.value && B.value.disconnect(), window.removeEventListener("resize", E);
|
|
204
|
+
const e = document.getElementById("side-sheet-styles");
|
|
205
|
+
e && e.remove();
|
|
202
206
|
}), {
|
|
203
|
-
closeSideSheet:
|
|
207
|
+
closeSideSheet: A,
|
|
204
208
|
contentHeight: V,
|
|
205
209
|
controlsRef: m,
|
|
206
210
|
headlineRef: y,
|
|
207
211
|
sideSheetRef: O,
|
|
208
|
-
sideSheetStyles:
|
|
209
|
-
goToLink:
|
|
210
|
-
mdiArrowLeft:
|
|
211
|
-
mdiClose:
|
|
212
|
-
mdiOpenInNew:
|
|
212
|
+
sideSheetStyles: J,
|
|
213
|
+
goToLink: q,
|
|
214
|
+
mdiArrowLeft: ie,
|
|
215
|
+
mdiClose: le,
|
|
216
|
+
mdiOpenInNew: se,
|
|
213
217
|
modalStyles: a,
|
|
214
218
|
open: r
|
|
215
219
|
};
|
|
216
220
|
}
|
|
217
|
-
},
|
|
218
|
-
function
|
|
219
|
-
const l =
|
|
221
|
+
}, ce = { class: "tw-flex tw-gap-1.5" }, ue = { key: 1 }, we = { class: "tw-flex tw-gap-1.5" };
|
|
222
|
+
function fe(n, o, i, t, I, M) {
|
|
223
|
+
const l = ee("kv-material-icon");
|
|
220
224
|
return i.visible ? (p(), k("div", {
|
|
221
225
|
key: 0,
|
|
222
226
|
class: b(["tw-block lg:tw-mt-0 tw-fixed tw-inset-0 tw-bg-black tw-transition-all md:tw-duration-150 tw-z-modal", {
|
|
223
227
|
"tw-bg-opacity-0 tw-delay-300": !t.open,
|
|
224
228
|
"tw-bg-opacity-low": t.open
|
|
225
229
|
}]),
|
|
226
|
-
onClick:
|
|
230
|
+
onClick: o[3] || (o[3] = te((...d) => t.closeSideSheet && t.closeSideSheet(...d), ["self"]))
|
|
227
231
|
}, [
|
|
228
232
|
w("div", {
|
|
229
233
|
ref: "sideSheetRef",
|
|
230
234
|
class: b(["tw-fixed tw-right-0 tw-transition-all tw-duration-300 tw-bg-white", {
|
|
231
235
|
"tw-translate-x-full": !t.open,
|
|
232
236
|
"tw-translate-x-0": t.open,
|
|
233
|
-
"tw-h-full":
|
|
237
|
+
"tw-h-full": n.$slots.controls
|
|
234
238
|
}]),
|
|
235
239
|
style: H(t.sideSheetStyles)
|
|
236
240
|
}, [
|
|
@@ -246,24 +250,24 @@ function we(o, n, i, t, I, M) {
|
|
|
246
250
|
"tw-border-b": i.showHeadlineBorder
|
|
247
251
|
}])
|
|
248
252
|
}, [
|
|
249
|
-
w("div",
|
|
253
|
+
w("div", ce, [
|
|
250
254
|
i.showBackButton ? (p(), k("button", {
|
|
251
255
|
key: 0,
|
|
252
256
|
class: "hover:tw-text-action-highlight tw-flex tw-items-center tw-justify-center",
|
|
253
|
-
onClick:
|
|
257
|
+
onClick: o[0] || (o[0] = (...d) => t.closeSideSheet && t.closeSideSheet(...d))
|
|
254
258
|
}, [
|
|
255
259
|
z(l, {
|
|
256
260
|
class: "tw-w-3 tw-h-3",
|
|
257
261
|
icon: t.mdiArrowLeft
|
|
258
262
|
}, null, 8, ["icon"])
|
|
259
263
|
])) : x("", !0),
|
|
260
|
-
i.headline ? (p(), k("h3",
|
|
264
|
+
i.headline ? (p(), k("h3", ue, ne(i.headline), 1)) : x("", !0)
|
|
261
265
|
]),
|
|
262
|
-
w("div",
|
|
266
|
+
w("div", we, [
|
|
263
267
|
i.showGoToLink ? (p(), k("button", {
|
|
264
268
|
key: 0,
|
|
265
269
|
class: "hover:tw-text-action-highlight tw-flex tw-items-center tw-justify-center",
|
|
266
|
-
onClick:
|
|
270
|
+
onClick: o[1] || (o[1] = (...d) => t.goToLink && t.goToLink(...d))
|
|
267
271
|
}, [
|
|
268
272
|
z(l, {
|
|
269
273
|
class: "tw-w-3 tw-h-3",
|
|
@@ -272,7 +276,7 @@ function we(o, n, i, t, I, M) {
|
|
|
272
276
|
])) : x("", !0),
|
|
273
277
|
w("button", {
|
|
274
278
|
class: "hover:tw-text-action-highlight tw-flex tw-items-center tw-justify-center",
|
|
275
|
-
onClick:
|
|
279
|
+
onClick: o[2] || (o[2] = (...d) => t.closeSideSheet && t.closeSideSheet(...d))
|
|
276
280
|
}, [
|
|
277
281
|
z(l, {
|
|
278
282
|
class: "tw-w-3 tw-h-3",
|
|
@@ -292,10 +296,10 @@ function we(o, n, i, t, I, M) {
|
|
|
292
296
|
"tw-opacity-full": t.open
|
|
293
297
|
}])
|
|
294
298
|
}, [
|
|
295
|
-
|
|
299
|
+
D(n.$slots, "default")
|
|
296
300
|
], 2)
|
|
297
301
|
], 4),
|
|
298
|
-
|
|
302
|
+
n.$slots.controls ? (p(), k("div", {
|
|
299
303
|
key: 0,
|
|
300
304
|
ref: "controlsRef",
|
|
301
305
|
class: b(["tw-absolute tw-bottom-0 tw-w-full tw-border-t tw-border-tertiary tw-bg-white tw-transition-opacity tw-duration-200", {
|
|
@@ -304,13 +308,13 @@ function we(o, n, i, t, I, M) {
|
|
|
304
308
|
}]),
|
|
305
309
|
style: { "z-index": "999" }
|
|
306
310
|
}, [
|
|
307
|
-
|
|
311
|
+
D(n.$slots, "controls")
|
|
308
312
|
], 2)) : x("", !0)
|
|
309
313
|
], 4)
|
|
310
314
|
], 6)
|
|
311
315
|
], 2)) : x("", !0);
|
|
312
316
|
}
|
|
313
|
-
const
|
|
317
|
+
const ge = /* @__PURE__ */ de(re, [["render", fe]]);
|
|
314
318
|
export {
|
|
315
|
-
|
|
319
|
+
ge as default
|
|
316
320
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.65.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"embla-carousel-fade",
|
|
115
115
|
"popper.js"
|
|
116
116
|
],
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "7eaf279276abe20afa6d5f9de928938039dbc5e3"
|
|
118
118
|
}
|