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