@voidable/ui 0.11.0 → 0.12.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/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,5 +1,6 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { KeyboardActivation } from '../keyboard-activation.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
import { PartsController } from '../parts.js';
|
|
4
5
|
/**
|
|
5
6
|
* Previous-slide control of a `<void-carousel>`: a button the theme draws as an arrow over the slides. Write it
|
|
@@ -7,6 +8,12 @@ import { PartsController } from '../parts.js';
|
|
|
7
8
|
* It is aria-disabled on the first slide unless the carousel has `loop`.
|
|
8
9
|
*/
|
|
9
10
|
export declare class VoidCarouselPrevious extends VoidElement {
|
|
11
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
12
|
+
keys: KeyOverrides | null;
|
|
13
|
+
/** @internal The actions of this element and their default keys. */
|
|
14
|
+
static readonly keyMap: {
|
|
15
|
+
activate: string[];
|
|
16
|
+
};
|
|
10
17
|
/** Enter and Space fire a real `click`, as on a native button. */
|
|
11
18
|
protected readonly _activation: KeyboardActivation;
|
|
12
19
|
connectedCallback(): void;
|
|
@@ -17,6 +24,12 @@ export declare class VoidCarouselPrevious extends VoidElement {
|
|
|
17
24
|
* aria-disabled on the last slide unless the carousel has `loop`.
|
|
18
25
|
*/
|
|
19
26
|
export declare class VoidCarouselNext extends VoidElement {
|
|
27
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
28
|
+
keys: KeyOverrides | null;
|
|
29
|
+
/** @internal The actions of this element and their default keys. */
|
|
30
|
+
static readonly keyMap: {
|
|
31
|
+
activate: string[];
|
|
32
|
+
};
|
|
20
33
|
/** Enter and Space fire a real `click`, as on a native button. */
|
|
21
34
|
protected readonly _activation: KeyboardActivation;
|
|
22
35
|
connectedCallback(): void;
|
|
@@ -34,6 +47,13 @@ export declare class VoidCarouselNext extends VoidElement {
|
|
|
34
47
|
* `value` and `index` are both the new slide's index.
|
|
35
48
|
*/
|
|
36
49
|
export declare class VoidCarousel extends VoidElement {
|
|
50
|
+
/** Key bindings for this element's actions, as JSON (`{"next":["ArrowRight"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
51
|
+
keys: KeyOverrides | null;
|
|
52
|
+
/** @internal The actions of this element and their default keys (horizontal; a vertical carousel starts with ArrowDown and ArrowUp). */
|
|
53
|
+
static readonly keyMap: {
|
|
54
|
+
next: string[];
|
|
55
|
+
previous: string[];
|
|
56
|
+
};
|
|
37
57
|
/**
|
|
38
58
|
* Zero-based index of the slide being shown. Set it to jump to a slide; the arrows, indicators and
|
|
39
59
|
* arrow keys update it and fire `void-change`.
|
|
@@ -63,6 +83,8 @@ export declare class VoidCarousel extends VoidElement {
|
|
|
63
83
|
/** Watches the dots, which the parts controller does not know: a morph that empties the indicators gets them back. */
|
|
64
84
|
private _dots;
|
|
65
85
|
protected readonly _parts: PartsController;
|
|
86
|
+
/** The name this wrote on the indicators, so one the author wrote is told apart from it. */
|
|
87
|
+
private _indicatorsName;
|
|
66
88
|
/** The slides, in document order. */
|
|
67
89
|
private get _slides();
|
|
68
90
|
/** Wires the slides, the arrows and the dots to the current slide. Idempotent. */
|
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { t as i } from "../chunks/keyboard-activation-BfEyoaMT.js";
|
|
5
|
+
import { t as a } from "../chunks/activation-B8aBarKd.js";
|
|
6
|
+
import { msg as o } from "../messages.js";
|
|
7
|
+
import { n as s } from "../chunks/parts-DI_3VpSy.js";
|
|
8
|
+
import { n as c, t as l } from "../chunks/carousel-C9u0bg5l.js";
|
|
9
|
+
import { property as u } from "lit/decorators.js";
|
|
7
10
|
//#region src/components/carousel.ts
|
|
8
|
-
var
|
|
11
|
+
var d = class extends e {
|
|
9
12
|
constructor(...e) {
|
|
10
|
-
super(...e), this._activation = new
|
|
13
|
+
super(...e), this.keys = null, this._activation = new i(this, { disabled: () => this.getAttribute("aria-disabled") === "true" });
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.keyMap = a;
|
|
11
17
|
}
|
|
12
18
|
connectedCallback() {
|
|
13
19
|
super.connectedCallback(), this.setHostAttribute("role", "button"), this.setHostAttribute("tabindex", "0");
|
|
14
20
|
}
|
|
15
21
|
};
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
t([u({
|
|
23
|
+
attribute: "keys",
|
|
24
|
+
converter: r
|
|
25
|
+
})], d.prototype, "keys", void 0), customElements.get("void-carousel-previous") || customElements.define("void-carousel-previous", d);
|
|
26
|
+
var f = class extends e {
|
|
18
27
|
constructor(...e) {
|
|
19
|
-
super(...e), this._activation = new
|
|
28
|
+
super(...e), this.keys = null, this._activation = new i(this, { disabled: () => this.getAttribute("aria-disabled") === "true" });
|
|
29
|
+
}
|
|
30
|
+
static {
|
|
31
|
+
this.keyMap = a;
|
|
20
32
|
}
|
|
21
33
|
connectedCallback() {
|
|
22
34
|
super.connectedCallback(), this.setHostAttribute("role", "button"), this.setHostAttribute("tabindex", "0");
|
|
23
35
|
}
|
|
24
36
|
};
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
t([u({
|
|
38
|
+
attribute: "keys",
|
|
39
|
+
converter: r
|
|
40
|
+
})], f.prototype, "keys", void 0), customElements.get("void-carousel-next") || customElements.define("void-carousel-next", f);
|
|
41
|
+
var p = class extends e {
|
|
27
42
|
constructor(...e) {
|
|
28
|
-
super(...e), this.index = 0, this.loop = !1, this.autoplay = !1, this.interval = 5e3, this.size = "md", this.orientation = "horizontal", this._autoplayTimer = null, this._labels = /* @__PURE__ */ new WeakMap(), this._dots = null, this._parts = new
|
|
43
|
+
super(...e), this.keys = null, this.index = 0, this.loop = !1, this.autoplay = !1, this.interval = 5e3, this.size = "md", this.orientation = "horizontal", this._autoplayTimer = null, this._labels = /* @__PURE__ */ new WeakMap(), this._dots = null, this._parts = new s(this, {
|
|
29
44
|
tags: [
|
|
30
45
|
"void-carousel-content",
|
|
31
46
|
"void-carousel-item",
|
|
@@ -34,7 +49,7 @@ var c = class extends e {
|
|
|
34
49
|
"void-carousel-indicators"
|
|
35
50
|
],
|
|
36
51
|
onChange: () => this._wire()
|
|
37
|
-
}), this._prev = () => {
|
|
52
|
+
}), this._indicatorsName = null, this._prev = () => {
|
|
38
53
|
this._goTo(this.index - 1);
|
|
39
54
|
}, this._next = () => {
|
|
40
55
|
this._goTo(this.index + 1);
|
|
@@ -46,10 +61,13 @@ var c = class extends e {
|
|
|
46
61
|
}, this._onMouseLeave = () => {
|
|
47
62
|
this.autoplay && this._startAutoplay();
|
|
48
63
|
}, this._onKeydown = (e) => {
|
|
49
|
-
let t =
|
|
50
|
-
|
|
64
|
+
let t = n(this, e, this.orientation === "horizontal" ? l : c);
|
|
65
|
+
t === "previous" ? (e.preventDefault(), this._prev()) : t === "next" && (e.preventDefault(), this._next());
|
|
51
66
|
};
|
|
52
67
|
}
|
|
68
|
+
static {
|
|
69
|
+
this.keyMap = l;
|
|
70
|
+
}
|
|
53
71
|
get _slides() {
|
|
54
72
|
return this._parts.all("void-carousel-item");
|
|
55
73
|
}
|
|
@@ -57,27 +75,35 @@ var c = class extends e {
|
|
|
57
75
|
let e = this._slides, t = e.length, n = this._parts.one("void-carousel-content");
|
|
58
76
|
n && this._parts.set(n, "aria-live", this.autoplay ? "off" : "polite"), e.forEach((e, n) => {
|
|
59
77
|
this._parts.provide(e, "role", "group"), this._parts.provide(e, "aria-roledescription", "slide");
|
|
60
|
-
let r =
|
|
78
|
+
let r = o(this, "carousel.slide", {
|
|
79
|
+
index: n + 1,
|
|
80
|
+
count: t
|
|
81
|
+
}), i = e.getAttribute("aria-label");
|
|
61
82
|
(i === null || i === this._labels.get(e)) && (this._parts.set(e, "aria-label", r), this._labels.set(e, r)), this._parts.set(e, "active", n === this.index);
|
|
62
83
|
});
|
|
63
|
-
let r = !this.loop && this.index === 0, i = !this.loop && this.index === t - 1, a = this._parts.one("void-carousel-previous"),
|
|
64
|
-
a && this._parts.set(a, "aria-disabled", r ? "true" : null),
|
|
84
|
+
let r = !this.loop && this.index === 0, i = !this.loop && this.index === t - 1, a = this._parts.one("void-carousel-previous"), s = this._parts.one("void-carousel-next");
|
|
85
|
+
a && this._parts.set(a, "aria-disabled", r ? "true" : null), s && this._parts.set(s, "aria-disabled", i ? "true" : null), this._syncDots(t), this.setHostStyle("--void-carousel-offset", String(this.index));
|
|
65
86
|
}
|
|
66
87
|
_syncDots(e) {
|
|
67
88
|
let t = this._parts.one("void-carousel-indicators");
|
|
68
89
|
if (!t) return;
|
|
69
|
-
this._parts.provide(t, "role", "tablist")
|
|
70
|
-
let n =
|
|
71
|
-
|
|
72
|
-
|
|
90
|
+
this._parts.provide(t, "role", "tablist");
|
|
91
|
+
let n = o(this, "carousel.indicators"), r = t.getAttribute("aria-label");
|
|
92
|
+
(r === null || r === this._indicatorsName) && (this._parts.set(t, "aria-label", n), this._indicatorsName = n);
|
|
93
|
+
let i = Array.from(t.children).filter((e) => e.localName === "button");
|
|
94
|
+
for (; i.length > e;) i.pop().remove();
|
|
95
|
+
for (; i.length < e;) {
|
|
73
96
|
let e = document.createElement("button");
|
|
74
|
-
e.type = "button", e.setAttribute("role", "tab"), t.appendChild(e),
|
|
97
|
+
e.type = "button", e.setAttribute("role", "tab"), t.appendChild(e), i.push(e);
|
|
75
98
|
}
|
|
76
|
-
|
|
77
|
-
let
|
|
78
|
-
|
|
79
|
-
let
|
|
80
|
-
|
|
99
|
+
i.forEach((t, n) => {
|
|
100
|
+
let r = n === this.index;
|
|
101
|
+
t.getAttribute("aria-selected") !== String(r) && t.setAttribute("aria-selected", String(r)), t.hasAttribute("active") !== r && t.toggleAttribute("active", r);
|
|
102
|
+
let i = o(this, "carousel.goTo", {
|
|
103
|
+
index: n + 1,
|
|
104
|
+
count: e
|
|
105
|
+
});
|
|
106
|
+
t.getAttribute("aria-label") !== i && t.setAttribute("aria-label", i);
|
|
81
107
|
});
|
|
82
108
|
}
|
|
83
109
|
connectedCallback() {
|
|
@@ -117,21 +143,24 @@ var c = class extends e {
|
|
|
117
143
|
this._autoplayTimer &&= (clearInterval(this._autoplayTimer), null);
|
|
118
144
|
}
|
|
119
145
|
};
|
|
120
|
-
t([
|
|
146
|
+
t([u({
|
|
147
|
+
attribute: "keys",
|
|
148
|
+
converter: r
|
|
149
|
+
})], p.prototype, "keys", void 0), t([u({
|
|
121
150
|
type: Number,
|
|
122
151
|
reflect: !0
|
|
123
|
-
})],
|
|
152
|
+
})], p.prototype, "index", void 0), t([u({
|
|
124
153
|
type: Boolean,
|
|
125
154
|
reflect: !0
|
|
126
|
-
})],
|
|
155
|
+
})], p.prototype, "loop", void 0), t([u({
|
|
127
156
|
type: Boolean,
|
|
128
157
|
reflect: !0
|
|
129
|
-
})],
|
|
158
|
+
})], p.prototype, "autoplay", void 0), t([u({ type: Number })], p.prototype, "interval", void 0), t([u({
|
|
130
159
|
type: String,
|
|
131
160
|
reflect: !0
|
|
132
|
-
})],
|
|
161
|
+
})], p.prototype, "size", void 0), t([u({
|
|
133
162
|
type: String,
|
|
134
163
|
reflect: !0
|
|
135
|
-
})],
|
|
164
|
+
})], p.prototype, "orientation", void 0), customElements.get("void-carousel") || customElements.define("void-carousel", p);
|
|
136
165
|
//#endregion
|
|
137
|
-
export {
|
|
166
|
+
export { p as VoidCarousel, f as VoidCarouselNext, d as VoidCarouselPrevious };
|
|
@@ -38,8 +38,8 @@ export declare function normalizeSegments<S extends {
|
|
|
38
38
|
name: string;
|
|
39
39
|
value: number;
|
|
40
40
|
}>(raw: unknown): S[] | null;
|
|
41
|
-
/** The
|
|
42
|
-
export declare function chartLocale(el: Element): string
|
|
41
|
+
/** The locale the text of `el` is in: its closest `lang` (the page's included), else `en-US`. */
|
|
42
|
+
export declare function chartLocale(el: Element): string;
|
|
43
43
|
/** Numbers the way a reader of this element's language expects them, with their full precision (up to three decimals). */
|
|
44
44
|
export declare function tableNumbers(el: Element): {
|
|
45
45
|
number: (v: number) => string;
|
|
@@ -1,14 +1,15 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { msg as n } from "../messages.js";
|
|
4
|
+
import { n as r } from "../chunks/form-control-fL-Hhy91.js";
|
|
5
|
+
import { t as i } from "../chunks/projection-oPe6ipjL.js";
|
|
6
|
+
import { n as a } from "../chunks/value-list-CH6GjYXM.js";
|
|
7
|
+
import { html as o, nothing as s } from "lit";
|
|
8
|
+
import { property as c } from "lit/decorators.js";
|
|
8
9
|
//#region src/components/checkbox-group.ts
|
|
9
|
-
var
|
|
10
|
+
var l = (e) => e.value ?? e.getAttribute("value") ?? "on", u = class extends r(e) {
|
|
10
11
|
constructor(...e) {
|
|
11
|
-
super(...e), this.label = "", this.orientation = "vertical", this.name = "", this.required = !1, this.disabled = !1, this._projection = new
|
|
12
|
+
super(...e), this.label = "", this.orientation = "vertical", this.name = "", this.required = !1, this.disabled = !1, this._projection = new i(this, {
|
|
12
13
|
regions: [{
|
|
13
14
|
name: "items",
|
|
14
15
|
target: () => this.querySelector(":scope > .void-checkbox-group-items")
|
|
@@ -27,13 +28,13 @@ var c = (e) => e.value ?? e.getAttribute("value") ?? "on", l = class extends n(e
|
|
|
27
28
|
}
|
|
28
29
|
get value() {
|
|
29
30
|
let e = this._boxes();
|
|
30
|
-
return this._wanted && e.length === 0 ? [...this._wanted] : e.filter((e) => e.checked).map(
|
|
31
|
+
return this._wanted && e.length === 0 ? [...this._wanted] : e.filter((e) => e.checked).map(l);
|
|
31
32
|
}
|
|
32
33
|
set value(e) {
|
|
33
34
|
let t = this._boxes(), n = Array.isArray(e) ? e : [];
|
|
34
35
|
this._wanted = t.length === 0 ? [...n] : null;
|
|
35
36
|
let r = new Set(n);
|
|
36
|
-
for (let e of t) e.checked = r.has(
|
|
37
|
+
for (let e of t) e.checked = r.has(l(e));
|
|
37
38
|
this.requestUpdate("value", void 0), this.formSync();
|
|
38
39
|
}
|
|
39
40
|
willUpdate(e) {
|
|
@@ -46,7 +47,7 @@ var c = (e) => e.value ?? e.getAttribute("value") ?? "on", l = class extends n(e
|
|
|
46
47
|
}
|
|
47
48
|
formSyncNative() {
|
|
48
49
|
let e = Array.from(this.querySelectorAll("void-checkbox")), t = this.required && this.value.length === 0 ? e.find((e) => !e.formDisabled) : void 0;
|
|
49
|
-
for (let
|
|
50
|
+
for (let r of e) r.querySelector("input[type=\"checkbox\"]")?.setCustomValidity(r === t ? n(this, "checkboxGroup.required") : "");
|
|
50
51
|
}
|
|
51
52
|
connectedCallback() {
|
|
52
53
|
super.connectedCallback(), this.setHostAttribute("role", "group"), this.label && this.setHostAttribute("aria-label", this.label), this.addEventListener("void-change", this._handleChildChange);
|
|
@@ -73,30 +74,30 @@ var c = (e) => e.value ?? e.getAttribute("value") ?? "on", l = class extends n(e
|
|
|
73
74
|
if (this.name) for (let e of this._boxes()) e.name = this.name;
|
|
74
75
|
}
|
|
75
76
|
render() {
|
|
76
|
-
return
|
|
77
|
-
${this.label ?
|
|
77
|
+
return o`
|
|
78
|
+
${this.label ? o`<span class="void-checkbox-group-label">${this.label}</span>` : s}
|
|
78
79
|
<div class="void-checkbox-group-items"></div>
|
|
79
80
|
`;
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
|
-
t([
|
|
83
|
+
t([c({
|
|
83
84
|
type: String,
|
|
84
85
|
reflect: !0
|
|
85
|
-
})],
|
|
86
|
+
})], u.prototype, "label", void 0), t([c({
|
|
86
87
|
type: String,
|
|
87
88
|
reflect: !0
|
|
88
|
-
})],
|
|
89
|
+
})], u.prototype, "orientation", void 0), t([c({
|
|
89
90
|
type: String,
|
|
90
91
|
reflect: !0
|
|
91
|
-
})],
|
|
92
|
+
})], u.prototype, "name", void 0), t([c({
|
|
92
93
|
type: Boolean,
|
|
93
94
|
reflect: !0
|
|
94
|
-
})],
|
|
95
|
+
})], u.prototype, "required", void 0), t([c({
|
|
95
96
|
type: Boolean,
|
|
96
97
|
reflect: !0
|
|
97
|
-
})],
|
|
98
|
-
converter:
|
|
98
|
+
})], u.prototype, "disabled", void 0), t([c({
|
|
99
|
+
converter: a,
|
|
99
100
|
reflect: !0
|
|
100
|
-
})],
|
|
101
|
+
})], u.prototype, "value", null), customElements.get("void-checkbox-group") || customElements.define("void-checkbox-group", u);
|
|
101
102
|
//#endregion
|
|
102
|
-
export {
|
|
103
|
+
export { u as VoidCheckboxGroup };
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { KeyboardActivation } from '../keyboard-activation.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
import { ProjectionController } from '../projection.js';
|
|
4
5
|
declare const VoidCheckbox_base: (new (...args: any[]) => import('../form-control.js').VoidNativeFormControl) & typeof VoidElement;
|
|
5
6
|
/** Binary or indeterminate selection for form fields, data table row selection, and toggle-able settings. */
|
|
6
7
|
export declare class VoidCheckbox extends VoidCheckbox_base {
|
|
8
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Space"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
9
|
+
keys: KeyOverrides | null;
|
|
10
|
+
/** @internal The actions of this element and their default keys. */
|
|
11
|
+
static readonly keyMap: {
|
|
12
|
+
activate: string[];
|
|
13
|
+
};
|
|
7
14
|
/** Enter and Space fire a real `click`, as on a native button. */
|
|
8
15
|
protected readonly _activation: KeyboardActivation;
|
|
9
16
|
/**
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { keysConverter as n } from "../keys.js";
|
|
4
|
+
import { t as r } from "../chunks/keyboard-activation-BfEyoaMT.js";
|
|
5
|
+
import { n as i } from "../chunks/activation-B8aBarKd.js";
|
|
6
|
+
import { n as a } from "../chunks/form-control-fL-Hhy91.js";
|
|
7
|
+
import { t as o } from "../chunks/projection-oPe6ipjL.js";
|
|
8
|
+
import { html as s, nothing as c } from "lit";
|
|
9
|
+
import { property as l } from "lit/decorators.js";
|
|
8
10
|
//#region src/components/checkbox.ts
|
|
9
|
-
var
|
|
11
|
+
var u = class extends a(e) {
|
|
10
12
|
constructor(...e) {
|
|
11
|
-
super(...e), this._activation = new
|
|
12
|
-
enter: !1,
|
|
13
|
-
disabled: () => this.formDisabled
|
|
14
|
-
}), this.checked = !1, this.disabled = !1, this.indeterminate = !1, this.name = "", this.value = "on", this.required = !1, this.color = "default", this.size = "md", this._projection = new i(this, { regions: [{
|
|
13
|
+
super(...e), this.keys = null, this._activation = new r(this, { disabled: () => this.formDisabled }), this.checked = !1, this.disabled = !1, this.indeterminate = !1, this.name = "", this.value = "on", this.required = !1, this.color = "default", this.size = "md", this._projection = new o(this, { regions: [{
|
|
15
14
|
name: "label",
|
|
16
15
|
target: "after"
|
|
17
16
|
}] }), this._onNativeFocus = () => {
|
|
@@ -38,6 +37,9 @@ var c = class extends r(e) {
|
|
|
38
37
|
}));
|
|
39
38
|
};
|
|
40
39
|
}
|
|
40
|
+
static {
|
|
41
|
+
this.keyMap = i;
|
|
42
|
+
}
|
|
41
43
|
connectedCallback() {
|
|
42
44
|
super.connectedCallback(), this.setHostAttribute("role", "checkbox"), this.setHostAttribute("tabindex", "0"), this.setHostAttribute("aria-checked", String(this.checked)), this.addEventListener("click", this._handleClick);
|
|
43
45
|
}
|
|
@@ -51,11 +53,11 @@ var c = class extends r(e) {
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
render() {
|
|
54
|
-
return
|
|
55
|
-
<input type="checkbox" .checked=${this.checked} .indeterminate=${this.indeterminate} ?disabled=${this.formDisabled} ?required=${this.required} name=${this.name} value=${this.value} form=${this.formAttr ??
|
|
56
|
+
return s`
|
|
57
|
+
<input type="checkbox" .checked=${this.checked} .indeterminate=${this.indeterminate} ?disabled=${this.formDisabled} ?required=${this.required} name=${this.name} value=${this.value} form=${this.formAttr ?? c} tabindex="-1" aria-hidden="true" inert @invalid=${this._onNativeInvalid} @focus=${this._onNativeFocus} />
|
|
56
58
|
<span class="void-checkbox-box">
|
|
57
|
-
${this.checked ?
|
|
58
|
-
${this.indeterminate && !this.checked ?
|
|
59
|
+
${this.checked ? s`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/></svg>` : ""}
|
|
60
|
+
${this.indeterminate && !this.checked ? s`<svg viewBox="0 0 12 12" fill="none"><path d="M3 6h6" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round"/></svg>` : ""}
|
|
59
61
|
</span>
|
|
60
62
|
`;
|
|
61
63
|
}
|
|
@@ -78,30 +80,33 @@ var c = class extends r(e) {
|
|
|
78
80
|
e && e.checked !== this.checked && (e.checked = this.checked), this.closest("void-checkbox-group")?.requestUpdate();
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
|
-
t([
|
|
83
|
+
t([l({
|
|
84
|
+
attribute: "keys",
|
|
85
|
+
converter: n
|
|
86
|
+
})], u.prototype, "keys", void 0), t([l({
|
|
82
87
|
type: Boolean,
|
|
83
88
|
reflect: !0
|
|
84
|
-
})],
|
|
89
|
+
})], u.prototype, "checked", void 0), t([l({
|
|
85
90
|
type: Boolean,
|
|
86
91
|
reflect: !0
|
|
87
|
-
})],
|
|
92
|
+
})], u.prototype, "disabled", void 0), t([l({
|
|
88
93
|
type: Boolean,
|
|
89
94
|
reflect: !0
|
|
90
|
-
})],
|
|
95
|
+
})], u.prototype, "indeterminate", void 0), t([l({
|
|
91
96
|
type: String,
|
|
92
97
|
reflect: !0
|
|
93
|
-
})],
|
|
98
|
+
})], u.prototype, "name", void 0), t([l({
|
|
94
99
|
type: String,
|
|
95
100
|
reflect: !0
|
|
96
|
-
})],
|
|
101
|
+
})], u.prototype, "value", void 0), t([l({
|
|
97
102
|
type: Boolean,
|
|
98
103
|
reflect: !0
|
|
99
|
-
})],
|
|
104
|
+
})], u.prototype, "required", void 0), t([l({
|
|
100
105
|
type: String,
|
|
101
106
|
reflect: !0
|
|
102
|
-
})],
|
|
107
|
+
})], u.prototype, "color", void 0), t([l({
|
|
103
108
|
type: String,
|
|
104
109
|
reflect: !0
|
|
105
|
-
})],
|
|
110
|
+
})], u.prototype, "size", void 0), customElements.get("void-checkbox") || customElements.define("void-checkbox", u);
|
|
106
111
|
//#endregion
|
|
107
|
-
export {
|
|
112
|
+
export { u as VoidCheckbox };
|
|
@@ -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
|
* Simple expand/collapse panel for FAQ sections, spoiler text, and progressive disclosure of secondary content.
|
|
5
6
|
*
|
|
@@ -17,6 +18,12 @@ import { PartsController } from '../parts.js';
|
|
|
17
18
|
* `preventDefault()` keeps it open. Does not bubble.
|
|
18
19
|
*/
|
|
19
20
|
export declare class VoidCollapsible extends VoidElement {
|
|
21
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
22
|
+
keys: KeyOverrides | null;
|
|
23
|
+
/** @internal The actions of this element and their default keys. */
|
|
24
|
+
static readonly keyMap: {
|
|
25
|
+
activate: string[];
|
|
26
|
+
};
|
|
20
27
|
/** Whether the content is shown. Add the attribute to start open; it follows the user's toggling. */
|
|
21
28
|
open: boolean;
|
|
22
29
|
/** Stop the panel from toggling. The trigger ignores clicks and Enter or Space. */
|
|
@@ -1,15 +1,17 @@
|
|
|
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/collapsible.ts
|
|
7
|
-
var
|
|
9
|
+
var c = class extends e {
|
|
8
10
|
constructor(...e) {
|
|
9
|
-
super(...e), this.open = !1, this.disabled = !1, this._parts = new
|
|
11
|
+
super(...e), this.keys = null, this.open = !1, this.disabled = !1, this._parts = new a(this, {
|
|
10
12
|
tags: ["void-collapsible-trigger", "void-collapsible-content"],
|
|
11
13
|
onChange: () => this._wire()
|
|
12
|
-
}), this._closed = new
|
|
14
|
+
}), this._closed = new o(this, this._parts), this._onBeforeMatch = (e) => {
|
|
13
15
|
this.open || e.target !== this._parts.one("void-collapsible-content") || (this.open = !0, this.dispatchEvent(new CustomEvent("void-open", {
|
|
14
16
|
bubbles: !1,
|
|
15
17
|
detail: { reason: "find" }
|
|
@@ -17,9 +19,12 @@ var a = class extends e {
|
|
|
17
19
|
}, this._onClick = (e) => {
|
|
18
20
|
this._fromTrigger(e) && (e.preventDefault(), this._toggle("trigger"));
|
|
19
21
|
}, this._onKeydown = (e) => {
|
|
20
|
-
|
|
22
|
+
n(this, e) !== "activate" || !this._fromTrigger(e) || e.target.closest("a, button, input, select, textarea") || (e.preventDefault(), this._toggle("keyboard"));
|
|
21
23
|
};
|
|
22
24
|
}
|
|
25
|
+
static {
|
|
26
|
+
this.keyMap = i;
|
|
27
|
+
}
|
|
23
28
|
connectedCallback() {
|
|
24
29
|
super.connectedCallback(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeydown), this.addEventListener("beforematch", this._onBeforeMatch);
|
|
25
30
|
}
|
|
@@ -48,12 +53,15 @@ var a = class extends e {
|
|
|
48
53
|
}))));
|
|
49
54
|
}
|
|
50
55
|
};
|
|
51
|
-
t([
|
|
56
|
+
t([s({
|
|
57
|
+
attribute: "keys",
|
|
58
|
+
converter: r
|
|
59
|
+
})], c.prototype, "keys", void 0), t([s({
|
|
52
60
|
type: Boolean,
|
|
53
61
|
reflect: !0
|
|
54
|
-
})],
|
|
62
|
+
})], c.prototype, "open", void 0), t([s({
|
|
55
63
|
type: Boolean,
|
|
56
64
|
reflect: !0
|
|
57
|
-
})],
|
|
65
|
+
})], c.prototype, "disabled", void 0), customElements.get("void-collapsible") || customElements.define("void-collapsible", c);
|
|
58
66
|
//#endregion
|
|
59
|
-
export {
|
|
67
|
+
export { c as VoidCollapsible };
|