@voidable/ui 0.9.0 → 0.11.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 +8 -1
- package/dist/base.js +5 -1
- package/dist/chunks/base-BGrS4eIl.js +307 -0
- package/dist/chunks/data-BpiiNapL.js +95 -0
- package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
- package/dist/chunks/{modal-hivQ4YoU.js → modal-DWGkNdNG.js} +3 -3
- package/dist/chunks/{overlay-BywGMcDW.js → overlay-CH7L4N-h.js} +2 -2
- package/dist/chunks/{parts-CMQQop0D.js → parts-DI_3VpSy.js} +21 -17
- package/dist/chunks/{base-CMruMbxC.js → projection-oPe6ipjL.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.d.ts +11 -0
- package/dist/components/alert.js +11 -4
- package/dist/components/avatar.js +13 -11
- package/dist/components/badge.d.ts +8 -2
- package/dist/components/badge.js +1 -4
- package/dist/components/banner.d.ts +9 -0
- package/dist/components/banner.js +11 -4
- package/dist/components/bar-chart.d.ts +21 -7
- package/dist/components/bar-chart.js +67 -43
- package/dist/components/breadcrumbs.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.d.ts +40 -2
- package/dist/components/calendar.js +170 -79
- package/dist/components/card.js +1 -1
- package/dist/components/carousel.js +20 -19
- package/dist/components/charts/data.d.ts +72 -0
- 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.d.ts +22 -6
- package/dist/components/donut-chart.js +96 -68
- 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.d.ts +20 -5
- package/dist/components/file-upload.js +52 -20
- package/dist/components/gauge.d.ts +32 -8
- package/dist/components/gauge.js +209 -135
- package/dist/components/hamburger.d.ts +12 -1
- package/dist/components/hamburger.js +33 -20
- 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.d.ts +22 -7
- package/dist/components/line-chart.js +80 -56
- 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.d.ts +9 -0
- package/dist/components/nav-bar.js +16 -3
- 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.d.ts +13 -1
- package/dist/components/stat.js +29 -19
- 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.d.ts +4 -0
- package/dist/components/table.js +42 -29
- 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 +15 -13
- package/dist/custom-elements.json +320 -88
- package/dist/dev/types.d.ts +3 -1
- package/dist/dev.js +85 -16
- 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 +84 -59
- package/dist/types/elements.d.ts +13 -13
- package/dist/types/react.d.ts +2 -2
- package/dist/types/solid.d.ts +2 -2
- package/dist/types/svelte.d.ts +2 -2
- package/dist/types/vue.d.ts +2 -2
- package/dist/vscode.html-custom-data.json +108 -28
- package/dist/web-types.json +189 -60
- package/package.json +1 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
3
|
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { r } from "../chunks/projection-oPe6ipjL.js";
|
|
5
|
+
import { o as i, r as a } from "../chunks/keyboard-CEhMSkws.js";
|
|
6
|
+
import { t as o } from "../chunks/overlay-CH7L4N-h.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";
|
|
9
10
|
//#region src/components/calendar.ts
|
|
10
|
-
|
|
11
|
+
r();
|
|
12
|
+
function d(e) {
|
|
11
13
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
12
14
|
return t ? [
|
|
13
15
|
Number(t[1]),
|
|
@@ -15,26 +17,45 @@ function l(e) {
|
|
|
15
17
|
Number(t[3])
|
|
16
18
|
] : null;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function f(e, t, n) {
|
|
19
21
|
return `${String(e).padStart(4, "0")}-${String(t + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
|
|
20
22
|
}
|
|
21
|
-
function
|
|
23
|
+
function p() {
|
|
22
24
|
let e = /* @__PURE__ */ new Date();
|
|
23
|
-
return
|
|
25
|
+
return f(e.getFullYear(), e.getMonth(), e.getDate());
|
|
24
26
|
}
|
|
25
|
-
function
|
|
27
|
+
function m(e, t) {
|
|
26
28
|
return new Date(e, t + 1, 0).getDate();
|
|
27
29
|
}
|
|
28
|
-
function
|
|
30
|
+
function h(e, t, n) {
|
|
29
31
|
return t && e < t ? t : n && e > n ? n : e;
|
|
30
32
|
}
|
|
31
|
-
function
|
|
32
|
-
let n =
|
|
33
|
+
function g(e, t) {
|
|
34
|
+
let n = d(e);
|
|
33
35
|
if (!n) return e;
|
|
34
36
|
let [r, i, a] = n;
|
|
35
37
|
return t.replace("YYYY", String(r).padStart(4, "0")).replace("MM", String(i + 1).padStart(2, "0")).replace("DD", String(a).padStart(2, "0"));
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
function _(e, t) {
|
|
40
|
+
let n = e.trim(), r = d(n), i = [], a = "";
|
|
41
|
+
for (let e of t.split(/(YYYY|MM|DD)/)) e === "YYYY" ? (i.push("y"), a += "(\\d{4})") : e === "MM" ? (i.push("m"), a += "(\\d{1,2})") : e === "DD" ? (i.push("d"), a += "(\\d{1,2})") : a += e.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&").replace(/\s+/g, "\\s*");
|
|
42
|
+
let o, s, c, l = r ? null : RegExp(`^${a}$`).exec(n);
|
|
43
|
+
if (r) [o, s, c] = [
|
|
44
|
+
r[0],
|
|
45
|
+
r[1] + 1,
|
|
46
|
+
r[2]
|
|
47
|
+
];
|
|
48
|
+
else if (l && i.length === 3 && new Set(i).size === 3) {
|
|
49
|
+
let e = (e) => Number(l[i.indexOf(e) + 1]);
|
|
50
|
+
[o, s, c] = [
|
|
51
|
+
e("y"),
|
|
52
|
+
e("m"),
|
|
53
|
+
e("d")
|
|
54
|
+
];
|
|
55
|
+
} else return null;
|
|
56
|
+
return s < 1 || s > 12 || c < 1 || c > m(o, s - 1) || o < 100 ? null : f(o, s - 1, c);
|
|
57
|
+
}
|
|
58
|
+
var v = class extends n(e) {
|
|
38
59
|
constructor(...e) {
|
|
39
60
|
super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this._viewYear = 0, this._viewMonth = 0, this._view = "days", this._focusDate = "", this._yearsPageStart = 0, this._didInit = !1, this._prevMonth = () => {
|
|
40
61
|
this._viewMonth === 0 ? (this._viewMonth = 11, this._viewYear--) : this._viewMonth--, this._syncFocusToView(), this.requestUpdate();
|
|
@@ -56,47 +77,47 @@ var h = class extends n(e) {
|
|
|
56
77
|
if (this.disabled) return;
|
|
57
78
|
let t = e.target.getAttribute("data-date");
|
|
58
79
|
if (!t) return;
|
|
59
|
-
let n =
|
|
80
|
+
let n = d(t);
|
|
60
81
|
if (!n) return;
|
|
61
|
-
let [r, i] = n,
|
|
82
|
+
let [r, i] = n, o = n[2], s = !0, c = null;
|
|
62
83
|
switch (e.key) {
|
|
63
|
-
case
|
|
64
|
-
|
|
84
|
+
case a(this).prev:
|
|
85
|
+
o--;
|
|
65
86
|
break;
|
|
66
|
-
case
|
|
67
|
-
|
|
87
|
+
case a(this).next:
|
|
88
|
+
o++;
|
|
68
89
|
break;
|
|
69
90
|
case "ArrowUp":
|
|
70
|
-
|
|
91
|
+
o -= 7;
|
|
71
92
|
break;
|
|
72
93
|
case "ArrowDown":
|
|
73
|
-
|
|
94
|
+
o += 7;
|
|
74
95
|
break;
|
|
75
96
|
case "Home":
|
|
76
|
-
|
|
97
|
+
o -= (new Date(r, i, o).getDay() - this.firstDay + 7) % 7;
|
|
77
98
|
break;
|
|
78
99
|
case "End":
|
|
79
|
-
|
|
100
|
+
o += 6 - (new Date(r, i, o).getDay() - this.firstDay + 7) % 7;
|
|
80
101
|
break;
|
|
81
102
|
case "PageUp":
|
|
82
103
|
case "PageDown": {
|
|
83
104
|
let t = e.key === "PageUp" ? -1 : 1, n = e.shiftKey ? new Date(r + t, i, 1) : new Date(r, i + t, 1);
|
|
84
|
-
|
|
105
|
+
o = Math.min(o, m(n.getFullYear(), n.getMonth())), c = n;
|
|
85
106
|
break;
|
|
86
107
|
}
|
|
87
108
|
case "Enter":
|
|
88
109
|
case " ":
|
|
89
110
|
this._selectDate(t), e.preventDefault();
|
|
90
111
|
return;
|
|
91
|
-
default:
|
|
112
|
+
default: s = !1;
|
|
92
113
|
}
|
|
93
|
-
if (!
|
|
114
|
+
if (!s) return;
|
|
94
115
|
e.preventDefault();
|
|
95
|
-
let
|
|
96
|
-
this._focusDate =
|
|
97
|
-
let
|
|
98
|
-
|
|
99
|
-
this.querySelector(`[data-date="${
|
|
116
|
+
let l = c ? new Date(c.getFullYear(), c.getMonth(), o) : new Date(r, i, o), u = h(f(l.getFullYear(), l.getMonth(), l.getDate()), this.min || void 0, this.max || void 0);
|
|
117
|
+
this._focusDate = u;
|
|
118
|
+
let p = d(u);
|
|
119
|
+
p && (this._viewYear = p[0], this._viewMonth = p[1]), this.requestUpdate(), this.updateComplete.then(() => {
|
|
120
|
+
this.querySelector(`[data-date="${u}"]`)?.focus();
|
|
100
121
|
});
|
|
101
122
|
};
|
|
102
123
|
}
|
|
@@ -107,16 +128,16 @@ var h = class extends n(e) {
|
|
|
107
128
|
super.updated(e), e.has("value") && this._syncViewToValue();
|
|
108
129
|
}
|
|
109
130
|
_initView() {
|
|
110
|
-
let e =
|
|
131
|
+
let e = d(this.value);
|
|
111
132
|
if (e) this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value;
|
|
112
133
|
else {
|
|
113
134
|
let e = /* @__PURE__ */ new Date();
|
|
114
|
-
this._viewYear = e.getFullYear(), this._viewMonth = e.getMonth(), this._focusDate =
|
|
135
|
+
this._viewYear = e.getFullYear(), this._viewMonth = e.getMonth(), this._focusDate = p();
|
|
115
136
|
}
|
|
116
137
|
this._yearsPageStart = this._viewYear - this._viewYear % 12;
|
|
117
138
|
}
|
|
118
139
|
_syncViewToValue() {
|
|
119
|
-
let e =
|
|
140
|
+
let e = d(this.value);
|
|
120
141
|
e && (this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value, this._yearsPageStart = this._viewYear - this._viewYear % 12, this.requestUpdate());
|
|
121
142
|
}
|
|
122
143
|
render() {
|
|
@@ -124,7 +145,7 @@ var h = class extends n(e) {
|
|
|
124
145
|
}
|
|
125
146
|
_renderDays() {
|
|
126
147
|
let e = this._getDayNames(), t = this._buildDayCells(), n = Array.from({ length: t.length / 7 }, (e, n) => t.slice(n * 7, n * 7 + 7)), r = this._getMonthName(this._viewMonth);
|
|
127
|
-
return
|
|
148
|
+
return s`
|
|
128
149
|
<div class="void-calendar-header">
|
|
129
150
|
<button
|
|
130
151
|
type="button"
|
|
@@ -154,21 +175,21 @@ var h = class extends n(e) {
|
|
|
154
175
|
</div>
|
|
155
176
|
<div class="void-calendar-grid" role="grid" aria-label="${r} ${this._viewYear}" @keydown=${this._onDayKeydown}>
|
|
156
177
|
<div class="void-calendar-weekdays" role="row">
|
|
157
|
-
${e.map((e) =>
|
|
178
|
+
${e.map((e) => s`<div class="void-calendar-weekday" role="columnheader" aria-label=${e.long}>${e.short}</div>`)}
|
|
158
179
|
</div>
|
|
159
180
|
<div class="void-calendar-days" role="rowgroup">
|
|
160
|
-
${n.map((e) =>
|
|
181
|
+
${n.map((e) => s`
|
|
161
182
|
<div class="void-calendar-week" role="row">
|
|
162
183
|
${e.map((e) => {
|
|
163
|
-
let t = e.iso === this.value, n = e.iso ===
|
|
164
|
-
return
|
|
184
|
+
let t = e.iso === this.value, n = e.iso === p(), r = this.disabled || e.disabled;
|
|
185
|
+
return s`
|
|
165
186
|
<div class="void-calendar-cell" role="gridcell" aria-selected=${t ? "true" : "false"}>
|
|
166
187
|
<button
|
|
167
188
|
type="button"
|
|
168
189
|
class="void-calendar-day${t ? " selected" : ""}${n ? " today" : ""}${e.outside ? " outside" : ""}"
|
|
169
190
|
?disabled=${r}
|
|
170
191
|
aria-label=${this._formatFullDate(e.iso)}
|
|
171
|
-
aria-current=${n ? "date" :
|
|
192
|
+
aria-current=${n ? "date" : c}
|
|
172
193
|
tabindex=${e.iso === this._focusDate ? "0" : "-1"}
|
|
173
194
|
data-date=${e.iso}
|
|
174
195
|
@click=${() => this._selectDate(e.iso)}
|
|
@@ -183,7 +204,7 @@ var h = class extends n(e) {
|
|
|
183
204
|
`;
|
|
184
205
|
}
|
|
185
206
|
_formatFullDate(e) {
|
|
186
|
-
let t =
|
|
207
|
+
let t = d(e);
|
|
187
208
|
if (!t) return e;
|
|
188
209
|
try {
|
|
189
210
|
return new Intl.DateTimeFormat(this.locale, { dateStyle: "full" }).format(new Date(t[0], t[1], t[2]));
|
|
@@ -206,9 +227,9 @@ var h = class extends n(e) {
|
|
|
206
227
|
return new Intl.DateTimeFormat(this.locale, { month: "long" }).format(new Date(2024, e, 1));
|
|
207
228
|
}
|
|
208
229
|
_buildDayCells() {
|
|
209
|
-
let e = this._viewYear, t = this._viewMonth, n =
|
|
230
|
+
let e = this._viewYear, t = this._viewMonth, n = m(e, t), r = (new Date(e, t, 1).getDay() - this.firstDay + 7) % 7, i = [], a = t === 0 ? 11 : t - 1, o = t === 0 ? e - 1 : e, s = m(o, a);
|
|
210
231
|
for (let e = r - 1; e >= 0; e--) {
|
|
211
|
-
let t = s - e, n =
|
|
232
|
+
let t = s - e, n = f(o, a, t);
|
|
212
233
|
i.push({
|
|
213
234
|
day: t,
|
|
214
235
|
iso: n,
|
|
@@ -217,7 +238,7 @@ var h = class extends n(e) {
|
|
|
217
238
|
});
|
|
218
239
|
}
|
|
219
240
|
for (let r = 1; r <= n; r++) {
|
|
220
|
-
let n =
|
|
241
|
+
let n = f(e, t, r);
|
|
221
242
|
i.push({
|
|
222
243
|
day: r,
|
|
223
244
|
iso: n,
|
|
@@ -225,9 +246,9 @@ var h = class extends n(e) {
|
|
|
225
246
|
disabled: this._isOutOfRange(n)
|
|
226
247
|
});
|
|
227
248
|
}
|
|
228
|
-
let c = t === 11 ? 0 : t + 1, l = t === 11 ? e + 1 : e,
|
|
229
|
-
for (let e = 1; e <=
|
|
230
|
-
let t =
|
|
249
|
+
let c = t === 11 ? 0 : t + 1, l = t === 11 ? e + 1 : e, u = 42 - i.length;
|
|
250
|
+
for (let e = 1; e <= u; e++) {
|
|
251
|
+
let t = f(l, c, e);
|
|
231
252
|
i.push({
|
|
232
253
|
day: e,
|
|
233
254
|
iso: t,
|
|
@@ -245,7 +266,7 @@ var h = class extends n(e) {
|
|
|
245
266
|
index: n,
|
|
246
267
|
name: e.format(new Date(2024, n, 1))
|
|
247
268
|
}));
|
|
248
|
-
return
|
|
269
|
+
return s`
|
|
249
270
|
<div class="void-calendar-header">
|
|
250
271
|
<button
|
|
251
272
|
type="button"
|
|
@@ -274,7 +295,7 @@ var h = class extends n(e) {
|
|
|
274
295
|
</button>
|
|
275
296
|
</div>
|
|
276
297
|
<div class="void-calendar-months">
|
|
277
|
-
${t.map((e) =>
|
|
298
|
+
${t.map((e) => s`
|
|
278
299
|
<button
|
|
279
300
|
type="button"
|
|
280
301
|
class="void-calendar-month${e.index === this._viewMonth && this._viewYear === (/* @__PURE__ */ new Date()).getFullYear() ? " current" : ""}"
|
|
@@ -287,7 +308,7 @@ var h = class extends n(e) {
|
|
|
287
308
|
}
|
|
288
309
|
_renderYears() {
|
|
289
310
|
let e = this._yearsPageStart, t = Array.from({ length: 12 }, (t, n) => e + n), n = (/* @__PURE__ */ new Date()).getFullYear();
|
|
290
|
-
return
|
|
311
|
+
return s`
|
|
291
312
|
<div class="void-calendar-header">
|
|
292
313
|
<button
|
|
293
314
|
type="button"
|
|
@@ -310,7 +331,7 @@ var h = class extends n(e) {
|
|
|
310
331
|
</button>
|
|
311
332
|
</div>
|
|
312
333
|
<div class="void-calendar-years">
|
|
313
|
-
${t.map((e) =>
|
|
334
|
+
${t.map((e) => s`
|
|
314
335
|
<button
|
|
315
336
|
type="button"
|
|
316
337
|
class="void-calendar-year${e === n ? " current" : ""}"
|
|
@@ -325,12 +346,12 @@ var h = class extends n(e) {
|
|
|
325
346
|
this._viewMonth = e, this._view = "days", this._syncFocusToView(), this.requestUpdate();
|
|
326
347
|
}
|
|
327
348
|
_syncFocusToView() {
|
|
328
|
-
let e =
|
|
349
|
+
let e = d(this._focusDate) ?? [
|
|
329
350
|
this._viewYear,
|
|
330
351
|
this._viewMonth,
|
|
331
352
|
1
|
|
332
|
-
], t = Math.min(e[2],
|
|
333
|
-
this._focusDate =
|
|
353
|
+
], t = Math.min(e[2], m(this._viewYear, this._viewMonth));
|
|
354
|
+
this._focusDate = h(f(this._viewYear, this._viewMonth, t), this.min || void 0, this.max || void 0);
|
|
334
355
|
}
|
|
335
356
|
_pickYear(e) {
|
|
336
357
|
this._viewYear = e, this._yearsPageStart = e - e % 12, this._view = "months", this.requestUpdate();
|
|
@@ -338,7 +359,7 @@ var h = class extends n(e) {
|
|
|
338
359
|
_selectDate(e) {
|
|
339
360
|
if (this.disabled || this._isOutOfRange(e)) return;
|
|
340
361
|
this.value = e, this._focusDate = e;
|
|
341
|
-
let t =
|
|
362
|
+
let t = d(e);
|
|
342
363
|
this._viewYear = t[0], this._viewMonth = t[1], this._view = "days", this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
343
364
|
bubbles: !0,
|
|
344
365
|
composed: !0,
|
|
@@ -349,22 +370,22 @@ var h = class extends n(e) {
|
|
|
349
370
|
}));
|
|
350
371
|
}
|
|
351
372
|
};
|
|
352
|
-
t([
|
|
373
|
+
t([l({
|
|
353
374
|
type: String,
|
|
354
375
|
reflect: !0
|
|
355
|
-
})],
|
|
376
|
+
})], v.prototype, "value", void 0), t([l({ type: String })], v.prototype, "min", void 0), t([l({ type: String })], v.prototype, "max", void 0), t([l({
|
|
356
377
|
type: Boolean,
|
|
357
378
|
reflect: !0
|
|
358
|
-
})],
|
|
379
|
+
})], v.prototype, "disabled", void 0), t([l({
|
|
359
380
|
type: String,
|
|
360
381
|
reflect: !0
|
|
361
|
-
})],
|
|
382
|
+
})], v.prototype, "size", void 0), t([l({ type: String })], v.prototype, "locale", void 0), t([l({
|
|
362
383
|
attribute: "first-day",
|
|
363
384
|
type: Number
|
|
364
|
-
})],
|
|
365
|
-
var
|
|
385
|
+
})], v.prototype, "firstDay", void 0), customElements.get("void-calendar") || customElements.define("void-calendar", v);
|
|
386
|
+
var y = class extends n(e) {
|
|
366
387
|
constructor(...e) {
|
|
367
|
-
super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this.open = !1, this.placeholder = "Select date", this.format = "MM/DD/YYYY", this.color = "default", this._dropdownId =
|
|
388
|
+
super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this.open = !1, this.placeholder = "Select date", this.format = "MM/DD/YYYY", this.color = "default", this.error = "", this._draft = null, this._rejected = null, this._ownError = "", this._errorId = i("void-date-picker-error"), this._dropdownId = i("void-date-picker-dialog"), this._overlay = new o(this, {
|
|
368
389
|
kind: "dialog",
|
|
369
390
|
surface: () => this.querySelector(":scope > .void-date-picker-dropdown"),
|
|
370
391
|
isOpen: () => this.open,
|
|
@@ -378,37 +399,71 @@ var g = class extends n(e) {
|
|
|
378
399
|
this.disabled || this._overlay.toggle("trigger");
|
|
379
400
|
}, this._onInputClick = () => {
|
|
380
401
|
this.disabled || this._overlay.toggle("focus");
|
|
402
|
+
}, this._onInput = (e) => {
|
|
403
|
+
this._draft = e.target.value;
|
|
404
|
+
}, this._commit = () => {
|
|
405
|
+
if (this._draft === null || this.disabled) return;
|
|
406
|
+
let e = this._draft.trim();
|
|
407
|
+
if (e === this._display) {
|
|
408
|
+
this._draft = null, this._accept();
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
if (e === "") {
|
|
412
|
+
this._draft = null, this._accept(), this._setTyped("");
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
let t = _(e, this.format), n = t ? this.min && t < this.min ? { rangeUnderflow: !0 } : this.max && t > this.max ? { rangeOverflow: !0 } : null : { badInput: !0 };
|
|
416
|
+
if (n || !t) {
|
|
417
|
+
let e = n?.rangeUnderflow ? `Choose ${g(this.min, this.format)} or a later date.` : n?.rangeOverflow ? `Choose ${g(this.max, this.format)} or an earlier date.` : `Enter a date as ${this.format} or YYYY-MM-DD.`;
|
|
418
|
+
this._rejected = {
|
|
419
|
+
flags: n ?? { badInput: !0 },
|
|
420
|
+
message: e
|
|
421
|
+
}, (!this.error || this.error === this._ownError) && (this.error = e, this._ownError = e), this.requestUpdate();
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
this._draft = null, this._accept(), this._setTyped(t);
|
|
381
425
|
}, this._onCalendarChange = (e) => {
|
|
382
|
-
e.stopPropagation(), this.value = e.detail.value, this._overlay.requestClose("select"), this.dispatchEvent(new CustomEvent("void-change", {
|
|
426
|
+
e.stopPropagation(), this._draft = null, this._accept(), this.value = e.detail.value, this._overlay.requestClose("select"), this.dispatchEvent(new CustomEvent("void-change", {
|
|
383
427
|
bubbles: !0,
|
|
384
428
|
composed: !0,
|
|
385
429
|
detail: e.detail
|
|
386
430
|
}));
|
|
387
431
|
}, this._onInputKeydown = (e) => {
|
|
388
|
-
e.key === "Enter" || e.key === " " ? (e.preventDefault(), this.disabled || this._overlay.toggle("keyboard")) : e.key === "ArrowDown" && !this.disabled && (e.preventDefault(), this.open ? this._focusDay() : this._overlay.requestOpen("keyboard"));
|
|
432
|
+
e.key === "Enter" && this._draft !== null && this._draft.trim() !== this._display ? (e.preventDefault(), this._commit(), !this._rejected && this.open && this._overlay.requestClose("select")) : e.key === "Enter" || e.key === " " && this._draft === null ? (e.preventDefault(), this.disabled || this._overlay.toggle("keyboard")) : e.key === "ArrowDown" && !this.disabled && (e.preventDefault(), this.open ? this._focusDay() : this._overlay.requestOpen("keyboard"));
|
|
389
433
|
};
|
|
390
434
|
}
|
|
391
435
|
static {
|
|
392
436
|
this.labelTarget = ".void-date-picker-input";
|
|
393
437
|
}
|
|
438
|
+
static {
|
|
439
|
+
this.clientState = { _draft: "value" };
|
|
440
|
+
}
|
|
441
|
+
static {
|
|
442
|
+
this.editState = ["value"];
|
|
443
|
+
}
|
|
394
444
|
async _focusDay() {
|
|
395
445
|
let e = this.querySelector(":scope > .void-date-picker-dropdown > void-calendar");
|
|
396
446
|
e && (await e.updateComplete, this.open && e.querySelector("[tabindex=\"0\"]")?.focus({ preventScroll: !0 }));
|
|
397
447
|
}
|
|
398
448
|
render() {
|
|
399
|
-
|
|
449
|
+
let e = this.value ? g(this.value, this.format) : "", t = this._rejected && this.error === this._ownError ? this.error : "";
|
|
450
|
+
return s`
|
|
400
451
|
<div class="void-date-picker-anchor">
|
|
401
452
|
<input
|
|
402
453
|
class="void-date-picker-input"
|
|
403
|
-
.value=${
|
|
454
|
+
.value=${u(this._draft ?? e)}
|
|
404
455
|
placeholder=${this.placeholder}
|
|
405
456
|
?disabled=${this.disabled}
|
|
406
|
-
|
|
457
|
+
autocomplete="off"
|
|
407
458
|
role="combobox"
|
|
408
459
|
aria-label=${this.placeholder}
|
|
409
460
|
aria-haspopup="dialog"
|
|
410
461
|
aria-expanded=${String(this.open)}
|
|
411
462
|
aria-controls=${this._dropdownId}
|
|
463
|
+
aria-invalid=${this.error ? "true" : c}
|
|
464
|
+
aria-describedby=${t ? this._errorId : c}
|
|
465
|
+
@input=${this._onInput}
|
|
466
|
+
@blur=${this._commit}
|
|
412
467
|
@click=${this._onInputClick}
|
|
413
468
|
@keydown=${this._onInputKeydown}
|
|
414
469
|
/>
|
|
@@ -428,7 +483,8 @@ var g = class extends n(e) {
|
|
|
428
483
|
</svg>
|
|
429
484
|
</button>
|
|
430
485
|
</div>
|
|
431
|
-
${this.
|
|
486
|
+
${t ? s`<span class="void-date-picker-error" id=${this._errorId} role="alert">${t}</span>` : c}
|
|
487
|
+
${this.open ? s`
|
|
432
488
|
<div class="void-date-picker-dropdown" id=${this._dropdownId} role="dialog" aria-label="Choose date" popover="manual">
|
|
433
489
|
<void-calendar
|
|
434
490
|
value=${this.value}
|
|
@@ -441,28 +497,63 @@ var g = class extends n(e) {
|
|
|
441
497
|
@void-change=${this._onCalendarChange}
|
|
442
498
|
></void-calendar>
|
|
443
499
|
</div>
|
|
444
|
-
` :
|
|
500
|
+
` : c}
|
|
445
501
|
`;
|
|
446
502
|
}
|
|
503
|
+
get _display() {
|
|
504
|
+
return this.value ? g(this.value, this.format) : "";
|
|
505
|
+
}
|
|
506
|
+
_accept(e = !0) {
|
|
507
|
+
this._rejected = null, this._ownError && this.error === this._ownError && (this.error = ""), this._ownError = "", e && this.requestUpdate();
|
|
508
|
+
}
|
|
509
|
+
_setTyped(e) {
|
|
510
|
+
if (e === this.value) return;
|
|
511
|
+
this.value = e;
|
|
512
|
+
let t = d(e);
|
|
513
|
+
this.dispatchEvent(new CustomEvent("void-change", {
|
|
514
|
+
bubbles: !0,
|
|
515
|
+
composed: !0,
|
|
516
|
+
detail: {
|
|
517
|
+
value: e,
|
|
518
|
+
date: t ? new Date(t[0], t[1], t[2]) : null
|
|
519
|
+
}
|
|
520
|
+
}));
|
|
521
|
+
}
|
|
522
|
+
formValidity() {
|
|
523
|
+
return this._rejected ? {
|
|
524
|
+
flags: this._rejected.flags,
|
|
525
|
+
message: this._rejected.message,
|
|
526
|
+
anchor: this.querySelector(".void-date-picker-input") ?? void 0
|
|
527
|
+
} : super.formValidity();
|
|
528
|
+
}
|
|
529
|
+
formRestore(e) {
|
|
530
|
+
this._draft = null, this._accept(), super.formRestore(e);
|
|
531
|
+
}
|
|
532
|
+
willUpdate(e) {
|
|
533
|
+
super.willUpdate(e), e.has("value") && (this._draft = null, this._rejected && this._accept(!1));
|
|
534
|
+
}
|
|
447
535
|
};
|
|
448
|
-
t([
|
|
536
|
+
t([l({
|
|
449
537
|
type: String,
|
|
450
538
|
reflect: !0
|
|
451
|
-
})],
|
|
539
|
+
})], y.prototype, "value", void 0), t([l({ type: String })], y.prototype, "min", void 0), t([l({ type: String })], y.prototype, "max", void 0), t([l({
|
|
452
540
|
type: Boolean,
|
|
453
541
|
reflect: !0
|
|
454
|
-
})],
|
|
542
|
+
})], y.prototype, "disabled", void 0), t([l({
|
|
455
543
|
type: String,
|
|
456
544
|
reflect: !0
|
|
457
|
-
})],
|
|
545
|
+
})], y.prototype, "size", void 0), t([l({ type: String })], y.prototype, "locale", void 0), t([l({
|
|
458
546
|
attribute: "first-day",
|
|
459
547
|
type: Number
|
|
460
|
-
})],
|
|
548
|
+
})], y.prototype, "firstDay", void 0), t([l({
|
|
461
549
|
type: Boolean,
|
|
462
550
|
reflect: !0
|
|
463
|
-
})],
|
|
551
|
+
})], y.prototype, "open", void 0), t([l({ type: String })], y.prototype, "placeholder", void 0), t([l({ type: String })], y.prototype, "format", void 0), t([l({
|
|
552
|
+
type: String,
|
|
553
|
+
reflect: !0
|
|
554
|
+
})], y.prototype, "color", void 0), t([l({
|
|
464
555
|
type: String,
|
|
465
556
|
reflect: !0
|
|
466
|
-
})],
|
|
557
|
+
})], y.prototype, "error", void 0), customElements.get("void-date-picker") || customElements.define("void-date-picker", y);
|
|
467
558
|
//#endregion
|
|
468
|
-
export {
|
|
559
|
+
export { v as VoidCalendar, y as VoidDatePicker };
|
package/dist/components/card.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
3
|
import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
|
|
4
|
-
import { n as r } from "../chunks/parts-
|
|
5
|
-
import {
|
|
4
|
+
import { n as r } from "../chunks/parts-DI_3VpSy.js";
|
|
5
|
+
import { r as i } from "../chunks/keyboard-CEhMSkws.js";
|
|
6
|
+
import { property as a } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/carousel.ts
|
|
7
|
-
var
|
|
8
|
+
var o = class extends e {
|
|
8
9
|
constructor(...e) {
|
|
9
10
|
super(...e), this._activation = new n(this, { disabled: () => this.getAttribute("aria-disabled") === "true" });
|
|
10
11
|
}
|
|
@@ -12,8 +13,8 @@ var a = class extends e {
|
|
|
12
13
|
super.connectedCallback(), this.setHostAttribute("role", "button"), this.setHostAttribute("tabindex", "0");
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
|
-
customElements.get("void-carousel-previous") || customElements.define("void-carousel-previous",
|
|
16
|
-
var
|
|
16
|
+
customElements.get("void-carousel-previous") || customElements.define("void-carousel-previous", o);
|
|
17
|
+
var s = class extends e {
|
|
17
18
|
constructor(...e) {
|
|
18
19
|
super(...e), this._activation = new n(this, { disabled: () => this.getAttribute("aria-disabled") === "true" });
|
|
19
20
|
}
|
|
@@ -21,8 +22,8 @@ var o = class extends e {
|
|
|
21
22
|
super.connectedCallback(), this.setHostAttribute("role", "button"), this.setHostAttribute("tabindex", "0");
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
|
-
customElements.get("void-carousel-next") || customElements.define("void-carousel-next",
|
|
25
|
-
var
|
|
25
|
+
customElements.get("void-carousel-next") || customElements.define("void-carousel-next", s);
|
|
26
|
+
var c = class extends e {
|
|
26
27
|
constructor(...e) {
|
|
27
28
|
super(...e), this.index = 0, this.loop = !1, this.autoplay = !1, this.interval = 5e3, this.size = "md", this.orientation = "horizontal", this._autoplayTimer = null, this._labels = /* @__PURE__ */ new WeakMap(), this._dots = null, this._parts = new r(this, {
|
|
28
29
|
tags: [
|
|
@@ -45,8 +46,8 @@ var s = class extends e {
|
|
|
45
46
|
}, this._onMouseLeave = () => {
|
|
46
47
|
this.autoplay && this._startAutoplay();
|
|
47
48
|
}, this._onKeydown = (e) => {
|
|
48
|
-
let t = this.orientation === "horizontal", n = t ?
|
|
49
|
-
e.key ===
|
|
49
|
+
let t = this.orientation === "horizontal", n = i(this), r = t ? n.prev : "ArrowUp", a = t ? n.next : "ArrowDown";
|
|
50
|
+
e.key === r ? (e.preventDefault(), this._prev()) : e.key === a && (e.preventDefault(), this._next());
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
get _slides() {
|
|
@@ -54,9 +55,9 @@ var s = class extends e {
|
|
|
54
55
|
}
|
|
55
56
|
_wire() {
|
|
56
57
|
let e = this._slides, t = e.length, n = this._parts.one("void-carousel-content");
|
|
57
|
-
n && this._parts.
|
|
58
|
+
n && this._parts.set(n, "aria-live", this.autoplay ? "off" : "polite"), e.forEach((e, n) => {
|
|
58
59
|
this._parts.provide(e, "role", "group"), this._parts.provide(e, "aria-roledescription", "slide");
|
|
59
|
-
let r =
|
|
60
|
+
let r = `${n + 1} of ${t}`, i = e.getAttribute("aria-label");
|
|
60
61
|
(i === null || i === this._labels.get(e)) && (this._parts.set(e, "aria-label", r), this._labels.set(e, r)), this._parts.set(e, "active", n === this.index);
|
|
61
62
|
});
|
|
62
63
|
let r = !this.loop && this.index === 0, i = !this.loop && this.index === t - 1, a = this._parts.one("void-carousel-previous"), o = this._parts.one("void-carousel-next");
|
|
@@ -116,21 +117,21 @@ var s = class extends e {
|
|
|
116
117
|
this._autoplayTimer &&= (clearInterval(this._autoplayTimer), null);
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
|
-
t([
|
|
120
|
+
t([a({
|
|
120
121
|
type: Number,
|
|
121
122
|
reflect: !0
|
|
122
|
-
})],
|
|
123
|
+
})], c.prototype, "index", void 0), t([a({
|
|
123
124
|
type: Boolean,
|
|
124
125
|
reflect: !0
|
|
125
|
-
})],
|
|
126
|
+
})], c.prototype, "loop", void 0), t([a({
|
|
126
127
|
type: Boolean,
|
|
127
128
|
reflect: !0
|
|
128
|
-
})],
|
|
129
|
+
})], c.prototype, "autoplay", void 0), t([a({ type: Number })], c.prototype, "interval", void 0), t([a({
|
|
129
130
|
type: String,
|
|
130
131
|
reflect: !0
|
|
131
|
-
})],
|
|
132
|
+
})], c.prototype, "size", void 0), t([a({
|
|
132
133
|
type: String,
|
|
133
134
|
reflect: !0
|
|
134
|
-
})],
|
|
135
|
+
})], c.prototype, "orientation", void 0), customElements.get("void-carousel") || customElements.define("void-carousel", c);
|
|
135
136
|
//#endregion
|
|
136
|
-
export {
|
|
137
|
+
export { c as VoidCarousel, s as VoidCarouselNext, o as VoidCarouselPrevious };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { nothing, TemplateResult } from 'lit';
|
|
2
|
+
/** Reports a problem with a chart's data through the element's dev warning. */
|
|
3
|
+
export type ChartWarn = (subject: string, message: string) => void;
|
|
4
|
+
/** What an element remembers of the last attribute text it accepted, so an unchanged attribute draws nothing new. */
|
|
5
|
+
export interface ChartSource {
|
|
6
|
+
text: string | null;
|
|
7
|
+
}
|
|
8
|
+
interface ChartInput<T> {
|
|
9
|
+
/** The attribute the text came from, for the warning. */
|
|
10
|
+
attr: string;
|
|
11
|
+
/** What the attribute should look like, for the warning. */
|
|
12
|
+
shape: string;
|
|
13
|
+
empty: () => T;
|
|
14
|
+
/** Turns parsed JSON into the property's value, or null when it has the wrong shape. */
|
|
15
|
+
normalize: (raw: unknown) => T | null;
|
|
16
|
+
warn: ChartWarn;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves what was assigned to a chart's `data` (or `zones`): an object (the property), or the text of the
|
|
20
|
+
* JSON attribute. Returns `null` when the text is the one already accepted (an attribute a server morph left
|
|
21
|
+
* alone), so nothing animates; otherwise the value to use. Invalid text gives the empty value (the chart
|
|
22
|
+
* draws nothing) and a dev warning; it never throws.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readChartInput<T>(input: unknown, source: ChartSource, o: ChartInput<T>): {
|
|
25
|
+
value: T;
|
|
26
|
+
} | null;
|
|
27
|
+
export declare const isRecord: (v: unknown) => v is Record<string, unknown>;
|
|
28
|
+
/** `{ series: [{ name, values }], labels }`, as the bar and line charts take it. */
|
|
29
|
+
export declare function normalizeSeriesData<S extends {
|
|
30
|
+
name: string;
|
|
31
|
+
values: number[];
|
|
32
|
+
}>(raw: unknown): {
|
|
33
|
+
series: S[];
|
|
34
|
+
labels?: string[];
|
|
35
|
+
} | null;
|
|
36
|
+
/** `{ segments: [{ name, value }] }`, as the donut takes it; the gauge's segments share the shape. */
|
|
37
|
+
export declare function normalizeSegments<S extends {
|
|
38
|
+
name: string;
|
|
39
|
+
value: number;
|
|
40
|
+
}>(raw: unknown): S[] | null;
|
|
41
|
+
/** The language the text of `el` is in: its closest `lang`, else the browser's. */
|
|
42
|
+
export declare function chartLocale(el: Element): string | undefined;
|
|
43
|
+
/** Numbers the way a reader of this element's language expects them, with their full precision (up to three decimals). */
|
|
44
|
+
export declare function tableNumbers(el: Element): {
|
|
45
|
+
number: (v: number) => string;
|
|
46
|
+
percent: (v: number) => string;
|
|
47
|
+
};
|
|
48
|
+
export interface ChartTable {
|
|
49
|
+
caption: string;
|
|
50
|
+
/** Column headers; for a table with row headers the first is the corner. */
|
|
51
|
+
head: string[];
|
|
52
|
+
rows: Array<{
|
|
53
|
+
header?: string;
|
|
54
|
+
cells: string[];
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The data table every chart carries: visually hidden, in the accessibility tree, with the chart's label as
|
|
59
|
+
* its caption (the theme shows it below the chart with `show-table`).
|
|
60
|
+
*/
|
|
61
|
+
export declare function dataTable(className: string, t: ChartTable | null): TemplateResult | typeof nothing;
|
|
62
|
+
/** The table of a chart whose data is `series` over `labels` (rows are the labels, columns the series). */
|
|
63
|
+
export declare function seriesTable(el: Element, caption: string, series: Array<{
|
|
64
|
+
name: string;
|
|
65
|
+
values: number[];
|
|
66
|
+
}>, labels: string[]): ChartTable | null;
|
|
67
|
+
/** The table of named parts of a whole (donut segments, gauge segments): name, value and share. */
|
|
68
|
+
export declare function segmentsTable(el: Element, caption: string, segments: Array<{
|
|
69
|
+
name: string;
|
|
70
|
+
value: number;
|
|
71
|
+
}>): ChartTable | null;
|
|
72
|
+
export {};
|