@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.
@@ -1,10 +1,10 @@
1
- import { toRefs as L, ref as m, watch as T, resolveComponent as _, openBlock as r, createElementBlock as d, normalizeClass as f, withModifiers as j, createElementVNode as s, normalizeStyle as V, createVNode as v, createCommentVNode as u, toDisplayString as z, renderSlot as C } from "vue";
2
- import { mdiClose as F, mdiArrowLeft as K, mdiExportVariant as N } from "@mdi/js";
3
- import R from "./KvMaterialIcon.js";
4
- import A from "../_virtual/_plugin-vue_export-helper.js";
5
- const G = {
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: R
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 go to link button
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
- "side-sheet-closed"
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: l,
66
- kvTrackFunction: t,
67
- trackEventCategory: p,
68
- animationSourceElement: y
69
- } = L(w), n = m(!1), i = m({}), c = m({});
70
- let h = null;
71
- const k = () => {
72
- const a = "tw-overflow-hidden";
73
- n.value ? document.body.classList.add(a) : document.body.classList.remove(a);
74
- }, g = () => {
75
- n.value = !1, k(), t.value(p.value, "click", "side-sheet-closed"), y.value && (c.value = {
76
- ...i.value,
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
- o("side-sheet-closed");
80
- }, "700"), document.removeEventListener("keyup", h);
81
- }, B = () => {
82
- o("go-to-link");
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 h = (a) => {
85
- a && a.key === "Escape" && g();
86
- }, T(l, () => {
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 (l.value) {
89
- document.addEventListener("keyup", h), setTimeout(() => {
90
- n.value = !0, k();
137
+ if (t) {
138
+ document.addEventListener("keyup", B), setTimeout(() => {
139
+ i.value = !0, x(), p();
91
140
  }, 100);
92
- const e = (a = y.value) == null ? void 0 : a.getBoundingClientRect(), S = (e == null ? void 0 : e.top) ?? 0, E = (e == null ? void 0 : e.left) ?? 0, b = (e == null ? void 0 : e.width) ?? 0, x = (e == null ? void 0 : e.height) ?? 0;
93
- S || E || b || x ? (i.value = {
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: `${S}px`,
96
- width: `${b}px`,
97
- height: `${x}px`
98
- }, c.value = {
99
- ...i.value,
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
- c.value = {
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)) : c.value = {};
109
- }
157
+ }, 10)) : u.value = {};
158
+ } else
159
+ i.value = !1, x(), document.removeEventListener("keyup", B);
110
160
  }), {
111
- mdiClose: F,
112
- mdiArrowLeft: K,
113
- mdiExportVariant: N,
114
- open: n,
115
- closeSideSheet: g,
116
- goToLink: B,
117
- modalStyles: c
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
- }, M = { class: "tw-flex tw-gap-1.5" }, D = { key: 1 }, I = { class: "tw-flex tw-gap-1.5" };
121
- function O(w, o, l, t, p, y) {
122
- const n = _("kv-material-icon");
123
- return l.visible ? (r(), d("div", {
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: f(["tw-block lg:tw-mt-0 tw-fixed tw-inset-0 tw-bg-black tw-transition-all md:tw-duration-150 tw-z-modal", {
126
- "tw-bg-opacity-0 tw-delay-300": !t.open,
127
- "tw-bg-opacity-low": t.open
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: o[3] || (o[3] = j((...i) => t.closeSideSheet && t.closeSideSheet(...i), ["self"]))
182
+ onClick: l[3] || (l[3] = q((...i) => e.closeSideSheet && e.closeSideSheet(...i), ["self"]))
130
183
  }, [
131
184
  s("div", {
132
- class: f(["tw-fixed tw-right-0 tw-transition-all tw-duration-300 tw-bg-white tw-overflow-y-auto", {
133
- "tw-w-0 tw-delay-200 tw-opacity-0": !t.open,
134
- "lg:tw-w-1/2 tw-w-full tw-opacity-full": t.open,
135
- "tw-h-full": w.$slots.controls
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-relative tw-h-full",
140
- style: V(t.modalStyles)
192
+ class: "tw-flex tw-flex-col tw-h-full",
193
+ style: O(e.modalStyles)
141
194
  }, [
142
195
  s("div", {
143
- class: f(["tw-flex tw-justify-between tw-transition-opacity tw-duration-500 tw-delay-200 tw-px-3 tw-py-2 tw-border-b tw-border-tertiary", {
144
- "tw-opacity-0": !t.open,
145
- "tw-opacity-full": t.open
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", M, [
149
- l.showBackButton ? (r(), d("button", {
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: o[0] || (o[0] = (...i) => t.closeSideSheet && t.closeSideSheet(...i))
207
+ onClick: l[0] || (l[0] = (...i) => e.closeSideSheet && e.closeSideSheet(...i))
153
208
  }, [
154
- v(n, {
209
+ C(r, {
155
210
  class: "tw-w-3 tw-h-3",
156
- icon: t.mdiArrowLeft
211
+ icon: e.mdiArrowLeft
157
212
  }, null, 8, ["icon"])
158
- ])) : u("", !0),
159
- l.headline ? (r(), d("h2", D, z(l.headline), 1)) : u("", !0)
213
+ ])) : g("", !0),
214
+ n.headline ? (v(), m("h2", te, J(n.headline), 1)) : g("", !0)
160
215
  ]),
161
- s("div", I, [
162
- l.showGoToLink ? (r(), d("button", {
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: o[1] || (o[1] = (...i) => t.goToLink && t.goToLink(...i))
220
+ onClick: l[1] || (l[1] = (...i) => e.goToLink && e.goToLink(...i))
166
221
  }, [
167
- v(n, {
222
+ C(r, {
168
223
  class: "tw-w-3 tw-h-3",
169
- icon: t.mdiExportVariant
224
+ icon: e.mdiExportVariant
170
225
  }, null, 8, ["icon"])
171
- ])) : u("", !0),
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: o[2] || (o[2] = (...i) => t.closeSideSheet && t.closeSideSheet(...i))
229
+ onClick: l[2] || (l[2] = (...i) => e.closeSideSheet && e.closeSideSheet(...i))
175
230
  }, [
176
- v(n, {
231
+ C(r, {
177
232
  class: "tw-w-3 tw-h-3",
178
- icon: t.mdiClose
233
+ icon: e.mdiClose
179
234
  }, null, 8, ["icon"])
180
235
  ])
181
236
  ])
182
237
  ], 2),
183
238
  s("div", {
184
- class: f(["tw-p-4 tw-overflow-y-auto tw-transition-opacity tw-duration-500 tw-delay-200 tw-overscroll-y-contain", {
185
- "tw-opacity-0": !t.open,
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
- C(w.$slots, "default")
190
- ], 2),
191
- w.$slots.controls ? (r(), d("div", {
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: f(["tw-absolute tw-border-t tw-border-tertiary tw-w-full tw-bottom-0 tw-bg-white", {
195
- "tw-opacity-0": !t.open,
196
- "tw-opacity-full": t.open
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
- C(w.$slots, "controls")
200
- ], 2)) : u("", !0)
260
+ V(c.$slots, "controls")
261
+ ], 2)) : g("", !0)
201
262
  ], 4)
202
263
  ], 2)
203
- ], 2)) : u("", !0);
264
+ ], 2)) : g("", !0);
204
265
  }
205
- const P = /* @__PURE__ */ A(G, [["render", O]]);
266
+ const ce = /* @__PURE__ */ Z($, [["render", ne]]);
206
267
  export {
207
- P as default
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.18.0",
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": "9251c08f08f522b6661854385895a9957144d5a7"
114
+ "gitHead": "deed239da39c2b792f12ce798a1311b68e45aff0"
115
115
  }