@kiva/kv-components 6.22.0 → 6.22.2

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