@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
package/dist/components/tabs.js
CHANGED
|
@@ -1,76 +1,107 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { n } from "../chunks/parts-D30c8OoG.js";
|
|
4
|
+
import { i as r, n as i } from "../chunks/keyboard-MQpfTX5I.js";
|
|
5
|
+
import { property as a } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/tabs.ts
|
|
6
|
-
var
|
|
7
|
+
var o = "void-tabs-list", s = "void-tabs-trigger", c = "void-tabs-content", l = class extends e {
|
|
7
8
|
constructor(...e) {
|
|
8
|
-
super(...e), this.
|
|
9
|
+
super(...e), this.value = "", this.size = "md", this.activation = "manual", this._parts = new n(this, {
|
|
10
|
+
tags: [
|
|
11
|
+
o,
|
|
12
|
+
s,
|
|
13
|
+
c
|
|
14
|
+
],
|
|
15
|
+
onChange: () => this._wire()
|
|
16
|
+
}), this._matchedValue = null, this._onClick = (e) => {
|
|
17
|
+
let t = this._triggerOf(e.target);
|
|
18
|
+
t && this._select(t);
|
|
19
|
+
}, this._onKeydown = (e) => {
|
|
20
|
+
if (e.altKey || e.ctrlKey || e.metaKey || e.defaultPrevented) return;
|
|
21
|
+
let t = this._triggerOf(e.target);
|
|
22
|
+
if (!t) return;
|
|
23
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
24
|
+
e.preventDefault(), this._select(t);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let n = this._triggers(), a = n.indexOf(t), o = n.map((e) => this._disabled(e)), s = -1;
|
|
28
|
+
if (e.key === "ArrowRight") s = r(o, a, 1);
|
|
29
|
+
else if (e.key === "ArrowLeft") s = r(o, a, -1);
|
|
30
|
+
else if (e.key === "Home") s = i(o, 1);
|
|
31
|
+
else if (e.key === "End") s = i(o, -1);
|
|
32
|
+
else return;
|
|
33
|
+
e.preventDefault(), !(s < 0) && (n[s].focus(), this.activation === "auto" && this._select(n[s]));
|
|
34
|
+
};
|
|
9
35
|
}
|
|
10
36
|
connectedCallback() {
|
|
11
|
-
super.connectedCallback(), this.
|
|
37
|
+
super.connectedCallback(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeydown);
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._onClick), this.removeEventListener("keydown", this._onKeydown);
|
|
12
41
|
}
|
|
13
42
|
updated(e) {
|
|
14
|
-
super.updated(e),
|
|
43
|
+
super.updated(e), e.has("value") && this._wire();
|
|
15
44
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type: String,
|
|
19
|
-
reflect: !0
|
|
20
|
-
})], i.prototype, "tab", void 0), t([r({
|
|
21
|
-
type: String,
|
|
22
|
-
reflect: !0
|
|
23
|
-
})], i.prototype, "label", void 0), t([r({
|
|
24
|
-
type: Boolean,
|
|
25
|
-
reflect: !0
|
|
26
|
-
})], i.prototype, "active", void 0), customElements.get("void-tab-panel") || customElements.define("void-tab-panel", i);
|
|
27
|
-
var a = class extends e {
|
|
28
|
-
constructor(...e) {
|
|
29
|
-
super(...e), this.value = "", this.size = "md", this._panels = [];
|
|
45
|
+
_triggers() {
|
|
46
|
+
return this._parts.within(this._parts.one(o), s);
|
|
30
47
|
}
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
_disabled(e) {
|
|
49
|
+
return e.hasAttribute("disabled");
|
|
33
50
|
}
|
|
34
|
-
|
|
35
|
-
|
|
51
|
+
_valueOf(e) {
|
|
52
|
+
return e.getAttribute("value") ?? "";
|
|
36
53
|
}
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
_reconcileRemovedSelection(e) {
|
|
55
|
+
if (e.some((e) => this._valueOf(e) === this.value)) {
|
|
56
|
+
this._matchedValue = this.value;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (this._matchedValue === null || this._matchedValue !== this.value || !e.length) return;
|
|
60
|
+
let t = e.find((e) => !this._disabled(e));
|
|
61
|
+
this._matchedValue = null, t && (this.value = this._valueOf(t), this._matchedValue = this.value);
|
|
39
62
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
_wire() {
|
|
64
|
+
let e = this._parts.one(o), t = this._triggers(), n = this._parts.all(c);
|
|
65
|
+
this._reconcileRemovedSelection(t), e && this._parts.set(e, "role", "tablist");
|
|
66
|
+
let r = t.map((e) => this._disabled(e)), a = t.findIndex((e, t) => this._valueOf(e) === this.value && !r[t]);
|
|
67
|
+
a < 0 && (a = i(r, 1));
|
|
68
|
+
let s = /* @__PURE__ */ new Map();
|
|
69
|
+
for (let e of n) s.has(this._valueOf(e)) || s.set(this._valueOf(e), e);
|
|
70
|
+
let l = /* @__PURE__ */ new Map();
|
|
71
|
+
t.forEach((e, t) => {
|
|
72
|
+
let n = this._valueOf(e), i = n === this.value, o = this._parts.id(e, "void-tabs-trigger");
|
|
73
|
+
l.has(n) || l.set(n, o);
|
|
74
|
+
let c = s.get(n);
|
|
75
|
+
this._parts.set(e, "role", "tab"), this._parts.set(e, "aria-selected", i ? "true" : "false"), this._parts.set(e, "active", i), this._parts.set(e, "tabindex", t === a ? "0" : "-1"), this._parts.set(e, "aria-disabled", r[t] ? "true" : null), this._parts.set(e, "aria-controls", c ? this._parts.id(c, "void-tabs-content") : null);
|
|
76
|
+
});
|
|
77
|
+
for (let e of n) {
|
|
78
|
+
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", l.get(t) ?? null);
|
|
80
|
+
}
|
|
58
81
|
}
|
|
59
|
-
|
|
60
|
-
|
|
82
|
+
_select(e) {
|
|
83
|
+
if (this._disabled(e)) return;
|
|
84
|
+
let t = this._valueOf(e);
|
|
85
|
+
this.value = t, this._wire(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
61
86
|
bubbles: !0,
|
|
62
87
|
composed: !0,
|
|
63
|
-
detail: { value:
|
|
88
|
+
detail: { value: t }
|
|
64
89
|
}));
|
|
65
90
|
}
|
|
66
|
-
|
|
67
|
-
let
|
|
68
|
-
|
|
91
|
+
_triggerOf(e) {
|
|
92
|
+
let t = e instanceof Element ? e.closest(s) : null;
|
|
93
|
+
return t && this._parts.owns(t) ? t : null;
|
|
69
94
|
}
|
|
70
95
|
};
|
|
71
|
-
t([
|
|
96
|
+
t([a({
|
|
97
|
+
type: String,
|
|
98
|
+
reflect: !0
|
|
99
|
+
})], l.prototype, "value", void 0), t([a({
|
|
100
|
+
type: String,
|
|
101
|
+
reflect: !0
|
|
102
|
+
})], l.prototype, "size", void 0), t([a({
|
|
72
103
|
type: String,
|
|
73
104
|
reflect: !0
|
|
74
|
-
})],
|
|
105
|
+
})], l.prototype, "activation", void 0), customElements.get("void-tabs") || customElements.define("void-tabs", l);
|
|
75
106
|
//#endregion
|
|
76
|
-
export {
|
|
107
|
+
export { l as VoidTabs };
|
package/dist/components/tag.d.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { nothing } from 'lit';
|
|
2
2
|
import { VoidElement } from '../base.js';
|
|
3
|
-
|
|
3
|
+
import { ProjectionController } from '../projection.js';
|
|
4
|
+
/**
|
|
5
|
+
* Removable label chip for selected filters, applied tags, and multi-value inputs.
|
|
6
|
+
*
|
|
7
|
+
* Inside a `<void-list>` or an element with `role="list"` a tag is a list item (`role="listitem"`);
|
|
8
|
+
* anywhere else it has no role.
|
|
9
|
+
*/
|
|
4
10
|
export declare class VoidTag extends VoidElement {
|
|
5
|
-
|
|
11
|
+
/** Status colour: `default`, `error`, `warning`, `caution`, `success`, `info`, `notice` or `highlight`. */
|
|
12
|
+
color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
|
|
13
|
+
/** Show a remove button. Clicking it fires `void-remove` and removes the tag from the page. */
|
|
6
14
|
removable: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
/** Size step: `sm`, `md` (default) or `lg`. */
|
|
16
|
+
size: 'sm' | 'md' | 'lg';
|
|
17
|
+
protected readonly _projection: ProjectionController;
|
|
18
|
+
/**
|
|
19
|
+
* A list item only inside a list: a `<void-list>` or an element with `role="list"` (a row of tags marked
|
|
20
|
+
* up as a list). Anywhere else a tag is a plain chip with no role, as `listitem` outside a list is invalid.
|
|
21
|
+
*/
|
|
10
22
|
connectedCallback(): void;
|
|
11
|
-
protected updated(_changed: Map<string, unknown>): void;
|
|
12
23
|
render(): typeof nothing | import('lit').TemplateResult<1>;
|
|
13
24
|
private _remove;
|
|
14
25
|
}
|
|
@@ -17,4 +28,3 @@ declare global {
|
|
|
17
28
|
'void-tag': VoidTag;
|
|
18
29
|
}
|
|
19
30
|
}
|
|
20
|
-
//# sourceMappingURL=tag.d.ts.map
|
package/dist/components/tag.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { html as
|
|
4
|
-
import { property as
|
|
1
|
+
import { n as e, t } from "../chunks/base-CMruMbxC.js";
|
|
2
|
+
import { t as n } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { html as r, nothing as i } from "lit";
|
|
4
|
+
import { property as a } from "lit/decorators.js";
|
|
5
5
|
//#region src/components/tag.ts
|
|
6
|
-
var
|
|
7
|
-
constructor(...
|
|
8
|
-
super(...
|
|
6
|
+
var o = class extends t {
|
|
7
|
+
constructor(...t) {
|
|
8
|
+
super(...t), this.color = "default", this.removable = !1, this.size = "md", this._projection = new e(this, { regions: [{
|
|
9
|
+
name: "label",
|
|
10
|
+
target: "before"
|
|
11
|
+
}] });
|
|
9
12
|
}
|
|
10
13
|
connectedCallback() {
|
|
11
|
-
super.connectedCallback()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (super.updated(e), !this._didSetup) {
|
|
15
|
-
this._didSetup = !0;
|
|
16
|
-
let e = this.querySelector(".void-tag-close");
|
|
17
|
-
for (let t of this._userContent) e ? this.insertBefore(t, e) : this.appendChild(t);
|
|
18
|
-
}
|
|
14
|
+
super.connectedCallback();
|
|
15
|
+
let e = this.parentElement, t = !!e && (e.localName === "void-list" || e.getAttribute("role") === "list");
|
|
16
|
+
this.setHostAttribute("role", t ? "listitem" : null);
|
|
19
17
|
}
|
|
20
18
|
render() {
|
|
21
|
-
return this.removable ?
|
|
19
|
+
return this.removable ? r`<button type="button" class="void-tag-close" aria-label="Remove" @click="${this._remove}">×</button>` : i;
|
|
22
20
|
}
|
|
23
21
|
_remove() {
|
|
24
22
|
this.dispatchEvent(new CustomEvent("void-remove", {
|
|
@@ -27,15 +25,15 @@ var a = class extends e {
|
|
|
27
25
|
})), this.remove();
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
|
-
|
|
28
|
+
n([a({
|
|
31
29
|
type: String,
|
|
32
30
|
reflect: !0
|
|
33
|
-
})],
|
|
31
|
+
})], o.prototype, "color", void 0), n([a({
|
|
34
32
|
type: Boolean,
|
|
35
33
|
reflect: !0
|
|
36
|
-
})],
|
|
34
|
+
})], o.prototype, "removable", void 0), n([a({
|
|
37
35
|
type: String,
|
|
38
36
|
reflect: !0
|
|
39
|
-
})],
|
|
37
|
+
})], o.prototype, "size", void 0), customElements.get("void-tag") || customElements.define("void-tag", o);
|
|
40
38
|
//#endregion
|
|
41
|
-
export {
|
|
39
|
+
export { o as VoidTag };
|
|
@@ -1,28 +1,57 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
1
2
|
import { VoidElement } from '../base.js';
|
|
3
|
+
import { FormSubmission } from '../form-control.js';
|
|
2
4
|
export type TagValue = string | {
|
|
3
5
|
text: string;
|
|
4
6
|
color?: string;
|
|
5
7
|
};
|
|
8
|
+
declare const VoidTagsInput_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
6
9
|
/** Multi-tag input field for email recipients, category labels, keyword tagging, and comma-separated value entry. */
|
|
7
|
-
export declare class VoidTagsInput extends
|
|
10
|
+
export declare class VoidTagsInput extends VoidTagsInput_base {
|
|
11
|
+
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
12
|
+
static labelTarget: string;
|
|
13
|
+
/**
|
|
14
|
+
* The tags, as an array of strings or `{ text, color }` objects. Set it as a property from script, or
|
|
15
|
+
* as a JSON array in the attribute.
|
|
16
|
+
*/
|
|
8
17
|
value: TagValue[];
|
|
18
|
+
/** Stop the field accepting input and removing tags, and exclude the values from the form submission. */
|
|
9
19
|
disabled: boolean;
|
|
20
|
+
/** Show the tags but do not let the user add or remove any. Still submitted. */
|
|
10
21
|
readonly: boolean;
|
|
22
|
+
/** Maximum number of tags. Once reached, the entry field is hidden. Unlimited by default. */
|
|
11
23
|
max: number;
|
|
24
|
+
/** Hint in the entry field. Defaults to `Add tag...`. */
|
|
12
25
|
placeholder: string;
|
|
26
|
+
/** Size step: `sm`, `md` (default) or `lg`. */
|
|
13
27
|
size: 'sm' | 'md' | 'lg';
|
|
14
|
-
|
|
28
|
+
/** Status colour of the tags: `default`, `error`, `warning`, `caution`, `success`, `info`, `notice` or `highlight`. */
|
|
29
|
+
color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
|
|
30
|
+
/** How the tags are drawn: `outline` (default) or `filled`. */
|
|
15
31
|
variant: 'filled' | 'outline';
|
|
32
|
+
/** Accept the same tag more than once. Without it a tag that is already present is ignored. */
|
|
16
33
|
allowDuplicates: boolean;
|
|
17
34
|
private _tagText;
|
|
18
35
|
private _tagColor;
|
|
19
|
-
|
|
36
|
+
/**
|
|
37
|
+
* One entry per tag (its text), plus text still in the entry field that
|
|
38
|
+
* would be accepted as a tag: a submit must not silently drop what the user
|
|
39
|
+
* typed but has not confirmed with Enter or a comma.
|
|
40
|
+
*/
|
|
41
|
+
protected formSubmission(): FormSubmission;
|
|
42
|
+
/**
|
|
43
|
+
* The host has no role while the entry field is there: that native input is the control and carries the
|
|
44
|
+
* accessible name. Without it (read-only, or at `max`) there is nothing to label, so the host is a
|
|
45
|
+
* labelled group of the tags.
|
|
46
|
+
*/
|
|
47
|
+
protected updated(changed: PropertyValues): void;
|
|
20
48
|
render(): import('lit').TemplateResult<1>;
|
|
21
49
|
private _focusInput;
|
|
22
50
|
private _onContainerKeydown;
|
|
23
51
|
private _addTag;
|
|
24
52
|
private _removeTag;
|
|
25
53
|
private _onKeydown;
|
|
54
|
+
private _onFieldInput;
|
|
26
55
|
private _onPaste;
|
|
27
56
|
private _dispatchChange;
|
|
28
57
|
}
|
|
@@ -31,4 +60,4 @@ declare global {
|
|
|
31
60
|
'void-tags-input': VoidTagsInput;
|
|
32
61
|
}
|
|
33
62
|
}
|
|
34
|
-
|
|
63
|
+
export {};
|
|
@@ -1,54 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { html as r, nothing as i } from "lit";
|
|
5
|
+
import { property as a } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/tags-input.ts
|
|
6
|
-
var
|
|
7
|
+
var o = class extends n(e) {
|
|
7
8
|
constructor(...e) {
|
|
8
9
|
super(...e), this.value = [], this.disabled = !1, this.readonly = !1, this.max = Infinity, this.placeholder = "Add tag...", this.size = "md", this.color = "default", this.variant = "outline", this.allowDuplicates = !1;
|
|
9
10
|
}
|
|
11
|
+
static {
|
|
12
|
+
this.labelTarget = ".void-tags-input-field";
|
|
13
|
+
}
|
|
10
14
|
_tagText(e) {
|
|
11
15
|
return typeof e == "string" ? e : e.text;
|
|
12
16
|
}
|
|
13
17
|
_tagColor(e) {
|
|
14
18
|
return typeof e == "string" ? void 0 : e.color;
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
formSubmission() {
|
|
21
|
+
let e = this.value.map((e) => this._tagText(e)), t = this.querySelector(".void-tags-input-field")?.value.trim() ?? "";
|
|
22
|
+
return t && e.length < this.max && (this.allowDuplicates || !e.includes(t)) && e.push(t), e;
|
|
23
|
+
}
|
|
24
|
+
updated(e) {
|
|
25
|
+
super.updated(e), this.setHostAttribute("role", this.querySelector(".void-tags-input-field") ? null : "group");
|
|
18
26
|
}
|
|
19
27
|
render() {
|
|
20
28
|
let e = this.value.length >= this.max;
|
|
21
|
-
return
|
|
29
|
+
return r`
|
|
22
30
|
<div class="void-tags-input" @click=${this._focusInput} @keydown=${this._onContainerKeydown}>
|
|
23
31
|
${this.value.map((e, t) => {
|
|
24
|
-
let
|
|
25
|
-
return
|
|
26
|
-
<span
|
|
27
|
-
class="void-tags-input-tag"
|
|
28
|
-
|
|
29
|
-
aria-selected="true"
|
|
30
|
-
data-color=${this._tagColor(e) || r}
|
|
31
|
-
>
|
|
32
|
-
<span class="void-tags-input-tag-text">${i}</span>
|
|
33
|
-
${!this.disabled && !this.readonly ? n`<button
|
|
32
|
+
let n = this._tagText(e);
|
|
33
|
+
return r`
|
|
34
|
+
<span class="void-tags-input-tag" data-color=${this._tagColor(e) || i}>
|
|
35
|
+
<span class="void-tags-input-tag-text">${n}</span>
|
|
36
|
+
${!this.disabled && !this.readonly ? r`<button
|
|
34
37
|
type="button"
|
|
35
38
|
class="void-tags-input-tag-remove"
|
|
36
|
-
aria-label="Remove ${
|
|
39
|
+
aria-label="Remove ${n}"
|
|
37
40
|
@click=${(e) => {
|
|
38
41
|
e.stopPropagation(), this._removeTag(t);
|
|
39
42
|
}}
|
|
40
|
-
>×</button>` :
|
|
43
|
+
>×</button>` : i}
|
|
41
44
|
</span>
|
|
42
45
|
`;
|
|
43
46
|
})}
|
|
44
|
-
${!e && !this.readonly ?
|
|
47
|
+
${!e && !this.readonly ? r`<input
|
|
45
48
|
class="void-tags-input-field"
|
|
46
49
|
type="text"
|
|
47
50
|
placeholder=${this.value.length === 0 ? this.placeholder : ""}
|
|
48
51
|
?disabled=${this.disabled}
|
|
49
52
|
@keydown=${this._onKeydown}
|
|
53
|
+
@input=${this._onFieldInput}
|
|
50
54
|
@paste=${this._onPaste}
|
|
51
|
-
/>` :
|
|
55
|
+
/>` : i}
|
|
52
56
|
</div>
|
|
53
57
|
`;
|
|
54
58
|
}
|
|
@@ -69,10 +73,13 @@ var a = class extends e {
|
|
|
69
73
|
let t = e.target;
|
|
70
74
|
if (e.key === "Enter" || e.key === ",") {
|
|
71
75
|
e.preventDefault();
|
|
72
|
-
let n =
|
|
73
|
-
this._addTag(n),
|
|
76
|
+
let n = t.value;
|
|
77
|
+
t.value = "", this._addTag(n), this.formSync();
|
|
74
78
|
} else e.key === "Backspace" && t.value === "" && this.value.length > 0 && this._removeTag(this.value.length - 1);
|
|
75
79
|
}
|
|
80
|
+
_onFieldInput() {
|
|
81
|
+
this.formSync();
|
|
82
|
+
}
|
|
76
83
|
_onPaste(e) {
|
|
77
84
|
let t = e.clipboardData?.getData("text") ?? "";
|
|
78
85
|
if (t.includes(",")) {
|
|
@@ -89,21 +96,24 @@ var a = class extends e {
|
|
|
89
96
|
}));
|
|
90
97
|
}
|
|
91
98
|
};
|
|
92
|
-
t([
|
|
99
|
+
t([a({ type: Array })], o.prototype, "value", void 0), t([a({
|
|
93
100
|
type: Boolean,
|
|
94
101
|
reflect: !0
|
|
95
|
-
})],
|
|
102
|
+
})], o.prototype, "disabled", void 0), t([a({
|
|
96
103
|
type: Boolean,
|
|
97
104
|
reflect: !0
|
|
98
|
-
})],
|
|
105
|
+
})], o.prototype, "readonly", void 0), t([a({ type: Number })], o.prototype, "max", void 0), t([a({ type: String })], o.prototype, "placeholder", void 0), t([a({
|
|
99
106
|
type: String,
|
|
100
107
|
reflect: !0
|
|
101
|
-
})],
|
|
108
|
+
})], o.prototype, "size", void 0), t([a({
|
|
102
109
|
type: String,
|
|
103
110
|
reflect: !0
|
|
104
|
-
})],
|
|
111
|
+
})], o.prototype, "color", void 0), t([a({
|
|
105
112
|
type: String,
|
|
106
113
|
reflect: !0
|
|
107
|
-
})],
|
|
114
|
+
})], o.prototype, "variant", void 0), t([a({
|
|
115
|
+
type: Boolean,
|
|
116
|
+
attribute: "allow-duplicates"
|
|
117
|
+
})], o.prototype, "allowDuplicates", void 0), customElements.get("void-tags-input") || customElements.define("void-tags-input", o);
|
|
108
118
|
//#endregion
|
|
109
|
-
export {
|
|
119
|
+
export { o as VoidTagsInput };
|
|
@@ -1,18 +1,74 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare const VoidTextarea_base: (new (...args: any[]) => import('../form-control.js').VoidNativeFormControl) & typeof VoidElement;
|
|
3
|
+
/**
|
|
4
|
+
* Multi-line text entry for comment fields, description inputs, and freeform text that needs more than one line.
|
|
5
|
+
* The host has no role: the native textarea is the (multi-line) textbox and carries the accessible name,
|
|
6
|
+
* which `<void-field>` supplies.
|
|
7
|
+
*/
|
|
8
|
+
export declare class VoidTextarea extends VoidTextarea_base {
|
|
9
|
+
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
10
|
+
static labelTarget: string;
|
|
11
|
+
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
12
|
+
static editState: string[];
|
|
13
|
+
/**
|
|
14
|
+
* The text in the box. As an attribute it is the initial value (and the form's reset target); read or
|
|
15
|
+
* set the `value` property for the current text.
|
|
16
|
+
*/
|
|
4
17
|
value: string;
|
|
18
|
+
/**
|
|
19
|
+
* Hint text shown while the box is empty. It is not a label: wrap the textarea in `void-field
|
|
20
|
+
* label="..."`.
|
|
21
|
+
*/
|
|
5
22
|
placeholder: string;
|
|
23
|
+
/**
|
|
24
|
+
* Stop the box accepting input and exclude it from the form submission. Also disabled by an enclosing
|
|
25
|
+
* `<fieldset disabled>`.
|
|
26
|
+
*/
|
|
6
27
|
disabled: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Show the value but do not let the user edit it. Unlike `disabled`, a readonly box is focusable,
|
|
30
|
+
* selectable and still submitted.
|
|
31
|
+
*/
|
|
7
32
|
readonly: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The control must have a value before its form can be submitted. An empty control is invalid
|
|
35
|
+
* (`valueMissing`) and the browser reports it, as for a native field.
|
|
36
|
+
*/
|
|
8
37
|
required: boolean;
|
|
38
|
+
/** Key the value is submitted under in the form's `FormData`. Without a name the box submits nothing. */
|
|
9
39
|
name: string;
|
|
40
|
+
/** Visible height in lines of text. Defaults to 3. */
|
|
10
41
|
rows: number;
|
|
42
|
+
/** Which way the user may drag the corner handle: `vertical` (default), `both` or `none`. */
|
|
11
43
|
resize: 'none' | 'vertical' | 'both';
|
|
12
|
-
|
|
44
|
+
/** Size step: `sm`, `md` (default) or `lg`; sets the text size and padding. */
|
|
45
|
+
size: 'sm' | 'md' | 'lg';
|
|
46
|
+
/**
|
|
47
|
+
* Mark the box invalid: it gets the error styling and `aria-invalid`. The message itself is shown by
|
|
48
|
+
* the wrapping `void-field`, whose own `error` attribute sets this one.
|
|
49
|
+
*/
|
|
13
50
|
error: string;
|
|
14
|
-
|
|
51
|
+
/** Autofill hint forwarded to the native control (`autocomplete`), e.g. `current-password`, `one-time-code`, `email`. */
|
|
52
|
+
autocomplete: string;
|
|
53
|
+
/** Minimum number of characters, enforced by the native control (`minlength`) and reported through validity. */
|
|
54
|
+
minlength: number | undefined;
|
|
55
|
+
/** Maximum number of characters accepted by the native control (`maxlength`). */
|
|
56
|
+
maxlength: number | undefined;
|
|
57
|
+
/** Virtual keyboard hint forwarded to the native control (`inputmode`). */
|
|
58
|
+
inputMode: '' | 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
59
|
+
/** Label of the mobile keyboard's enter key (`enterkeyhint`). */
|
|
60
|
+
enterKeyHint: '' | 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
61
|
+
/** Capitalisation behaviour of virtual keyboards (`autocapitalize`). */
|
|
62
|
+
autocapitalize: '' | 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
63
|
+
/**
|
|
64
|
+
* The host's `spellcheck` attribute as written (`"true"`, `"false"`, `""`, or absent for the browser default),
|
|
65
|
+
* forwarded to the native control: the native enumerated attribute, not a boolean.
|
|
66
|
+
*/
|
|
67
|
+
protected spellcheckAttr: string | null;
|
|
15
68
|
render(): import('lit').TemplateResult<1>;
|
|
69
|
+
protected formWriteNativeDefault(state: unknown): void;
|
|
70
|
+
protected formReadNative(): void;
|
|
71
|
+
protected formSyncNative(): void;
|
|
16
72
|
private _onInput;
|
|
17
73
|
private _onChange;
|
|
18
74
|
}
|
|
@@ -21,4 +77,4 @@ declare global {
|
|
|
21
77
|
'void-textarea': VoidTextarea;
|
|
22
78
|
}
|
|
23
79
|
}
|
|
24
|
-
|
|
80
|
+
export {};
|