@voidable/ui 0.9.0 → 0.10.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/base-entry.d.ts +1 -0
- package/dist/base.d.ts +2 -1
- package/dist/base.js +5 -1
- package/dist/chunks/base-BxmMM3B7.js +298 -0
- package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
- package/dist/chunks/{modal-hivQ4YoU.js → modal-CgGp_fCs.js} +3 -3
- package/dist/chunks/{overlay-BywGMcDW.js → overlay-hLJ7IQHx.js} +2 -2
- package/dist/chunks/{parts-CMQQop0D.js → parts-DI_3VpSy.js} +21 -17
- package/dist/chunks/{base-CMruMbxC.js → projection-SnR79EHI.js} +105 -389
- package/dist/components/accordion.js +2 -2
- package/dist/components/action-input.d.ts +2 -2
- package/dist/components/action-input.js +56 -54
- package/dist/components/alert.js +2 -2
- package/dist/components/avatar.js +13 -11
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.js +2 -2
- package/dist/components/bar-chart.js +31 -29
- package/dist/components/breadcrumbs.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +78 -76
- package/dist/components/card.js +1 -1
- package/dist/components/carousel.js +18 -17
- package/dist/components/checkbox-group.js +13 -12
- package/dist/components/checkbox.js +17 -16
- package/dist/components/collapsible.js +2 -2
- package/dist/components/color-picker.js +26 -24
- package/dist/components/combobox.js +17 -16
- package/dist/components/compose-input.js +13 -11
- package/dist/components/dialog.js +1 -1
- package/dist/components/divider.js +11 -9
- package/dist/components/donut-chart.js +51 -49
- package/dist/components/drawer.d.ts +2 -2
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.js +4 -4
- package/dist/components/editable.js +13 -12
- package/dist/components/error-fallback.js +2 -2
- package/dist/components/field.js +10 -9
- package/dist/components/file-upload.js +19 -17
- package/dist/components/gauge.js +88 -86
- package/dist/components/hamburger.js +11 -9
- package/dist/components/hover-card.js +3 -3
- package/dist/components/indicator.js +14 -12
- package/dist/components/input.js +41 -39
- package/dist/components/line-chart.js +41 -39
- package/dist/components/list.js +1 -1
- package/dist/components/menu.js +3 -3
- package/dist/components/multiselect.js +30 -29
- package/dist/components/nav-bar.js +1 -1
- package/dist/components/nav-menu.js +20 -19
- package/dist/components/number-input.js +17 -15
- package/dist/components/pagination.js +22 -20
- package/dist/components/panel.js +2 -2
- package/dist/components/pin-input.js +32 -30
- package/dist/components/popover.js +3 -3
- package/dist/components/progress.js +14 -12
- package/dist/components/radio-group.js +13 -11
- package/dist/components/radio.d.ts +25 -0
- package/dist/components/radio.js +78 -29
- package/dist/components/scroll-area.js +8 -7
- package/dist/components/segmented-control.js +21 -21
- package/dist/components/select.js +49 -47
- package/dist/components/sidebar.d.ts +2 -2
- package/dist/components/sidebar.js +2 -2
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +16 -14
- package/dist/components/spinner.js +11 -9
- package/dist/components/stat.js +19 -17
- package/dist/components/status-dot.js +1 -1
- package/dist/components/stepper.js +15 -13
- package/dist/components/switch.js +14 -12
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +29 -29
- package/dist/components/tag.js +9 -8
- package/dist/components/tags-input.js +24 -22
- package/dist/components/textarea.js +34 -32
- package/dist/components/toast.d.ts +19 -2
- package/dist/components/toast.js +43 -10
- package/dist/components/toggle-group.js +16 -15
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip.js +3 -3
- package/dist/components.json +1 -1
- package/dist/custom-elements.json +48 -18
- package/dist/dev.js +31 -7
- package/dist/index.js +1 -1
- package/dist/keyboard.d.ts +10 -0
- package/dist/llms.txt +1 -1
- package/dist/parts.d.ts +5 -0
- package/dist/projection-api.d.ts +23 -0
- package/dist/projection.d.ts +8 -2
- package/dist/reference.md +4 -4
- package/dist/vscode.html-custom-data.json +13 -7
- package/dist/web-types.json +17 -17
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { t as
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { n as r } from "../chunks/projection-SnR79EHI.js";
|
|
4
5
|
import { html as i, nothing as a } from "lit";
|
|
5
6
|
import { property as o, query as s } from "lit/decorators.js";
|
|
6
7
|
import { live as c } from "lit/directives/live.js";
|
|
7
8
|
//#region src/components/number-input.ts
|
|
8
|
-
var l = class extends
|
|
9
|
+
var l = class extends n(e) {
|
|
9
10
|
constructor(...e) {
|
|
10
11
|
super(...e), this.value = null, this.min = -Infinity, this.max = Infinity, this.step = 1, this.precision = -1, this.disabled = !1, this.readonly = !1, this.size = "md", this.color = "default", this.placeholder = "", this.controls = "sides", this.label = "", this.prefix = "", this.unit = "", this._pressTimer = null, this._repeatTimer = null, this._repeatInterval = 300, this._repeatCount = 0, this._pendingText = null;
|
|
11
12
|
}
|
|
@@ -98,10 +99,10 @@ var l = class extends r(t) {
|
|
|
98
99
|
this.formDisabled || this.readonly || (e.key === "ArrowUp" ? (e.preventDefault(), this._increment()) : e.key === "ArrowDown" && (e.preventDefault(), this._decrement()));
|
|
99
100
|
}
|
|
100
101
|
_onBlur() {
|
|
101
|
-
if (!this._input || this.readonly ||
|
|
102
|
+
if (!this._input || this.readonly || r(this)) return;
|
|
102
103
|
this._pendingText = null;
|
|
103
|
-
let
|
|
104
|
-
this._input.value.trim() ? isNaN(
|
|
104
|
+
let e = parseFloat(this._input.value);
|
|
105
|
+
this._input.value.trim() ? isNaN(e) ? this._input.value = this.value === null ? "" : this._format(this.value) : this._commit(e) : this._commit(null);
|
|
105
106
|
}
|
|
106
107
|
_onFieldInput() {
|
|
107
108
|
this._pendingText = this._input?.value ?? null, this.formSync();
|
|
@@ -167,6 +168,7 @@ var l = class extends r(t) {
|
|
|
167
168
|
?readonly=${this.readonly}
|
|
168
169
|
role="spinbutton"
|
|
169
170
|
aria-valuenow=${this.value ?? a}
|
|
171
|
+
aria-valuetext=${this.value === null ? a : this._format(this.value)}
|
|
170
172
|
aria-required=${this.required ? "true" : a}
|
|
171
173
|
aria-valuemin=${isFinite(this.min) ? this.min : a}
|
|
172
174
|
aria-valuemax=${isFinite(this.max) ? this.max : a}
|
|
@@ -182,30 +184,30 @@ var l = class extends r(t) {
|
|
|
182
184
|
`;
|
|
183
185
|
}
|
|
184
186
|
};
|
|
185
|
-
|
|
187
|
+
t([o({
|
|
186
188
|
reflect: !0,
|
|
187
189
|
converter: {
|
|
188
190
|
fromAttribute: (e) => e === null || e.trim() === "" ? null : Number(e),
|
|
189
191
|
toAttribute: (e) => e == null ? null : String(e)
|
|
190
192
|
}
|
|
191
|
-
})], l.prototype, "value", void 0),
|
|
193
|
+
})], l.prototype, "value", void 0), t([o({ type: Number })], l.prototype, "min", void 0), t([o({ type: Number })], l.prototype, "max", void 0), t([o({ converter: {
|
|
192
194
|
fromAttribute: (e) => e === "any" ? "any" : e === null ? 1 : Number(e),
|
|
193
195
|
toAttribute: (e) => String(e)
|
|
194
|
-
} })], l.prototype, "step", void 0),
|
|
196
|
+
} })], l.prototype, "step", void 0), t([o({ type: Number })], l.prototype, "precision", void 0), t([o({
|
|
195
197
|
type: Boolean,
|
|
196
198
|
reflect: !0
|
|
197
|
-
})], l.prototype, "disabled", void 0),
|
|
199
|
+
})], l.prototype, "disabled", void 0), t([o({
|
|
198
200
|
type: Boolean,
|
|
199
201
|
reflect: !0
|
|
200
|
-
})], l.prototype, "readonly", void 0),
|
|
202
|
+
})], l.prototype, "readonly", void 0), t([o({
|
|
201
203
|
type: String,
|
|
202
204
|
reflect: !0
|
|
203
|
-
})], l.prototype, "size", void 0),
|
|
205
|
+
})], l.prototype, "size", void 0), t([o({
|
|
204
206
|
type: String,
|
|
205
207
|
reflect: !0
|
|
206
|
-
})], l.prototype, "color", void 0),
|
|
208
|
+
})], l.prototype, "color", void 0), t([o({ type: String })], l.prototype, "placeholder", void 0), t([o({
|
|
207
209
|
type: String,
|
|
208
210
|
reflect: !0
|
|
209
|
-
})], l.prototype, "controls", void 0),
|
|
211
|
+
})], l.prototype, "controls", void 0), t([o({ type: String })], l.prototype, "label", void 0), t([o({ type: String })], l.prototype, "prefix", void 0), t([o({ type: String })], l.prototype, "unit", void 0), t([s(".void-number-input-field")], l.prototype, "_input", void 0), customElements.get("void-number-input") || customElements.define("void-number-input", l);
|
|
210
212
|
//#endregion
|
|
211
213
|
export { l as VoidNumberInput };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { r as n } from "../chunks/projection-SnR79EHI.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/pagination.ts
|
|
6
|
-
|
|
7
|
+
n();
|
|
8
|
+
var o = class extends e {
|
|
7
9
|
constructor(...e) {
|
|
8
10
|
super(...e), this.total = 1, this.value = 1, this.siblings = 1, this.size = "md", this.hrefTemplate = "", this.param = "";
|
|
9
11
|
}
|
|
@@ -41,18 +43,18 @@ var a = class extends e {
|
|
|
41
43
|
}, 0);
|
|
42
44
|
}
|
|
43
45
|
_renderLinks(e) {
|
|
44
|
-
let t = 0,
|
|
45
|
-
@click=${(e) => this._onLinkClick(e,
|
|
46
|
-
return
|
|
46
|
+
let t = 0, n = (e, t, n, i) => i ? r`<span class="void-pagination-btn" aria-disabled="true" aria-label=${e}>${t}</span>` : r`<a class="void-pagination-btn" href=${this._href(n)} aria-label=${e}
|
|
47
|
+
@click=${(e) => this._onLinkClick(e, n)}>${t}</a>`;
|
|
48
|
+
return r`
|
|
47
49
|
<nav role="navigation" aria-label="Pagination">
|
|
48
|
-
${
|
|
49
|
-
${e.map((e) => e === "ellipsis" ? (t++,
|
|
50
|
+
${n("Previous page", "«", this.value - 1, this.value <= 1)}
|
|
51
|
+
${e.map((e) => e === "ellipsis" ? (t++, r`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : r`<a
|
|
50
52
|
class="void-pagination-btn"
|
|
51
53
|
href=${this._href(e)}
|
|
52
|
-
aria-current=${e === this.value ? "page" :
|
|
54
|
+
aria-current=${e === this.value ? "page" : i}
|
|
53
55
|
@click=${(t) => this._onLinkClick(t, e)}
|
|
54
56
|
>${e}</a>`)}
|
|
55
|
-
${
|
|
57
|
+
${n("Next page", "»", this.value + 1, this.value >= this.total)}
|
|
56
58
|
</nav>
|
|
57
59
|
`;
|
|
58
60
|
}
|
|
@@ -76,7 +78,7 @@ var a = class extends e {
|
|
|
76
78
|
let e = this._pages();
|
|
77
79
|
if (this._linkMode) return this._renderLinks(e);
|
|
78
80
|
let t = 0;
|
|
79
|
-
return
|
|
81
|
+
return r`
|
|
80
82
|
<nav role="navigation" aria-label="Pagination">
|
|
81
83
|
<button
|
|
82
84
|
type="button"
|
|
@@ -85,12 +87,12 @@ var a = class extends e {
|
|
|
85
87
|
@click=${() => this._go(this.value - 1)}
|
|
86
88
|
aria-label="Previous page"
|
|
87
89
|
>«</button>
|
|
88
|
-
${e.map((e) => e === "ellipsis" ? (t++,
|
|
90
|
+
${e.map((e) => e === "ellipsis" ? (t++, r`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : r`
|
|
89
91
|
<button
|
|
90
92
|
type="button"
|
|
91
93
|
class="void-pagination-btn"
|
|
92
94
|
?disabled=${e === this.value}
|
|
93
|
-
aria-current=${e === this.value ? "page" :
|
|
95
|
+
aria-current=${e === this.value ? "page" : i}
|
|
94
96
|
@click=${() => this._go(e)}
|
|
95
97
|
>${e}</button>
|
|
96
98
|
`)}
|
|
@@ -105,19 +107,19 @@ var a = class extends e {
|
|
|
105
107
|
`;
|
|
106
108
|
}
|
|
107
109
|
};
|
|
108
|
-
t([
|
|
110
|
+
t([a({ type: Number })], o.prototype, "total", void 0), t([a({
|
|
109
111
|
type: Number,
|
|
110
112
|
reflect: !0
|
|
111
|
-
})],
|
|
113
|
+
})], o.prototype, "value", void 0), t([a({ type: Number })], o.prototype, "siblings", void 0), t([a({
|
|
112
114
|
type: String,
|
|
113
115
|
reflect: !0
|
|
114
|
-
})],
|
|
116
|
+
})], o.prototype, "size", void 0), t([a({
|
|
115
117
|
type: String,
|
|
116
118
|
attribute: "href-template",
|
|
117
119
|
reflect: !0
|
|
118
|
-
})],
|
|
120
|
+
})], o.prototype, "hrefTemplate", void 0), t([a({
|
|
119
121
|
type: String,
|
|
120
122
|
reflect: !0
|
|
121
|
-
})],
|
|
123
|
+
})], o.prototype, "param", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", o);
|
|
122
124
|
//#endregion
|
|
123
|
-
export {
|
|
125
|
+
export { o as VoidPagination };
|
package/dist/components/panel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { n } from "../chunks/parts-
|
|
3
|
+
import { n } from "../chunks/parts-DI_3VpSy.js";
|
|
4
4
|
import { property as r } from "lit/decorators.js";
|
|
5
5
|
//#region src/components/panel.ts
|
|
6
6
|
var i = class extends e {
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { t as
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { n as r } from "../chunks/projection-SnR79EHI.js";
|
|
4
5
|
import { n as i, t as a } from "../chunks/secret-value-CmTtVkMg.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { r as o } from "../chunks/keyboard-CEhMSkws.js";
|
|
7
|
+
import { html as s, nothing as c } from "lit";
|
|
8
|
+
import { property as l } from "lit/decorators.js";
|
|
9
|
+
import { live as u } from "lit/directives/live.js";
|
|
8
10
|
//#region src/components/pin-input.ts
|
|
9
|
-
var
|
|
10
|
-
constructor(...
|
|
11
|
-
super(...
|
|
11
|
+
var d = class t extends n(e) {
|
|
12
|
+
constructor(...e) {
|
|
13
|
+
super(...e), this.length = 6, this.groups = "", this.value = "", this.disabled = !1, this.mask = !1, this.type = "numeric", this.size = "md", this.color = "default", this.placeholder = "", this._focusValue = null, this._onFocusIn = () => {
|
|
12
14
|
this._focusValue ??= this.value;
|
|
13
|
-
}, this._onFocusOut = (
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
this._focusValue = null,
|
|
15
|
+
}, this._onFocusOut = (e) => {
|
|
16
|
+
if (e.relatedTarget instanceof Node && this.contains(e.relatedTarget) || r(this)) return;
|
|
17
|
+
let t = this._focusValue;
|
|
18
|
+
this._focusValue = null, t !== null && t !== this.value && this.dispatchEvent(new CustomEvent("void-change", {
|
|
17
19
|
bubbles: !0,
|
|
18
20
|
composed: !0,
|
|
19
21
|
detail: { value: this.value }
|
|
@@ -23,8 +25,8 @@ var u = class n extends r(t) {
|
|
|
23
25
|
static {
|
|
24
26
|
this.editState = ["value"];
|
|
25
27
|
}
|
|
26
|
-
requestUpdate(e,
|
|
27
|
-
super.requestUpdate(e,
|
|
28
|
+
requestUpdate(e, n, r) {
|
|
29
|
+
super.requestUpdate(e, n, i(this.mask, e, r, () => t.getPropertyOptions("value")));
|
|
28
30
|
}
|
|
29
31
|
updated(e) {
|
|
30
32
|
super.updated(e), this.mask && e.get("mask") !== void 0 && a(this);
|
|
@@ -92,7 +94,7 @@ var u = class n extends r(t) {
|
|
|
92
94
|
e.value = "", this._syncValue();
|
|
93
95
|
}
|
|
94
96
|
e.preventDefault();
|
|
95
|
-
} else e.key ===
|
|
97
|
+
} else e.key === o(this).prev ? (e.preventDefault(), this._focusCell(t - 1)) : e.key === o(this).next ? (e.preventDefault(), this._focusCell(t + 1)) : e.key === "Delete" && (n.value = "", this._syncValue(), e.preventDefault());
|
|
96
98
|
}
|
|
97
99
|
_onPaste(e) {
|
|
98
100
|
e.preventDefault();
|
|
@@ -111,16 +113,16 @@ var u = class n extends r(t) {
|
|
|
111
113
|
render() {
|
|
112
114
|
let e = [], t = this._separatorIndices();
|
|
113
115
|
for (let n = 0; n < this._effectiveLength; n++) {
|
|
114
|
-
t.has(n) && e.push(
|
|
116
|
+
t.has(n) && e.push(s`<span class="void-pin-separator" aria-hidden="true">–</span>`);
|
|
115
117
|
let r = this.value[n] ?? "";
|
|
116
|
-
e.push(
|
|
118
|
+
e.push(s`
|
|
117
119
|
<input
|
|
118
120
|
class="void-pin-cell"
|
|
119
121
|
type=${this.mask ? "password" : "text"}
|
|
120
122
|
inputmode=${this.type === "numeric" ? "numeric" : "text"}
|
|
121
123
|
maxlength="1"
|
|
122
|
-
.value=${
|
|
123
|
-
placeholder=${this.placeholder ||
|
|
124
|
+
.value=${u(r)}
|
|
125
|
+
placeholder=${this.placeholder || c}
|
|
124
126
|
?disabled=${this.disabled}
|
|
125
127
|
autocomplete="one-time-code"
|
|
126
128
|
aria-label=${`Digit ${n + 1} of ${this._effectiveLength}`}
|
|
@@ -131,30 +133,30 @@ var u = class n extends r(t) {
|
|
|
131
133
|
/>
|
|
132
134
|
`);
|
|
133
135
|
}
|
|
134
|
-
return
|
|
136
|
+
return s`<div class="void-pin-input">${e}</div>`;
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
|
-
|
|
139
|
+
t([l({ type: Number })], d.prototype, "length", void 0), t([l({
|
|
138
140
|
type: String,
|
|
139
141
|
reflect: !0
|
|
140
|
-
})],
|
|
142
|
+
})], d.prototype, "groups", void 0), t([l({
|
|
141
143
|
type: String,
|
|
142
144
|
reflect: !0
|
|
143
|
-
})],
|
|
145
|
+
})], d.prototype, "value", void 0), t([l({
|
|
144
146
|
type: Boolean,
|
|
145
147
|
reflect: !0
|
|
146
|
-
})],
|
|
148
|
+
})], d.prototype, "disabled", void 0), t([l({
|
|
147
149
|
type: Boolean,
|
|
148
150
|
reflect: !0
|
|
149
|
-
})],
|
|
151
|
+
})], d.prototype, "mask", void 0), t([l({
|
|
150
152
|
type: String,
|
|
151
153
|
reflect: !0
|
|
152
|
-
})],
|
|
154
|
+
})], d.prototype, "type", void 0), t([l({
|
|
153
155
|
type: String,
|
|
154
156
|
reflect: !0
|
|
155
|
-
})],
|
|
157
|
+
})], d.prototype, "size", void 0), t([l({
|
|
156
158
|
type: String,
|
|
157
159
|
reflect: !0
|
|
158
|
-
})],
|
|
160
|
+
})], d.prototype, "color", void 0), t([l({ type: String })], d.prototype, "placeholder", void 0), customElements.get("void-pin-input") || customElements.define("void-pin-input", d);
|
|
159
161
|
//#endregion
|
|
160
|
-
export {
|
|
162
|
+
export { d as VoidPinInput };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { i as n, n as r } from "../chunks/parts-
|
|
4
|
-
import { t as i } from "../chunks/overlay-
|
|
3
|
+
import { i as n, n as r } from "../chunks/parts-DI_3VpSy.js";
|
|
4
|
+
import { t as i } from "../chunks/overlay-hLJ7IQHx.js";
|
|
5
5
|
import { property as a } from "lit/decorators.js";
|
|
6
6
|
//#region src/components/popover.ts
|
|
7
7
|
var o = class extends e {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { r as n } from "../chunks/projection-SnR79EHI.js";
|
|
4
|
+
import { html as r } from "lit";
|
|
5
|
+
import { property as i } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/progress.ts
|
|
6
|
-
|
|
7
|
+
n();
|
|
8
|
+
var a = class extends e {
|
|
7
9
|
constructor(...e) {
|
|
8
10
|
super(...e), this.value = 0, this.max = 100, this.color = "default", this.size = "md", this.indeterminate = !1;
|
|
9
11
|
}
|
|
@@ -15,24 +17,24 @@ var i = class extends e {
|
|
|
15
17
|
}
|
|
16
18
|
render() {
|
|
17
19
|
let e = Math.min(100, Math.max(0, this.value / this.max * 100));
|
|
18
|
-
return
|
|
20
|
+
return r`<div class="void-progress-track"><div class="void-progress-fill" style="--void-progress-fill: ${this.indeterminate ? "0%" : e + "%"}"></div></div>`;
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
|
-
t([
|
|
23
|
+
t([i({
|
|
22
24
|
type: Number,
|
|
23
25
|
reflect: !0
|
|
24
|
-
})],
|
|
26
|
+
})], a.prototype, "value", void 0), t([i({
|
|
25
27
|
type: Number,
|
|
26
28
|
reflect: !0
|
|
27
|
-
})],
|
|
29
|
+
})], a.prototype, "max", void 0), t([i({
|
|
28
30
|
type: String,
|
|
29
31
|
reflect: !0
|
|
30
|
-
})],
|
|
32
|
+
})], a.prototype, "color", void 0), t([i({
|
|
31
33
|
type: String,
|
|
32
34
|
reflect: !0
|
|
33
|
-
})],
|
|
35
|
+
})], a.prototype, "size", void 0), t([i({
|
|
34
36
|
type: Boolean,
|
|
35
37
|
reflect: !0
|
|
36
|
-
})],
|
|
38
|
+
})], a.prototype, "indeterminate", void 0), customElements.get("void-progress") || customElements.define("void-progress", a);
|
|
37
39
|
//#endregion
|
|
38
|
-
export {
|
|
40
|
+
export { a as VoidProgress };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { n
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { t as r } from "../chunks/projection-SnR79EHI.js";
|
|
4
5
|
import { html as i, nothing as a } from "lit";
|
|
5
6
|
import { property as o } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/radio-group.ts
|
|
7
|
-
var s = class extends
|
|
8
|
-
constructor(...
|
|
9
|
-
super(...
|
|
8
|
+
var s = class extends n(e) {
|
|
9
|
+
constructor(...e) {
|
|
10
|
+
super(...e), this.label = "", this.value = "", this.name = "", this.required = !1, this.disabled = !1, this.orientation = "vertical", this._projection = new r(this, {
|
|
10
11
|
regions: [{
|
|
11
12
|
name: "options",
|
|
12
13
|
target: () => this.querySelector(":scope > .void-radio-group-options")
|
|
@@ -68,6 +69,7 @@ var s = class extends r(t) {
|
|
|
68
69
|
}
|
|
69
70
|
_syncChecked() {
|
|
70
71
|
for (let e of this._radios()) e.checked = e.value === this.value;
|
|
72
|
+
this._radios()[0]?._syncTabStops?.();
|
|
71
73
|
}
|
|
72
74
|
render() {
|
|
73
75
|
return i`
|
|
@@ -76,19 +78,19 @@ var s = class extends r(t) {
|
|
|
76
78
|
`;
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
|
-
|
|
81
|
+
t([o({ type: String })], s.prototype, "label", void 0), t([o({
|
|
80
82
|
type: String,
|
|
81
83
|
reflect: !0
|
|
82
|
-
})], s.prototype, "value", void 0),
|
|
84
|
+
})], s.prototype, "value", void 0), t([o({
|
|
83
85
|
type: String,
|
|
84
86
|
reflect: !0
|
|
85
|
-
})], s.prototype, "name", void 0),
|
|
87
|
+
})], s.prototype, "name", void 0), t([o({
|
|
86
88
|
type: Boolean,
|
|
87
89
|
reflect: !0
|
|
88
|
-
})], s.prototype, "required", void 0),
|
|
90
|
+
})], s.prototype, "required", void 0), t([o({
|
|
89
91
|
type: Boolean,
|
|
90
92
|
reflect: !0
|
|
91
|
-
})], s.prototype, "disabled", void 0),
|
|
93
|
+
})], s.prototype, "disabled", void 0), t([o({
|
|
92
94
|
type: String,
|
|
93
95
|
reflect: !0
|
|
94
96
|
})], s.prototype, "orientation", void 0), customElements.get("void-radio-group") || customElements.define("void-radio-group", s);
|
|
@@ -36,6 +36,31 @@ export declare class VoidRadio extends VoidRadio_base {
|
|
|
36
36
|
connectedCallback(): void;
|
|
37
37
|
disconnectedCallback(): void;
|
|
38
38
|
protected updated(changed: Map<string, unknown>): void;
|
|
39
|
+
/** A morph may have changed which radio is checked or enabled. */
|
|
40
|
+
protected morphedCallback(): void;
|
|
41
|
+
private _anchor;
|
|
42
|
+
private _hasFocus;
|
|
43
|
+
/** Checked, or chosen by the group's value which has not reached `checked` yet. */
|
|
44
|
+
private _isOn;
|
|
45
|
+
/**
|
|
46
|
+
* The radios that behave as one group with this one: those of the same `void-radio-group`, or,
|
|
47
|
+
* outside one, those with the same `name` in the same form (or document), as native radios do.
|
|
48
|
+
*/
|
|
49
|
+
private _peers;
|
|
50
|
+
/**
|
|
51
|
+
* Roving tabindex: one radio of the group is tabbable: the checked one, else (nothing checked) the
|
|
52
|
+
* focused one, else the first enabled one. Disabled radios are never tabbable.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
_syncTabStops(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Arrow keys move to the next or previous enabled radio of the group, wrapping, and check it with a
|
|
58
|
+
* real `click`, as native radios do (so a click listener, `void-change` and the form value all follow
|
|
59
|
+
* as for a pointer click). The inline arrows follow the reading direction.
|
|
60
|
+
*/
|
|
61
|
+
private _handleKeydown;
|
|
62
|
+
private _handleFocus;
|
|
63
|
+
private _handleBlur;
|
|
39
64
|
render(): import('lit').TemplateResult<1>;
|
|
40
65
|
/** Form reset target is the checked state; the native radio submits. */
|
|
41
66
|
protected formSnapshot(): unknown;
|
package/dist/components/radio.js
CHANGED
|
@@ -1,19 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { t as
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
|
|
4
|
+
import { n as r } from "../chunks/form-control-C0vH6gii.js";
|
|
5
|
+
import { t as i } from "../chunks/projection-SnR79EHI.js";
|
|
6
|
+
import { a, r as o } from "../chunks/keyboard-CEhMSkws.js";
|
|
7
|
+
import { html as s, nothing as c } from "lit";
|
|
8
|
+
import { property as l } from "lit/decorators.js";
|
|
7
9
|
//#region src/components/radio.ts
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
var u = !1;
|
|
11
|
+
typeof document < "u" && (document.addEventListener("keydown", (e) => {
|
|
12
|
+
u = e.key === "Tab" && e.shiftKey;
|
|
13
|
+
}, !0), document.addEventListener("pointerdown", () => {
|
|
14
|
+
u = !1;
|
|
15
|
+
}, !0));
|
|
16
|
+
var d = class t extends r(e) {
|
|
17
|
+
constructor(...e) {
|
|
18
|
+
super(...e), this._activation = new n(this, {
|
|
11
19
|
enter: !1,
|
|
12
20
|
disabled: () => this.formDisabled
|
|
13
|
-
}), this.checked = !1, this.disabled = !1, this.name = "", this.value = "on", this.required = !1, this.color = "default", this.size = "md", this._projection = new
|
|
21
|
+
}), this.checked = !1, this.disabled = !1, this.name = "", this.value = "on", this.required = !1, this.color = "default", this.size = "md", this._projection = new i(this, { regions: [{
|
|
14
22
|
name: "label",
|
|
15
23
|
target: "after"
|
|
16
|
-
}] }), this.
|
|
24
|
+
}] }), this._anchor = null, this._hasFocus = !1, this._handleKeydown = (e) => {
|
|
25
|
+
if (e.altKey || e.ctrlKey || e.metaKey || e.defaultPrevented || e.target !== this) return;
|
|
26
|
+
let t = o(this), n = e.key === t.next || e.key === "ArrowDown";
|
|
27
|
+
if (!n && e.key !== t.prev && e.key !== "ArrowUp") return;
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
let r = this._peers(), i = r[a(r.map((e) => e.formDisabled), r.indexOf(this), n ? 1 : -1)];
|
|
30
|
+
i && (i.focus(), i.click());
|
|
31
|
+
}, this._handleFocus = (e) => {
|
|
32
|
+
let t = this._peers(), n = e.relatedTarget;
|
|
33
|
+
if (u && n && !t.some((e) => e.contains(n)) && !t.some((e) => !e.formDisabled && e._isOn()) && this.compareDocumentPosition(n) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
34
|
+
let e = t.filter((e) => !e.formDisabled).pop();
|
|
35
|
+
if (e && e !== this) {
|
|
36
|
+
e.focus();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
this._hasFocus = !0, this._syncTabStops();
|
|
41
|
+
}, this._handleBlur = (e) => {
|
|
42
|
+
this._hasFocus = !1;
|
|
43
|
+
let t = e.relatedTarget;
|
|
44
|
+
(!t || !this._peers().some((e) => e.contains(t))) && this._syncTabStops();
|
|
45
|
+
}, this._onNativeFocus = () => {
|
|
17
46
|
this.focus();
|
|
18
47
|
}, this._onNativeInvalid = (e) => {
|
|
19
48
|
let t = e.target;
|
|
@@ -39,22 +68,42 @@ var c = class extends i(t) {
|
|
|
39
68
|
};
|
|
40
69
|
}
|
|
41
70
|
connectedCallback() {
|
|
42
|
-
super.connectedCallback(), this.setHostAttribute("role", "radio"), this.setHostAttribute("
|
|
71
|
+
super.connectedCallback(), this.setHostAttribute("role", "radio"), this.setHostAttribute("aria-checked", String(this._isOn())), this._anchor = this.closest("void-radio-group") ?? this.form ?? this.getRootNode(), this.setHostAttribute("tabindex", "-1"), this._syncTabStops(), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown), this.addEventListener("focus", this._handleFocus), this.addEventListener("blur", this._handleBlur);
|
|
43
72
|
}
|
|
44
73
|
disconnectedCallback() {
|
|
45
|
-
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
|
|
74
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown), this.removeEventListener("focus", this._handleFocus), this.removeEventListener("blur", this._handleBlur), this._hasFocus = !1;
|
|
75
|
+
let e = this._anchor;
|
|
76
|
+
this._anchor = null, e && queueMicrotask(() => {
|
|
77
|
+
Array.from(e.querySelectorAll("void-radio")).find((t) => t.isConnected && t.name === this.name && t._anchor === e)?._syncTabStops();
|
|
78
|
+
});
|
|
46
79
|
}
|
|
47
80
|
updated(e) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
81
|
+
super.updated(e), e.has("checked") && this.setHostAttribute("aria-checked", String(this.checked)), (e.has("disabled") || e.has("ancestorDisabled")) && this.setHostAttribute("aria-disabled", this.formDisabled ? "true" : null), (e.has("checked") || e.has("disabled") || e.has("ancestorDisabled") || e.has("name")) && this._syncTabStops();
|
|
82
|
+
}
|
|
83
|
+
morphedCallback() {
|
|
84
|
+
this._syncTabStops();
|
|
85
|
+
}
|
|
86
|
+
_isOn() {
|
|
87
|
+
if (this.checked) return !0;
|
|
88
|
+
let e = this.closest("void-radio-group");
|
|
89
|
+
return !!e?.value && e.value === this.value;
|
|
90
|
+
}
|
|
91
|
+
_peers() {
|
|
92
|
+
let e = this.closest("void-radio-group");
|
|
93
|
+
if (e) return Array.from(e.querySelectorAll("void-radio")).filter((n) => n instanceof t && n.closest("void-radio-group") === e);
|
|
94
|
+
if (!this.name) return [this];
|
|
95
|
+
let n = this.form ?? this.getRootNode();
|
|
96
|
+
return Array.from(n.querySelectorAll("void-radio")).filter((e) => e instanceof t && e.name === this.name && e.form === this.form && !e.closest("void-radio-group"));
|
|
97
|
+
}
|
|
98
|
+
_syncTabStops() {
|
|
99
|
+
let e = this._peers(), t = e.filter((e) => !e.formDisabled), n = t.find((e) => e._isOn()) ?? t.find((e) => e._hasFocus) ?? t[0];
|
|
100
|
+
for (let t of e) t.setHostAttribute("tabindex", t === n ? "0" : "-1");
|
|
52
101
|
}
|
|
53
102
|
render() {
|
|
54
|
-
return
|
|
55
|
-
<input type="radio" .checked=${this.checked} ?disabled=${this.formDisabled} ?required=${this.required} name=${this.name} value=${this.value} form=${this.formAttr ??
|
|
103
|
+
return s`
|
|
104
|
+
<input type="radio" .checked=${this.checked} ?disabled=${this.formDisabled} ?required=${this.required} name=${this.name} value=${this.value} form=${this.formAttr ?? c} tabindex="-1" aria-hidden="true" inert @invalid=${this._onNativeInvalid} @focus=${this._onNativeFocus} />
|
|
56
105
|
<span class="void-radio-circle">
|
|
57
|
-
${this.checked ?
|
|
106
|
+
${this.checked ? s`<span class="void-radio-dot"></span>` : ""}
|
|
58
107
|
</span>
|
|
59
108
|
`;
|
|
60
109
|
}
|
|
@@ -81,27 +130,27 @@ var c = class extends i(t) {
|
|
|
81
130
|
}
|
|
82
131
|
}
|
|
83
132
|
};
|
|
84
|
-
|
|
133
|
+
t([l({
|
|
85
134
|
type: Boolean,
|
|
86
135
|
reflect: !0
|
|
87
|
-
})],
|
|
136
|
+
})], d.prototype, "checked", void 0), t([l({
|
|
88
137
|
type: Boolean,
|
|
89
138
|
reflect: !0
|
|
90
|
-
})],
|
|
139
|
+
})], d.prototype, "disabled", void 0), t([l({
|
|
91
140
|
type: String,
|
|
92
141
|
reflect: !0
|
|
93
|
-
})],
|
|
142
|
+
})], d.prototype, "name", void 0), t([l({
|
|
94
143
|
type: String,
|
|
95
144
|
reflect: !0
|
|
96
|
-
})],
|
|
145
|
+
})], d.prototype, "value", void 0), t([l({
|
|
97
146
|
type: Boolean,
|
|
98
147
|
reflect: !0
|
|
99
|
-
})],
|
|
148
|
+
})], d.prototype, "required", void 0), t([l({
|
|
100
149
|
type: String,
|
|
101
150
|
reflect: !0
|
|
102
|
-
})],
|
|
151
|
+
})], d.prototype, "color", void 0), t([l({
|
|
103
152
|
type: String,
|
|
104
153
|
reflect: !0
|
|
105
|
-
})],
|
|
154
|
+
})], d.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", d);
|
|
106
155
|
//#endregion
|
|
107
|
-
export {
|
|
156
|
+
export { d as VoidRadio };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as n } from "../chunks/projection-SnR79EHI.js";
|
|
3
4
|
import { html as r } from "lit";
|
|
4
5
|
import { property as i } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/scroll-area.ts
|
|
6
|
-
var a = class extends
|
|
7
|
-
constructor(...
|
|
8
|
-
super(...
|
|
7
|
+
var a = class extends e {
|
|
8
|
+
constructor(...e) {
|
|
9
|
+
super(...e), this.maxHeight = "", this.orientation = "vertical", this._projection = new n(this, { regions: [{
|
|
9
10
|
name: "viewport",
|
|
10
11
|
target: () => this.querySelector(":scope > .void-scroll-area-viewport"),
|
|
11
12
|
scrolls: !0
|
|
@@ -18,10 +19,10 @@ var a = class extends t {
|
|
|
18
19
|
return r`<div class="void-scroll-area-viewport"></div>`;
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
+
t([i({
|
|
22
23
|
type: String,
|
|
23
24
|
attribute: "max-height"
|
|
24
|
-
})], a.prototype, "maxHeight", void 0),
|
|
25
|
+
})], a.prototype, "maxHeight", void 0), t([i({
|
|
25
26
|
type: String,
|
|
26
27
|
reflect: !0
|
|
27
28
|
})], a.prototype, "orientation", void 0), customElements.get("void-scroll-area") || customElements.define("void-scroll-area", a);
|