@voidable/ui 0.10.0 → 0.12.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/angular/index.d.ts +2 -2
- package/dist/angular/index.js +2 -1
- package/dist/base.d.ts +6 -0
- package/dist/base.js +2 -2
- package/dist/chunks/activation-B8aBarKd.js +4 -0
- package/dist/chunks/{base-BxmMM3B7.js → base-BGrS4eIl.js} +9 -0
- package/dist/chunks/carousel-C9u0bg5l.js +10 -0
- package/dist/chunks/choice-BTrsi7OW.js +16 -0
- package/dist/chunks/data-Baycjoo4.js +96 -0
- package/dist/chunks/fields-MEqz-olE.js +21 -0
- package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
- package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
- package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
- package/dist/chunks/menu-CxRRgkJI.js +21 -0
- package/dist/chunks/{modal-CgGp_fCs.js → modal-Cz2-Ov76.js} +24 -16
- package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
- package/dist/chunks/{overlay-hLJ7IQHx.js → overlay-BuV-4Yvt.js} +76 -69
- package/dist/chunks/overlay-K1ilWC1p.js +4 -0
- package/dist/chunks/pickers-CjlFgNke.js +36 -0
- package/dist/chunks/{projection-SnR79EHI.js → projection-oPe6ipjL.js} +1 -1
- package/dist/chunks/table-BBpqwWEi.js +4 -0
- package/dist/chunks/tabs-Buf3EBWq.js +10 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.js +23 -15
- package/dist/components/action-input.d.ts +2 -1
- package/dist/components/action-input.js +60 -56
- package/dist/components/alert.d.ts +11 -0
- package/dist/components/alert.js +10 -3
- package/dist/components/avatar.js +2 -2
- 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 +10 -3
- package/dist/components/bar-chart.d.ts +21 -7
- package/dist/components/bar-chart.js +68 -45
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +16 -12
- package/dist/components/button.d.ts +7 -0
- package/dist/components/button.js +24 -17
- package/dist/components/calendar.d.ts +85 -12
- package/dist/components/calendar.js +263 -120
- package/dist/components/card.js +1 -1
- package/dist/components/carousel.d.ts +22 -0
- package/dist/components/carousel.js +66 -37
- package/dist/components/charts/data.d.ts +72 -0
- package/dist/components/checkbox-group.js +23 -22
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +30 -25
- package/dist/components/collapsible.d.ts +7 -0
- package/dist/components/collapsible.js +20 -12
- package/dist/components/color-picker.js +29 -28
- package/dist/components/combobox.d.ts +13 -1
- package/dist/components/combobox.js +55 -42
- package/dist/components/compose-input.d.ts +9 -1
- package/dist/components/compose-input.js +29 -17
- package/dist/components/dialog.js +1 -1
- package/dist/components/divider.js +2 -2
- package/dist/components/donut-chart.d.ts +22 -6
- package/dist/components/donut-chart.js +97 -70
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.d.ts +22 -0
- package/dist/components/dropdown-menu.js +55 -40
- package/dist/components/editable.d.ts +11 -1
- package/dist/components/editable.js +36 -23
- package/dist/components/error-fallback.d.ts +4 -2
- package/dist/components/error-fallback.js +35 -29
- package/dist/components/field.js +2 -2
- package/dist/components/file-upload.d.ts +29 -5
- package/dist/components/file-upload.js +84 -28
- package/dist/components/gauge.d.ts +32 -8
- package/dist/components/gauge.js +206 -133
- package/dist/components/hamburger.d.ts +19 -1
- package/dist/components/hamburger.js +45 -25
- package/dist/components/hover-card.d.ts +7 -0
- package/dist/components/hover-card.js +23 -15
- package/dist/components/indicator.js +16 -15
- package/dist/components/input.js +3 -3
- package/dist/components/line-chart.d.ts +22 -7
- package/dist/components/line-chart.js +80 -57
- package/dist/components/list.js +1 -1
- package/dist/components/menu.d.ts +25 -0
- package/dist/components/menu.js +56 -34
- package/dist/components/multiselect.d.ts +17 -1
- package/dist/components/multiselect.js +97 -75
- package/dist/components/nav-bar.d.ts +9 -0
- package/dist/components/nav-bar.js +16 -3
- package/dist/components/nav-menu.d.ts +9 -0
- package/dist/components/nav-menu.js +31 -24
- package/dist/components/number-input.d.ts +15 -1
- package/dist/components/number-input.js +72 -38
- package/dist/components/pagination.js +26 -25
- package/dist/components/panel.js +1 -1
- package/dist/components/pin-input.d.ts +11 -0
- package/dist/components/pin-input.js +47 -33
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +22 -14
- package/dist/components/progress.js +2 -2
- package/dist/components/radio-group.js +3 -3
- package/dist/components/radio.d.ts +10 -1
- package/dist/components/radio.js +38 -33
- package/dist/components/scroll-area.js +2 -2
- package/dist/components/segmented-control.d.ts +14 -0
- package/dist/components/segmented-control.js +41 -29
- package/dist/components/select.js +2 -2
- package/dist/components/sidebar.d.ts +1 -0
- package/dist/components/sidebar.js +15 -11
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +3 -3
- package/dist/components/spinner.d.ts +5 -3
- package/dist/components/spinner.js +22 -15
- package/dist/components/stat.d.ts +13 -1
- package/dist/components/stat.js +28 -20
- package/dist/components/status-dot.d.ts +2 -2
- package/dist/components/status-dot.js +13 -15
- package/dist/components/stepper.d.ts +2 -0
- package/dist/components/stepper.js +21 -14
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.js +25 -17
- package/dist/components/table.d.ts +81 -1
- package/dist/components/table.js +571 -69
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +43 -34
- package/dist/components/tag.js +13 -12
- package/dist/components/tags-input.d.ts +10 -1
- package/dist/components/tags-input.js +43 -31
- package/dist/components/textarea.js +3 -3
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +36 -29
- package/dist/components/toggle-group.d.ts +8 -0
- package/dist/components/toggle-group.js +25 -18
- package/dist/components/toggle.d.ts +7 -0
- package/dist/components/toggle.js +24 -16
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +21 -13
- package/dist/components.json +108 -84
- package/dist/custom-elements.json +4520 -236
- package/dist/dev/rules.d.ts +0 -1
- package/dist/dev/types.d.ts +5 -1
- package/dist/dev.js +298 -122
- package/dist/index.d.ts +4 -0
- package/dist/index.js +69 -67
- package/dist/keyboard-activation.d.ts +9 -9
- package/dist/keyboard.d.ts +2 -10
- package/dist/keymaps/activation.d.ts +8 -0
- package/dist/keymaps/carousel.d.ts +9 -0
- package/dist/keymaps/choice.d.ts +21 -0
- package/dist/keymaps/fields.d.ts +31 -0
- package/dist/keymaps/index.d.ts +2 -0
- package/dist/keymaps/menu.d.ts +36 -0
- package/dist/keymaps/nav-menu.d.ts +11 -0
- package/dist/keymaps/overlay.d.ts +4 -0
- package/dist/keymaps/pickers.d.ts +36 -0
- package/dist/keymaps/table.d.ts +8 -0
- package/dist/keymaps/tabs.d.ts +7 -0
- package/dist/keymaps.js +51 -0
- package/dist/keys.d.ts +46 -0
- package/dist/keys.js +57 -0
- package/dist/llms.txt +11 -3
- package/dist/messages/ar.d.ts +1 -0
- package/dist/messages/ar.js +130 -0
- package/dist/messages/fr.d.ts +1 -0
- package/dist/messages/fr.js +109 -0
- package/dist/messages.d.ts +213 -0
- package/dist/messages.js +190 -0
- package/dist/modal.d.ts +7 -0
- package/dist/reference.md +885 -60
- package/dist/testing/index.d.ts +46 -0
- package/dist/testing.js +79 -0
- package/dist/types/elements.d.ts +100 -84
- package/dist/types/react.d.ts +7 -3
- package/dist/types/solid.d.ts +7 -3
- package/dist/types/solid2.d.ts +4 -0
- package/dist/types/svelte.d.ts +7 -3
- package/dist/types/vue.d.ts +7 -3
- package/dist/vscode.html-custom-data.json +478 -38
- package/dist/web-types.json +1001 -111
- package/package.json +22 -2
|
@@ -1,29 +1,33 @@
|
|
|
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
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { i, n as a } from "../chunks/parts-DI_3VpSy.js";
|
|
5
|
+
import { n as o, t as s } from "../chunks/nav-menu-Bx284Dk6.js";
|
|
6
|
+
import { property as c } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/nav-menu.ts
|
|
7
|
-
var
|
|
8
|
+
var l = class extends e {
|
|
8
9
|
constructor(...e) {
|
|
9
|
-
super(...e), this.orientation = "horizontal", this.width = "", this._handleItemOpen = (e) => {
|
|
10
|
+
super(...e), this.keys = null, this.orientation = "horizontal", this.width = "", this._handleItemOpen = (e) => {
|
|
10
11
|
let t = e.target;
|
|
11
|
-
if (!(t instanceof
|
|
12
|
+
if (!(t instanceof u)) return;
|
|
12
13
|
let n = e.detail?.reason === "hover" ? "hover" : "outside";
|
|
13
14
|
for (let e of this._getItems()) e !== t && e.open && e._closeDropdown(n);
|
|
14
15
|
}, this._handleKeydown = (e) => {
|
|
15
16
|
let t = this._getItems();
|
|
16
17
|
if (!t.length) return;
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
19
|
-
let n = t.map((e) => e._control()).filter((e) => !!e),
|
|
20
|
-
if (
|
|
21
|
-
e.preventDefault(),
|
|
18
|
+
let r = n(this, e, this.orientation === "horizontal" ? s : o);
|
|
19
|
+
if (r === "next" || r === "previous") {
|
|
20
|
+
let n = t.map((e) => e._control()).filter((e) => !!e), i = n.indexOf(document.activeElement);
|
|
21
|
+
if (i < 0) return;
|
|
22
|
+
e.preventDefault(), r === "next" ? (n[i + 1] ?? n[0])?.focus() : (n[i - 1] ?? n[n.length - 1])?.focus();
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
|
-
if (
|
|
25
|
+
if (r === "close") for (let e of t) e.open && (e._closeDropdown("escape"), e._control()?.focus());
|
|
25
26
|
};
|
|
26
27
|
}
|
|
28
|
+
static {
|
|
29
|
+
this.keyMap = s;
|
|
30
|
+
}
|
|
27
31
|
connectedCallback() {
|
|
28
32
|
super.connectedCallback(), this.setHostAttribute("role", "menubar"), this.addEventListener("keydown", this._handleKeydown), this.addEventListener("void-open", this._handleItemOpen, !0);
|
|
29
33
|
}
|
|
@@ -37,16 +41,19 @@ var o = class extends e {
|
|
|
37
41
|
return Array.from(this.querySelectorAll("void-nav-menu-item")).filter((e) => e.closest("void-nav-menu") === this);
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
|
-
t([
|
|
44
|
+
t([c({
|
|
45
|
+
attribute: "keys",
|
|
46
|
+
converter: r
|
|
47
|
+
})], l.prototype, "keys", void 0), t([c({
|
|
41
48
|
type: String,
|
|
42
49
|
reflect: !0
|
|
43
|
-
})],
|
|
50
|
+
})], l.prototype, "orientation", void 0), t([c({
|
|
44
51
|
type: String,
|
|
45
52
|
reflect: !0
|
|
46
|
-
})],
|
|
47
|
-
var
|
|
53
|
+
})], l.prototype, "width", void 0), customElements.get("void-nav-menu") || customElements.define("void-nav-menu", l);
|
|
54
|
+
var u = class extends e {
|
|
48
55
|
constructor(...e) {
|
|
49
|
-
super(...e), this.open = !1, this.disabled = !1, this.current = !1, this._openedByHover = !1, this._parts = new
|
|
56
|
+
super(...e), this.open = !1, this.disabled = !1, this.current = !1, this._openedByHover = !1, this._parts = new a(this, {
|
|
50
57
|
tags: ["void-nav-menu-trigger", "void-nav-menu-content"],
|
|
51
58
|
onChange: () => this._wire()
|
|
52
59
|
}), this._onClick = (e) => {
|
|
@@ -70,7 +77,7 @@ var s = class extends e {
|
|
|
70
77
|
};
|
|
71
78
|
}
|
|
72
79
|
_control() {
|
|
73
|
-
return
|
|
80
|
+
return i(this._parts.one("void-nav-menu-trigger"));
|
|
74
81
|
}
|
|
75
82
|
_content() {
|
|
76
83
|
return this._parts.one("void-nav-menu-content");
|
|
@@ -107,15 +114,15 @@ var s = class extends e {
|
|
|
107
114
|
})));
|
|
108
115
|
}
|
|
109
116
|
};
|
|
110
|
-
t([
|
|
117
|
+
t([c({
|
|
111
118
|
type: Boolean,
|
|
112
119
|
reflect: !0
|
|
113
|
-
})],
|
|
120
|
+
})], u.prototype, "open", void 0), t([c({
|
|
114
121
|
type: Boolean,
|
|
115
122
|
reflect: !0
|
|
116
|
-
})],
|
|
123
|
+
})], u.prototype, "disabled", void 0), t([c({
|
|
117
124
|
type: Boolean,
|
|
118
125
|
reflect: !0
|
|
119
|
-
})],
|
|
126
|
+
})], u.prototype, "current", void 0), customElements.get("void-nav-menu-item") || customElements.define("void-nav-menu-item", u);
|
|
120
127
|
//#endregion
|
|
121
|
-
export {
|
|
128
|
+
export { l as VoidNavMenu, u as VoidNavMenuItem };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { FormSubmission } from '../form-control.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
declare const VoidNumberInput_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
4
5
|
/**
|
|
5
6
|
* Precise numeric entry for quantity selectors, price fields, and settings with increment/decrement controls.
|
|
@@ -7,6 +8,13 @@ declare const VoidNumberInput_base: (new (...args: any[]) => import('../form-con
|
|
|
7
8
|
* name, which `<void-field>` supplies), and the stepper buttons are its own buttons.
|
|
8
9
|
*/
|
|
9
10
|
export declare class VoidNumberInput extends VoidNumberInput_base {
|
|
11
|
+
/** Key bindings for this element's actions, as JSON (`{"increment":["ArrowUp","k"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
12
|
+
keys: KeyOverrides | null;
|
|
13
|
+
/** @internal The actions of this element and their default keys. */
|
|
14
|
+
static readonly keyMap: {
|
|
15
|
+
increment: string[];
|
|
16
|
+
decrement: string[];
|
|
17
|
+
};
|
|
10
18
|
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
11
19
|
static labelTarget: string;
|
|
12
20
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
@@ -43,7 +51,7 @@ export declare class VoidNumberInput extends VoidNumberInput_base {
|
|
|
43
51
|
*/
|
|
44
52
|
controls: 'sides' | 'right' | 'none';
|
|
45
53
|
/**
|
|
46
|
-
* Accessible name of the field when it is not inside a `void-field`. Defaults to `Number input
|
|
54
|
+
* Accessible name of the field when it is not inside a `void-field`. Defaults to the `numberInput.label` message (English: `Number input`), so
|
|
47
55
|
* set it.
|
|
48
56
|
*/
|
|
49
57
|
label: string;
|
|
@@ -77,7 +85,13 @@ export declare class VoidNumberInput extends VoidNumberInput_base {
|
|
|
77
85
|
*/
|
|
78
86
|
protected formSubmission(): FormSubmission;
|
|
79
87
|
private _clamp;
|
|
88
|
+
/** The value as the reader's language writes it (decimal separator, digits), without grouping, with `precision` decimals when set. */
|
|
80
89
|
private _format;
|
|
90
|
+
/**
|
|
91
|
+
* Reads typed text the way the language writes numbers: its digits, decimal and grouping separators and minus
|
|
92
|
+
* sign. `NaN` when it is not a number. A plain `1.5` still reads as 1.5 where the decimal separator is a comma.
|
|
93
|
+
*/
|
|
94
|
+
private _parse;
|
|
81
95
|
/** Round to `precision` decimals (`precision="0"` gives integers); untouched when precision is unset. */
|
|
82
96
|
private _round;
|
|
83
97
|
private _commit;
|
|
@@ -1,14 +1,20 @@
|
|
|
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
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { localeOf as i, msg as a } from "../messages.js";
|
|
5
|
+
import { t as o } from "../chunks/form-control-fL-Hhy91.js";
|
|
6
|
+
import { n as s } from "../chunks/projection-oPe6ipjL.js";
|
|
7
|
+
import { a as c } from "../chunks/fields-MEqz-olE.js";
|
|
8
|
+
import { html as l, nothing as u } from "lit";
|
|
9
|
+
import { property as d, query as f } from "lit/decorators.js";
|
|
10
|
+
import { live as p } from "lit/directives/live.js";
|
|
8
11
|
//#region src/components/number-input.ts
|
|
9
|
-
var
|
|
12
|
+
var m = class extends o(e) {
|
|
10
13
|
constructor(...e) {
|
|
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;
|
|
14
|
+
super(...e), this.keys = null, 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;
|
|
15
|
+
}
|
|
16
|
+
static {
|
|
17
|
+
this.keyMap = c;
|
|
12
18
|
}
|
|
13
19
|
static {
|
|
14
20
|
this.labelTarget = "input[role=spinbutton]";
|
|
@@ -28,7 +34,7 @@ var l = class extends n(e) {
|
|
|
28
34
|
formSubmission() {
|
|
29
35
|
let e = this._pendingText;
|
|
30
36
|
if (e !== null) {
|
|
31
|
-
let t =
|
|
37
|
+
let t = this._parse(e);
|
|
32
38
|
if (!isNaN(t)) return String(this._clamp(t));
|
|
33
39
|
if (!e.trim()) return "";
|
|
34
40
|
}
|
|
@@ -38,7 +44,30 @@ var l = class extends n(e) {
|
|
|
38
44
|
return Math.min(Math.max(e, this.min), this.max);
|
|
39
45
|
}
|
|
40
46
|
_format(e) {
|
|
41
|
-
|
|
47
|
+
let t = i(this), n = this.precision >= 0 ? {
|
|
48
|
+
minimumFractionDigits: this.precision,
|
|
49
|
+
maximumFractionDigits: this.precision
|
|
50
|
+
} : { maximumFractionDigits: 20 };
|
|
51
|
+
try {
|
|
52
|
+
return new Intl.NumberFormat(t, {
|
|
53
|
+
useGrouping: !1,
|
|
54
|
+
...n
|
|
55
|
+
}).format(e);
|
|
56
|
+
} catch {
|
|
57
|
+
return this.precision >= 0 ? e.toFixed(this.precision) : String(e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
_parse(e) {
|
|
61
|
+
let t;
|
|
62
|
+
try {
|
|
63
|
+
t = new Intl.NumberFormat(i(this));
|
|
64
|
+
} catch {
|
|
65
|
+
return parseFloat(e);
|
|
66
|
+
}
|
|
67
|
+
let n = t.formatToParts(-12345.6), r = (e, t) => n.find((t) => t.type === e)?.value ?? t, a = r("group", ","), o = r("decimal", "."), s = /* @__PURE__ */ new Map();
|
|
68
|
+
for (let e = 0; e < 10; e++) s.set(t.format(e), String(e));
|
|
69
|
+
let c = Array.from(e.trim()).map((e) => s.get(e) ?? e).join("");
|
|
70
|
+
return c = c.split(a).join("").replace(/[\s ]/g, ""), c = o === "." ? c : c.split(o).join("."), c = c.replace(/[−]/g, (e) => e === "−" ? "-" : ""), parseFloat(c);
|
|
42
71
|
}
|
|
43
72
|
_round(e) {
|
|
44
73
|
return this.precision >= 0 ? Number(e.toFixed(this.precision)) : e;
|
|
@@ -96,17 +125,19 @@ var l = class extends n(e) {
|
|
|
96
125
|
this._pressTimer !== null && (clearTimeout(this._pressTimer), this._pressTimer = null), this._repeatTimer !== null && (clearInterval(this._repeatTimer), this._repeatTimer = null), this._repeatCount = 0;
|
|
97
126
|
}
|
|
98
127
|
_onKeydown(e) {
|
|
99
|
-
this.formDisabled || this.readonly
|
|
128
|
+
if (this.formDisabled || this.readonly) return;
|
|
129
|
+
let t = n(this, e);
|
|
130
|
+
t === "increment" ? (e.preventDefault(), this._increment()) : t === "decrement" && (e.preventDefault(), this._decrement());
|
|
100
131
|
}
|
|
101
132
|
_onBlur() {
|
|
102
|
-
if (!this._input || this.readonly ||
|
|
133
|
+
if (!this._input || this.readonly || s(this)) return;
|
|
103
134
|
this._pendingText = null;
|
|
104
|
-
let e =
|
|
135
|
+
let e = this._parse(this._input.value);
|
|
105
136
|
this._input.value.trim() ? isNaN(e) ? this._input.value = this.value === null ? "" : this._format(this.value) : this._commit(e) : this._commit(null);
|
|
106
137
|
}
|
|
107
138
|
_onFieldInput() {
|
|
108
139
|
this._pendingText = this._input?.value ?? null, this.formSync();
|
|
109
|
-
let e =
|
|
140
|
+
let e = this._parse(this._pendingText ?? ""), t = Number.isNaN(e) ? null : e;
|
|
110
141
|
this.dispatchEvent(new CustomEvent("void-input", {
|
|
111
142
|
bubbles: !0,
|
|
112
143
|
composed: !0,
|
|
@@ -117,12 +148,12 @@ var l = class extends n(e) {
|
|
|
117
148
|
this._onBlur();
|
|
118
149
|
}
|
|
119
150
|
render() {
|
|
120
|
-
let e =
|
|
151
|
+
let e = l`
|
|
121
152
|
<button
|
|
122
153
|
class="void-number-input-btn void-number-input-btn-dec"
|
|
123
154
|
type="button"
|
|
124
155
|
?disabled=${this.disabled || this.readonly || this.value !== null && this.value <= this.min}
|
|
125
|
-
aria-label
|
|
156
|
+
aria-label=${a(this, "numberInput.decrement")}
|
|
126
157
|
@pointerdown=${(e) => {
|
|
127
158
|
e.preventDefault(), this._startRepeat(-1);
|
|
128
159
|
}}
|
|
@@ -135,12 +166,12 @@ var l = class extends n(e) {
|
|
|
135
166
|
<line x1="3" y1="8" x2="13" y2="8"/>
|
|
136
167
|
</svg>
|
|
137
168
|
</button>
|
|
138
|
-
`, t =
|
|
169
|
+
`, t = l`
|
|
139
170
|
<button
|
|
140
171
|
class="void-number-input-btn void-number-input-btn-inc"
|
|
141
172
|
type="button"
|
|
142
173
|
?disabled=${this.disabled || this.readonly || this.value !== null && this.value >= this.max}
|
|
143
|
-
aria-label
|
|
174
|
+
aria-label=${a(this, "numberInput.increment")}
|
|
144
175
|
@pointerdown=${(e) => {
|
|
145
176
|
e.preventDefault(), this._startRepeat(1);
|
|
146
177
|
}}
|
|
@@ -155,59 +186,62 @@ var l = class extends n(e) {
|
|
|
155
186
|
</svg>
|
|
156
187
|
</button>
|
|
157
188
|
`;
|
|
158
|
-
return
|
|
189
|
+
return l`
|
|
159
190
|
${this.controls !== "none" && this.controls !== "right" ? e : ""}
|
|
160
|
-
${this.prefix ?
|
|
191
|
+
${this.prefix ? l`<span class="void-number-input-prefix">${this.prefix}</span>` : u}
|
|
161
192
|
<input
|
|
162
193
|
class="void-number-input-field"
|
|
163
194
|
type="text"
|
|
164
195
|
inputmode=${this.precision === 0 ? "numeric" : "decimal"}
|
|
165
|
-
.value=${
|
|
196
|
+
.value=${p(this._pendingText ?? (this.value === null ? "" : this._format(this.value)))}
|
|
166
197
|
placeholder=${this.placeholder}
|
|
167
198
|
?disabled=${this.disabled}
|
|
168
199
|
?readonly=${this.readonly}
|
|
169
200
|
role="spinbutton"
|
|
170
|
-
aria-valuenow=${this.value ??
|
|
171
|
-
aria-valuetext=${this.value === null ?
|
|
172
|
-
aria-required=${this.required ? "true" :
|
|
173
|
-
aria-valuemin=${isFinite(this.min) ? this.min :
|
|
174
|
-
aria-valuemax=${isFinite(this.max) ? this.max :
|
|
175
|
-
aria-label=${this.label ||
|
|
201
|
+
aria-valuenow=${this.value ?? u}
|
|
202
|
+
aria-valuetext=${this.value === null ? u : this._format(this.value)}
|
|
203
|
+
aria-required=${this.required ? "true" : u}
|
|
204
|
+
aria-valuemin=${isFinite(this.min) ? this.min : u}
|
|
205
|
+
aria-valuemax=${isFinite(this.max) ? this.max : u}
|
|
206
|
+
aria-label=${this.label || a(this, "numberInput.label")}
|
|
176
207
|
@keydown=${this._onKeydown}
|
|
177
208
|
@blur=${this._onBlur}
|
|
178
209
|
@input=${this._onFieldInput}
|
|
179
210
|
@change=${this._onInputChange}
|
|
180
211
|
/>
|
|
181
|
-
${this.unit ?
|
|
182
|
-
${this.controls === "right" ?
|
|
212
|
+
${this.unit ? l`<span class="void-number-input-unit">${this.unit}</span>` : u}
|
|
213
|
+
${this.controls === "right" ? l`<div class="void-number-input-btn-group">${t}${e}</div>` : ""}
|
|
183
214
|
${this.controls === "sides" ? t : ""}
|
|
184
215
|
`;
|
|
185
216
|
}
|
|
186
217
|
};
|
|
187
|
-
t([
|
|
218
|
+
t([d({
|
|
219
|
+
attribute: "keys",
|
|
220
|
+
converter: r
|
|
221
|
+
})], m.prototype, "keys", void 0), t([d({
|
|
188
222
|
reflect: !0,
|
|
189
223
|
converter: {
|
|
190
224
|
fromAttribute: (e) => e === null || e.trim() === "" ? null : Number(e),
|
|
191
225
|
toAttribute: (e) => e == null ? null : String(e)
|
|
192
226
|
}
|
|
193
|
-
})],
|
|
227
|
+
})], m.prototype, "value", void 0), t([d({ type: Number })], m.prototype, "min", void 0), t([d({ type: Number })], m.prototype, "max", void 0), t([d({ converter: {
|
|
194
228
|
fromAttribute: (e) => e === "any" ? "any" : e === null ? 1 : Number(e),
|
|
195
229
|
toAttribute: (e) => String(e)
|
|
196
|
-
} })],
|
|
230
|
+
} })], m.prototype, "step", void 0), t([d({ type: Number })], m.prototype, "precision", void 0), t([d({
|
|
197
231
|
type: Boolean,
|
|
198
232
|
reflect: !0
|
|
199
|
-
})],
|
|
233
|
+
})], m.prototype, "disabled", void 0), t([d({
|
|
200
234
|
type: Boolean,
|
|
201
235
|
reflect: !0
|
|
202
|
-
})],
|
|
236
|
+
})], m.prototype, "readonly", void 0), t([d({
|
|
203
237
|
type: String,
|
|
204
238
|
reflect: !0
|
|
205
|
-
})],
|
|
239
|
+
})], m.prototype, "size", void 0), t([d({
|
|
206
240
|
type: String,
|
|
207
241
|
reflect: !0
|
|
208
|
-
})],
|
|
242
|
+
})], m.prototype, "color", void 0), t([d({ type: String })], m.prototype, "placeholder", void 0), t([d({
|
|
209
243
|
type: String,
|
|
210
244
|
reflect: !0
|
|
211
|
-
})],
|
|
245
|
+
})], m.prototype, "controls", void 0), t([d({ type: String })], m.prototype, "label", void 0), t([d({ type: String })], m.prototype, "prefix", void 0), t([d({ type: String })], m.prototype, "unit", void 0), t([f(".void-number-input-field")], m.prototype, "_input", void 0), customElements.get("void-number-input") || customElements.define("void-number-input", m);
|
|
212
246
|
//#endregion
|
|
213
|
-
export {
|
|
247
|
+
export { m as VoidNumberInput };
|
|
@@ -1,11 +1,12 @@
|
|
|
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
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { msg as n } from "../messages.js";
|
|
4
|
+
import { r } from "../chunks/projection-oPe6ipjL.js";
|
|
5
|
+
import { html as i, nothing as a } from "lit";
|
|
6
|
+
import { property as o } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/pagination.ts
|
|
7
|
-
|
|
8
|
-
var
|
|
8
|
+
r();
|
|
9
|
+
var s = class extends e {
|
|
9
10
|
constructor(...e) {
|
|
10
11
|
super(...e), this.total = 1, this.value = 1, this.siblings = 1, this.size = "md", this.hrefTemplate = "", this.param = "";
|
|
11
12
|
}
|
|
@@ -43,18 +44,18 @@ var o = class extends e {
|
|
|
43
44
|
}, 0);
|
|
44
45
|
}
|
|
45
46
|
_renderLinks(e) {
|
|
46
|
-
let t = 0,
|
|
47
|
+
let t = 0, r = (e, t, n, r) => r ? i`<span class="void-pagination-btn" aria-disabled="true" aria-label=${e}>${t}</span>` : i`<a class="void-pagination-btn" href=${this._href(n)} aria-label=${e}
|
|
47
48
|
@click=${(e) => this._onLinkClick(e, n)}>${t}</a>`;
|
|
48
|
-
return
|
|
49
|
-
<nav role="navigation" aria-label
|
|
50
|
-
${n(
|
|
51
|
-
${e.map((e) => e === "ellipsis" ? (t++,
|
|
49
|
+
return i`
|
|
50
|
+
<nav role="navigation" aria-label=${n(this, "pagination.label")}>
|
|
51
|
+
${r(n(this, "pagination.previous"), "«", this.value - 1, this.value <= 1)}
|
|
52
|
+
${e.map((e) => e === "ellipsis" ? (t++, i`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : i`<a
|
|
52
53
|
class="void-pagination-btn"
|
|
53
54
|
href=${this._href(e)}
|
|
54
|
-
aria-current=${e === this.value ? "page" :
|
|
55
|
+
aria-current=${e === this.value ? "page" : a}
|
|
55
56
|
@click=${(t) => this._onLinkClick(t, e)}
|
|
56
57
|
>${e}</a>`)}
|
|
57
|
-
${n(
|
|
58
|
+
${r(n(this, "pagination.next"), "»", this.value + 1, this.value >= this.total)}
|
|
58
59
|
</nav>
|
|
59
60
|
`;
|
|
60
61
|
}
|
|
@@ -78,21 +79,21 @@ var o = class extends e {
|
|
|
78
79
|
let e = this._pages();
|
|
79
80
|
if (this._linkMode) return this._renderLinks(e);
|
|
80
81
|
let t = 0;
|
|
81
|
-
return
|
|
82
|
-
<nav role="navigation" aria-label
|
|
82
|
+
return i`
|
|
83
|
+
<nav role="navigation" aria-label=${n(this, "pagination.label")}>
|
|
83
84
|
<button
|
|
84
85
|
type="button"
|
|
85
86
|
class="void-pagination-btn"
|
|
86
87
|
?disabled=${this.value <= 1}
|
|
87
88
|
@click=${() => this._go(this.value - 1)}
|
|
88
|
-
aria-label
|
|
89
|
+
aria-label=${n(this, "pagination.previous")}
|
|
89
90
|
>«</button>
|
|
90
|
-
${e.map((e) => e === "ellipsis" ? (t++,
|
|
91
|
+
${e.map((e) => e === "ellipsis" ? (t++, i`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : i`
|
|
91
92
|
<button
|
|
92
93
|
type="button"
|
|
93
94
|
class="void-pagination-btn"
|
|
94
95
|
?disabled=${e === this.value}
|
|
95
|
-
aria-current=${e === this.value ? "page" :
|
|
96
|
+
aria-current=${e === this.value ? "page" : a}
|
|
96
97
|
@click=${() => this._go(e)}
|
|
97
98
|
>${e}</button>
|
|
98
99
|
`)}
|
|
@@ -101,25 +102,25 @@ var o = class extends e {
|
|
|
101
102
|
class="void-pagination-btn"
|
|
102
103
|
?disabled=${this.value >= this.total}
|
|
103
104
|
@click=${() => this._go(this.value + 1)}
|
|
104
|
-
aria-label
|
|
105
|
+
aria-label=${n(this, "pagination.next")}
|
|
105
106
|
>»</button>
|
|
106
107
|
</nav>
|
|
107
108
|
`;
|
|
108
109
|
}
|
|
109
110
|
};
|
|
110
|
-
t([
|
|
111
|
+
t([o({ type: Number })], s.prototype, "total", void 0), t([o({
|
|
111
112
|
type: Number,
|
|
112
113
|
reflect: !0
|
|
113
|
-
})],
|
|
114
|
+
})], s.prototype, "value", void 0), t([o({ type: Number })], s.prototype, "siblings", void 0), t([o({
|
|
114
115
|
type: String,
|
|
115
116
|
reflect: !0
|
|
116
|
-
})],
|
|
117
|
+
})], s.prototype, "size", void 0), t([o({
|
|
117
118
|
type: String,
|
|
118
119
|
attribute: "href-template",
|
|
119
120
|
reflect: !0
|
|
120
|
-
})],
|
|
121
|
+
})], s.prototype, "hrefTemplate", void 0), t([o({
|
|
121
122
|
type: String,
|
|
122
123
|
reflect: !0
|
|
123
|
-
})],
|
|
124
|
+
})], s.prototype, "param", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", s);
|
|
124
125
|
//#endregion
|
|
125
|
-
export {
|
|
126
|
+
export { s as VoidPagination };
|
package/dist/components/panel.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropertyDeclaration, PropertyValues } from 'lit';
|
|
2
2
|
import { VoidElement } from '../base.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
declare const VoidPinInput_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
4
5
|
/**
|
|
5
6
|
* Single-character input cells for OTP verification codes, PIN entry, and multi-digit confirmation fields.
|
|
@@ -10,6 +11,15 @@ declare const VoidPinInput_base: (new (...args: any[]) => import('../form-contro
|
|
|
10
11
|
* @fires {CustomEvent<{ value: string }>} void-complete - Every cell is filled.
|
|
11
12
|
*/
|
|
12
13
|
export declare class VoidPinInput extends VoidPinInput_base {
|
|
14
|
+
/** Key bindings for this element's actions, as JSON (`{"previous":["ArrowLeft"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
15
|
+
keys: KeyOverrides | null;
|
|
16
|
+
/** @internal The actions of this element and their default keys. */
|
|
17
|
+
static readonly keyMap: {
|
|
18
|
+
previous: string[];
|
|
19
|
+
next: string[];
|
|
20
|
+
deleteBackward: string[];
|
|
21
|
+
deleteForward: string[];
|
|
22
|
+
};
|
|
13
23
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
14
24
|
static editState: string[];
|
|
15
25
|
/** Number of cells, so the number of characters in the code. Defaults to 6. */
|
|
@@ -44,6 +54,7 @@ export declare class VoidPinInput extends VoidPinInput_base {
|
|
|
44
54
|
/** Character shown in every empty cell, such as `-`. */
|
|
45
55
|
placeholder: string;
|
|
46
56
|
requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void;
|
|
57
|
+
private _name;
|
|
47
58
|
protected updated(changed: PropertyValues): void;
|
|
48
59
|
private get _effectiveLength();
|
|
49
60
|
private get _parsedGroups();
|