@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,4 +1,5 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
+
import { KeyOverrides } from '../keys.js';
|
|
2
3
|
import { PartsController } from '../parts.js';
|
|
3
4
|
/**
|
|
4
5
|
* Tabbed section navigation for settings pages, detail views, and parallel content categories.
|
|
@@ -17,6 +18,16 @@ import { PartsController } from '../parts.js';
|
|
|
17
18
|
* @fires {CustomEvent<{ value: string }>} void-change - The user selected a tab.
|
|
18
19
|
*/
|
|
19
20
|
export declare class VoidTabs extends VoidElement {
|
|
21
|
+
/** Key bindings for this element's actions, as JSON (`{"next":["ArrowRight","l"]}`); `[]` 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
|
+
next: string[];
|
|
26
|
+
previous: string[];
|
|
27
|
+
first: string[];
|
|
28
|
+
last: string[];
|
|
29
|
+
activate: string[];
|
|
30
|
+
};
|
|
20
31
|
/**
|
|
21
32
|
* The `value` of the selected tab. As an attribute it is the initial tab; selecting a tab updates it (it
|
|
22
33
|
* reflects) and fires `void-change`.
|
package/dist/components/tabs.js
CHANGED
|
@@ -1,38 +1,44 @@
|
|
|
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 {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { n as i } from "../chunks/parts-DI_3VpSy.js";
|
|
5
|
+
import { n as a, r as o } from "../chunks/keyboard-ChtDvhB_.js";
|
|
6
|
+
import { t as s } from "../chunks/tabs-Buf3EBWq.js";
|
|
7
|
+
import { property as c } from "lit/decorators.js";
|
|
6
8
|
//#region src/components/tabs.ts
|
|
7
|
-
var
|
|
9
|
+
var l = "void-tabs-list", u = "void-tabs-trigger", d = "void-tabs-content", f = class extends e {
|
|
8
10
|
constructor(...e) {
|
|
9
|
-
super(...e), this.value = "", this.size = "md", this.activation = "manual", this._parts = new
|
|
11
|
+
super(...e), this.keys = null, this.value = "", this.size = "md", this.activation = "manual", this._parts = new i(this, {
|
|
10
12
|
tags: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
l,
|
|
14
|
+
u,
|
|
15
|
+
d
|
|
14
16
|
],
|
|
15
17
|
onChange: () => this._wire()
|
|
16
18
|
}), this._matchedValue = null, this._onClick = (e) => {
|
|
17
19
|
let t = this._triggerOf(e.target);
|
|
18
20
|
t && this._select(t);
|
|
19
21
|
}, this._onKeydown = (e) => {
|
|
20
|
-
|
|
21
|
-
let t = this._triggerOf(e.target);
|
|
22
|
+
let t = n(this, e);
|
|
22
23
|
if (!t) return;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let r = this._triggerOf(e.target);
|
|
25
|
+
if (!r) return;
|
|
26
|
+
if (t === "activate") {
|
|
27
|
+
e.preventDefault(), this._select(r);
|
|
25
28
|
return;
|
|
26
29
|
}
|
|
27
|
-
let
|
|
28
|
-
if (
|
|
29
|
-
else if (
|
|
30
|
-
else if (
|
|
31
|
-
else if (
|
|
30
|
+
let i = this._triggers(), s = i.indexOf(r), c = i.map((e) => this._disabled(e)), l = -1;
|
|
31
|
+
if (t === "next") l = o(c, s, 1);
|
|
32
|
+
else if (t === "previous") l = o(c, s, -1);
|
|
33
|
+
else if (t === "first") l = a(c, 1);
|
|
34
|
+
else if (t === "last") l = a(c, -1);
|
|
32
35
|
else return;
|
|
33
|
-
e.preventDefault(), !(
|
|
36
|
+
e.preventDefault(), !(l < 0) && (i[l].focus(), this.activation === "auto" && this._select(i[l]));
|
|
34
37
|
};
|
|
35
38
|
}
|
|
39
|
+
static {
|
|
40
|
+
this.keyMap = s;
|
|
41
|
+
}
|
|
36
42
|
connectedCallback() {
|
|
37
43
|
super.connectedCallback(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeydown);
|
|
38
44
|
}
|
|
@@ -43,7 +49,7 @@ var s = "void-tabs-list", c = "void-tabs-trigger", l = "void-tabs-content", u =
|
|
|
43
49
|
super.updated(e), e.has("value") && this._wire();
|
|
44
50
|
}
|
|
45
51
|
_triggers() {
|
|
46
|
-
return this._parts.within(this._parts.one(
|
|
52
|
+
return this._parts.within(this._parts.one(l), u);
|
|
47
53
|
}
|
|
48
54
|
_disabled(e) {
|
|
49
55
|
return e.hasAttribute("disabled");
|
|
@@ -61,22 +67,22 @@ var s = "void-tabs-list", c = "void-tabs-trigger", l = "void-tabs-content", u =
|
|
|
61
67
|
this._matchedValue = null, t && (this.value = this._valueOf(t), this._matchedValue = this.value);
|
|
62
68
|
}
|
|
63
69
|
_wire() {
|
|
64
|
-
let e = this._parts.one(
|
|
70
|
+
let e = this._parts.one(l), t = this._triggers(), n = this._parts.all(d);
|
|
65
71
|
this._reconcileRemovedSelection(t), e && this._parts.set(e, "role", "tablist");
|
|
66
|
-
let r = t.map((e) => this._disabled(e)),
|
|
67
|
-
|
|
72
|
+
let r = t.map((e) => this._disabled(e)), i = t.findIndex((e, t) => this._valueOf(e) === this.value && !r[t]);
|
|
73
|
+
i < 0 && (i = a(r, 1));
|
|
68
74
|
let o = /* @__PURE__ */ new Map();
|
|
69
75
|
for (let e of n) o.has(this._valueOf(e)) || o.set(this._valueOf(e), e);
|
|
70
|
-
let
|
|
76
|
+
let s = /* @__PURE__ */ new Map();
|
|
71
77
|
t.forEach((e, t) => {
|
|
72
|
-
let n = this._valueOf(e),
|
|
73
|
-
|
|
78
|
+
let n = this._valueOf(e), a = n === this.value, c = this._parts.id(e, "void-tabs-trigger");
|
|
79
|
+
s.has(n) || s.set(n, c);
|
|
74
80
|
let l = o.get(n);
|
|
75
|
-
this._parts.set(e, "role", "tab"), this._parts.set(e, "aria-selected",
|
|
81
|
+
this._parts.set(e, "role", "tab"), this._parts.set(e, "aria-selected", a ? "true" : "false"), this._parts.set(e, "active", a), this._parts.set(e, "tabindex", t === i ? "0" : "-1"), this._parts.set(e, "aria-disabled", r[t] ? "true" : null), this._parts.set(e, "aria-controls", l ? this._parts.id(l, "void-tabs-content") : null);
|
|
76
82
|
});
|
|
77
83
|
for (let e of n) {
|
|
78
84
|
let t = this._valueOf(e), n = t === this.value;
|
|
79
|
-
this._parts.id(e, "void-tabs-content"), this._parts.set(e, "role", "tabpanel"), this._parts.set(e, "active", n), this._parts.set(e, "tabindex", n ? "0" : null), this._parts.set(e, "aria-labelledby",
|
|
85
|
+
this._parts.id(e, "void-tabs-content"), this._parts.set(e, "role", "tabpanel"), this._parts.set(e, "active", n), this._parts.set(e, "tabindex", n ? "0" : null), this._parts.set(e, "aria-labelledby", s.get(t) ?? null);
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
_select(e) {
|
|
@@ -89,19 +95,22 @@ var s = "void-tabs-list", c = "void-tabs-trigger", l = "void-tabs-content", u =
|
|
|
89
95
|
}));
|
|
90
96
|
}
|
|
91
97
|
_triggerOf(e) {
|
|
92
|
-
let t = e instanceof Element ? e.closest(
|
|
98
|
+
let t = e instanceof Element ? e.closest(u) : null;
|
|
93
99
|
return t && this._parts.owns(t) ? t : null;
|
|
94
100
|
}
|
|
95
101
|
};
|
|
96
|
-
t([
|
|
102
|
+
t([c({
|
|
103
|
+
attribute: "keys",
|
|
104
|
+
converter: r
|
|
105
|
+
})], f.prototype, "keys", void 0), t([c({
|
|
97
106
|
type: String,
|
|
98
107
|
reflect: !0
|
|
99
|
-
})],
|
|
108
|
+
})], f.prototype, "value", void 0), t([c({
|
|
100
109
|
type: String,
|
|
101
110
|
reflect: !0
|
|
102
|
-
})],
|
|
111
|
+
})], f.prototype, "size", void 0), t([c({
|
|
103
112
|
type: String,
|
|
104
113
|
reflect: !0
|
|
105
|
-
})],
|
|
114
|
+
})], f.prototype, "activation", void 0), customElements.get("void-tabs") || customElements.define("void-tabs", f);
|
|
106
115
|
//#endregion
|
|
107
|
-
export {
|
|
116
|
+
export { f as VoidTabs };
|
package/dist/components/tag.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
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 {
|
|
3
|
+
import { msg as n } from "../messages.js";
|
|
4
|
+
import { t as r } from "../chunks/projection-oPe6ipjL.js";
|
|
5
|
+
import { html as i, nothing as a } from "lit";
|
|
6
|
+
import { property as o } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/tag.ts
|
|
7
|
-
var
|
|
8
|
+
var s = class extends e {
|
|
8
9
|
constructor(...e) {
|
|
9
|
-
super(...e), this.color = "default", this.removable = !1, this.size = "md", this._projection = new
|
|
10
|
+
super(...e), this.color = "default", this.removable = !1, this.size = "md", this._projection = new r(this, { regions: [{
|
|
10
11
|
name: "label",
|
|
11
12
|
target: "before"
|
|
12
13
|
}] });
|
|
@@ -17,7 +18,7 @@ var o = class extends e {
|
|
|
17
18
|
this.setHostAttribute("role", t ? "listitem" : null);
|
|
18
19
|
}
|
|
19
20
|
render() {
|
|
20
|
-
return this.removable ?
|
|
21
|
+
return this.removable ? i`<button type="button" class="void-tag-close" aria-label=${n(this, "remove")} @click="${this._remove}">×</button>` : a;
|
|
21
22
|
}
|
|
22
23
|
_remove() {
|
|
23
24
|
this.dispatchEvent(new CustomEvent("void-remove", {
|
|
@@ -26,15 +27,15 @@ var o = class extends e {
|
|
|
26
27
|
})), this.remove();
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
t([
|
|
30
|
+
t([o({
|
|
30
31
|
type: String,
|
|
31
32
|
reflect: !0
|
|
32
|
-
})],
|
|
33
|
+
})], s.prototype, "color", void 0), t([o({
|
|
33
34
|
type: Boolean,
|
|
34
35
|
reflect: !0
|
|
35
|
-
})],
|
|
36
|
+
})], s.prototype, "removable", void 0), t([o({
|
|
36
37
|
type: String,
|
|
37
38
|
reflect: !0
|
|
38
|
-
})],
|
|
39
|
+
})], s.prototype, "size", void 0), customElements.get("void-tag") || customElements.define("void-tag", s);
|
|
39
40
|
//#endregion
|
|
40
|
-
export {
|
|
41
|
+
export { s as VoidTag };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { VoidElement } from '../base.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
import { FormSubmission } from '../form-control.js';
|
|
4
5
|
export type TagValue = string | {
|
|
5
6
|
text: string;
|
|
@@ -8,6 +9,13 @@ export type TagValue = string | {
|
|
|
8
9
|
declare const VoidTagsInput_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
9
10
|
/** Multi-tag input field for email recipients, category labels, keyword tagging, and comma-separated value entry. */
|
|
10
11
|
export declare class VoidTagsInput extends VoidTagsInput_base {
|
|
12
|
+
/** Key bindings for this element's actions, as JSON (`{"add":["Enter",";"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
13
|
+
keys: KeyOverrides | null;
|
|
14
|
+
/** @internal The actions of this element and their default keys. */
|
|
15
|
+
static readonly keyMap: {
|
|
16
|
+
add: string[];
|
|
17
|
+
removeLast: string[];
|
|
18
|
+
};
|
|
11
19
|
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
12
20
|
static labelTarget: string;
|
|
13
21
|
/**
|
|
@@ -21,8 +29,9 @@ export declare class VoidTagsInput extends VoidTagsInput_base {
|
|
|
21
29
|
readonly: boolean;
|
|
22
30
|
/** Maximum number of tags. Once reached, the entry field is hidden. Unlimited by default. */
|
|
23
31
|
max: number;
|
|
24
|
-
/** Hint in the entry field. Defaults to `Add tag
|
|
32
|
+
/** Hint in the entry field. Defaults to the `tagsInput.placeholder` message (English: `Add tag...`). */
|
|
25
33
|
placeholder: string;
|
|
34
|
+
private get _hint();
|
|
26
35
|
/** Size step: `sm`, `md` (default) or `lg`. */
|
|
27
36
|
size: 'sm' | 'md' | 'lg';
|
|
28
37
|
/** Status colour of the tags: `default`, `error`, `warning`, `caution`, `success`, `info`, `notice` or `highlight`. */
|
|
@@ -1,19 +1,28 @@
|
|
|
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 { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { msg as i } from "../messages.js";
|
|
5
|
+
import { t as a } from "../chunks/form-control-fL-Hhy91.js";
|
|
6
|
+
import { r as o } from "../chunks/projection-oPe6ipjL.js";
|
|
7
|
+
import { t as s } from "../chunks/value-list-CH6GjYXM.js";
|
|
8
|
+
import { s as c } from "../chunks/fields-MEqz-olE.js";
|
|
9
|
+
import { html as l, nothing as u } from "lit";
|
|
10
|
+
import { property as d } from "lit/decorators.js";
|
|
8
11
|
//#region src/components/tags-input.ts
|
|
9
|
-
|
|
10
|
-
var
|
|
12
|
+
o();
|
|
13
|
+
var f = class extends a(e) {
|
|
11
14
|
constructor(...e) {
|
|
12
|
-
super(...e), this.value = [], this.disabled = !1, this.readonly = !1, this.max = Infinity, this.placeholder = "
|
|
15
|
+
super(...e), this.keys = null, this.value = [], this.disabled = !1, this.readonly = !1, this.max = Infinity, this.placeholder = "", this.size = "md", this.color = "default", this.variant = "outline", this.allowDuplicates = !1;
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.keyMap = c;
|
|
13
19
|
}
|
|
14
20
|
static {
|
|
15
21
|
this.labelTarget = ".void-tags-input-field";
|
|
16
22
|
}
|
|
23
|
+
get _hint() {
|
|
24
|
+
return this.placeholder || i(this, "tagsInput.placeholder");
|
|
25
|
+
}
|
|
17
26
|
_tagText(e) {
|
|
18
27
|
return typeof e == "string" ? e : e.text;
|
|
19
28
|
}
|
|
@@ -29,33 +38,33 @@ var c = class extends n(e) {
|
|
|
29
38
|
}
|
|
30
39
|
render() {
|
|
31
40
|
let e = this.value.length >= this.max;
|
|
32
|
-
return
|
|
41
|
+
return l`
|
|
33
42
|
<div class="void-tags-input" @click=${this._focusInput} @keydown=${this._onContainerKeydown}>
|
|
34
43
|
${this.value.map((e, t) => {
|
|
35
44
|
let n = this._tagText(e);
|
|
36
|
-
return
|
|
37
|
-
<span class="void-tags-input-tag" data-color=${this._tagColor(e) ||
|
|
45
|
+
return l`
|
|
46
|
+
<span class="void-tags-input-tag" data-color=${this._tagColor(e) || u}>
|
|
38
47
|
<span class="void-tags-input-tag-text">${n}</span>
|
|
39
|
-
${!this.disabled && !this.readonly ?
|
|
48
|
+
${!this.disabled && !this.readonly ? l`<button
|
|
40
49
|
type="button"
|
|
41
50
|
class="void-tags-input-tag-remove"
|
|
42
|
-
aria-label
|
|
51
|
+
aria-label=${i(this, "removeItem", { name: n })}
|
|
43
52
|
@click=${(e) => {
|
|
44
53
|
e.stopPropagation(), this._removeTag(t);
|
|
45
54
|
}}
|
|
46
|
-
>×</button>` :
|
|
55
|
+
>×</button>` : u}
|
|
47
56
|
</span>
|
|
48
57
|
`;
|
|
49
58
|
})}
|
|
50
|
-
${!e && !this.readonly ?
|
|
59
|
+
${!e && !this.readonly ? l`<input
|
|
51
60
|
class="void-tags-input-field"
|
|
52
61
|
type="text"
|
|
53
|
-
placeholder=${this.value.length === 0 ? this.
|
|
62
|
+
placeholder=${this.value.length === 0 ? this._hint : ""}
|
|
54
63
|
?disabled=${this.disabled}
|
|
55
64
|
@keydown=${this._onKeydown}
|
|
56
65
|
@input=${this._onFieldInput}
|
|
57
66
|
@paste=${this._onPaste}
|
|
58
|
-
/>` :
|
|
67
|
+
/>` : u}
|
|
59
68
|
</div>
|
|
60
69
|
`;
|
|
61
70
|
}
|
|
@@ -73,12 +82,12 @@ var c = class extends n(e) {
|
|
|
73
82
|
this.disabled || this.readonly || (this.value = this.value.filter((t, n) => n !== e), this._dispatchChange());
|
|
74
83
|
}
|
|
75
84
|
_onKeydown(e) {
|
|
76
|
-
let t = e.target;
|
|
77
|
-
if (
|
|
85
|
+
let t = e.target, r = n(this, e);
|
|
86
|
+
if (r === "add") {
|
|
78
87
|
e.preventDefault();
|
|
79
88
|
let n = t.value;
|
|
80
89
|
t.value = "", this._addTag(n), this.formSync();
|
|
81
|
-
} else
|
|
90
|
+
} else r === "removeLast" && t.value === "" && this.value.length > 0 && this._removeTag(this.value.length - 1);
|
|
82
91
|
}
|
|
83
92
|
_onFieldInput() {
|
|
84
93
|
this.formSync();
|
|
@@ -99,27 +108,30 @@ var c = class extends n(e) {
|
|
|
99
108
|
}));
|
|
100
109
|
}
|
|
101
110
|
};
|
|
102
|
-
t([
|
|
103
|
-
|
|
111
|
+
t([d({
|
|
112
|
+
attribute: "keys",
|
|
113
|
+
converter: r
|
|
114
|
+
})], f.prototype, "keys", void 0), t([d({
|
|
115
|
+
converter: s,
|
|
104
116
|
reflect: !0
|
|
105
|
-
})],
|
|
117
|
+
})], f.prototype, "value", void 0), t([d({
|
|
106
118
|
type: Boolean,
|
|
107
119
|
reflect: !0
|
|
108
|
-
})],
|
|
120
|
+
})], f.prototype, "disabled", void 0), t([d({
|
|
109
121
|
type: Boolean,
|
|
110
122
|
reflect: !0
|
|
111
|
-
})],
|
|
123
|
+
})], f.prototype, "readonly", void 0), t([d({ type: Number })], f.prototype, "max", void 0), t([d({ type: String })], f.prototype, "placeholder", void 0), t([d({
|
|
112
124
|
type: String,
|
|
113
125
|
reflect: !0
|
|
114
|
-
})],
|
|
126
|
+
})], f.prototype, "size", void 0), t([d({
|
|
115
127
|
type: String,
|
|
116
128
|
reflect: !0
|
|
117
|
-
})],
|
|
129
|
+
})], f.prototype, "color", void 0), t([d({
|
|
118
130
|
type: String,
|
|
119
131
|
reflect: !0
|
|
120
|
-
})],
|
|
132
|
+
})], f.prototype, "variant", void 0), t([d({
|
|
121
133
|
type: Boolean,
|
|
122
134
|
attribute: "allow-duplicates"
|
|
123
|
-
})],
|
|
135
|
+
})], f.prototype, "allowDuplicates", void 0), customElements.get("void-tags-input") || customElements.define("void-tags-input", f);
|
|
124
136
|
//#endregion
|
|
125
|
-
export {
|
|
137
|
+
export { f as VoidTagsInput };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { n } from "../chunks/form-control-
|
|
3
|
+
import { n } from "../chunks/form-control-fL-Hhy91.js";
|
|
4
4
|
import { r } from "../chunks/projection-oPe6ipjL.js";
|
|
5
5
|
import { html as i, nothing as a } from "lit";
|
|
6
6
|
import { property as o } from "lit/decorators.js";
|
|
@@ -72,6 +72,8 @@ export declare class VoidToastContainer extends VoidElement {
|
|
|
72
72
|
private _observer;
|
|
73
73
|
private _announceTimers;
|
|
74
74
|
connectedCallback(): void;
|
|
75
|
+
private _name;
|
|
76
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
75
77
|
disconnectedCallback(): void;
|
|
76
78
|
/**
|
|
77
79
|
* Two persistent, visually hidden live regions that exist from the container's connection: a polite one
|
package/dist/components/toast.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
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 { n as
|
|
5
|
-
import {
|
|
3
|
+
import { msg as n, nameHost as r } from "../messages.js";
|
|
4
|
+
import { n as i } from "../chunks/parts-DI_3VpSy.js";
|
|
5
|
+
import { n as a, t as o } from "../chunks/dismiss-Drsy_dE5.js";
|
|
6
|
+
import { property as s } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/toast.ts
|
|
7
|
-
var
|
|
8
|
+
var c = class extends e {
|
|
8
9
|
constructor(...e) {
|
|
9
|
-
super(...e), this.color = "default", this.duration = 5e3, this._parts = new
|
|
10
|
+
super(...e), this.color = "default", this.duration = 5e3, this._parts = new i(this, {
|
|
10
11
|
tags: [
|
|
11
12
|
"void-toast-title",
|
|
12
13
|
"void-toast-description",
|
|
@@ -23,7 +24,7 @@ var o = class extends e {
|
|
|
23
24
|
}, this._onFocusOut = (e) => {
|
|
24
25
|
e.relatedTarget instanceof Node && this.contains(e.relatedTarget) || (this._focused = !1, this._resume());
|
|
25
26
|
}, this._onClick = (e) => {
|
|
26
|
-
|
|
27
|
+
o(this._parts.one("void-toast-close"), e) && this._close("close-button");
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
connectedCallback() {
|
|
@@ -60,24 +61,30 @@ var o = class extends e {
|
|
|
60
61
|
bubbles: !1,
|
|
61
62
|
cancelable: e === "close-button",
|
|
62
63
|
detail: { reason: e }
|
|
63
|
-
})) &&
|
|
64
|
+
})) && a(this);
|
|
64
65
|
}
|
|
65
66
|
};
|
|
66
|
-
t([
|
|
67
|
+
t([s({
|
|
67
68
|
type: String,
|
|
68
69
|
reflect: !0
|
|
69
|
-
})],
|
|
70
|
-
var
|
|
70
|
+
})], c.prototype, "color", void 0), t([s({ type: Number })], c.prototype, "duration", void 0), customElements.get("void-toast") || customElements.define("void-toast", c);
|
|
71
|
+
var l = class extends e {
|
|
71
72
|
constructor(...e) {
|
|
72
73
|
super(...e), this.placement = "bottom-right", this._observer = null, this._announceTimers = /* @__PURE__ */ new Map();
|
|
73
74
|
}
|
|
74
75
|
connectedCallback() {
|
|
75
|
-
super.connectedCallback(), this.setHostAttribute("role", "region"), this.
|
|
76
|
+
super.connectedCallback(), this.setHostAttribute("role", "region"), this._name(), typeof this.showPopover == "function" && this.setHostAttribute("popover", "manual"), this._ensureAnnouncers(), this._observer ??= new MutationObserver((e) => {
|
|
76
77
|
this._syncShown(e.some((e) => e.addedNodes.length > 0));
|
|
77
|
-
for (let t of e) for (let e of t.addedNodes) e instanceof
|
|
78
|
+
for (let t of e) for (let e of t.addedNodes) e instanceof c && this._announce(e);
|
|
78
79
|
}), this._observer.observe(this, { childList: !0 }), this._syncShown(!0);
|
|
79
80
|
for (let e of this.querySelectorAll(":scope > void-toast")) this._announce(e);
|
|
80
81
|
}
|
|
82
|
+
_name() {
|
|
83
|
+
r(this, n(this, "toast.region"), (e, t) => this.setHostAttribute(e, t));
|
|
84
|
+
}
|
|
85
|
+
updated(e) {
|
|
86
|
+
super.updated(e), this._name();
|
|
87
|
+
}
|
|
81
88
|
disconnectedCallback() {
|
|
82
89
|
super.disconnectedCallback(), this._observer?.disconnect();
|
|
83
90
|
for (let e of this._announceTimers.values()) clearTimeout(e);
|
|
@@ -126,38 +133,38 @@ var s = class extends e {
|
|
|
126
133
|
static show(e) {
|
|
127
134
|
let t = document.querySelector("void-toast-container");
|
|
128
135
|
t || (t = document.createElement("void-toast-container"), document.body.appendChild(t));
|
|
129
|
-
let n =
|
|
136
|
+
let n = u(e);
|
|
130
137
|
return t.appendChild(n), n;
|
|
131
138
|
}
|
|
132
139
|
};
|
|
133
|
-
t([
|
|
140
|
+
t([s({
|
|
134
141
|
type: String,
|
|
135
142
|
reflect: !0
|
|
136
|
-
})],
|
|
137
|
-
function
|
|
143
|
+
})], l.prototype, "placement", void 0);
|
|
144
|
+
function u(e) {
|
|
138
145
|
let t = document.createElement("void-toast");
|
|
139
146
|
e.color !== void 0 && (t.color = e.color), e.duration !== void 0 && (t.duration = e.duration);
|
|
140
|
-
let
|
|
147
|
+
let r = (e, t) => {
|
|
141
148
|
let n = document.createElement(`void-toast-${e}`);
|
|
142
149
|
return t !== void 0 && (n.textContent = t), n;
|
|
143
150
|
};
|
|
144
|
-
if (e.title && t.append(
|
|
145
|
-
let
|
|
146
|
-
for (let
|
|
151
|
+
if (e.title && t.append(r("title", e.title)), t.append(r("description", e.description)), e.actions?.length) {
|
|
152
|
+
let n = r("actions");
|
|
153
|
+
for (let r of e.actions) {
|
|
147
154
|
let e = document.createElement("void-button");
|
|
148
|
-
e.setAttribute("size", "sm"), e.textContent =
|
|
155
|
+
e.setAttribute("size", "sm"), e.textContent = r.label, e.addEventListener("click", (e) => r.onClick?.(e, t)), n.append(e);
|
|
149
156
|
}
|
|
150
|
-
t.append(
|
|
157
|
+
t.append(n);
|
|
151
158
|
}
|
|
152
159
|
if (e.dismissable !== !1) {
|
|
153
|
-
let e =
|
|
154
|
-
|
|
160
|
+
let e = r("close"), i = document.createElement("button");
|
|
161
|
+
i.type = "button", i.setAttribute("aria-label", n(document.querySelector("void-toast-container") ?? document.documentElement, "dismiss")), i.innerHTML = "×", e.append(i), t.append(e);
|
|
155
162
|
}
|
|
156
163
|
return t;
|
|
157
164
|
}
|
|
158
|
-
function
|
|
159
|
-
return
|
|
165
|
+
function d(e) {
|
|
166
|
+
return l.show(e);
|
|
160
167
|
}
|
|
161
|
-
customElements.get("void-toast-container") || customElements.define("void-toast-container",
|
|
168
|
+
customElements.get("void-toast-container") || customElements.define("void-toast-container", l);
|
|
162
169
|
//#endregion
|
|
163
|
-
export {
|
|
170
|
+
export { c as VoidToast, l as VoidToastContainer, d as toast };
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
+
import { KeyOverrides } from '../keys.js';
|
|
2
3
|
import { FormSubmission } from '../form-control.js';
|
|
3
4
|
import { VoidToggle } from './toggle.js';
|
|
4
5
|
declare const VoidToggleGroup_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
5
6
|
/** Multi-button toggle set for text editor toolbars and filter chips where one or many options can be active. */
|
|
6
7
|
export declare class VoidToggleGroup extends VoidToggleGroup_base {
|
|
8
|
+
/** Key bindings for this element's actions, as JSON (`{"next":["ArrowRight"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
9
|
+
keys: KeyOverrides | null;
|
|
10
|
+
/** @internal The actions of this element and their default keys (horizontal; a vertical group starts with ArrowDown and ArrowUp). */
|
|
11
|
+
static readonly keyMap: {
|
|
12
|
+
next: string[];
|
|
13
|
+
previous: string[];
|
|
14
|
+
};
|
|
7
15
|
/**
|
|
8
16
|
* Comma-separated `value`s of the pressed toggles (`bold,italic`), or the single pressed value. Reflected to the
|
|
9
17
|
* attribute as the pressed toggles change; the form's reset target stays the state it started with. Without it (or with an empty one) the
|
|
@@ -1,12 +1,13 @@
|
|
|
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 {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { t as i } from "../chunks/form-control-fL-Hhy91.js";
|
|
5
|
+
import { i as a, r as o } from "../chunks/choice-BTrsi7OW.js";
|
|
6
|
+
import { property as s } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/toggle-group.ts
|
|
7
|
-
var
|
|
8
|
+
var c = class extends i(e) {
|
|
8
9
|
constructor(...e) {
|
|
9
|
-
super(...e), this.value = "", this.multiple = !1, this.disabled = !1, this.size = "md", this.color = "default", this.orientation = "horizontal", this._handleChildChange = (e) => {
|
|
10
|
+
super(...e), this.keys = null, this.value = "", this.multiple = !1, this.disabled = !1, this.size = "md", this.color = "default", this.orientation = "horizontal", this._handleChildChange = (e) => {
|
|
10
11
|
let t = e.target.closest("void-toggle");
|
|
11
12
|
if (!t || t.closest("void-toggle-group") !== this) return;
|
|
12
13
|
if (e.stopImmediatePropagation(), this.formDisabled) {
|
|
@@ -32,13 +33,16 @@ var a = class extends n(e) {
|
|
|
32
33
|
}, this._handleKeydown = (e) => {
|
|
33
34
|
let t = this._toggles().filter((e) => !e.disabled);
|
|
34
35
|
if (!t.length) return;
|
|
35
|
-
let
|
|
36
|
-
if (
|
|
36
|
+
let r = n(this, e, this.orientation === "horizontal" ? o : a);
|
|
37
|
+
if (r !== "next" && r !== "previous") return;
|
|
37
38
|
e.preventDefault();
|
|
38
|
-
let
|
|
39
|
-
|
|
39
|
+
let i = t.indexOf(e.target), s;
|
|
40
|
+
s = r === "next" ? i < 0 ? 0 : (i + 1) % t.length : i < 0 ? t.length - 1 : (i - 1 + t.length) % t.length, t[s].focus();
|
|
40
41
|
};
|
|
41
42
|
}
|
|
43
|
+
static {
|
|
44
|
+
this.keyMap = o;
|
|
45
|
+
}
|
|
42
46
|
connectedCallback() {
|
|
43
47
|
super.connectedCallback(), this.hasUpdated || this._adoptPressed(this._toggles()), this.setHostAttribute("role", "group"), this.addEventListener("void-change", this._handleChildChange), this.addEventListener("keydown", this._handleKeydown), this._syncToggles();
|
|
44
48
|
}
|
|
@@ -85,24 +89,27 @@ var a = class extends n(e) {
|
|
|
85
89
|
e.pressed = t.includes(n), this.disabled && (e.disabled = !0), e.size = this.size, this.color !== "default" && (e.color = this.color);
|
|
86
90
|
}
|
|
87
91
|
};
|
|
88
|
-
t([
|
|
92
|
+
t([s({
|
|
93
|
+
attribute: "keys",
|
|
94
|
+
converter: r
|
|
95
|
+
})], c.prototype, "keys", void 0), t([s({
|
|
89
96
|
type: String,
|
|
90
97
|
reflect: !0
|
|
91
|
-
})],
|
|
98
|
+
})], c.prototype, "value", void 0), t([s({
|
|
92
99
|
type: Boolean,
|
|
93
100
|
reflect: !0
|
|
94
|
-
})],
|
|
101
|
+
})], c.prototype, "multiple", void 0), t([s({
|
|
95
102
|
type: Boolean,
|
|
96
103
|
reflect: !0
|
|
97
|
-
})],
|
|
104
|
+
})], c.prototype, "disabled", void 0), t([s({
|
|
98
105
|
type: String,
|
|
99
106
|
reflect: !0
|
|
100
|
-
})],
|
|
107
|
+
})], c.prototype, "size", void 0), t([s({
|
|
101
108
|
type: String,
|
|
102
109
|
reflect: !0
|
|
103
|
-
})],
|
|
110
|
+
})], c.prototype, "color", void 0), t([s({
|
|
104
111
|
type: String,
|
|
105
112
|
reflect: !0
|
|
106
|
-
})],
|
|
113
|
+
})], c.prototype, "orientation", void 0), customElements.get("void-toggle-group") || customElements.define("void-toggle-group", c);
|
|
107
114
|
//#endregion
|
|
108
|
-
export {
|
|
115
|
+
export { c as VoidToggleGroup };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { KeyboardActivation } from '../keyboard-activation.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
/** Pressable toggle button for toolbar actions and editor formatting controls with binary active/inactive state. */
|
|
4
5
|
export declare class VoidToggle extends VoidElement {
|
|
6
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
7
|
+
keys: KeyOverrides | null;
|
|
8
|
+
/** @internal The actions of this element and their default keys. */
|
|
9
|
+
static readonly keyMap: {
|
|
10
|
+
activate: string[];
|
|
11
|
+
};
|
|
5
12
|
/** Enter and Space fire a real `click`, as on a native button. */
|
|
6
13
|
protected readonly _activation: KeyboardActivation;
|
|
7
14
|
/**
|