@voidable/ui 0.11.0 → 0.12.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.
- package/README.md +1 -1
- package/dist/angular/index.d.ts +2 -2
- package/dist/angular/index.js +2 -1
- package/dist/chunks/activation-B8aBarKd.js +4 -0
- package/dist/chunks/carousel-C9u0bg5l.js +10 -0
- package/dist/chunks/choice-BTrsi7OW.js +16 -0
- package/dist/chunks/data-Baycjoo4.js +96 -0
- package/dist/chunks/fields-MEqz-olE.js +21 -0
- package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
- package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
- package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
- package/dist/chunks/menu-CxRRgkJI.js +21 -0
- package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
- package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
- package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
- package/dist/chunks/overlay-K1ilWC1p.js +4 -0
- package/dist/chunks/pickers-CjlFgNke.js +36 -0
- package/dist/chunks/table-BBpqwWEi.js +4 -0
- package/dist/chunks/tabs-Buf3EBWq.js +10 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.js +22 -14
- package/dist/components/action-input.d.ts +2 -1
- package/dist/components/action-input.js +59 -55
- package/dist/components/bar-chart.js +41 -40
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +15 -11
- package/dist/components/button.d.ts +7 -0
- package/dist/components/button.js +23 -16
- package/dist/components/calendar.d.ts +45 -10
- package/dist/components/calendar.js +183 -129
- package/dist/components/carousel.d.ts +22 -0
- package/dist/components/carousel.js +64 -35
- package/dist/components/charts/data.d.ts +2 -2
- package/dist/components/checkbox-group.js +22 -21
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +29 -24
- package/dist/components/collapsible.d.ts +7 -0
- package/dist/components/collapsible.js +19 -11
- package/dist/components/color-picker.js +28 -27
- package/dist/components/combobox.d.ts +13 -1
- package/dist/components/combobox.js +54 -41
- package/dist/components/compose-input.d.ts +9 -1
- package/dist/components/compose-input.js +28 -16
- package/dist/components/dialog.js +1 -1
- package/dist/components/donut-chart.js +57 -56
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.d.ts +22 -0
- package/dist/components/dropdown-menu.js +54 -39
- package/dist/components/editable.d.ts +11 -1
- package/dist/components/editable.js +35 -22
- package/dist/components/error-fallback.d.ts +4 -2
- package/dist/components/error-fallback.js +34 -28
- package/dist/components/file-upload.d.ts +9 -0
- package/dist/components/file-upload.js +54 -28
- package/dist/components/gauge.js +108 -107
- package/dist/components/hamburger.d.ts +7 -0
- package/dist/components/hamburger.js +28 -19
- package/dist/components/hover-card.d.ts +7 -0
- package/dist/components/hover-card.js +22 -14
- package/dist/components/indicator.js +15 -14
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.js +43 -42
- package/dist/components/menu.d.ts +25 -0
- package/dist/components/menu.js +55 -33
- package/dist/components/multiselect.d.ts +17 -1
- package/dist/components/multiselect.js +96 -74
- package/dist/components/nav-menu.d.ts +9 -0
- package/dist/components/nav-menu.js +30 -23
- package/dist/components/number-input.d.ts +15 -1
- package/dist/components/number-input.js +71 -37
- package/dist/components/pagination.js +25 -24
- package/dist/components/pin-input.d.ts +11 -0
- package/dist/components/pin-input.js +46 -32
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +21 -13
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio.d.ts +10 -1
- package/dist/components/radio.js +37 -32
- package/dist/components/segmented-control.d.ts +14 -0
- package/dist/components/segmented-control.js +40 -28
- package/dist/components/sidebar.d.ts +1 -0
- package/dist/components/sidebar.js +14 -10
- package/dist/components/slider.js +1 -1
- package/dist/components/spinner.d.ts +5 -3
- package/dist/components/spinner.js +21 -14
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.d.ts +2 -2
- package/dist/components/status-dot.js +12 -14
- package/dist/components/stepper.d.ts +2 -0
- package/dist/components/stepper.js +20 -13
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.js +24 -16
- package/dist/components/table.d.ts +77 -1
- package/dist/components/table.js +562 -73
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +42 -33
- package/dist/components/tag.js +12 -11
- package/dist/components/tags-input.d.ts +10 -1
- package/dist/components/tags-input.js +42 -30
- package/dist/components/textarea.js +1 -1
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +35 -28
- package/dist/components/toggle-group.d.ts +8 -0
- package/dist/components/toggle-group.js +24 -17
- package/dist/components/toggle.d.ts +7 -0
- package/dist/components/toggle.js +23 -15
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +20 -12
- package/dist/components.json +96 -74
- package/dist/custom-elements.json +4213 -131
- package/dist/dev/rules.d.ts +0 -1
- package/dist/dev/types.d.ts +3 -1
- package/dist/dev.js +244 -113
- package/dist/index.d.ts +4 -0
- package/dist/index.js +68 -66
- package/dist/keyboard-activation.d.ts +9 -9
- package/dist/keyboard.d.ts +2 -10
- package/dist/keymaps/activation.d.ts +8 -0
- package/dist/keymaps/carousel.d.ts +9 -0
- package/dist/keymaps/choice.d.ts +21 -0
- package/dist/keymaps/fields.d.ts +31 -0
- package/dist/keymaps/index.d.ts +2 -0
- package/dist/keymaps/menu.d.ts +36 -0
- package/dist/keymaps/nav-menu.d.ts +11 -0
- package/dist/keymaps/overlay.d.ts +4 -0
- package/dist/keymaps/pickers.d.ts +36 -0
- package/dist/keymaps/table.d.ts +8 -0
- package/dist/keymaps/tabs.d.ts +7 -0
- package/dist/keymaps.js +51 -0
- package/dist/keys.d.ts +46 -0
- package/dist/keys.js +57 -0
- package/dist/llms.txt +11 -3
- package/dist/messages/ar.d.ts +1 -0
- package/dist/messages/ar.js +130 -0
- package/dist/messages/fr.d.ts +1 -0
- package/dist/messages/fr.js +109 -0
- package/dist/messages.d.ts +213 -0
- package/dist/messages.js +190 -0
- package/dist/modal.d.ts +7 -0
- package/dist/reference.md +817 -17
- package/dist/testing/index.d.ts +46 -0
- package/dist/testing.js +79 -0
- package/dist/types/elements.d.ts +89 -73
- package/dist/types/react.d.ts +5 -1
- package/dist/types/solid.d.ts +5 -1
- package/dist/types/solid2.d.ts +4 -0
- package/dist/types/svelte.d.ts +5 -1
- package/dist/types/vue.d.ts +5 -1
- package/dist/vscode.html-custom-data.json +384 -18
- package/dist/web-types.json +830 -69
- package/package.json +22 -2
- package/dist/chunks/data-BpiiNapL.js +0 -95
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as e } from "./base-BGrS4eIl.js";
|
|
2
|
+
import { actionFor as t } from "../keys.js";
|
|
2
3
|
//#region src/overlay.ts
|
|
3
|
-
var
|
|
4
|
+
var n = new Set([
|
|
4
5
|
"escape",
|
|
5
6
|
"outside",
|
|
6
7
|
"blur",
|
|
@@ -8,53 +9,53 @@ var t = new Set([
|
|
|
8
9
|
"close-button",
|
|
9
10
|
"select",
|
|
10
11
|
"hover"
|
|
11
|
-
]),
|
|
12
|
-
function
|
|
12
|
+
]), r = new Set(["tooltip", "hover"]), i = "a[href], area[href], button, input, select, textarea, iframe, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable=\"false\"]), [tabindex]";
|
|
13
|
+
function a(e) {
|
|
13
14
|
let t = e;
|
|
14
|
-
return typeof t.focus != "function" || t.tabIndex < 0 || t.disabled || t.closest("[inert]") || t.localName === "input" && t.type === "hidden" ? !1 :
|
|
15
|
+
return typeof t.focus != "function" || t.tabIndex < 0 || t.disabled || t.closest("[inert]") || t.localName === "input" && t.type === "hidden" ? !1 : o(t);
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function o(e) {
|
|
17
18
|
if (e.closest("[hidden]")) return !1;
|
|
18
19
|
let t = e.checkVisibility;
|
|
19
20
|
return typeof t == "function" ? t.call(e, { visibilityProperty: !0 }) : !0;
|
|
20
21
|
}
|
|
21
|
-
function o(e) {
|
|
22
|
-
return Array.from(e.querySelectorAll(r)).filter(i);
|
|
23
|
-
}
|
|
24
22
|
function s(e) {
|
|
23
|
+
return Array.from(e.querySelectorAll(i)).filter(a);
|
|
24
|
+
}
|
|
25
|
+
function c(e) {
|
|
25
26
|
if (!e || !e.isConnected || typeof e.focus != "function") return !1;
|
|
26
27
|
let t = e;
|
|
27
|
-
return t.disabled || t.closest("[inert]") || t !== t.ownerDocument.body && t.tabIndex < 0 && !t.hasAttribute("tabindex") ? !1 :
|
|
28
|
+
return t.disabled || t.closest("[inert]") || t !== t.ownerDocument.body && t.tabIndex < 0 && !t.hasAttribute("tabindex") ? !1 : o(t);
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function l(e, t) {
|
|
30
31
|
try {
|
|
31
32
|
return e.matches(t);
|
|
32
33
|
} catch {
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
var
|
|
37
|
+
var u = (e) => typeof e.showPopover == "function", d = (e, t, n) => {
|
|
37
38
|
n === null ? e.hasAttribute(t) && e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
|
|
38
|
-
},
|
|
39
|
+
}, f = (e, t, n) => {
|
|
39
40
|
n === null ? e.style.removeProperty(t) : e.style.getPropertyValue(t) !== n && e.style.setProperty(t, n);
|
|
40
41
|
};
|
|
41
|
-
function
|
|
42
|
+
function p(e, t) {
|
|
42
43
|
if (t) {
|
|
43
44
|
let t = e;
|
|
44
|
-
return t.open ?
|
|
45
|
+
return t.open ? u(t) ? l(t, ":modal") ?? !0 : !0 : !1;
|
|
45
46
|
}
|
|
46
|
-
return
|
|
47
|
+
return u(e) ? l(e, ":popover-open") ?? !e.hidden : !e.hidden;
|
|
47
48
|
}
|
|
48
|
-
var
|
|
49
|
-
function
|
|
50
|
-
if (e[
|
|
49
|
+
var m = Symbol.for("@voidable/ui:overlay-force-fallback");
|
|
50
|
+
function h(e) {
|
|
51
|
+
if (e[m]) return !1;
|
|
51
52
|
let t = e.defaultView?.CSS;
|
|
52
53
|
return t?.supports ? t.supports("anchor-name: --void-a") && t.supports("position-area: block-end span-inline-end") && t.supports("position-try-fallbacks: flip-block") : !1;
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function g(e) {
|
|
55
56
|
return `${e}-${Math.random().toString(36).slice(2, 10)}`;
|
|
56
57
|
}
|
|
57
|
-
var
|
|
58
|
+
var _ = Symbol.for("@voidable/ui:overlays"), v = class e {
|
|
58
59
|
constructor(e) {
|
|
59
60
|
this._doc = e, this.stack = [], this._locks = 0, this._saved = null, this._listening = !1, this._positioned = /* @__PURE__ */ new Set(), this._frame = 0, this._resize = null, this._schedule = () => {
|
|
60
61
|
if (this._frame || !this._positioned.size) return;
|
|
@@ -64,12 +65,18 @@ var g = Symbol.for("@voidable/ui:overlays"), _ = class e {
|
|
|
64
65
|
for (let e of this._positioned) e.reposition();
|
|
65
66
|
}));
|
|
66
67
|
}, this._onKeydown = (e) => {
|
|
67
|
-
if (e.
|
|
68
|
-
let
|
|
69
|
-
|
|
68
|
+
if (e.defaultPrevented || e.isComposing) return;
|
|
69
|
+
let n = this.top();
|
|
70
|
+
if (n) {
|
|
71
|
+
if (t(n.host, e) !== "close") {
|
|
72
|
+
e.key === "Escape" && n.kind === "modal" && e.preventDefault();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
e.preventDefault(), n.requestClose("escape");
|
|
76
|
+
}
|
|
70
77
|
}, this._onPointerdown = (e) => {
|
|
71
78
|
if (e.button !== void 0 && e.button > 0) return;
|
|
72
|
-
let t = this.top((e) => !
|
|
79
|
+
let t = this.top((e) => !r.has(e.kind));
|
|
73
80
|
if (!(!t || t.containsEvent(e)) && t.requestClose("outside") && t.kind === "modal") {
|
|
74
81
|
let e = this._doc, t = (e) => e.preventDefault();
|
|
75
82
|
e.addEventListener("mousedown", t, {
|
|
@@ -80,17 +87,17 @@ var g = Symbol.for("@voidable/ui:overlays"), _ = class e {
|
|
|
80
87
|
}, this._onFocusin = (e) => {
|
|
81
88
|
let t = e.target;
|
|
82
89
|
if (!(!t || t === this._doc || t === this._doc.body)) for (let e = this.stack.length - 1; e >= 0; e--) {
|
|
83
|
-
let
|
|
84
|
-
if (!
|
|
85
|
-
if (
|
|
86
|
-
|
|
90
|
+
let n = this.stack[e];
|
|
91
|
+
if (!r.has(n.kind)) {
|
|
92
|
+
if (n.host.contains(t) || t.contains(n.host) || n.kind === "modal") return;
|
|
93
|
+
n.requestClose("blur");
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
};
|
|
90
97
|
}
|
|
91
98
|
static of(t) {
|
|
92
99
|
let n = t;
|
|
93
|
-
return n[
|
|
100
|
+
return n[_] ??= new e(t);
|
|
94
101
|
}
|
|
95
102
|
push(e) {
|
|
96
103
|
this.remove(e, !1), this.stack.push(e), this._listen();
|
|
@@ -153,18 +160,18 @@ var g = Symbol.for("@voidable/ui:overlays"), _ = class e {
|
|
|
153
160
|
let e = this._doc;
|
|
154
161
|
e.removeEventListener("keydown", this._onKeydown), e.removeEventListener("pointerdown", this._onPointerdown, !0), e.removeEventListener("focusin", this._onFocusin), e.removeEventListener("scroll", this._schedule, { capture: !0 }), e.defaultView?.removeEventListener("resize", this._schedule), this._frame && e.defaultView?.cancelAnimationFrame(this._frame), this._frame = 0, this._resize?.disconnect(), this._resize = null, this._positioned.clear();
|
|
155
162
|
}
|
|
156
|
-
},
|
|
157
|
-
function
|
|
163
|
+
}, y = Symbol.for("@voidable/ui:overlay-controller");
|
|
164
|
+
function b(e) {
|
|
158
165
|
for (let t = e; t; t = t.parentNode) {
|
|
159
|
-
let e = t[
|
|
166
|
+
let e = t[y];
|
|
160
167
|
if (e) return e;
|
|
161
168
|
}
|
|
162
169
|
}
|
|
163
|
-
function
|
|
170
|
+
function x(e, t) {
|
|
164
171
|
let n = e.trim(), r = parseFloat(n);
|
|
165
172
|
return Number.isFinite(r) ? n.endsWith("rem") ? r * (parseFloat(getComputedStyle(t.ownerDocument.documentElement).fontSize) || 16) : n.endsWith("em") ? r * (parseFloat(getComputedStyle(t).fontSize) || 16) : r : 0;
|
|
166
173
|
}
|
|
167
|
-
function
|
|
174
|
+
function S(e, t, n, r, i, a, o = !1) {
|
|
168
175
|
let s = r === "top" || r === "bottom", c = a, l = (n) => n === "bottom" ? e.bottom + a : n === "top" ? e.top - a - t.height : n === "right" ? e.right + a : e.left - a - t.width, u = (e, r) => e === "bottom" || e === "top" ? r >= c && r + t.height <= n.height - c : r >= c && r + t.width <= n.width - c, d = {
|
|
169
176
|
top: "bottom",
|
|
170
177
|
bottom: "top",
|
|
@@ -191,7 +198,7 @@ function x(e, t, n, r, i, a, o = !1) {
|
|
|
191
198
|
align: y
|
|
192
199
|
};
|
|
193
200
|
}
|
|
194
|
-
var
|
|
201
|
+
var C = class {
|
|
195
202
|
constructor(e, t) {
|
|
196
203
|
this._active = !1, this._surface = null, this._opener = null, this._openerId = "", this._openReason = "api", this._closeReason = null, this._formClosing = !1, this._ariaTrigger = null, this._anchorName = "", this._anchorEl = null, this._mode = null, this._locked = !1, this._checkFrame = 0, this._reshowing = !1, this._hadFocus = !1, this._onCancel = (e) => {
|
|
197
204
|
e.preventDefault(), this._registry.top() === this && this.requestClose("escape");
|
|
@@ -214,8 +221,8 @@ var S = class {
|
|
|
214
221
|
this._reshowing || !this._active || !e || e.open || this._o.setOpen(!1);
|
|
215
222
|
}, this._onToggle = (e) => {
|
|
216
223
|
let t = this._surface;
|
|
217
|
-
e.newState !== "closed" || !this._active || !t || !t.isConnected ||
|
|
218
|
-
}, this.host = e, this.kind = t.kind, this._o = t, this._modal = t.kind === "modal", this._attr = t.attr ??
|
|
224
|
+
e.newState !== "closed" || !this._active || !t || !t.isConnected || p(t, !1) || this._o.setOpen(!1);
|
|
225
|
+
}, this.host = e, this.kind = t.kind, this._o = t, this._modal = t.kind === "modal", this._attr = t.attr ?? d, this._css = t.style ?? f, e[y] = this, e.addController(this);
|
|
219
226
|
}
|
|
220
227
|
get active() {
|
|
221
228
|
return this._active;
|
|
@@ -227,7 +234,7 @@ var S = class {
|
|
|
227
234
|
return this._anchorEl;
|
|
228
235
|
}
|
|
229
236
|
get _registry() {
|
|
230
|
-
return
|
|
237
|
+
return v.of(this.host.ownerDocument);
|
|
231
238
|
}
|
|
232
239
|
requestOpen(e = "api") {
|
|
233
240
|
this._o.isOpen() || (this._openReason = e, this._o.setOpen(!0));
|
|
@@ -235,12 +242,12 @@ var S = class {
|
|
|
235
242
|
requestClose(e) {
|
|
236
243
|
if (!this._o.isOpen()) return !0;
|
|
237
244
|
if ((e === "escape" || e === "outside" || e === "close-button") && this._o.closable && !this._o.closable()) return !1;
|
|
238
|
-
let
|
|
245
|
+
let t = new CustomEvent("void-close", {
|
|
239
246
|
bubbles: !1,
|
|
240
|
-
cancelable:
|
|
247
|
+
cancelable: n.has(e),
|
|
241
248
|
detail: { reason: e }
|
|
242
249
|
});
|
|
243
|
-
return this.host.dispatchEvent(
|
|
250
|
+
return this.host.dispatchEvent(t), t.defaultPrevented ? !1 : (this._closeReason = e, this._o.setOpen(!1), !0);
|
|
244
251
|
}
|
|
245
252
|
toggle(e = "trigger") {
|
|
246
253
|
this._o.isOpen() ? this.requestClose("trigger") : this.requestOpen(e);
|
|
@@ -281,15 +288,15 @@ var S = class {
|
|
|
281
288
|
let e = this._o.surface() ?? null;
|
|
282
289
|
e && e !== this._surface && this._adopt(e);
|
|
283
290
|
let t = this._o.isOpen();
|
|
284
|
-
t && e ? (this._active ?
|
|
291
|
+
t && e ? (this._active ? p(e, this._modal) || this._reshow(e) : this._activate(e), this._position()) : !t && this._active ? this._deactivate(!0) : !t && e && p(e, this._modal) && this._hide(e), this._syncTriggerAria();
|
|
285
292
|
}
|
|
286
293
|
_adopt(e) {
|
|
287
294
|
let t = this._surface;
|
|
288
|
-
t && (t.removeEventListener("cancel", this._onCancel), t.removeEventListener("close", this._onNativeClose), t.removeEventListener("submit", this._onSubmit), t.removeEventListener("toggle", this._onToggle), t.removeEventListener("focusin", this._onSurfaceFocus)), this._surface = e, e.id || this._attr(e, "id",
|
|
295
|
+
t && (t.removeEventListener("cancel", this._onCancel), t.removeEventListener("close", this._onNativeClose), t.removeEventListener("submit", this._onSubmit), t.removeEventListener("toggle", this._onToggle), t.removeEventListener("focusin", this._onSurfaceFocus)), this._surface = e, e.id || this._attr(e, "id", g(`${this.host.localName}-overlay`)), e.addEventListener("focusin", this._onSurfaceFocus), this._modal ? (e.addEventListener("cancel", this._onCancel), e.addEventListener("close", this._onNativeClose), e.addEventListener("submit", this._onSubmit)) : (u(e) || (this._attr(e, "popover", null), this._active || (e.hidden = !0)), e.addEventListener("toggle", this._onToggle));
|
|
289
296
|
}
|
|
290
297
|
_activate(e) {
|
|
291
|
-
let t = this.host.ownerDocument,
|
|
292
|
-
this._opener =
|
|
298
|
+
let t = this.host.ownerDocument, n = t.activeElement;
|
|
299
|
+
this._opener = r.has(this.kind) ? this._o.trigger?.() ?? null : n && n !== t.body ? n : null, this._openerId = this._opener?.id ?? "", this._active = !0, this._hadFocus = !1, this._registry.push(this), this._modal && (this._closeNonAncestors(), this._registry.lock(), this._locked = !0), this._show(e), this._position(), this._syncTriggerAria();
|
|
293
300
|
let i = this._openReason;
|
|
294
301
|
this._openReason = "api", this._focusInitial(e, i), this.host.dispatchEvent(new CustomEvent("void-open", {
|
|
295
302
|
bubbles: !1,
|
|
@@ -302,7 +309,7 @@ var S = class {
|
|
|
302
309
|
_show(t) {
|
|
303
310
|
if (this._modal) {
|
|
304
311
|
let e = t;
|
|
305
|
-
if (e.open && !
|
|
312
|
+
if (e.open && !p(e, !0)) {
|
|
306
313
|
this._reshowing = !0;
|
|
307
314
|
try {
|
|
308
315
|
e.close();
|
|
@@ -317,14 +324,14 @@ var S = class {
|
|
|
317
324
|
}
|
|
318
325
|
return;
|
|
319
326
|
}
|
|
320
|
-
if (
|
|
321
|
-
|
|
327
|
+
if (u(t)) try {
|
|
328
|
+
l(t, ":popover-open") || (t.showPopover(), this._watchFade(t), e.current?.restoreParkedFocus(t.ownerDocument));
|
|
322
329
|
} catch {}
|
|
323
330
|
else t.hidden = !1;
|
|
324
331
|
}
|
|
325
332
|
_watchFade(e) {
|
|
326
333
|
let t = (n) => {
|
|
327
|
-
if (n.target !== e || (e.removeEventListener("transitionend", t), e.removeEventListener("transitioncancel", t), !this._active || !
|
|
334
|
+
if (n.target !== e || (e.removeEventListener("transitionend", t), e.removeEventListener("transitioncancel", t), !this._active || !l(e, ":popover-open"))) return;
|
|
328
335
|
let r = e.ownerDocument.defaultView;
|
|
329
336
|
if (!r || r.getComputedStyle(e).opacity !== "0") return;
|
|
330
337
|
let i = e.getAttribute("data-void-position");
|
|
@@ -338,8 +345,8 @@ var S = class {
|
|
|
338
345
|
t.open && t.close();
|
|
339
346
|
return;
|
|
340
347
|
}
|
|
341
|
-
if (
|
|
342
|
-
|
|
348
|
+
if (u(e)) try {
|
|
349
|
+
l(e, ":popover-open") && e.hidePopover();
|
|
343
350
|
} catch {}
|
|
344
351
|
else e.hidden = !0;
|
|
345
352
|
}
|
|
@@ -372,16 +379,16 @@ var S = class {
|
|
|
372
379
|
let n = this._o.initialFocus?.(t);
|
|
373
380
|
if (n === !1) return;
|
|
374
381
|
let r = n ?? null;
|
|
375
|
-
r || (this._modal ? r = this._defaultModalFocus(e) : this.kind === "dialog" && t !== "api" && t !== "hover" && (r = e.querySelector("[autofocus]") ??
|
|
382
|
+
r || (this._modal ? r = this._defaultModalFocus(e) : this.kind === "dialog" && t !== "api" && t !== "hover" && (r = e.querySelector("[autofocus]") ?? s(e)[0] ?? this._focusableSurface(e))), r && r.isConnected && r.focus({ preventScroll: !this._modal });
|
|
376
383
|
}
|
|
377
384
|
_defaultModalFocus(e) {
|
|
378
385
|
let t = e.getRootNode() === this.host.shadowRoot, n = t ? [this.host, e] : [e];
|
|
379
386
|
for (let e of n) {
|
|
380
|
-
let t = Array.from(e.querySelectorAll("[autofocus]")).find((e) =>
|
|
387
|
+
let t = Array.from(e.querySelectorAll("[autofocus]")).find((e) => c(e));
|
|
381
388
|
if (t) return t;
|
|
382
389
|
}
|
|
383
|
-
let r = t ? this.host : e.querySelector("[data-void-projection]"), i = r ?
|
|
384
|
-
return i.length ? i[0] :
|
|
390
|
+
let r = t ? this.host : e.querySelector("[data-void-projection]"), i = r ? s(r) : [];
|
|
391
|
+
return i.length ? i[0] : s(e)[0] ?? this._focusableSurface(e);
|
|
385
392
|
}
|
|
386
393
|
_focusableSurface(e) {
|
|
387
394
|
return e.hasAttribute("tabindex") || this._attr(e, "tabindex", "-1"), e;
|
|
@@ -392,21 +399,21 @@ var S = class {
|
|
|
392
399
|
}
|
|
393
400
|
_focusReturnTarget() {
|
|
394
401
|
let e = this.host.ownerDocument, t = this._opener;
|
|
395
|
-
if (t &&
|
|
402
|
+
if (t && c(t)) return t;
|
|
396
403
|
if (this._openerId) {
|
|
397
404
|
let t = e.getElementById(this._openerId);
|
|
398
|
-
if (t &&
|
|
405
|
+
if (t && c(t)) return t;
|
|
399
406
|
}
|
|
400
|
-
if (t?.isConnected) for (let e =
|
|
407
|
+
if (t?.isConnected) for (let e = b(t); e; e = b(e.host.parentNode)) {
|
|
401
408
|
if (e === this) continue;
|
|
402
409
|
let t = e._o.trigger?.();
|
|
403
|
-
if (t &&
|
|
404
|
-
if (e._active && e._surface) return
|
|
410
|
+
if (t && c(t)) return t;
|
|
411
|
+
if (e._active && e._surface) return s(e._surface)[0] ?? e._focusableSurface(e._surface);
|
|
405
412
|
}
|
|
406
|
-
let
|
|
407
|
-
if (
|
|
408
|
-
let i = this._registry.top((e) => e !== this && !
|
|
409
|
-
return i?._surface ?
|
|
413
|
+
let n = this._o.trigger?.();
|
|
414
|
+
if (n && c(n)) return n;
|
|
415
|
+
let i = this._registry.top((e) => e !== this && !r.has(e.kind));
|
|
416
|
+
return i?._surface ? s(i._surface)[0] ?? i._focusableSurface(i._surface) : null;
|
|
410
417
|
}
|
|
411
418
|
_syncTriggerAria() {
|
|
412
419
|
if (!this._o.haspopup) return;
|
|
@@ -431,7 +438,7 @@ var S = class {
|
|
|
431
438
|
let i = `${Math.round(t.getBoundingClientRect().width)}px`;
|
|
432
439
|
this._css(e, "--void-overlay-anchor-width", i);
|
|
433
440
|
let a = this.host.ownerDocument;
|
|
434
|
-
this._mode === null && (this._mode =
|
|
441
|
+
this._mode === null && (this._mode = h(a) && u(e) ? "anchor" : "fixed"), this._mode === "anchor" ? (this._attr(e, "data-void-position", "anchor"), this._registry.unposition(this), !this._checkFrame && a.defaultView && (this._checkFrame = a.defaultView.requestAnimationFrame(() => {
|
|
435
442
|
this._checkFrame = 0, this._active && this._mode === "anchor" && this._overflows(e) && (this._mode = "fixed", this._position());
|
|
436
443
|
}))) : (this._attr(e, "data-void-position", "fixed"), this._placeFixed(), this._registry.position(this));
|
|
437
444
|
}
|
|
@@ -440,7 +447,7 @@ var S = class {
|
|
|
440
447
|
return t.left < -.5 || t.top < -.5 || t.right > r + .5 || t.bottom > i + .5;
|
|
441
448
|
}
|
|
442
449
|
_linkAnchor(e, t) {
|
|
443
|
-
this._anchorName ||= `--${
|
|
450
|
+
this._anchorName ||= `--${g("void-anchor")}`;
|
|
444
451
|
let n = this._anchorName;
|
|
445
452
|
this._anchorEl && this._anchorEl !== e && this._clearAnchor(this._anchorEl), this._anchorEl = e, e === this.host && this._o.hostStyle ? this._o.hostStyle("anchor-name", n) : e.style && this._css(e, "anchor-name", n), this._css(t, "position-anchor", n);
|
|
446
453
|
}
|
|
@@ -453,7 +460,7 @@ var S = class {
|
|
|
453
460
|
let { side: n, align: r } = this._o.placement?.() ?? {
|
|
454
461
|
side: "bottom",
|
|
455
462
|
align: "start"
|
|
456
|
-
}, i = e.ownerDocument.documentElement, a =
|
|
463
|
+
}, i = e.ownerDocument.documentElement, a = x(getComputedStyle(e).getPropertyValue("--void-overlay-gap"), e), o = getComputedStyle(t).direction === "rtl", s = S(t.getBoundingClientRect(), {
|
|
457
464
|
width: e.offsetWidth,
|
|
458
465
|
height: e.offsetHeight
|
|
459
466
|
}, {
|
|
@@ -464,4 +471,4 @@ var S = class {
|
|
|
464
471
|
}
|
|
465
472
|
};
|
|
466
473
|
//#endregion
|
|
467
|
-
export {
|
|
474
|
+
export { C as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/keymaps/pickers.ts
|
|
2
|
+
var e = {
|
|
3
|
+
next: ["ArrowDown"],
|
|
4
|
+
previous: ["ArrowUp"],
|
|
5
|
+
open: ["Alt+ArrowDown"],
|
|
6
|
+
activate: ["Enter"],
|
|
7
|
+
close: ["Escape", "Alt+ArrowUp"]
|
|
8
|
+
}, t = {
|
|
9
|
+
next: ["ArrowDown"],
|
|
10
|
+
previous: ["ArrowUp"],
|
|
11
|
+
first: ["Home"],
|
|
12
|
+
last: ["End"],
|
|
13
|
+
nextPage: ["PageDown"],
|
|
14
|
+
previousPage: ["PageUp"],
|
|
15
|
+
activate: ["Enter", "Space"],
|
|
16
|
+
typeahead: ["Printable"],
|
|
17
|
+
close: ["Escape", "Alt+ArrowUp"]
|
|
18
|
+
}, n = {
|
|
19
|
+
previousDay: ["ArrowInlineStart"],
|
|
20
|
+
nextDay: ["ArrowInlineEnd"],
|
|
21
|
+
previousWeek: ["ArrowUp"],
|
|
22
|
+
nextWeek: ["ArrowDown"],
|
|
23
|
+
startOfWeek: ["Home"],
|
|
24
|
+
endOfWeek: ["End"],
|
|
25
|
+
previousMonth: ["PageUp"],
|
|
26
|
+
nextMonth: ["PageDown"],
|
|
27
|
+
previousYear: ["Shift+PageUp"],
|
|
28
|
+
nextYear: ["Shift+PageDown"],
|
|
29
|
+
activate: ["Enter", "Space"]
|
|
30
|
+
}, r = {
|
|
31
|
+
activate: ["Enter", "Space"],
|
|
32
|
+
open: ["ArrowDown"],
|
|
33
|
+
close: ["Escape"]
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { t as i, e as n, r, n as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { PartsController } from '../parts.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
/**
|
|
4
5
|
* Collapsible section container for FAQs, settings panels, and long-form content organized into expandable items.
|
|
5
6
|
*
|
|
@@ -26,6 +27,12 @@ export declare class VoidAccordion extends VoidElement {
|
|
|
26
27
|
* (`outside`). Does not bubble.
|
|
27
28
|
*/
|
|
28
29
|
export declare class VoidAccordionItem extends VoidElement {
|
|
30
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
31
|
+
keys: KeyOverrides | null;
|
|
32
|
+
/** @internal The actions of this element and their default keys. */
|
|
33
|
+
static readonly keyMap: {
|
|
34
|
+
activate: string[];
|
|
35
|
+
};
|
|
29
36
|
/**
|
|
30
37
|
* Whether the content is shown. Add the attribute to start open; it is updated when the user toggles
|
|
31
38
|
* the item.
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { n } from "../
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { t as i } from "../chunks/activation-B8aBarKd.js";
|
|
5
|
+
import { n as a } from "../chunks/parts-DI_3VpSy.js";
|
|
6
|
+
import { t as o } from "../chunks/disclosure-Bj_49GcC.js";
|
|
7
|
+
import { property as s } from "lit/decorators.js";
|
|
6
8
|
//#region src/components/accordion.ts
|
|
7
|
-
var
|
|
9
|
+
var c = class extends e {
|
|
8
10
|
constructor(...e) {
|
|
9
11
|
super(...e), this.multiple = !1;
|
|
10
12
|
}
|
|
11
13
|
};
|
|
12
|
-
t([
|
|
14
|
+
t([s({
|
|
13
15
|
type: Boolean,
|
|
14
16
|
reflect: !0
|
|
15
|
-
})],
|
|
16
|
-
var
|
|
17
|
+
})], c.prototype, "multiple", void 0), customElements.get("void-accordion") || customElements.define("void-accordion", c);
|
|
18
|
+
var l = class t extends e {
|
|
17
19
|
constructor(...e) {
|
|
18
|
-
super(...e), this.open = !1, this._parts = new
|
|
20
|
+
super(...e), this.keys = null, this.open = !1, this._parts = new a(this, {
|
|
19
21
|
tags: ["void-accordion-trigger", "void-accordion-content"],
|
|
20
22
|
onChange: () => this._wire()
|
|
21
|
-
}), this._closed = new
|
|
23
|
+
}), this._closed = new o(this, this._parts), this._onBeforeMatch = (e) => {
|
|
22
24
|
this.open || e.target !== this._parts.one("void-accordion-content") || this._open("find");
|
|
23
25
|
}, this._onClick = (e) => {
|
|
24
26
|
this._fromTrigger(e) && (e.preventDefault(), this._toggle("trigger"));
|
|
25
27
|
}, this._onKeydown = (e) => {
|
|
26
|
-
|
|
28
|
+
n(this, e) !== "activate" || !this._fromTrigger(e) || e.target.closest("a, button, input, select, textarea") || (e.preventDefault(), this._toggle("keyboard"));
|
|
27
29
|
};
|
|
28
30
|
}
|
|
31
|
+
static {
|
|
32
|
+
this.keyMap = i;
|
|
33
|
+
}
|
|
29
34
|
connectedCallback() {
|
|
30
35
|
super.connectedCallback(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeydown), this.addEventListener("beforematch", this._onBeforeMatch);
|
|
31
36
|
}
|
|
@@ -53,7 +58,7 @@ var o = class t extends e {
|
|
|
53
58
|
_open(e) {
|
|
54
59
|
this.open = !0;
|
|
55
60
|
let n = this.parentElement;
|
|
56
|
-
if (n instanceof
|
|
61
|
+
if (n instanceof c && !n.multiple) for (let e of Array.from(n.children)) e !== this && e instanceof t && e.open && (e.open = !1, e.dispatchEvent(new CustomEvent("void-close", {
|
|
57
62
|
bubbles: !1,
|
|
58
63
|
detail: { reason: "outside" }
|
|
59
64
|
})));
|
|
@@ -63,9 +68,12 @@ var o = class t extends e {
|
|
|
63
68
|
}));
|
|
64
69
|
}
|
|
65
70
|
};
|
|
66
|
-
t([
|
|
71
|
+
t([s({
|
|
72
|
+
attribute: "keys",
|
|
73
|
+
converter: r
|
|
74
|
+
})], l.prototype, "keys", void 0), t([s({
|
|
67
75
|
type: Boolean,
|
|
68
76
|
reflect: !0
|
|
69
|
-
})],
|
|
77
|
+
})], l.prototype, "open", void 0), customElements.get("void-accordion-item") || customElements.define("void-accordion-item", l);
|
|
70
78
|
//#endregion
|
|
71
|
-
export {
|
|
79
|
+
export { c as VoidAccordion, l as VoidAccordionItem };
|
|
@@ -65,8 +65,9 @@ export declare class VoidActionInput extends VoidActionInput_base {
|
|
|
65
65
|
* or `arrow-right`. Any other value draws the search icon.
|
|
66
66
|
*/
|
|
67
67
|
icon: string;
|
|
68
|
-
/** Accessible name of the button and its tooltip. Defaults to `Action
|
|
68
|
+
/** Accessible name of the button and its tooltip. Defaults to the `actionInput.action` message (English: `Action`); say what it does (`Copy link`). */
|
|
69
69
|
actionLabel: string;
|
|
70
|
+
private get _action();
|
|
70
71
|
/** Which side of the field the button sits on, in the reading direction: `end` (default) or `start`. */
|
|
71
72
|
iconSide: 'start' | 'end';
|
|
72
73
|
/** Where the button's tooltip appears: `top` (default), `bottom`, `left` or `right`. */
|