@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.
- package/dist/vue/KvLightbox.js +70 -58
- package/package.json +2 -2
package/dist/vue/KvLightbox.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRefs as L, ref as u, nextTick as
|
|
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(
|
|
29
|
-
return ["lightbox", "alert"].includes(
|
|
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(
|
|
59
|
+
setup(n, { emit: e }) {
|
|
53
60
|
const {
|
|
54
61
|
visible: t,
|
|
55
|
-
variant:
|
|
56
|
-
preventClose:
|
|
57
|
-
} = L(
|
|
58
|
-
|
|
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:
|
|
61
|
-
deactivate:
|
|
67
|
+
activate: o,
|
|
68
|
+
deactivate: s
|
|
62
69
|
} = T([
|
|
63
|
-
|
|
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 =
|
|
78
|
+
w.value = o, v.value = s;
|
|
72
79
|
});
|
|
73
80
|
let m = null, f = null;
|
|
74
|
-
const
|
|
75
|
-
var
|
|
76
|
-
|
|
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 = (
|
|
79
|
-
|
|
85
|
+
f = (o) => {
|
|
86
|
+
o && o.key === "Escape" && !k.value && d();
|
|
80
87
|
};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
t.value && (document.addEventListener("keyup", f),
|
|
85
|
-
var
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
|
|
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 ?
|
|
100
|
+
t.value ? h() : d();
|
|
94
101
|
}), M(() => {
|
|
95
|
-
t.value &&
|
|
102
|
+
t.value && h();
|
|
96
103
|
}), N(() => d()), {
|
|
97
104
|
mdiClose: O,
|
|
98
|
-
role:
|
|
99
|
-
kvLightbox:
|
|
100
|
-
kvLightboxBody:
|
|
105
|
+
role: B,
|
|
106
|
+
kvLightbox: c,
|
|
107
|
+
kvLightboxBody: a,
|
|
101
108
|
onKeyUp: f,
|
|
102
|
-
onScreenClick:
|
|
109
|
+
onScreenClick: _,
|
|
103
110
|
hide: d,
|
|
104
|
-
show:
|
|
105
|
-
controlsRef:
|
|
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(
|
|
118
|
-
const
|
|
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(
|
|
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[
|
|
137
|
+
onClick: e[3] || (e[3] = x((...r) => l.onScreenClick && l.onScreenClick(...r), ["stop", "prevent"]))
|
|
131
138
|
}, [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
151
|
+
i("div", {
|
|
140
152
|
ref: "kvLightbox",
|
|
141
153
|
tabindex: "-1",
|
|
142
154
|
"data-test": "kv-lightbox",
|
|
143
|
-
class:
|
|
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:
|
|
155
|
-
onClick: e[
|
|
166
|
+
role: l.role,
|
|
167
|
+
onClick: e[2] || (e[2] = x(() => {
|
|
156
168
|
}, ["stop"]))
|
|
157
169
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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 ?
|
|
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[
|
|
179
|
+
onClick: e[1] || (e[1] = x((r) => l.hide("close-x"), ["stop"]))
|
|
168
180
|
}, [
|
|
169
|
-
D(
|
|
181
|
+
D(a, {
|
|
170
182
|
class: "tw-w-3 tw-h-3",
|
|
171
|
-
icon:
|
|
183
|
+
icon: l.mdiClose
|
|
172
184
|
}, null, 8, ["icon"]),
|
|
173
|
-
e[
|
|
185
|
+
e[4] || (e[4] = i("span", { class: "tw-sr-only" }, "Close", -1))
|
|
174
186
|
]))
|
|
175
187
|
]),
|
|
176
|
-
|
|
177
|
-
|
|
188
|
+
i("div", tt, [
|
|
189
|
+
p(n.$slots, "default")
|
|
178
190
|
], 512),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
], 512)) :
|
|
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.
|
|
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": "
|
|
117
|
+
"gitHead": "1ef00287b2aff9739d729e4020218247921f931f"
|
|
118
118
|
}
|