@voidable/ui 0.8.1 → 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/README.md +8 -0
- 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-D_YVy2vg.js → modal-CgGp_fCs.js} +3 -3
- package/dist/chunks/{overlay-BywGMcDW.js → overlay-hLJ7IQHx.js} +2 -2
- package/dist/chunks/{parts-D30c8OoG.js → parts-DI_3VpSy.js} +25 -18
- package/dist/chunks/{base-CMruMbxC.js → projection-SnR79EHI.js} +105 -389
- package/dist/chunks/secret-value-CmTtVkMg.js +14 -0
- package/dist/chunks/value-list-CH6GjYXM.js +28 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/action-input.d.ts +8 -4
- package/dist/components/action-input.js +61 -49
- 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.d.ts +10 -0
- package/dist/components/checkbox-group.js +36 -23
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +17 -16
- package/dist/components/collapsible.js +2 -2
- package/dist/components/color-picker.d.ts +2 -2
- package/dist/components/color-picker.js +26 -24
- package/dist/components/combobox.d.ts +4 -2
- package/dist/components/combobox.js +22 -18
- package/dist/components/compose-input.d.ts +1 -1
- package/dist/components/compose-input.js +15 -10
- 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.d.ts +1 -1
- 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 +90 -85
- 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.d.ts +6 -2
- package/dist/components/input.js +46 -34
- 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.d.ts +9 -0
- package/dist/components/multiselect.js +64 -54
- package/dist/components/nav-bar.js +1 -1
- package/dist/components/nav-menu.js +20 -19
- package/dist/components/number-input.d.ts +2 -2
- 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.d.ts +6 -2
- package/dist/components/pin-input.js +39 -27
- package/dist/components/popover.js +3 -3
- package/dist/components/progress.js +14 -12
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +15 -10
- 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.d.ts +1 -1
- package/dist/components/segmented-control.js +21 -21
- package/dist/components/select.d.ts +67 -16
- package/dist/components/select.js +183 -56
- 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.d.ts +2 -2
- package/dist/components/slider.js +18 -13
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/components/tags-input.js +25 -19
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +36 -31
- package/dist/components/toast.d.ts +19 -2
- package/dist/components/toast.js +43 -10
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +16 -15
- package/dist/components/toggle.js +5 -2
- package/dist/components/tooltip.js +3 -3
- package/dist/components.json +3 -3
- package/dist/custom-elements.json +133 -67
- package/dist/dev/types.d.ts +2 -3
- package/dist/dev.js +81 -55
- package/dist/index.js +1 -1
- package/dist/keyboard.d.ts +10 -0
- package/dist/llms.txt +125 -0
- package/dist/parts.d.ts +8 -1
- package/dist/projection-api.d.ts +23 -0
- package/dist/projection.d.ts +8 -2
- package/dist/reference.md +4575 -0
- package/dist/secret-value.d.ts +17 -0
- package/dist/types/elements.d.ts +2 -2
- package/dist/value-list.d.ts +14 -0
- package/dist/vscode.html-custom-data.json +46 -26
- package/dist/web-types.json +73 -53
- package/package.json +5 -3
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
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/form-control-C0vH6gii.js";
|
|
4
|
+
import { t as r } from "../chunks/projection-SnR79EHI.js";
|
|
5
|
+
import { n as i } from "../chunks/parts-DI_3VpSy.js";
|
|
6
|
+
import { a, i as o, n as s, t as c } from "../chunks/keyboard-CEhMSkws.js";
|
|
7
|
+
import { t as l } from "../chunks/overlay-hLJ7IQHx.js";
|
|
8
|
+
import { n as u } from "../chunks/value-list-CH6GjYXM.js";
|
|
9
|
+
import { html as d, nothing as f } from "lit";
|
|
10
|
+
import { property as p } from "lit/decorators.js";
|
|
9
11
|
//#region src/components/multiselect.ts
|
|
10
|
-
var
|
|
12
|
+
var m = class extends e {
|
|
11
13
|
constructor(...e) {
|
|
12
14
|
super(...e), this.value = "", this.selected = !1, this.disabled = !1, this.label = "";
|
|
13
15
|
}
|
|
@@ -20,23 +22,23 @@ var p = class extends t {
|
|
|
20
22
|
].some((t) => e.has(t) && e.get(t) !== void 0) && (this.closest("void-multiselect") ?? this.closest("void-combobox"))?.requestUpdate();
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
|
-
|
|
25
|
+
t([p({
|
|
24
26
|
type: String,
|
|
25
27
|
reflect: !0
|
|
26
|
-
})],
|
|
28
|
+
})], m.prototype, "value", void 0), t([p({
|
|
27
29
|
type: Boolean,
|
|
28
30
|
reflect: !0
|
|
29
|
-
})],
|
|
31
|
+
})], m.prototype, "selected", void 0), t([p({
|
|
30
32
|
type: Boolean,
|
|
31
33
|
reflect: !0
|
|
32
|
-
})],
|
|
33
|
-
var
|
|
34
|
-
function
|
|
34
|
+
})], m.prototype, "disabled", void 0), t([p({ type: String })], m.prototype, "label", void 0), customElements.get("void-option") || customElements.define("void-option", m);
|
|
35
|
+
var h = (e) => e instanceof m ? e.value : e.getAttribute("value") ?? "", g = (e) => e instanceof m ? e.selected : e.hasAttribute("selected");
|
|
36
|
+
function _(e) {
|
|
35
37
|
return e.getAttribute("label") || e.textContent?.trim() || e.getAttribute("value") || "";
|
|
36
38
|
}
|
|
37
|
-
var
|
|
38
|
-
constructor(...
|
|
39
|
-
super(...
|
|
39
|
+
var v = class extends n(e) {
|
|
40
|
+
constructor(...e) {
|
|
41
|
+
super(...e), this.placeholder = "Select...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._active = null, this._typeahead = new c(), this._wiring = !1, this._projection = new r(this, { placement: "start" }), this._parts = new i(this, {
|
|
40
42
|
tags: ["void-multiselect-content", "void-option"],
|
|
41
43
|
onChange: () => {
|
|
42
44
|
this._wire(), this._wiring || this.requestUpdate();
|
|
@@ -52,7 +54,7 @@ var _ = class extends r(t) {
|
|
|
52
54
|
attr: (e, t, n) => this._parts.set(e, t, n),
|
|
53
55
|
style: (e, t, n) => this._parts.style(e, t, n),
|
|
54
56
|
initialFocus: () => !1
|
|
55
|
-
}), this._onPointerDown = (e) => {
|
|
57
|
+
}), this._wanted = null, this._reflected = null, this._onPointerDown = (e) => {
|
|
56
58
|
let t = e.target;
|
|
57
59
|
(this._content()?.contains(t) || t.closest?.(".void-multiselect-pill-remove")) && e.preventDefault();
|
|
58
60
|
}, this._onClick = (e) => {
|
|
@@ -74,7 +76,7 @@ var _ = class extends r(t) {
|
|
|
74
76
|
if (this.formDisabled || e.target !== e.currentTarget || e.isComposing) return;
|
|
75
77
|
let t = this._options.map((e) => e.disabled), n = e.key;
|
|
76
78
|
if (!this.open) {
|
|
77
|
-
n === "Home" || n === "End" ? (e.preventDefault(), this._openList(n === "Home" ? "first" : "last")) : n === "ArrowUp" ? (e.preventDefault(), this._openList("first")) : n === "Enter" || n === " " || n === "ArrowDown" ? (e.preventDefault(), this._openList("selected")) :
|
|
79
|
+
n === "Home" || n === "End" ? (e.preventDefault(), this._openList(n === "Home" ? "first" : "last")) : n === "ArrowUp" ? (e.preventDefault(), this._openList("first")) : n === "Enter" || n === " " || n === "ArrowDown" ? (e.preventDefault(), this._openList("selected")) : o(e) && (e.preventDefault(), this._openList("selected"), this._typeaheadTo(e.key));
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
82
|
switch (n) {
|
|
@@ -91,10 +93,10 @@ var _ = class extends r(t) {
|
|
|
91
93
|
e.preventDefault(), this._moveActive(this._stepBy(-10));
|
|
92
94
|
break;
|
|
93
95
|
case "Home":
|
|
94
|
-
e.preventDefault(), this._moveActive(
|
|
96
|
+
e.preventDefault(), this._moveActive(s(t, 1));
|
|
95
97
|
break;
|
|
96
98
|
case "End":
|
|
97
|
-
e.preventDefault(), this._moveActive(
|
|
99
|
+
e.preventDefault(), this._moveActive(s(t, -1));
|
|
98
100
|
break;
|
|
99
101
|
case "Enter":
|
|
100
102
|
case " ":
|
|
@@ -106,7 +108,7 @@ var _ = class extends r(t) {
|
|
|
106
108
|
case "Tab":
|
|
107
109
|
this._close("blur");
|
|
108
110
|
break;
|
|
109
|
-
default:
|
|
111
|
+
default: o(e) && (e.preventDefault(), this._typeaheadTo(e.key));
|
|
110
112
|
}
|
|
111
113
|
}, this._onFocusOut = (e) => {
|
|
112
114
|
this.open && !this.contains(e.relatedTarget) && this._close("blur");
|
|
@@ -126,15 +128,18 @@ var _ = class extends r(t) {
|
|
|
126
128
|
return e ? this._parts.within(e, "void-option") : [];
|
|
127
129
|
}
|
|
128
130
|
get value() {
|
|
129
|
-
|
|
131
|
+
let e = this._options;
|
|
132
|
+
return this._wanted && e.length === 0 ? [...this._wanted] : e.filter(g).map(h);
|
|
130
133
|
}
|
|
131
134
|
set value(e) {
|
|
132
|
-
let t =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
let t = this._options, n = Array.isArray(e) ? e : [];
|
|
136
|
+
this._wanted = t.length === 0 ? [...n] : null;
|
|
137
|
+
let r = new Set(n);
|
|
138
|
+
for (let e of t) {
|
|
139
|
+
let t = r.has(h(e));
|
|
140
|
+
e instanceof m ? e.selected = t : e.toggleAttribute("selected", t);
|
|
136
141
|
}
|
|
137
|
-
this.requestUpdate();
|
|
142
|
+
this.requestUpdate("value", void 0);
|
|
138
143
|
}
|
|
139
144
|
formSubmission() {
|
|
140
145
|
return this.value;
|
|
@@ -147,6 +152,8 @@ var _ = class extends r(t) {
|
|
|
147
152
|
}
|
|
148
153
|
willUpdate(e) {
|
|
149
154
|
super.willUpdate(e), e.has("open") && !this.open && (this._active = null, this._typeahead.reset());
|
|
155
|
+
let t = JSON.stringify(this.value);
|
|
156
|
+
t !== this._reflected && (this._reflected = t, e.has("value") || this.requestUpdate("value", void 0));
|
|
150
157
|
}
|
|
151
158
|
updated(e) {
|
|
152
159
|
super.updated(e), this._wiring = !0;
|
|
@@ -159,7 +166,7 @@ var _ = class extends r(t) {
|
|
|
159
166
|
}
|
|
160
167
|
_wire() {
|
|
161
168
|
let e = this._content(), t = this._trigger(), n = this._options, r = this.open && !this.formDisabled;
|
|
162
|
-
this._active && (!n.includes(this._active) || this._active.disabled) && (this._active = null);
|
|
169
|
+
this._wanted && n.length > 0 && (this.value = this._wanted), this._active && (!n.includes(this._active) || this._active.disabled) && (this._active = null);
|
|
163
170
|
for (let e of n) this._parts.set(e, "role", "option"), this._parts.id(e, "void-option"), this._parts.set(e, "aria-selected", e.selected ? "true" : null), this._parts.set(e, "aria-disabled", e.disabled ? "true" : null), this._parts.set(e, "active", e === this._active);
|
|
164
171
|
if (!e) return;
|
|
165
172
|
this._parts.set(e, "popover", "manual"), this._parts.set(e, "role", "listbox"), this._parts.set(e, "aria-multiselectable", "true"), this._parts.id(e, "void-multiselect-content");
|
|
@@ -168,11 +175,11 @@ var _ = class extends r(t) {
|
|
|
168
175
|
}
|
|
169
176
|
_controls(e) {
|
|
170
177
|
let t = e ? this._content() : null;
|
|
171
|
-
return t ? this._parts.id(t, "void-multiselect-content") :
|
|
178
|
+
return t ? this._parts.id(t, "void-multiselect-content") : f;
|
|
172
179
|
}
|
|
173
180
|
render() {
|
|
174
181
|
let e = this._options.filter((e) => e.selected), t = this.open && !this.formDisabled, n = e.length;
|
|
175
|
-
return
|
|
182
|
+
return d`
|
|
176
183
|
<div
|
|
177
184
|
class="void-multiselect-trigger"
|
|
178
185
|
role="combobox"
|
|
@@ -181,32 +188,32 @@ var _ = class extends r(t) {
|
|
|
181
188
|
aria-haspopup="listbox"
|
|
182
189
|
aria-expanded=${String(t)}
|
|
183
190
|
aria-controls=${this._controls(t)}
|
|
184
|
-
aria-description=${n ? `${n} selected` :
|
|
185
|
-
aria-disabled=${this.formDisabled ? "true" :
|
|
186
|
-
aria-required=${this.required ? "true" :
|
|
187
|
-
aria-invalid=${this.error ? "true" :
|
|
191
|
+
aria-description=${n ? `${n} selected` : f}
|
|
192
|
+
aria-disabled=${this.formDisabled ? "true" : f}
|
|
193
|
+
aria-required=${this.required ? "true" : f}
|
|
194
|
+
aria-invalid=${this.error ? "true" : f}
|
|
188
195
|
@keydown=${this._onTriggerKeydown}
|
|
189
196
|
>
|
|
190
|
-
${n > 0 ? e.map((e) =>
|
|
197
|
+
${n > 0 ? e.map((e) => d`
|
|
191
198
|
<span class="void-multiselect-pill">
|
|
192
|
-
<span class="void-multiselect-pill-label">${
|
|
199
|
+
<span class="void-multiselect-pill-label">${_(e)}</span>
|
|
193
200
|
<button
|
|
194
201
|
type="button"
|
|
195
202
|
class="void-multiselect-pill-remove"
|
|
196
203
|
tabindex="-1"
|
|
197
|
-
aria-label="Remove ${
|
|
204
|
+
aria-label="Remove ${_(e)}"
|
|
198
205
|
data-value=${e.value}
|
|
199
206
|
>×</button>
|
|
200
207
|
</span>
|
|
201
|
-
`) :
|
|
208
|
+
`) : d`<span class="void-multiselect-placeholder">${this.placeholder}</span>`}
|
|
202
209
|
</div>
|
|
203
|
-
${this.error ?
|
|
210
|
+
${this.error ? d`<span class="void-multiselect-error">${this.error}</span>` : f}
|
|
204
211
|
`;
|
|
205
212
|
}
|
|
206
213
|
_openList(e, t = "keyboard") {
|
|
207
214
|
if (this._overlay.requestOpen(t), !this.open) return;
|
|
208
215
|
let n = this._options, r = n.map((e) => e.disabled), i = -1;
|
|
209
|
-
e === "first" ? i =
|
|
216
|
+
e === "first" ? i = s(r, 1) : e === "last" ? i = s(r, -1) : e === "selected" && (i = n.findIndex((e) => e.selected && !e.disabled), i < 0 && (i = s(r, 1))), this._active = i >= 0 ? n[i] : null, this.requestUpdate();
|
|
210
217
|
}
|
|
211
218
|
_close(e = "api") {
|
|
212
219
|
this.open && this._overlay.requestClose(e);
|
|
@@ -215,16 +222,16 @@ var _ = class extends r(t) {
|
|
|
215
222
|
e < 0 || (this._active = this._options[e], this.requestUpdate());
|
|
216
223
|
}
|
|
217
224
|
_stepBy(e) {
|
|
218
|
-
let t = this._options, n = t.map((e) => e.disabled), r = this._active ? t.indexOf(this._active) : -1, i = e > 0 ? 1 : -1,
|
|
219
|
-
for (let t = r,
|
|
225
|
+
let t = this._options, n = t.map((e) => e.disabled), r = this._active ? t.indexOf(this._active) : -1, i = e > 0 ? 1 : -1, o = r;
|
|
226
|
+
for (let t = r, s = Math.abs(e); s > 0;) {
|
|
220
227
|
let e = a(n, t, i, !1);
|
|
221
228
|
if (e < 0) break;
|
|
222
|
-
|
|
229
|
+
o = t = e, s--;
|
|
223
230
|
}
|
|
224
|
-
return
|
|
231
|
+
return o >= 0 ? o : s(n, i);
|
|
225
232
|
}
|
|
226
233
|
_typeaheadTo(e) {
|
|
227
|
-
let t = this._options, n = this._active ? t.indexOf(this._active) : -1, r = this._typeahead.match(e, t.map((e) =>
|
|
234
|
+
let t = this._options, n = this._active ? t.indexOf(this._active) : -1, r = this._typeahead.match(e, t.map((e) => _(e)), t.map((e) => e.disabled), n);
|
|
228
235
|
this._moveActive(r);
|
|
229
236
|
}
|
|
230
237
|
_toggleOption(e, t = !e.selected) {
|
|
@@ -235,21 +242,24 @@ var _ = class extends r(t) {
|
|
|
235
242
|
}));
|
|
236
243
|
}
|
|
237
244
|
};
|
|
238
|
-
|
|
245
|
+
t([p({ type: String })], v.prototype, "placeholder", void 0), t([p({
|
|
239
246
|
type: Boolean,
|
|
240
247
|
reflect: !0
|
|
241
|
-
})],
|
|
248
|
+
})], v.prototype, "disabled", void 0), t([p({
|
|
242
249
|
type: String,
|
|
243
250
|
reflect: !0
|
|
244
|
-
})],
|
|
251
|
+
})], v.prototype, "size", void 0), t([p({
|
|
245
252
|
type: String,
|
|
246
253
|
reflect: !0
|
|
247
|
-
})],
|
|
254
|
+
})], v.prototype, "error", void 0), t([p({
|
|
248
255
|
type: String,
|
|
249
256
|
reflect: !0
|
|
250
|
-
})],
|
|
257
|
+
})], v.prototype, "name", void 0), t([p({
|
|
251
258
|
type: Boolean,
|
|
252
259
|
reflect: !0
|
|
253
|
-
})],
|
|
260
|
+
})], v.prototype, "open", void 0), t([p({
|
|
261
|
+
converter: u,
|
|
262
|
+
reflect: !0
|
|
263
|
+
})], v.prototype, "value", null), customElements.get("void-multiselect") || customElements.define("void-multiselect", v);
|
|
254
264
|
//#endregion
|
|
255
|
-
export {
|
|
265
|
+
export { v as VoidMultiselect, m as VoidOption, _ as optionLabel };
|
|
@@ -1,23 +1,24 @@
|
|
|
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 {
|
|
3
|
+
import { i as n, n as r } from "../chunks/parts-DI_3VpSy.js";
|
|
4
|
+
import { r as i } from "../chunks/keyboard-CEhMSkws.js";
|
|
5
|
+
import { property as a } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/nav-menu.ts
|
|
6
|
-
var
|
|
7
|
+
var o = class extends e {
|
|
7
8
|
constructor(...e) {
|
|
8
9
|
super(...e), this.orientation = "horizontal", this.width = "", this._handleItemOpen = (e) => {
|
|
9
10
|
let t = e.target;
|
|
10
|
-
if (!(t instanceof
|
|
11
|
+
if (!(t instanceof s)) return;
|
|
11
12
|
let n = e.detail?.reason === "hover" ? "hover" : "outside";
|
|
12
13
|
for (let e of this._getItems()) e !== t && e.open && e._closeDropdown(n);
|
|
13
14
|
}, this._handleKeydown = (e) => {
|
|
14
15
|
let t = this._getItems();
|
|
15
16
|
if (!t.length) return;
|
|
16
|
-
let n = this.orientation === "horizontal", r = n ?
|
|
17
|
-
if (e.key ===
|
|
18
|
-
let n = t.map((e) => e._control()).filter((e) => !!e),
|
|
19
|
-
if (
|
|
20
|
-
e.preventDefault(), e.key ===
|
|
17
|
+
let n = this.orientation === "horizontal", r = i(this), a = n ? r.next : "ArrowDown", o = n ? r.prev : "ArrowUp";
|
|
18
|
+
if (e.key === a || e.key === o) {
|
|
19
|
+
let n = t.map((e) => e._control()).filter((e) => !!e), r = n.indexOf(document.activeElement);
|
|
20
|
+
if (r < 0) return;
|
|
21
|
+
e.preventDefault(), e.key === a ? (n[r + 1] ?? n[0])?.focus() : (n[r - 1] ?? n[n.length - 1])?.focus();
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
24
|
if (e.key === "Escape") for (let e of t) e.open && (e._closeDropdown("escape"), e._control()?.focus());
|
|
@@ -36,14 +37,14 @@ var a = class extends e {
|
|
|
36
37
|
return Array.from(this.querySelectorAll("void-nav-menu-item")).filter((e) => e.closest("void-nav-menu") === this);
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
|
-
t([
|
|
40
|
+
t([a({
|
|
40
41
|
type: String,
|
|
41
42
|
reflect: !0
|
|
42
|
-
})],
|
|
43
|
+
})], o.prototype, "orientation", void 0), t([a({
|
|
43
44
|
type: String,
|
|
44
45
|
reflect: !0
|
|
45
|
-
})],
|
|
46
|
-
var
|
|
46
|
+
})], o.prototype, "width", void 0), customElements.get("void-nav-menu") || customElements.define("void-nav-menu", o);
|
|
47
|
+
var s = class extends e {
|
|
47
48
|
constructor(...e) {
|
|
48
49
|
super(...e), this.open = !1, this.disabled = !1, this.current = !1, this._openedByHover = !1, this._parts = new r(this, {
|
|
49
50
|
tags: ["void-nav-menu-trigger", "void-nav-menu-content"],
|
|
@@ -106,15 +107,15 @@ var o = class extends e {
|
|
|
106
107
|
})));
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
|
-
t([
|
|
110
|
+
t([a({
|
|
110
111
|
type: Boolean,
|
|
111
112
|
reflect: !0
|
|
112
|
-
})],
|
|
113
|
+
})], s.prototype, "open", void 0), t([a({
|
|
113
114
|
type: Boolean,
|
|
114
115
|
reflect: !0
|
|
115
|
-
})],
|
|
116
|
+
})], s.prototype, "disabled", void 0), t([a({
|
|
116
117
|
type: Boolean,
|
|
117
118
|
reflect: !0
|
|
118
|
-
})],
|
|
119
|
+
})], s.prototype, "current", void 0), customElements.get("void-nav-menu-item") || customElements.define("void-nav-menu-item", s);
|
|
119
120
|
//#endregion
|
|
120
|
-
export {
|
|
121
|
+
export { o as VoidNavMenu, s as VoidNavMenuItem };
|
|
@@ -12,8 +12,8 @@ export declare class VoidNumberInput extends VoidNumberInput_base {
|
|
|
12
12
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
13
13
|
static editState: string[];
|
|
14
14
|
/**
|
|
15
|
-
* The number, or `null` while the field is empty (the default, and after the user clears it).
|
|
16
|
-
* attribute it
|
|
15
|
+
* The number, or `null` while the field is empty (the default, and after the user clears it). Reflected to
|
|
16
|
+
* the attribute as it changes (absent while empty); an absent or empty attribute is an empty field. It is kept within
|
|
17
17
|
* `min` and `max` once the user commits an edit. An empty field submits an empty string, and with
|
|
18
18
|
* `required` it is invalid (`valueMissing`), as a native number field.
|
|
19
19
|
*/
|
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
import { PropertyDeclaration, PropertyValues } from 'lit';
|
|
1
2
|
import { VoidElement } from '../base.js';
|
|
2
3
|
declare const VoidPinInput_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
3
4
|
/**
|
|
@@ -19,8 +20,9 @@ export declare class VoidPinInput extends VoidPinInput_base {
|
|
|
19
20
|
*/
|
|
20
21
|
groups: string;
|
|
21
22
|
/**
|
|
22
|
-
* The characters entered so far, without separators
|
|
23
|
-
* form's reset target
|
|
23
|
+
* The characters entered so far, without separators, reflected to the `value` attribute as they
|
|
24
|
+
* change; the form's reset target stays the value the cells started with. A `mask`ed input does not
|
|
25
|
+
* reflect: its attribute is only ever the initial value.
|
|
24
26
|
*/
|
|
25
27
|
value: string;
|
|
26
28
|
/** Stop the cells accepting input and exclude the value from the form submission. */
|
|
@@ -41,6 +43,8 @@ export declare class VoidPinInput extends VoidPinInput_base {
|
|
|
41
43
|
color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
|
|
42
44
|
/** Character shown in every empty cell, such as `-`. */
|
|
43
45
|
placeholder: string;
|
|
46
|
+
requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void;
|
|
47
|
+
protected updated(changed: PropertyValues): void;
|
|
44
48
|
private get _effectiveLength();
|
|
45
49
|
private get _parsedGroups();
|
|
46
50
|
private _separatorIndices;
|