@voidable/ui 0.6.1 → 0.8.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/README.md +168 -9
- package/dist/angular/index.d.ts +20 -0
- package/dist/angular/index.js +78 -0
- package/dist/autoloader-core.d.ts +45 -0
- package/dist/autoloader-table.generated.d.ts +5 -0
- package/dist/autoloader.d.ts +13 -0
- package/dist/autoloader.js +229 -0
- package/dist/base.d.ts +173 -2
- package/dist/base.js +2 -9
- package/dist/chunks/base-CMruMbxC.js +824 -0
- package/dist/chunks/disclosure-Bj_49GcC.js +23 -0
- package/dist/chunks/dismiss-Drsy_dE5.js +37 -0
- package/dist/chunks/form-control-C0vH6gii.js +300 -0
- package/dist/chunks/keyboard-MQpfTX5I.js +46 -0
- package/dist/chunks/keyboard-activation-CV0m4hkn.js +29 -0
- package/dist/chunks/modal-D_YVy2vg.js +71 -0
- package/dist/chunks/overlay-BywGMcDW.js +467 -0
- package/dist/chunks/parts-D30c8OoG.js +229 -0
- package/dist/chunks/{shape-FJvZa8FW.js → shape-C_LW7EjG.js} +12 -4
- package/dist/components/accordion.d.ts +38 -10
- package/dist/components/accordion.js +51 -53
- package/dist/components/action-input.d.ts +64 -6
- package/dist/components/action-input.js +84 -41
- package/dist/components/alert.d.ts +24 -10
- package/dist/components/alert.js +26 -27
- package/dist/components/avatar.d.ts +8 -2
- package/dist/components/avatar.js +3 -3
- package/dist/components/badge.d.ts +8 -3
- package/dist/components/badge.js +2 -2
- package/dist/components/banner.d.ts +21 -10
- package/dist/components/banner.js +27 -27
- package/dist/components/bar-chart.d.ts +30 -6
- package/dist/components/bar-chart.js +29 -39
- package/dist/components/breadcrumbs.d.ts +19 -6
- package/dist/components/breadcrumbs.js +16 -22
- package/dist/components/button.d.ts +64 -10
- package/dist/components/button.js +70 -26
- package/dist/components/calendar.d.ts +65 -10
- package/dist/components/calendar.js +157 -106
- package/dist/components/card.d.ts +14 -9
- package/dist/components/card.js +8 -22
- package/dist/components/carousel.d.ts +65 -14
- package/dist/components/carousel.js +84 -93
- package/dist/components/charts/scale.d.ts +0 -1
- package/dist/components/charts/shape.d.ts +0 -1
- package/dist/components/checkbox-group.d.ts +38 -5
- package/dist/components/checkbox-group.js +61 -20
- package/dist/components/checkbox.d.ts +53 -7
- package/dist/components/checkbox.js +66 -29
- package/dist/components/collapsible.d.ts +29 -9
- package/dist/components/collapsible.js +42 -44
- package/dist/components/color-picker.d.ts +20 -4
- package/dist/components/color-picker.js +35 -29
- package/dist/components/combobox.d.ts +84 -10
- package/dist/components/combobox.js +142 -45
- package/dist/components/compose-input.d.ts +8 -1
- package/dist/components/compose-input.js +9 -3
- package/dist/components/dialog.d.ts +24 -20
- package/dist/components/dialog.js +8 -57
- package/dist/components/divider.d.ts +8 -1
- package/dist/components/divider.js +3 -3
- package/dist/components/donut-chart.d.ts +28 -5
- package/dist/components/donut-chart.js +55 -54
- package/dist/components/drawer.d.ts +19 -18
- package/dist/components/drawer.js +9 -53
- package/dist/components/dropdown-menu.d.ts +62 -7
- package/dist/components/dropdown-menu.js +124 -33
- package/dist/components/editable.d.ts +37 -3
- package/dist/components/editable.js +45 -24
- package/dist/components/error-fallback.d.ts +36 -5
- package/dist/components/error-fallback.js +73 -23
- package/dist/components/field.d.ts +38 -4
- package/dist/components/field.js +63 -21
- package/dist/components/file-upload.d.ts +23 -2
- package/dist/components/file-upload.js +47 -24
- package/dist/components/gauge.d.ts +48 -9
- package/dist/components/gauge.js +57 -55
- package/dist/components/hamburger.d.ts +19 -4
- package/dist/components/hamburger.js +28 -19
- package/dist/components/hover-card.d.ts +40 -14
- package/dist/components/hover-card.js +76 -59
- package/dist/components/indicator.d.ts +18 -7
- package/dist/components/indicator.js +16 -18
- package/dist/components/input.d.ts +70 -5
- package/dist/components/input.js +83 -20
- package/dist/components/line-chart.d.ts +27 -5
- package/dist/components/line-chart.js +19 -21
- package/dist/components/list.d.ts +10 -1
- package/dist/components/list.js +3 -3
- package/dist/components/menu.d.ts +67 -21
- package/dist/components/menu.js +116 -115
- package/dist/components/multiselect.d.ts +108 -13
- package/dist/components/multiselect.js +207 -70
- package/dist/components/nav-bar.d.ts +12 -7
- package/dist/components/nav-bar.js +11 -21
- package/dist/components/nav-menu.d.ts +52 -12
- package/dist/components/nav-menu.js +68 -70
- package/dist/components/number-input.d.ts +76 -8
- package/dist/components/number-input.js +117 -51
- package/dist/components/pagination.d.ts +19 -1
- package/dist/components/pagination.js +68 -7
- package/dist/components/panel.d.ts +16 -8
- package/dist/components/panel.js +20 -20
- package/dist/components/pin-input.d.ts +41 -4
- package/dist/components/pin-input.js +45 -27
- package/dist/components/popover.d.ts +29 -11
- package/dist/components/popover.js +47 -35
- package/dist/components/progress.d.ts +7 -3
- package/dist/components/progress.js +3 -3
- package/dist/components/radio-group.d.ts +30 -5
- package/dist/components/radio-group.js +56 -19
- package/dist/components/radio.d.ts +47 -7
- package/dist/components/radio.js +68 -29
- package/dist/components/scroll-area.d.ts +8 -5
- package/dist/components/scroll-area.js +19 -20
- package/dist/components/segmented-control.d.ts +52 -8
- package/dist/components/segmented-control.js +66 -36
- package/dist/components/select.d.ts +59 -12
- package/dist/components/select.js +96 -46
- package/dist/components/sidebar.d.ts +22 -3
- package/dist/components/sidebar.js +20 -10
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +4 -4
- package/dist/components/slider.d.ts +27 -5
- package/dist/components/slider.js +29 -17
- package/dist/components/spinner.d.ts +6 -2
- package/dist/components/spinner.js +3 -3
- package/dist/components/stat.d.ts +21 -4
- package/dist/components/stat.js +7 -3
- package/dist/components/status-dot.d.ts +4 -1
- package/dist/components/status-dot.js +3 -3
- package/dist/components/stepper.d.ts +5 -1
- package/dist/components/stepper.js +2 -2
- package/dist/components/switch.d.ts +24 -5
- package/dist/components/switch.js +37 -19
- package/dist/components/table.d.ts +51 -2
- package/dist/components/table.js +157 -8
- package/dist/components/tabs.d.ts +49 -17
- package/dist/components/tabs.js +85 -54
- package/dist/components/tag.d.ts +17 -7
- package/dist/components/tag.js +19 -21
- package/dist/components/tags-input.d.ts +33 -4
- package/dist/components/tags-input.js +40 -30
- package/dist/components/textarea.d.ts +61 -5
- package/dist/components/textarea.js +58 -21
- package/dist/components/toast.d.ts +89 -15
- package/dist/components/toast.js +105 -30
- package/dist/components/toggle-group.d.ts +30 -3
- package/dist/components/toggle-group.js +43 -16
- package/dist/components/toggle.d.ts +25 -4
- package/dist/components/toggle.js +28 -18
- package/dist/components/tooltip.d.ts +31 -12
- package/dist/components/tooltip.js +62 -28
- package/dist/components.json +1518 -0
- package/dist/custom-elements.json +31817 -0
- package/dist/dev/index.d.ts +40 -0
- package/dist/dev/rules.d.ts +46 -0
- package/dist/dev/table.generated.d.ts +8 -0
- package/dist/dev/types.d.ts +113 -0
- package/dist/dev.js +3364 -0
- package/dist/disclosure.d.ts +30 -0
- package/dist/dismiss.d.ts +20 -0
- package/dist/form-control.d.ts +92 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +24 -24
- package/dist/keyboard-activation.d.ts +31 -0
- package/dist/keyboard.d.ts +32 -0
- package/dist/modal.d.ts +44 -0
- package/dist/overlay.d.ts +249 -0
- package/dist/parts.d.ts +171 -0
- package/dist/projection.d.ts +370 -0
- package/dist/types/elements.d.ts +648 -0
- package/dist/types/react.d.ts +163 -0
- package/dist/types/solid.d.ts +164 -0
- package/dist/types/solid2.d.ts +161 -0
- package/dist/types/svelte.d.ts +154 -0
- package/dist/types/vue.d.ts +156 -0
- package/dist/vscode.html-custom-data.json +6004 -0
- package/dist/web-types.json +8365 -0
- package/package.json +113 -21
- package/dist/base.d.ts.map +0 -1
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/action-input.d.ts.map +0 -1
- package/dist/components/alert.d.ts.map +0 -1
- package/dist/components/avatar.d.ts.map +0 -1
- package/dist/components/badge.d.ts.map +0 -1
- package/dist/components/banner.d.ts.map +0 -1
- package/dist/components/bar-chart.d.ts.map +0 -1
- package/dist/components/breadcrumbs.d.ts.map +0 -1
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/calendar.d.ts.map +0 -1
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/charts/scale.d.ts.map +0 -1
- package/dist/components/charts/shape.d.ts.map +0 -1
- package/dist/components/checkbox-group.d.ts.map +0 -1
- package/dist/components/checkbox.d.ts.map +0 -1
- package/dist/components/collapsible.d.ts.map +0 -1
- package/dist/components/color-picker.d.ts.map +0 -1
- package/dist/components/combobox.d.ts.map +0 -1
- package/dist/components/compose-input.d.ts.map +0 -1
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/divider.d.ts.map +0 -1
- package/dist/components/donut-chart.d.ts.map +0 -1
- package/dist/components/drawer.d.ts.map +0 -1
- package/dist/components/dropdown-menu.d.ts.map +0 -1
- package/dist/components/editable.d.ts.map +0 -1
- package/dist/components/error-fallback.d.ts.map +0 -1
- package/dist/components/field.d.ts.map +0 -1
- package/dist/components/file-upload.d.ts.map +0 -1
- package/dist/components/gauge.d.ts.map +0 -1
- package/dist/components/hamburger.d.ts.map +0 -1
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/indicator.d.ts.map +0 -1
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/line-chart.d.ts.map +0 -1
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/menu.d.ts.map +0 -1
- package/dist/components/multiselect.d.ts.map +0 -1
- package/dist/components/nav-bar.d.ts.map +0 -1
- package/dist/components/nav-menu.d.ts.map +0 -1
- package/dist/components/number-input.d.ts.map +0 -1
- package/dist/components/pagination.d.ts.map +0 -1
- package/dist/components/panel.d.ts.map +0 -1
- package/dist/components/pin-input.d.ts.map +0 -1
- package/dist/components/popover.d.ts.map +0 -1
- package/dist/components/progress.d.ts.map +0 -1
- package/dist/components/radio-group.d.ts.map +0 -1
- package/dist/components/radio.d.ts.map +0 -1
- package/dist/components/scroll-area.d.ts.map +0 -1
- package/dist/components/segmented-control.d.ts.map +0 -1
- package/dist/components/select.d.ts.map +0 -1
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/skeleton.d.ts.map +0 -1
- package/dist/components/slider.d.ts.map +0 -1
- package/dist/components/spinner.d.ts.map +0 -1
- package/dist/components/stat.d.ts.map +0 -1
- package/dist/components/status-dot.d.ts.map +0 -1
- package/dist/components/stepper.d.ts.map +0 -1
- package/dist/components/switch.d.ts.map +0 -1
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tag.d.ts.map +0 -1
- package/dist/components/tags-input.d.ts.map +0 -1
- package/dist/components/textarea.d.ts.map +0 -1
- package/dist/components/toast.d.ts.map +0 -1
- package/dist/components/toggle-group.d.ts.map +0 -1
- package/dist/components/toggle.d.ts.map +0 -1
- package/dist/components/tooltip.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
|
@@ -1,89 +1,186 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { n as e, r as t, t as n } from "../chunks/base-CMruMbxC.js";
|
|
2
|
+
import { t as r } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as i } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { n as a } from "../chunks/parts-D30c8OoG.js";
|
|
5
|
+
import { i as o, n as s } from "../chunks/keyboard-MQpfTX5I.js";
|
|
6
|
+
import { t as c } from "../chunks/overlay-BywGMcDW.js";
|
|
7
|
+
import { optionLabel as l } from "./multiselect.js";
|
|
8
|
+
import { html as u, nothing as d } from "lit";
|
|
9
|
+
import { property as f } from "lit/decorators.js";
|
|
10
|
+
import { live as p } from "lit/directives/live.js";
|
|
5
11
|
//#region src/components/combobox.ts
|
|
6
|
-
var
|
|
7
|
-
constructor(...
|
|
8
|
-
super(...
|
|
9
|
-
|
|
12
|
+
var m = class extends i(n) {
|
|
13
|
+
constructor(...n) {
|
|
14
|
+
super(...n), this.value = "", this.placeholder = "Search...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._query = "", this._active = null, this._wiring = !1, this._projection = new e(this, { placement: "start" }), this._parts = new a(this, {
|
|
15
|
+
tags: ["void-combobox-content", "void-option"],
|
|
16
|
+
onChange: () => {
|
|
17
|
+
this._wire(), this._wiring || this.requestUpdate();
|
|
18
|
+
}
|
|
19
|
+
}), this._overlay = new c(this, {
|
|
20
|
+
kind: "listbox",
|
|
21
|
+
surface: () => this._content(),
|
|
22
|
+
isOpen: () => this.open && !this.disabled,
|
|
23
|
+
setOpen: (e) => {
|
|
24
|
+
this.open = e;
|
|
25
|
+
},
|
|
26
|
+
anchor: () => this._input(),
|
|
27
|
+
attr: (e, t, n) => this._parts.set(e, t, n),
|
|
28
|
+
style: (e, t, n) => this._parts.style(e, t, n),
|
|
29
|
+
initialFocus: () => !1
|
|
30
|
+
}), this._initial = !1, this._onPointerDown = (e) => {
|
|
31
|
+
let t = this._content();
|
|
32
|
+
if (!t || !t.contains(e.target)) return;
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
let n = e.target.closest("void-option");
|
|
35
|
+
n && !n.disabled && this._options.includes(n) && this._selectOption(n);
|
|
36
|
+
}, this._onInputFocus = () => {
|
|
37
|
+
this.disabled || t(this) || (this._overlay.requestOpen("focus"), this._query = "", this._active = null);
|
|
10
38
|
}, this._onInput = (e) => {
|
|
11
|
-
this._query = e.target.value, this.
|
|
39
|
+
this._query = e.target.value, this.open = !0, this._active = null, this.requestUpdate();
|
|
12
40
|
}, this._onInputKeydown = (e) => {
|
|
13
|
-
|
|
41
|
+
if (this.disabled || e.isComposing) return;
|
|
42
|
+
let t = e.key;
|
|
43
|
+
if (t === "ArrowDown" || t === "ArrowUp") {
|
|
44
|
+
if (e.preventDefault(), this.open) e.altKey ? t === "ArrowUp" && this._close("escape") : this._moveActive(t === "ArrowDown" ? "next" : "prev");
|
|
45
|
+
else if (this._query = "", this._overlay.requestOpen("keyboard"), !e.altKey) {
|
|
46
|
+
let e = this._visible.find((e) => e.value === this.value && !e.disabled);
|
|
47
|
+
e ? this._active = e : this._moveActive(t === "ArrowDown" ? "next" : "prev");
|
|
48
|
+
}
|
|
49
|
+
this.requestUpdate();
|
|
50
|
+
} else t === "Enter" ? this.open && this._active && !this._active.disabled ? (e.preventDefault(), this._selectOption(this._active)) : this.open && this._close("escape") : t === "Escape" ? this.open && (e.preventDefault(), e.stopPropagation(), this._close("escape")) : (t === "ArrowLeft" || t === "ArrowRight" || t === "Home" || t === "End") && this._active && (this._active = null, this.requestUpdate());
|
|
14
51
|
}, this._onInputBlur = () => {
|
|
15
52
|
setTimeout(() => {
|
|
16
|
-
this.
|
|
53
|
+
this.contains(document.activeElement) && document.activeElement?.tagName === "INPUT" || this._close("blur");
|
|
17
54
|
}, 150);
|
|
18
|
-
}, this._onDocumentClick = (e) => {
|
|
19
|
-
this.contains(e.target) || (this._open = !1, this._query = "", this.requestUpdate());
|
|
20
|
-
}, this._onDocumentKeydown = (e) => {
|
|
21
|
-
e.key === "Escape" && this._open && (this._open = !1, this._query = "", this.requestUpdate());
|
|
22
55
|
};
|
|
23
56
|
}
|
|
57
|
+
static {
|
|
58
|
+
this.labelTarget = "input[role=combobox]";
|
|
59
|
+
}
|
|
60
|
+
_content() {
|
|
61
|
+
return this._parts.one("void-combobox-content");
|
|
62
|
+
}
|
|
63
|
+
_input() {
|
|
64
|
+
return this.querySelector(":scope > input[role=combobox]");
|
|
65
|
+
}
|
|
66
|
+
get _options() {
|
|
67
|
+
let e = this._content();
|
|
68
|
+
return e ? this._parts.within(e, "void-option") : [];
|
|
69
|
+
}
|
|
70
|
+
get _visible() {
|
|
71
|
+
if (!this._query) return this._options;
|
|
72
|
+
let e = this._query.toLowerCase();
|
|
73
|
+
return this._options.filter((t) => l(t).toLowerCase().includes(e));
|
|
74
|
+
}
|
|
24
75
|
connectedCallback() {
|
|
25
|
-
super.connectedCallback(), this.
|
|
76
|
+
super.connectedCallback(), this.addEventListener("mousedown", this._onPointerDown);
|
|
26
77
|
}
|
|
27
|
-
|
|
28
|
-
|
|
78
|
+
_adoptSelected(e) {
|
|
79
|
+
if (this._initial) return;
|
|
80
|
+
if (this.value || this.hasAttribute("value")) {
|
|
81
|
+
this._initial = !0;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
let t = e.find((e) => e.hasAttribute("selected"));
|
|
85
|
+
t && (this._initial = !0, this.value = t.getAttribute("value") ?? "");
|
|
86
|
+
}
|
|
87
|
+
willUpdate(e) {
|
|
88
|
+
super.willUpdate(e), e.has("open") && !this.open && (this._query = "", this._active = null);
|
|
29
89
|
}
|
|
30
90
|
updated(e) {
|
|
31
|
-
super.updated(e), this.
|
|
91
|
+
super.updated(e), this._wiring = !0;
|
|
92
|
+
try {
|
|
93
|
+
this._parts.sync();
|
|
94
|
+
} finally {
|
|
95
|
+
this._wiring = !1;
|
|
96
|
+
}
|
|
97
|
+
this.open && this._active?.scrollIntoView?.({ block: "nearest" });
|
|
98
|
+
}
|
|
99
|
+
_wire() {
|
|
100
|
+
let e = this._content(), t = this._input(), n = this._options, r = this.open && !this.disabled, i = r ? this._query.toLowerCase() : "";
|
|
101
|
+
this._adoptSelected(n), this._active && (!n.includes(this._active) || this._active.disabled) && (this._active = null);
|
|
102
|
+
let a = 0;
|
|
103
|
+
for (let e of n) {
|
|
104
|
+
this._parts.set(e, "role", "option"), this._parts.id(e, "void-option"), this._parts.set(e, "aria-selected", e.value === this.value ? "true" : null), this._parts.set(e, "aria-disabled", e.disabled ? "true" : null);
|
|
105
|
+
let t = !i || l(e).toLowerCase().includes(i);
|
|
106
|
+
this._parts.set(e, "hidden", !t), t ? a++ : e === this._active && (this._active = null), this._parts.set(e, "active", e === this._active);
|
|
107
|
+
}
|
|
108
|
+
if (e) {
|
|
109
|
+
this._parts.set(e, "popover", "manual"), this._parts.set(e, "role", "listbox"), this._parts.id(e, "void-combobox-content");
|
|
110
|
+
let n = r ? t?.getAttribute("aria-labelledby") ?? null : null;
|
|
111
|
+
this._parts.set(e, "aria-labelledby", n), this._parts.set(e, "aria-label", r && !n && (t?.getAttribute("aria-label") || this.placeholder) || null), this._parts.set(e, "empty", a === 0), t && this._parts.set(t, "aria-activedescendant", r && this._active ? this._parts.id(this._active, "void-option") : null);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
_controls(e) {
|
|
115
|
+
let t = e ? this._content() : null;
|
|
116
|
+
return t ? this._parts.id(t, "void-combobox-content") : d;
|
|
32
117
|
}
|
|
33
118
|
render() {
|
|
34
|
-
let e = this._options.
|
|
35
|
-
return
|
|
119
|
+
let e = this._options.find((e) => e.value === this.value), t = this.open && !this.disabled;
|
|
120
|
+
return u`
|
|
36
121
|
<input
|
|
37
122
|
class="void-combobox-input"
|
|
38
|
-
|
|
123
|
+
role="combobox"
|
|
124
|
+
.value=${p(t ? this._query : e ? l(e) : this.value || "")}
|
|
39
125
|
placeholder=${this.placeholder}
|
|
126
|
+
aria-label=${this.placeholder}
|
|
40
127
|
?disabled=${this.disabled}
|
|
41
128
|
autocomplete="off"
|
|
42
129
|
aria-autocomplete="list"
|
|
43
|
-
aria-
|
|
130
|
+
aria-haspopup="listbox"
|
|
131
|
+
aria-expanded=${String(t)}
|
|
132
|
+
aria-controls=${this._controls(t)}
|
|
133
|
+
aria-required=${this.required ? "true" : d}
|
|
44
134
|
aria-invalid=${this.error ? "true" : "false"}
|
|
45
135
|
@focus=${this._onInputFocus}
|
|
46
136
|
@input=${this._onInput}
|
|
47
137
|
@keydown=${this._onInputKeydown}
|
|
48
138
|
@blur=${this._onInputBlur}
|
|
49
139
|
/>
|
|
50
|
-
${this.
|
|
51
|
-
<div class="void-combobox-dropdown" role="listbox" aria-label=${this.placeholder}>
|
|
52
|
-
${e.length > 0 ? e.map((e) => n`
|
|
53
|
-
<div
|
|
54
|
-
class="void-combobox-option"
|
|
55
|
-
role="option"
|
|
56
|
-
aria-selected=${e.value === this.value ? "true" : "false"}
|
|
57
|
-
@mousedown=${(t) => {
|
|
58
|
-
t.preventDefault(), this._selectOption(e);
|
|
59
|
-
}}
|
|
60
|
-
>${e.textContent?.trim() || e.value}</div>
|
|
61
|
-
`) : n`<div class="void-combobox-empty">No options found</div>`}
|
|
62
|
-
</div>
|
|
63
|
-
` : r}
|
|
64
|
-
${this.error ? n`<span class="void-combobox-error">${this.error}</span>` : r}
|
|
140
|
+
${this.error ? u`<span class="void-combobox-error">${this.error}</span>` : d}
|
|
65
141
|
`;
|
|
66
142
|
}
|
|
143
|
+
disconnectedCallback() {
|
|
144
|
+
super.disconnectedCallback(), this.removeEventListener("mousedown", this._onPointerDown);
|
|
145
|
+
}
|
|
146
|
+
_close(e = "api") {
|
|
147
|
+
this.open && this._overlay.requestClose(e), this._query = "", this._active = null;
|
|
148
|
+
}
|
|
149
|
+
_moveActive(e) {
|
|
150
|
+
let t = this._visible, n = t.map((e) => e.disabled), r = this._active ? t.indexOf(this._active) : -1;
|
|
151
|
+
if (r < 0 && !this._query) {
|
|
152
|
+
let e = t.find((e) => e.value === this.value && !e.disabled);
|
|
153
|
+
if (e) {
|
|
154
|
+
this._active = e;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
let i;
|
|
159
|
+
i = e === "next" ? o(n, r, 1) : r < 0 ? s(n, -1) : o(n, r, -1), this._active = i >= 0 ? t[i] : null;
|
|
160
|
+
}
|
|
67
161
|
_selectOption(e) {
|
|
68
|
-
this.
|
|
162
|
+
this._initial = !0, this.value = e.value, this._close("select"), this.dispatchEvent(new CustomEvent("void-change", {
|
|
69
163
|
bubbles: !0,
|
|
70
164
|
composed: !0,
|
|
71
165
|
detail: { value: this.value }
|
|
72
166
|
}));
|
|
73
167
|
}
|
|
74
168
|
};
|
|
75
|
-
|
|
169
|
+
r([f({ type: String })], m.prototype, "value", void 0), r([f({ type: String })], m.prototype, "placeholder", void 0), r([f({
|
|
76
170
|
type: Boolean,
|
|
77
171
|
reflect: !0
|
|
78
|
-
})],
|
|
172
|
+
})], m.prototype, "disabled", void 0), r([f({
|
|
79
173
|
type: String,
|
|
80
174
|
reflect: !0
|
|
81
|
-
})],
|
|
175
|
+
})], m.prototype, "size", void 0), r([f({
|
|
82
176
|
type: String,
|
|
83
177
|
reflect: !0
|
|
84
|
-
})],
|
|
178
|
+
})], m.prototype, "error", void 0), r([f({
|
|
85
179
|
type: String,
|
|
86
180
|
reflect: !0
|
|
87
|
-
})],
|
|
181
|
+
})], m.prototype, "name", void 0), r([f({
|
|
182
|
+
type: Boolean,
|
|
183
|
+
reflect: !0
|
|
184
|
+
})], m.prototype, "open", void 0), customElements.get("void-combobox") || customElements.define("void-combobox", m);
|
|
88
185
|
//#endregion
|
|
89
|
-
export {
|
|
186
|
+
export { m as VoidCombobox };
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
/** Rich text entry area for messaging UIs, comment boxes, and social post composers. */
|
|
3
3
|
export declare class VoidComposeInput extends VoidElement {
|
|
4
|
+
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
5
|
+
static labelTarget: string;
|
|
6
|
+
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
7
|
+
static editState: string[];
|
|
8
|
+
/** The draft text. It is cleared after each send. */
|
|
4
9
|
value: string;
|
|
10
|
+
/** Hint shown while the box is empty. Defaults to `Type a message...`. */
|
|
5
11
|
placeholder: string;
|
|
12
|
+
/** Stop the box and the send button reacting. */
|
|
6
13
|
disabled: boolean;
|
|
14
|
+
/** Maximum number of characters. 0 (the default) means no limit. */
|
|
7
15
|
maxlength: number;
|
|
8
16
|
private _textarea;
|
|
9
17
|
render(): import('lit').TemplateResult<1>;
|
|
@@ -16,4 +24,3 @@ declare global {
|
|
|
16
24
|
'void-compose-input': VoidComposeInput;
|
|
17
25
|
}
|
|
18
26
|
}
|
|
19
|
-
//# sourceMappingURL=compose-input.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
3
|
import { html as n } from "lit";
|
|
4
4
|
import { property as r, query as i } from "lit/decorators.js";
|
|
@@ -7,6 +7,12 @@ var a = class extends e {
|
|
|
7
7
|
constructor(...e) {
|
|
8
8
|
super(...e), this.value = "", this.placeholder = "Type a message...", this.disabled = !1, this.maxlength = 0;
|
|
9
9
|
}
|
|
10
|
+
static {
|
|
11
|
+
this.labelTarget = "textarea";
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
this.editState = ["value"];
|
|
15
|
+
}
|
|
10
16
|
render() {
|
|
11
17
|
return n`
|
|
12
18
|
<div class="void-compose-input-wrapper">
|
|
@@ -38,7 +44,7 @@ var a = class extends e {
|
|
|
38
44
|
let t = e.target;
|
|
39
45
|
this.value = t.value, t.style.height = "auto";
|
|
40
46
|
let n = t.scrollHeight;
|
|
41
|
-
t.style.height = "", this.
|
|
47
|
+
t.style.height = "", this.setHostStyle("--void-compose-input-height", `${n}px`), this.dispatchEvent(new CustomEvent("void-input", {
|
|
42
48
|
bubbles: !0,
|
|
43
49
|
composed: !0,
|
|
44
50
|
detail: { value: this.value }
|
|
@@ -50,7 +56,7 @@ var a = class extends e {
|
|
|
50
56
|
_onSend() {
|
|
51
57
|
if (this.disabled || !this.value) return;
|
|
52
58
|
let e = this.value;
|
|
53
|
-
this.value = "", this._textarea && (this._textarea.style.height = "", this.
|
|
59
|
+
this.value = "", this._textarea && (this._textarea.style.height = "", this.setHostStyle("--void-compose-input-height", null)), this.dispatchEvent(new CustomEvent("void-submit", {
|
|
54
60
|
bubbles: !0,
|
|
55
61
|
composed: !0,
|
|
56
62
|
detail: { value: e }
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { VoidModal } from '../modal.js';
|
|
2
|
+
/**
|
|
3
|
+
* Modal overlay for confirmations, detail views, and multi-step forms that require user attention before continuing.
|
|
4
|
+
*
|
|
5
|
+
* Write its regions as parts: `<void-dialog-title>` (required: it names the dialog), then optionally
|
|
6
|
+
* `<void-dialog-description>`, `<void-dialog-body>` and `<void-dialog-actions>`. The parts are the final DOM: the
|
|
7
|
+
* dialog never moves them. It opens as a native modal dialog (`showModal()`): in the top layer above everything, the
|
|
8
|
+
* page behind it inert (Tab and assistive technology cannot reach it), scrolling locked while any modal is open.
|
|
9
|
+
* Focus moves to the first `[autofocus]` element, else the first focusable element of its parts, else the close
|
|
10
|
+
* button, and returns to the element that had it when the dialog closes. A `<form method="dialog">` inside closes
|
|
11
|
+
* it; the parts may sit inside such a form.
|
|
12
|
+
*
|
|
13
|
+
* @attr {string} aria-label - Accessible name when there is no `<void-dialog-title>` (prefer the title).
|
|
14
|
+
* @csspart surface - The native `<dialog>` that holds the parts (style its `::backdrop` through it).
|
|
15
|
+
* @csspart close - The close button.
|
|
16
|
+
* @fires {CustomEvent<{ reason: 'api' }>} void-open - The dialog opened. `detail.reason` is `api` (attribute or property).
|
|
17
|
+
* @fires {CustomEvent<{ reason: 'escape' | 'outside' | 'close-button' | 'form' | 'parent' | 'api' }>} void-close - The
|
|
18
|
+
* dialog is closing. Cancelable (`preventDefault()` keeps it open) when the user caused it: `escape`, `outside` (a
|
|
19
|
+
* press on the backdrop) or `close-button`. Not cancelable for `form` (a `method="dialog"` form), `parent` (an
|
|
20
|
+
* enclosing overlay closed) or `api` (the `open` attribute or property changed, including a server re-render).
|
|
21
|
+
*/
|
|
22
|
+
export declare class VoidDialog extends VoidModal {
|
|
23
|
+
/** Width of the dialog panel: `sm`, `md` (default) or `lg`. */
|
|
24
|
+
size: 'sm' | 'md' | 'lg';
|
|
20
25
|
}
|
|
21
26
|
declare global {
|
|
22
27
|
interface HTMLElementTagNameMap {
|
|
23
28
|
'void-dialog': VoidDialog;
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
|
-
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -1,64 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../chunks/
|
|
3
|
-
import {
|
|
4
|
-
import { property as i } from "lit/decorators.js";
|
|
1
|
+
import { t as e } from "../chunks/decorate-CaYbmmmm.js";
|
|
2
|
+
import { t } from "../chunks/modal-D_YVy2vg.js";
|
|
3
|
+
import { property as n } from "lit/decorators.js";
|
|
5
4
|
//#region src/components/dialog.ts
|
|
6
|
-
var
|
|
5
|
+
var r = class extends t {
|
|
7
6
|
constructor(...e) {
|
|
8
|
-
super(...e), this.
|
|
9
|
-
e.key === "Escape" && this.closable && this._close();
|
|
10
|
-
}, this._onBackdropClick = (e) => {
|
|
11
|
-
this.closable && e.target === e.currentTarget && this._close();
|
|
12
|
-
}, this._onBackdropKeydown = (e) => {
|
|
13
|
-
e.key === "Escape" && this.closable && this._close();
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
connectedCallback() {
|
|
17
|
-
super.connectedCallback(), this.setAttribute("role", "dialog"), this.setAttribute("aria-modal", "true"), this.heading && this.setAttribute("aria-label", this.heading), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
18
|
-
}
|
|
19
|
-
updated(e) {
|
|
20
|
-
if (super.updated(e), e.has("heading") && (this.heading ? this.setAttribute("aria-label", this.heading) : this.removeAttribute("aria-label")), e.has("open") && (this.open ? (document.body.style.overflow = "hidden", document.addEventListener("keydown", this._handleKeydown), this._focusFirst()) : (document.body.style.overflow = "", document.removeEventListener("keydown", this._handleKeydown))), !this._didSetup) {
|
|
21
|
-
let e = this.querySelector(".void-dialog-body");
|
|
22
|
-
if (e) {
|
|
23
|
-
this._didSetup = !0;
|
|
24
|
-
for (let t of this._userContent) e.appendChild(t);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
disconnectedCallback() {
|
|
29
|
-
super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown), this.open && (document.body.style.overflow = "");
|
|
30
|
-
}
|
|
31
|
-
_focusFirst() {
|
|
32
|
-
requestAnimationFrame(() => {
|
|
33
|
-
this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])")?.focus();
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
_close() {
|
|
37
|
-
this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
|
|
38
|
-
bubbles: !0,
|
|
39
|
-
composed: !0
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
return this.open ? n`
|
|
44
|
-
<div class="void-dialog-backdrop" @click="${this._onBackdropClick}" @keydown="${this._onBackdropKeydown}">
|
|
45
|
-
<div class="void-dialog-panel">
|
|
46
|
-
<div class="void-dialog-header">
|
|
47
|
-
<span class="void-dialog-heading">${this.heading}</span>
|
|
48
|
-
${this.closable ? n`<button type="button" class="void-dialog-close" aria-label="Close" @click="${this._close}">×</button>` : r}
|
|
49
|
-
</div>
|
|
50
|
-
<div class="void-dialog-body"></div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
` : r;
|
|
7
|
+
super(...e), this.size = "md";
|
|
54
8
|
}
|
|
55
9
|
};
|
|
56
|
-
|
|
57
|
-
type: Boolean,
|
|
58
|
-
reflect: !0
|
|
59
|
-
})], a.prototype, "open", void 0), t([i({ type: String })], a.prototype, "heading", void 0), t([i({
|
|
10
|
+
e([n({
|
|
60
11
|
type: String,
|
|
61
12
|
reflect: !0
|
|
62
|
-
})],
|
|
13
|
+
})], r.prototype, "size", void 0), customElements.get("void-dialog") || customElements.define("void-dialog", r);
|
|
63
14
|
//#endregion
|
|
64
|
-
export {
|
|
15
|
+
export { r as VoidDialog };
|
|
@@ -2,7 +2,15 @@ import { nothing } from 'lit';
|
|
|
2
2
|
import { VoidElement } from '../base.js';
|
|
3
3
|
/** Visual separator between sections in forms, sidebars, and content layouts; supports optional label text. */
|
|
4
4
|
export declare class VoidDivider extends VoidElement {
|
|
5
|
+
/**
|
|
6
|
+
* Optional text drawn in the line, for a labelled break such as `or`. Also the separator's accessible
|
|
7
|
+
* name.
|
|
8
|
+
*/
|
|
5
9
|
label: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* `horizontal` (default) draws a rule across the available width; `vertical` draws one the height of
|
|
12
|
+
* its container, for use between inline items.
|
|
13
|
+
*/
|
|
6
14
|
orientation: 'horizontal' | 'vertical';
|
|
7
15
|
connectedCallback(): void;
|
|
8
16
|
updated(changed: Map<string, unknown>): void;
|
|
@@ -13,4 +21,3 @@ declare global {
|
|
|
13
21
|
'void-divider': VoidDivider;
|
|
14
22
|
}
|
|
15
23
|
}
|
|
16
|
-
//# sourceMappingURL=divider.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
3
|
import { html as n, nothing as r } from "lit";
|
|
4
4
|
import { property as i } from "lit/decorators.js";
|
|
@@ -8,10 +8,10 @@ var a = class extends e {
|
|
|
8
8
|
super(...e), this.label = void 0, this.orientation = "horizontal";
|
|
9
9
|
}
|
|
10
10
|
connectedCallback() {
|
|
11
|
-
super.connectedCallback(), this.
|
|
11
|
+
super.connectedCallback(), this.setHostAttribute("role", "separator"), this.setHostAttribute("aria-orientation", this.orientation);
|
|
12
12
|
}
|
|
13
13
|
updated(e) {
|
|
14
|
-
e.has("orientation") && this.
|
|
14
|
+
e.has("orientation") && this.setHostAttribute("aria-orientation", this.orientation);
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
return this.label ? n`${this.label}` : r;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { VoidElement } from '../base.js';
|
|
2
3
|
export interface DonutChartSegment {
|
|
3
4
|
name: string;
|
|
4
5
|
value: number;
|
|
@@ -7,9 +8,18 @@ export interface DonutChartSegment {
|
|
|
7
8
|
export interface DonutChartData {
|
|
8
9
|
segments: DonutChartSegment[];
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Donut chart for part-to-whole breakdowns, drawn in SVG with animated segments and an optional total in the
|
|
13
|
+
* centre. Give it `data` (`{ segments: [{ name, value }] }`) from script; it has no children. The chart is an
|
|
14
|
+
* image to assistive technology, so set `aria-label` and state the key figures in the surrounding text.
|
|
15
|
+
*/
|
|
16
|
+
export declare class VoidDonutChart extends VoidElement {
|
|
17
|
+
/** Width and height of the chart in pixels. Defaults to 220. */
|
|
12
18
|
size: number;
|
|
19
|
+
/**
|
|
20
|
+
* Inner radius as a fraction of the outer radius, from 0 (a pie) to just under 1 (a thin ring).
|
|
21
|
+
* Defaults to 0.6.
|
|
22
|
+
*/
|
|
13
23
|
inner: number;
|
|
14
24
|
/** Visible gap between segments. `false`/`0` = seamless (segments touch).
|
|
15
25
|
`true` = 1% of the total arc consumed by gaps (the sensible default
|
|
@@ -17,11 +27,25 @@ export declare class VoidDonutChart extends LitElement {
|
|
|
17
27
|
total arc consumed by gaps. Higher % = clearer segmentation but more
|
|
18
28
|
arc sacrificed to whitespace; the precision-vs-clarity tradeoff. */
|
|
19
29
|
gaps: boolean | number;
|
|
30
|
+
/**
|
|
31
|
+
* How segments are drawn: `filled` (default), `outline` (tinted with a border) or `wireframe` (border
|
|
32
|
+
* only).
|
|
33
|
+
*/
|
|
20
34
|
variant: 'filled' | 'outline' | 'wireframe';
|
|
21
|
-
|
|
35
|
+
/** Print each segment's value on its arc, abbreviated above 1000 (`1.2k`). */
|
|
36
|
+
showValue: boolean;
|
|
37
|
+
/** Print the sum of the segments in the centre of the ring. */
|
|
22
38
|
showTotal: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Accessible name of the chart, such as `Traffic by source`. The chart is an image to assistive
|
|
41
|
+
* technology, so set it and put the key figures in the text around it.
|
|
42
|
+
*/
|
|
23
43
|
ariaLabel: string;
|
|
24
44
|
private _data;
|
|
45
|
+
/**
|
|
46
|
+
* The chart's data: `{ segments: [{ name, value, color? }] }`. Each segment's share of the ring is its
|
|
47
|
+
* `value` over the sum of all values. Property only: assign a new object to update the chart and animate to it.
|
|
48
|
+
*/
|
|
25
49
|
get data(): DonutChartData;
|
|
26
50
|
set data(next: DonutChartData);
|
|
27
51
|
private _phase;
|
|
@@ -54,4 +78,3 @@ declare global {
|
|
|
54
78
|
'void-donut-chart': VoidDonutChart;
|
|
55
79
|
}
|
|
56
80
|
}
|
|
57
|
-
//# sourceMappingURL=donut-chart.d.ts.map
|