@kiva/kv-components 6.18.0 → 6.19.1
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 +162 -101
- package/package.json +2 -2
package/dist/vue/KvSideSheet.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { toRefs as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { toRefs as U, ref as w, reactive as A, computed as G, onMounted as D, onUnmounted as T, watch as j, resolveComponent as I, openBlock as v, createElementBlock as m, normalizeClass as y, withModifiers as q, createElementVNode as s, normalizeStyle as O, createVNode as C, createCommentVNode as g, toDisplayString as J, renderSlot as V, nextTick as P } from "vue";
|
|
2
|
+
import { mdiArrowLeft as Q, mdiClose as W, mdiExportVariant as X } from "@mdi/js";
|
|
3
|
+
import Y from "./KvMaterialIcon.js";
|
|
4
|
+
import Z from "../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const $ = {
|
|
6
6
|
components: {
|
|
7
|
-
KvMaterialIcon:
|
|
7
|
+
KvMaterialIcon: Y
|
|
8
8
|
},
|
|
9
9
|
props: {
|
|
10
10
|
/**
|
|
@@ -15,7 +15,7 @@ const G = {
|
|
|
15
15
|
default: !1
|
|
16
16
|
},
|
|
17
17
|
/**
|
|
18
|
-
* Show the
|
|
18
|
+
* Show the back button
|
|
19
19
|
* */
|
|
20
20
|
showBackButton: {
|
|
21
21
|
type: Boolean,
|
|
@@ -28,6 +28,13 @@ const G = {
|
|
|
28
28
|
type: Boolean,
|
|
29
29
|
default: !1
|
|
30
30
|
},
|
|
31
|
+
/**
|
|
32
|
+
* Show the border of the headline section
|
|
33
|
+
* */
|
|
34
|
+
showHeadlineBorder: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !0
|
|
37
|
+
},
|
|
31
38
|
/**
|
|
32
39
|
* Tracking event function
|
|
33
40
|
* */
|
|
@@ -44,165 +51,219 @@ const G = {
|
|
|
44
51
|
},
|
|
45
52
|
/**
|
|
46
53
|
* Source element position for expand animation
|
|
47
|
-
*/
|
|
54
|
+
* */
|
|
48
55
|
animationSourceElement: {
|
|
49
56
|
type: Object,
|
|
50
57
|
default: () => ({})
|
|
51
58
|
},
|
|
52
59
|
/**
|
|
53
60
|
* The headline of the side sheet
|
|
54
|
-
*/
|
|
61
|
+
* */
|
|
55
62
|
headline: {
|
|
56
63
|
type: String,
|
|
57
64
|
default: ""
|
|
58
65
|
}
|
|
59
66
|
},
|
|
60
|
-
emits: [
|
|
61
|
-
|
|
62
|
-
],
|
|
63
|
-
setup(w, { emit: o }) {
|
|
67
|
+
emits: ["side-sheet-closed", "go-to-link"],
|
|
68
|
+
setup(c, { emit: l, slots: n }) {
|
|
64
69
|
const {
|
|
65
|
-
visible:
|
|
66
|
-
kvTrackFunction:
|
|
67
|
-
trackEventCategory:
|
|
68
|
-
animationSourceElement:
|
|
69
|
-
} =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
visible: e,
|
|
71
|
+
kvTrackFunction: E,
|
|
72
|
+
trackEventCategory: L,
|
|
73
|
+
animationSourceElement: r
|
|
74
|
+
} = U(c), i = w(!1), S = w({}), u = w({}), h = w(null), f = w(null), R = w(window.innerHeight), d = A({
|
|
75
|
+
headline: 0,
|
|
76
|
+
controls: 0
|
|
77
|
+
}), M = G(() => {
|
|
78
|
+
const t = R.value - d.headline - d.controls;
|
|
79
|
+
return Math.max(t, 0);
|
|
80
|
+
}), F = (t, a) => {
|
|
81
|
+
let o;
|
|
82
|
+
return (...b) => {
|
|
83
|
+
clearTimeout(o), o = setTimeout(() => t(...b), a);
|
|
84
|
+
};
|
|
85
|
+
}, p = () => {
|
|
86
|
+
R.value = window.innerHeight, setTimeout(() => {
|
|
87
|
+
P(() => {
|
|
88
|
+
var t;
|
|
89
|
+
if (f.value) {
|
|
90
|
+
const a = f.value.getBoundingClientRect();
|
|
91
|
+
d.headline = a.height;
|
|
92
|
+
} else
|
|
93
|
+
d.headline = 0;
|
|
94
|
+
if ((t = n.controls) != null && t.call(n) && h.value) {
|
|
95
|
+
const a = h.value.getBoundingClientRect();
|
|
96
|
+
d.controls = a.height;
|
|
97
|
+
} else
|
|
98
|
+
d.controls = 0;
|
|
99
|
+
});
|
|
100
|
+
}, 300);
|
|
101
|
+
}, k = F(p, 100), x = () => {
|
|
102
|
+
const t = "tw-overflow-hidden";
|
|
103
|
+
i.value ? document.body.classList.add(t) : document.body.classList.remove(t);
|
|
104
|
+
}, H = () => {
|
|
105
|
+
i.value = !1, x(), E.value(L.value, "click", "side-sheet-closed"), r.value && (u.value = {
|
|
106
|
+
...S.value,
|
|
77
107
|
transition: "all 0.5s ease-in-out"
|
|
78
108
|
}), setTimeout(() => {
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
|
|
109
|
+
l("side-sheet-closed");
|
|
110
|
+
}, 700), document.removeEventListener("keyup", B);
|
|
111
|
+
}, K = () => {
|
|
112
|
+
l("go-to-link");
|
|
113
|
+
}, B = (t) => {
|
|
114
|
+
(t == null ? void 0 : t.key) === "Escape" && H();
|
|
83
115
|
};
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
116
|
+
return D(() => {
|
|
117
|
+
if (setTimeout(() => {
|
|
118
|
+
p();
|
|
119
|
+
}, 100), h.value) {
|
|
120
|
+
const t = new ResizeObserver(k);
|
|
121
|
+
t.observe(h.value), T(() => t.disconnect());
|
|
122
|
+
}
|
|
123
|
+
if (f.value) {
|
|
124
|
+
const t = new ResizeObserver(k);
|
|
125
|
+
t.observe(f.value), T(() => t.disconnect());
|
|
126
|
+
}
|
|
127
|
+
window.addEventListener("resize", k), T(() => window.removeEventListener("resize", k));
|
|
128
|
+
}), j(() => {
|
|
129
|
+
var t;
|
|
130
|
+
return (t = n.controls) == null ? void 0 : t.call(n);
|
|
131
|
+
}, () => {
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
p();
|
|
134
|
+
}, 100);
|
|
135
|
+
}, { deep: !0, immediate: !0 }), j(e, (t) => {
|
|
87
136
|
var a;
|
|
88
|
-
if (
|
|
89
|
-
document.addEventListener("keyup",
|
|
90
|
-
|
|
137
|
+
if (t) {
|
|
138
|
+
document.addEventListener("keyup", B), setTimeout(() => {
|
|
139
|
+
i.value = !0, x(), p();
|
|
91
140
|
}, 100);
|
|
92
|
-
const
|
|
93
|
-
|
|
141
|
+
const o = (a = r.value) == null ? void 0 : a.getBoundingClientRect(), b = (o == null ? void 0 : o.top) ?? 0, N = (o == null ? void 0 : o.left) ?? 0, z = (o == null ? void 0 : o.width) ?? 0, _ = (o == null ? void 0 : o.height) ?? 0;
|
|
142
|
+
b || N || z || _ ? (S.value = {
|
|
94
143
|
position: "fixed",
|
|
95
|
-
top: `${
|
|
96
|
-
width: `${
|
|
97
|
-
height: `${
|
|
98
|
-
},
|
|
99
|
-
...
|
|
144
|
+
top: `${b}px`,
|
|
145
|
+
width: `${z}px`,
|
|
146
|
+
height: `${_}px`
|
|
147
|
+
}, u.value = {
|
|
148
|
+
...S.value,
|
|
100
149
|
transition: "none"
|
|
101
150
|
}, setTimeout(() => {
|
|
102
|
-
|
|
151
|
+
u.value = {
|
|
103
152
|
top: "0",
|
|
104
153
|
width: "100%",
|
|
105
154
|
height: "100%",
|
|
106
155
|
transition: "all 0.5s ease-in-out"
|
|
107
156
|
};
|
|
108
|
-
}, 10)) :
|
|
109
|
-
}
|
|
157
|
+
}, 10)) : u.value = {};
|
|
158
|
+
} else
|
|
159
|
+
i.value = !1, x(), document.removeEventListener("keyup", B);
|
|
110
160
|
}), {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
161
|
+
closeSideSheet: H,
|
|
162
|
+
contentHeight: M,
|
|
163
|
+
controlsRef: h,
|
|
164
|
+
headlineRef: f,
|
|
165
|
+
goToLink: K,
|
|
166
|
+
mdiArrowLeft: Q,
|
|
167
|
+
mdiClose: W,
|
|
168
|
+
mdiExportVariant: X,
|
|
169
|
+
modalStyles: u,
|
|
170
|
+
open: i
|
|
118
171
|
};
|
|
119
172
|
}
|
|
120
|
-
},
|
|
121
|
-
function
|
|
122
|
-
const
|
|
123
|
-
return
|
|
173
|
+
}, ee = { class: "tw-flex tw-gap-1.5" }, te = { key: 1 }, oe = { class: "tw-flex tw-gap-1.5" };
|
|
174
|
+
function ne(c, l, n, e, E, L) {
|
|
175
|
+
const r = I("kv-material-icon");
|
|
176
|
+
return n.visible ? (v(), m("div", {
|
|
124
177
|
key: 0,
|
|
125
|
-
class:
|
|
126
|
-
"tw-bg-opacity-0 tw-delay-300": !
|
|
127
|
-
"tw-bg-opacity-low":
|
|
178
|
+
class: y(["tw-block lg:tw-mt-0 tw-fixed tw-inset-0 tw-bg-black tw-transition-all md:tw-duration-150 tw-z-modal", {
|
|
179
|
+
"tw-bg-opacity-0 tw-delay-300": !e.open,
|
|
180
|
+
"tw-bg-opacity-low": e.open
|
|
128
181
|
}]),
|
|
129
|
-
onClick:
|
|
182
|
+
onClick: l[3] || (l[3] = q((...i) => e.closeSideSheet && e.closeSideSheet(...i), ["self"]))
|
|
130
183
|
}, [
|
|
131
184
|
s("div", {
|
|
132
|
-
class:
|
|
133
|
-
"tw-w-0 tw-delay-200 tw-opacity-0": !
|
|
134
|
-
"lg:tw-w-1/2 tw-w-full tw-opacity-full":
|
|
135
|
-
"tw-h-full":
|
|
185
|
+
class: y(["tw-fixed tw-right-0 tw-transition-all tw-duration-300 tw-bg-white tw-overflow-y-auto", {
|
|
186
|
+
"tw-w-0 tw-delay-200 tw-opacity-0": !e.open,
|
|
187
|
+
"lg:tw-w-1/2 tw-w-full tw-opacity-full": e.open,
|
|
188
|
+
"tw-h-full": c.$slots.controls
|
|
136
189
|
}])
|
|
137
190
|
}, [
|
|
138
191
|
s("div", {
|
|
139
|
-
class: "tw-
|
|
140
|
-
style:
|
|
192
|
+
class: "tw-flex tw-flex-col tw-h-full",
|
|
193
|
+
style: O(e.modalStyles)
|
|
141
194
|
}, [
|
|
142
195
|
s("div", {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"tw-opacity-
|
|
196
|
+
ref: "headlineRef",
|
|
197
|
+
class: y(["tw-flex tw-justify-between tw-transition-opacity tw-duration-500 tw-delay-200 tw-px-3 tw-py-2 tw-border-tertiary", {
|
|
198
|
+
"tw-opacity-0": !e.open,
|
|
199
|
+
"tw-opacity-full": e.open,
|
|
200
|
+
"tw-border-b": n.showHeadlineBorder
|
|
146
201
|
}])
|
|
147
202
|
}, [
|
|
148
|
-
s("div",
|
|
149
|
-
|
|
203
|
+
s("div", ee, [
|
|
204
|
+
n.showBackButton ? (v(), m("button", {
|
|
150
205
|
key: 0,
|
|
151
206
|
class: "hover:tw-text-action-highlight tw-flex tw-items-center tw-justify-center",
|
|
152
|
-
onClick:
|
|
207
|
+
onClick: l[0] || (l[0] = (...i) => e.closeSideSheet && e.closeSideSheet(...i))
|
|
153
208
|
}, [
|
|
154
|
-
|
|
209
|
+
C(r, {
|
|
155
210
|
class: "tw-w-3 tw-h-3",
|
|
156
|
-
icon:
|
|
211
|
+
icon: e.mdiArrowLeft
|
|
157
212
|
}, null, 8, ["icon"])
|
|
158
|
-
])) :
|
|
159
|
-
|
|
213
|
+
])) : g("", !0),
|
|
214
|
+
n.headline ? (v(), m("h2", te, J(n.headline), 1)) : g("", !0)
|
|
160
215
|
]),
|
|
161
|
-
s("div",
|
|
162
|
-
|
|
216
|
+
s("div", oe, [
|
|
217
|
+
n.showGoToLink ? (v(), m("button", {
|
|
163
218
|
key: 0,
|
|
164
219
|
class: "hover:tw-text-action-highlight tw-flex tw-items-center tw-justify-center",
|
|
165
|
-
onClick:
|
|
220
|
+
onClick: l[1] || (l[1] = (...i) => e.goToLink && e.goToLink(...i))
|
|
166
221
|
}, [
|
|
167
|
-
|
|
222
|
+
C(r, {
|
|
168
223
|
class: "tw-w-3 tw-h-3",
|
|
169
|
-
icon:
|
|
224
|
+
icon: e.mdiExportVariant
|
|
170
225
|
}, null, 8, ["icon"])
|
|
171
|
-
])) :
|
|
226
|
+
])) : g("", !0),
|
|
172
227
|
s("button", {
|
|
173
228
|
class: "hover:tw-text-action-highlight tw-flex tw-items-center tw-justify-center",
|
|
174
|
-
onClick:
|
|
229
|
+
onClick: l[2] || (l[2] = (...i) => e.closeSideSheet && e.closeSideSheet(...i))
|
|
175
230
|
}, [
|
|
176
|
-
|
|
231
|
+
C(r, {
|
|
177
232
|
class: "tw-w-3 tw-h-3",
|
|
178
|
-
icon:
|
|
233
|
+
icon: e.mdiClose
|
|
179
234
|
}, null, 8, ["icon"])
|
|
180
235
|
])
|
|
181
236
|
])
|
|
182
237
|
], 2),
|
|
183
238
|
s("div", {
|
|
184
|
-
class:
|
|
185
|
-
|
|
186
|
-
"tw-opacity-full": t.open
|
|
187
|
-
}])
|
|
239
|
+
class: "tw-overflow-y-auto tw-overscroll-y-contain",
|
|
240
|
+
style: O({ height: e.contentHeight + "px" })
|
|
188
241
|
}, [
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
242
|
+
s("div", {
|
|
243
|
+
class: y(["tw-p-2 tw-transition-opacity tw-duration-500 tw-delay-200", {
|
|
244
|
+
"tw-opacity-0": !e.open,
|
|
245
|
+
"tw-opacity-full": e.open
|
|
246
|
+
}])
|
|
247
|
+
}, [
|
|
248
|
+
V(c.$slots, "default")
|
|
249
|
+
], 2)
|
|
250
|
+
], 4),
|
|
251
|
+
c.$slots.controls ? (v(), m("div", {
|
|
192
252
|
key: 0,
|
|
193
253
|
ref: "controlsRef",
|
|
194
|
-
class:
|
|
195
|
-
"tw-opacity-0": !
|
|
196
|
-
"tw-opacity-full":
|
|
197
|
-
}])
|
|
254
|
+
class: y(["tw-absolute tw-bottom-0 tw-w-full tw-border-t tw-border-tertiary tw-bg-white", {
|
|
255
|
+
"tw-opacity-0": !e.open,
|
|
256
|
+
"tw-opacity-full": e.open
|
|
257
|
+
}]),
|
|
258
|
+
style: { "z-index": "999" }
|
|
198
259
|
}, [
|
|
199
|
-
|
|
200
|
-
], 2)) :
|
|
260
|
+
V(c.$slots, "controls")
|
|
261
|
+
], 2)) : g("", !0)
|
|
201
262
|
], 4)
|
|
202
263
|
], 2)
|
|
203
|
-
], 2)) :
|
|
264
|
+
], 2)) : g("", !0);
|
|
204
265
|
}
|
|
205
|
-
const
|
|
266
|
+
const ce = /* @__PURE__ */ Z($, [["render", ne]]);
|
|
206
267
|
export {
|
|
207
|
-
|
|
268
|
+
ce as default
|
|
208
269
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.19.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"embla-carousel-fade",
|
|
112
112
|
"popper.js"
|
|
113
113
|
],
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "deed239da39c2b792f12ce798a1311b68e45aff0"
|
|
115
115
|
}
|