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