@kiva/kv-components 6.43.0 → 6.44.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,4 +1,4 @@
1
- import { toRefs as L, ref as u, nextTick as y, computed as E, watch as K, onMounted as M, onBeforeUnmount as N, resolveComponent as P, openBlock as b, createBlock as R, Transition as V, withCtx as j, withDirectives as q, createElementVNode as o, withModifiers as g, normalizeClass as p, renderSlot as k, toDisplayString as z, createElementBlock as C, createVNode as D, createCommentVNode as S, vShow as I } from "vue";
1
+ import { toRefs as L, ref as u, nextTick as C, computed as E, watch as K, onMounted as M, onBeforeUnmount as N, resolveComponent as P, openBlock as b, createBlock as R, Transition as V, withCtx as j, withDirectives as q, createElementVNode as i, withModifiers as x, createElementBlock as g, createCommentVNode as y, normalizeClass as S, renderSlot as p, toDisplayString as z, createVNode as D, vShow as I } from "vue";
2
2
  import { mdiClose as O } from "@mdi/js";
3
3
  import { useFocusTrap as T } from "@vueuse/integrations/useFocusTrap";
4
4
  import { hideOthers as U } from "../vendor/aria-hidden/dist/es2015/index.js";
@@ -11,6 +11,13 @@ const X = {
11
11
  KvMaterialIcon: Q
12
12
  },
13
13
  props: {
14
+ /**
15
+ * Whether to apply a blur to the background behind the lightbox
16
+ */
17
+ blurBackground: {
18
+ type: Boolean,
19
+ default: !1
20
+ },
14
21
  /**
15
22
  * Whether the dialog is open or not
16
23
  * */
@@ -25,8 +32,8 @@ const X = {
25
32
  variant: {
26
33
  type: String,
27
34
  default: "lightbox",
28
- validator(i) {
29
- return ["lightbox", "alert"].includes(i);
35
+ validator(n) {
36
+ return ["lightbox", "alert"].includes(n);
30
37
  }
31
38
  },
32
39
  /**
@@ -49,18 +56,18 @@ const X = {
49
56
  emits: [
50
57
  "lightbox-closed"
51
58
  ],
52
- setup(i, { emit: e }) {
59
+ setup(n, { emit: e }) {
53
60
  const {
54
61
  visible: t,
55
- variant: a,
56
- preventClose: h
57
- } = L(i), s = u(null), n = u(null), c = u(null), w = u(null), v = u(null);
58
- y(() => {
62
+ variant: l,
63
+ preventClose: k
64
+ } = L(n), c = u(null), a = u(null), r = u(null), w = u(null), v = u(null);
65
+ C(() => {
59
66
  const {
60
- activate: l,
61
- deactivate: r
67
+ activate: o,
68
+ deactivate: s
62
69
  } = T([
63
- s.value,
70
+ c.value,
64
71
  // This lightbox
65
72
  '[role="alert"]'
66
73
  // Any open toasts/alerts on the page
@@ -68,41 +75,41 @@ const X = {
68
75
  allowOutsideClick: !0
69
76
  // allow clicking outside the lightbox to close it
70
77
  });
71
- w.value = l, v.value = r;
78
+ w.value = o, v.value = s;
72
79
  });
73
80
  let m = null, f = null;
74
- const _ = E(() => a.value === "alert" ? "alertdialog" : "dialog"), d = (l = "") => {
75
- var r;
76
- s.value && n.value && ((r = v.value) == null || r.call(v), n.value.scrollTop = 0, H(n.value)), A(), m && (m(), m = null), document.removeEventListener("keyup", f), e("lightbox-closed", { type: l });
81
+ const B = E(() => l.value === "alert" ? "alertdialog" : "dialog"), d = (o = "") => {
82
+ var s;
83
+ c.value && a.value && ((s = v.value) == null || s.call(v), a.value.scrollTop = 0, H(a.value)), A(), m && (m(), m = null), document.removeEventListener("keyup", f), e("lightbox-closed", { type: o });
77
84
  };
78
- f = (l) => {
79
- l && l.key === "Escape" && !h.value && d();
85
+ f = (o) => {
86
+ o && o.key === "Escape" && !k.value && d();
80
87
  };
81
- const B = () => {
82
- h.value || d("background-click");
83
- }, x = () => {
84
- t.value && (document.addEventListener("keyup", f), y(() => {
85
- var l;
86
- if (s.value && n.value && ((l = w.value) == null || l.call(w), m = U(s.value), J(n.value)), G(), a.value === "alert") {
87
- const r = c.value.querySelector("button");
88
- r && r.focus();
88
+ const _ = () => {
89
+ k.value || d("background-click");
90
+ }, h = () => {
91
+ t.value && (document.addEventListener("keyup", f), C(() => {
92
+ var o;
93
+ if (c.value && a.value && ((o = w.value) == null || o.call(w), m = U(c.value), J(a.value)), G(), l.value === "alert") {
94
+ const s = r.value.querySelector("button");
95
+ s && s.focus();
89
96
  }
90
97
  }));
91
98
  };
92
99
  return K(t, () => {
93
- t.value ? x() : d();
100
+ t.value ? h() : d();
94
101
  }), M(() => {
95
- t.value && x();
102
+ t.value && h();
96
103
  }), N(() => d()), {
97
104
  mdiClose: O,
98
- role: _,
99
- kvLightbox: s,
100
- kvLightboxBody: n,
105
+ role: B,
106
+ kvLightbox: c,
107
+ kvLightboxBody: a,
101
108
  onKeyUp: f,
102
- onScreenClick: B,
109
+ onScreenClick: _,
103
110
  hide: d,
104
- show: x,
105
- controlsRef: c
111
+ show: h,
112
+ controlsRef: r
106
113
  };
107
114
  }
108
115
  }, Y = ["aria-label", "aria-describedby", "role"], Z = { class: "tw-flex tw-p-2.5 md:tw-px-4 md:tw-pt-4 md:tw-pb-3.5" }, F = { class: "tw-flex-grow" }, $ = { class: "tw-text-h3 tw-flex-1" }, tt = {
@@ -114,8 +121,8 @@ const X = {
114
121
  ref: "controlsRef",
115
122
  class: "tw-flex-shrink-0 tw-flex tw-justify-end tw-gap-x-2.5 tw-p-2.5 md:tw-px-4 md:tw-pb-4 md:tw-pt-1"
116
123
  };
117
- function lt(i, e, t, a, h, s) {
118
- const n = P("kv-material-icon");
124
+ function lt(n, e, t, l, k, c) {
125
+ const a = P("kv-material-icon");
119
126
  return b(), R(V, {
120
127
  "enter-active-class": "tw-transition-opacity tw-duration-300",
121
128
  "leave-active-class": "tw-transition-opacity tw-duration-300",
@@ -125,22 +132,27 @@ function lt(i, e, t, a, h, s) {
125
132
  "leave-to-class": "tw-opacity-0"
126
133
  }, {
127
134
  default: j(() => [
128
- q(o("div", {
135
+ q(i("div", {
129
136
  class: "tw-z-modal tw-fixed tw-inset-0 tw-bg-black tw-bg-opacity-[75%]",
130
- onClick: e[2] || (e[2] = g((...c) => a.onScreenClick && a.onScreenClick(...c), ["stop", "prevent"]))
137
+ onClick: e[3] || (e[3] = x((...r) => l.onScreenClick && l.onScreenClick(...r), ["stop", "prevent"]))
131
138
  }, [
132
- o("div", null, [
133
- o("div", {
134
- class: p(["tw-flex tw-absolute tw-inset-0", {
139
+ i("div", null, [
140
+ t.blurBackground ? (b(), g("div", {
141
+ key: 0,
142
+ class: "tw-fixed tw-inset-0 tw-w-full tw-h-full tw-backdrop-blur-sm",
143
+ onClick: e[0] || (e[0] = x((...r) => l.onScreenClick && l.onScreenClick(...r), ["stop", "prevent"]))
144
+ })) : y("", !0),
145
+ i("div", {
146
+ class: S(["tw-flex tw-absolute tw-inset-0", {
135
147
  "md:tw-px-2": t.variant === "lightbox",
136
148
  "tw-px-2": t.variant === "alert"
137
149
  }])
138
150
  }, [
139
- o("div", {
151
+ i("div", {
140
152
  ref: "kvLightbox",
141
153
  tabindex: "-1",
142
154
  "data-test": "kv-lightbox",
143
- class: p(["tw-bg-primary tw-flex tw-flex-col tw-mx-auto md:tw-my-auto", {
155
+ class: S(["tw-bg-primary tw-flex tw-flex-col tw-mx-auto md:tw-my-auto", {
144
156
  "tw-w-full md:tw-w-auto": t.variant === "lightbox",
145
157
  "tw-mt-auto md:tw-my-auto": t.variant === "lightbox",
146
158
  "tw-min-h-half-screen md:tw-min-h-0": t.variant === "lightbox",
@@ -151,34 +163,34 @@ function lt(i, e, t, a, h, s) {
151
163
  "aria-modal": "true",
152
164
  "aria-label": t.title ? t.title : null,
153
165
  "aria-describedby": t.variant === "alert" ? "kvLightboxBody" : null,
154
- role: a.role,
155
- onClick: e[1] || (e[1] = g(() => {
166
+ role: l.role,
167
+ onClick: e[2] || (e[2] = x(() => {
156
168
  }, ["stop"]))
157
169
  }, [
158
- o("div", Z, [
159
- o("div", F, [
160
- k(i.$slots, "header", {}, () => [
161
- o("h2", $, z(t.title), 1)
170
+ i("div", Z, [
171
+ i("div", F, [
172
+ p(n.$slots, "header", {}, () => [
173
+ i("h2", $, z(t.title), 1)
162
174
  ])
163
175
  ]),
164
- t.preventClose ? S("", !0) : (b(), C("button", {
176
+ t.preventClose ? y("", !0) : (b(), g("button", {
165
177
  key: 0,
166
178
  class: "tw-grid tw-content-center tw-justify-center tw-ml-auto tw-w-6 tw-h-6 tw--m-2 hover:tw-text-action-highlight",
167
- onClick: e[0] || (e[0] = g((c) => a.hide("close-x"), ["stop"]))
179
+ onClick: e[1] || (e[1] = x((r) => l.hide("close-x"), ["stop"]))
168
180
  }, [
169
- D(n, {
181
+ D(a, {
170
182
  class: "tw-w-3 tw-h-3",
171
- icon: a.mdiClose
183
+ icon: l.mdiClose
172
184
  }, null, 8, ["icon"]),
173
- e[3] || (e[3] = o("span", { class: "tw-sr-only" }, "Close", -1))
185
+ e[4] || (e[4] = i("span", { class: "tw-sr-only" }, "Close", -1))
174
186
  ]))
175
187
  ]),
176
- o("div", tt, [
177
- k(i.$slots, "default")
188
+ i("div", tt, [
189
+ p(n.$slots, "default")
178
190
  ], 512),
179
- i.$slots.controls ? (b(), C("div", et, [
180
- k(i.$slots, "controls")
181
- ], 512)) : S("", !0)
191
+ n.$slots.controls ? (b(), g("div", et, [
192
+ p(n.$slots, "controls")
193
+ ], 512)) : y("", !0)
182
194
  ], 10, Y)
183
195
  ], 2)
184
196
  ])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "6.43.0",
3
+ "version": "6.44.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -114,5 +114,5 @@
114
114
  "embla-carousel-fade",
115
115
  "popper.js"
116
116
  ],
117
- "gitHead": "c153687be5fd01c127a6c117eb061899d3da5105"
117
+ "gitHead": "1ef00287b2aff9739d729e4020218247921f931f"
118
118
  }