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