@voidable/ui 0.11.0 → 0.12.1

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.
Files changed (152) hide show
  1. package/README.md +1 -1
  2. package/dist/angular/index.d.ts +2 -2
  3. package/dist/angular/index.js +2 -1
  4. package/dist/chunks/activation-B8aBarKd.js +4 -0
  5. package/dist/chunks/carousel-C9u0bg5l.js +10 -0
  6. package/dist/chunks/choice-BTrsi7OW.js +16 -0
  7. package/dist/chunks/data-Baycjoo4.js +96 -0
  8. package/dist/chunks/fields-MEqz-olE.js +21 -0
  9. package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
  10. package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
  11. package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
  12. package/dist/chunks/menu-CxRRgkJI.js +21 -0
  13. package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
  14. package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
  15. package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
  16. package/dist/chunks/overlay-K1ilWC1p.js +4 -0
  17. package/dist/chunks/pickers-CjlFgNke.js +36 -0
  18. package/dist/chunks/table-BBpqwWEi.js +4 -0
  19. package/dist/chunks/tabs-Buf3EBWq.js +10 -0
  20. package/dist/components/accordion.d.ts +7 -0
  21. package/dist/components/accordion.js +22 -14
  22. package/dist/components/action-input.d.ts +2 -1
  23. package/dist/components/action-input.js +59 -55
  24. package/dist/components/bar-chart.js +41 -40
  25. package/dist/components/breadcrumbs.d.ts +2 -0
  26. package/dist/components/breadcrumbs.js +15 -11
  27. package/dist/components/button.d.ts +7 -0
  28. package/dist/components/button.js +23 -16
  29. package/dist/components/calendar.d.ts +45 -10
  30. package/dist/components/calendar.js +183 -129
  31. package/dist/components/carousel.d.ts +22 -0
  32. package/dist/components/carousel.js +64 -35
  33. package/dist/components/charts/data.d.ts +2 -2
  34. package/dist/components/checkbox-group.js +22 -21
  35. package/dist/components/checkbox.d.ts +7 -0
  36. package/dist/components/checkbox.js +29 -24
  37. package/dist/components/collapsible.d.ts +7 -0
  38. package/dist/components/collapsible.js +19 -11
  39. package/dist/components/color-picker.js +28 -27
  40. package/dist/components/combobox.d.ts +13 -1
  41. package/dist/components/combobox.js +54 -41
  42. package/dist/components/compose-input.d.ts +9 -1
  43. package/dist/components/compose-input.js +28 -16
  44. package/dist/components/dialog.js +1 -1
  45. package/dist/components/donut-chart.js +57 -56
  46. package/dist/components/drawer.js +1 -1
  47. package/dist/components/dropdown-menu.d.ts +22 -0
  48. package/dist/components/dropdown-menu.js +54 -39
  49. package/dist/components/editable.d.ts +11 -1
  50. package/dist/components/editable.js +35 -22
  51. package/dist/components/error-fallback.d.ts +4 -2
  52. package/dist/components/error-fallback.js +34 -28
  53. package/dist/components/file-upload.d.ts +9 -0
  54. package/dist/components/file-upload.js +54 -28
  55. package/dist/components/gauge.js +108 -107
  56. package/dist/components/hamburger.d.ts +7 -0
  57. package/dist/components/hamburger.js +28 -19
  58. package/dist/components/hover-card.d.ts +7 -0
  59. package/dist/components/hover-card.js +22 -14
  60. package/dist/components/indicator.js +15 -14
  61. package/dist/components/input.js +1 -1
  62. package/dist/components/line-chart.js +43 -42
  63. package/dist/components/menu.d.ts +25 -0
  64. package/dist/components/menu.js +55 -33
  65. package/dist/components/multiselect.d.ts +17 -1
  66. package/dist/components/multiselect.js +96 -74
  67. package/dist/components/nav-menu.d.ts +9 -0
  68. package/dist/components/nav-menu.js +30 -23
  69. package/dist/components/number-input.d.ts +15 -1
  70. package/dist/components/number-input.js +71 -37
  71. package/dist/components/pagination.js +25 -24
  72. package/dist/components/pin-input.d.ts +11 -0
  73. package/dist/components/pin-input.js +46 -32
  74. package/dist/components/popover.d.ts +7 -0
  75. package/dist/components/popover.js +21 -13
  76. package/dist/components/radio-group.js +1 -1
  77. package/dist/components/radio.d.ts +10 -1
  78. package/dist/components/radio.js +37 -32
  79. package/dist/components/segmented-control.d.ts +14 -0
  80. package/dist/components/segmented-control.js +40 -28
  81. package/dist/components/sidebar.d.ts +1 -0
  82. package/dist/components/sidebar.js +14 -10
  83. package/dist/components/slider.js +1 -1
  84. package/dist/components/spinner.d.ts +5 -3
  85. package/dist/components/spinner.js +21 -14
  86. package/dist/components/stat.js +1 -1
  87. package/dist/components/status-dot.d.ts +2 -2
  88. package/dist/components/status-dot.js +12 -14
  89. package/dist/components/stepper.d.ts +2 -0
  90. package/dist/components/stepper.js +20 -13
  91. package/dist/components/switch.d.ts +7 -0
  92. package/dist/components/switch.js +24 -16
  93. package/dist/components/table.d.ts +77 -1
  94. package/dist/components/table.js +562 -73
  95. package/dist/components/tabs.d.ts +11 -0
  96. package/dist/components/tabs.js +42 -33
  97. package/dist/components/tag.js +12 -11
  98. package/dist/components/tags-input.d.ts +10 -1
  99. package/dist/components/tags-input.js +42 -30
  100. package/dist/components/textarea.js +1 -1
  101. package/dist/components/toast.d.ts +2 -0
  102. package/dist/components/toast.js +35 -28
  103. package/dist/components/toggle-group.d.ts +8 -0
  104. package/dist/components/toggle-group.js +24 -17
  105. package/dist/components/toggle.d.ts +7 -0
  106. package/dist/components/toggle.js +23 -15
  107. package/dist/components/tooltip.d.ts +7 -0
  108. package/dist/components/tooltip.js +20 -12
  109. package/dist/components.json +96 -74
  110. package/dist/custom-elements.json +4213 -131
  111. package/dist/dev/rules.d.ts +0 -1
  112. package/dist/dev/types.d.ts +3 -1
  113. package/dist/dev.js +244 -113
  114. package/dist/index.d.ts +4 -0
  115. package/dist/index.js +68 -66
  116. package/dist/keyboard-activation.d.ts +9 -9
  117. package/dist/keyboard.d.ts +2 -10
  118. package/dist/keymaps/activation.d.ts +8 -0
  119. package/dist/keymaps/carousel.d.ts +9 -0
  120. package/dist/keymaps/choice.d.ts +21 -0
  121. package/dist/keymaps/fields.d.ts +31 -0
  122. package/dist/keymaps/index.d.ts +2 -0
  123. package/dist/keymaps/menu.d.ts +36 -0
  124. package/dist/keymaps/nav-menu.d.ts +11 -0
  125. package/dist/keymaps/overlay.d.ts +4 -0
  126. package/dist/keymaps/pickers.d.ts +36 -0
  127. package/dist/keymaps/table.d.ts +8 -0
  128. package/dist/keymaps/tabs.d.ts +7 -0
  129. package/dist/keymaps.js +51 -0
  130. package/dist/keys.d.ts +46 -0
  131. package/dist/keys.js +57 -0
  132. package/dist/llms.txt +11 -3
  133. package/dist/messages/ar.d.ts +1 -0
  134. package/dist/messages/ar.js +130 -0
  135. package/dist/messages/fr.d.ts +1 -0
  136. package/dist/messages/fr.js +109 -0
  137. package/dist/messages.d.ts +213 -0
  138. package/dist/messages.js +190 -0
  139. package/dist/modal.d.ts +7 -0
  140. package/dist/reference.md +817 -17
  141. package/dist/testing/index.d.ts +46 -0
  142. package/dist/testing.js +79 -0
  143. package/dist/types/elements.d.ts +89 -73
  144. package/dist/types/react.d.ts +5 -1
  145. package/dist/types/solid.d.ts +5 -1
  146. package/dist/types/solid2.d.ts +4 -0
  147. package/dist/types/svelte.d.ts +5 -1
  148. package/dist/types/vue.d.ts +5 -1
  149. package/dist/vscode.html-custom-data.json +384 -18
  150. package/dist/web-types.json +830 -69
  151. package/package.json +22 -2
  152. package/dist/chunks/data-BpiiNapL.js +0 -95
@@ -1,15 +1,18 @@
1
1
  import { t as e } from "../chunks/base-BGrS4eIl.js";
2
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-oPe6ipjL.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-CH7L4N-h.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";
3
+ import { actionFor as n, keysConverter as r } from "../keys.js";
4
+ import { msg as i } from "../messages.js";
5
+ import { t as a } from "../chunks/form-control-fL-Hhy91.js";
6
+ import { t as o } from "../chunks/projection-oPe6ipjL.js";
7
+ import { n as s } from "../chunks/parts-DI_3VpSy.js";
8
+ import { n as c, r as l, t as u } from "../chunks/keyboard-ChtDvhB_.js";
9
+ import { i as d } from "../chunks/pickers-CjlFgNke.js";
10
+ import { t as f } from "../chunks/overlay-BuV-4Yvt.js";
11
+ import { n as p } from "../chunks/value-list-CH6GjYXM.js";
12
+ import { html as m, nothing as h } from "lit";
13
+ import { property as g } from "lit/decorators.js";
11
14
  //#region src/components/multiselect.ts
12
- var m = class extends e {
15
+ var _ = class extends e {
13
16
  constructor(...e) {
14
17
  super(...e), this.value = "", this.selected = !1, this.disabled = !1, this.label = "";
15
18
  }
@@ -22,28 +25,28 @@ var m = class extends e {
22
25
  ].some((t) => e.has(t) && e.get(t) !== void 0) && (this.closest("void-multiselect") ?? this.closest("void-combobox"))?.requestUpdate();
23
26
  }
24
27
  };
25
- t([p({
28
+ t([g({
26
29
  type: String,
27
30
  reflect: !0
28
- })], m.prototype, "value", void 0), t([p({
31
+ })], _.prototype, "value", void 0), t([g({
29
32
  type: Boolean,
30
33
  reflect: !0
31
- })], m.prototype, "selected", void 0), t([p({
34
+ })], _.prototype, "selected", void 0), t([g({
32
35
  type: Boolean,
33
36
  reflect: !0
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) {
37
+ })], _.prototype, "disabled", void 0), t([g({ type: String })], _.prototype, "label", void 0), customElements.get("void-option") || customElements.define("void-option", _);
38
+ var v = (e) => e instanceof _ ? e.value : e.getAttribute("value") ?? "", y = (e) => e instanceof _ ? e.selected : e.hasAttribute("selected");
39
+ function b(e) {
37
40
  return e.getAttribute("label") || e.textContent?.trim() || e.getAttribute("value") || "";
38
41
  }
39
- var v = class extends n(e) {
42
+ var x = class extends a(e) {
40
43
  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, {
44
+ super(...e), this.keys = null, this.placeholder = "", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._active = null, this._typeahead = new u(), this._wiring = !1, this._projection = new o(this, { placement: "start" }), this._parts = new s(this, {
42
45
  tags: ["void-multiselect-content", "void-option"],
43
46
  onChange: () => {
44
47
  this._wire(), this._wiring || this.requestUpdate();
45
48
  }
46
- }), this._overlay = new l(this, {
49
+ }), this._overlay = new f(this, {
47
50
  kind: "listbox",
48
51
  surface: () => this._content(),
49
52
  isOpen: () => this.open && !this.formDisabled,
@@ -73,50 +76,66 @@ var v = class extends n(e) {
73
76
  }
74
77
  this._trigger()?.contains(t) && (e.stopPropagation(), this.open ? this._close("trigger") : this._openList("none", "trigger"));
75
78
  }, this._onTriggerKeydown = (e) => {
76
- if (this.formDisabled || e.target !== e.currentTarget || e.isComposing) return;
77
- let t = this._options.map((e) => e.disabled), n = e.key;
79
+ if (this.formDisabled || e.target !== e.currentTarget) return;
80
+ let t = n(this, e);
81
+ if (!t) {
82
+ e.key === "Tab" && this.open && !e.defaultPrevented && this._close("blur");
83
+ return;
84
+ }
78
85
  if (!this.open) {
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));
86
+ if (t === "first" || t === "last") this._openList(t);
87
+ else if (t === "previous") this._openList("first");
88
+ else if (t === "next" || t === "activate") this._openList("selected");
89
+ else if (t === "typeahead") this._openList("selected"), this._typeaheadTo(e.key);
90
+ else return;
91
+ e.preventDefault();
80
92
  return;
81
93
  }
82
- switch (n) {
83
- case "ArrowDown":
84
- e.preventDefault(), e.altKey || this._moveActive(this._stepBy(1));
94
+ let r = this._options.map((e) => e.disabled);
95
+ switch (t) {
96
+ case "next":
97
+ this._moveActive(this._stepBy(1));
85
98
  break;
86
- case "ArrowUp":
87
- e.preventDefault(), e.altKey ? this._close("escape") : this._moveActive(this._stepBy(-1));
99
+ case "previous":
100
+ this._moveActive(this._stepBy(-1));
88
101
  break;
89
- case "PageDown":
90
- e.preventDefault(), this._moveActive(this._stepBy(10));
102
+ case "nextPage":
103
+ this._moveActive(this._stepBy(10));
91
104
  break;
92
- case "PageUp":
93
- e.preventDefault(), this._moveActive(this._stepBy(-10));
105
+ case "previousPage":
106
+ this._moveActive(this._stepBy(-10));
94
107
  break;
95
- case "Home":
96
- e.preventDefault(), this._moveActive(s(t, 1));
108
+ case "first":
109
+ this._moveActive(c(r, 1));
97
110
  break;
98
- case "End":
99
- e.preventDefault(), this._moveActive(s(t, -1));
111
+ case "last":
112
+ this._moveActive(c(r, -1));
100
113
  break;
101
- case "Enter":
102
- case " ":
103
- e.preventDefault(), this._active && !this._active.disabled && this._toggleOption(this._active);
114
+ case "activate":
115
+ this._active && !this._active.disabled && this._toggleOption(this._active);
104
116
  break;
105
- case "Escape":
106
- e.preventDefault(), e.stopPropagation(), this._close("escape");
117
+ case "close":
118
+ e.stopPropagation(), this._close("escape");
107
119
  break;
108
- case "Tab":
109
- this._close("blur");
120
+ case "typeahead":
121
+ this._typeaheadTo(e.key);
110
122
  break;
111
- default: o(e) && (e.preventDefault(), this._typeaheadTo(e.key));
123
+ default: return;
112
124
  }
125
+ e.preventDefault();
113
126
  }, this._onFocusOut = (e) => {
114
127
  this.open && !this.contains(e.relatedTarget) && this._close("blur");
115
128
  };
116
129
  }
130
+ static {
131
+ this.keyMap = d;
132
+ }
117
133
  static {
118
134
  this.labelTarget = "[role=combobox]";
119
135
  }
136
+ get _hint() {
137
+ return this.placeholder || i(this, "multiselect.placeholder");
138
+ }
120
139
  _content() {
121
140
  return this._parts.one("void-multiselect-content");
122
141
  }
@@ -129,15 +148,15 @@ var v = class extends n(e) {
129
148
  }
130
149
  get value() {
131
150
  let e = this._options;
132
- return this._wanted && e.length === 0 ? [...this._wanted] : e.filter(g).map(h);
151
+ return this._wanted && e.length === 0 ? [...this._wanted] : e.filter(y).map(v);
133
152
  }
134
153
  set value(e) {
135
154
  let t = this._options, n = Array.isArray(e) ? e : [];
136
155
  this._wanted = t.length === 0 ? [...n] : null;
137
156
  let r = new Set(n);
138
157
  for (let e of t) {
139
- let t = r.has(h(e));
140
- e instanceof m ? e.selected = t : e.toggleAttribute("selected", t);
158
+ let t = r.has(v(e));
159
+ e instanceof _ ? e.selected = t : e.toggleAttribute("selected", t);
141
160
  }
142
161
  this.requestUpdate("value", void 0);
143
162
  }
@@ -171,49 +190,49 @@ var v = class extends n(e) {
171
190
  if (!e) return;
172
191
  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");
173
192
  let i = r ? t?.getAttribute("aria-labelledby") ?? null : null;
174
- this._parts.set(e, "aria-labelledby", i), this._parts.set(e, "aria-label", r && !i && (t?.getAttribute("aria-label") || this.placeholder) || null), t && this._parts.set(t, "aria-activedescendant", r && this._active ? this._parts.id(this._active, "void-option") : null);
193
+ this._parts.set(e, "aria-labelledby", i), this._parts.set(e, "aria-label", r && !i && (t?.getAttribute("aria-label") || this._hint) || null), t && this._parts.set(t, "aria-activedescendant", r && this._active ? this._parts.id(this._active, "void-option") : null);
175
194
  }
176
195
  _controls(e) {
177
196
  let t = e ? this._content() : null;
178
- return t ? this._parts.id(t, "void-multiselect-content") : f;
197
+ return t ? this._parts.id(t, "void-multiselect-content") : h;
179
198
  }
180
199
  render() {
181
200
  let e = this._options.filter((e) => e.selected), t = this.open && !this.formDisabled, n = e.length;
182
- return d`
201
+ return m`
183
202
  <div
184
203
  class="void-multiselect-trigger"
185
204
  role="combobox"
186
205
  tabindex=${this.formDisabled ? "-1" : "0"}
187
- aria-label=${this.placeholder}
206
+ aria-label=${this._hint}
188
207
  aria-haspopup="listbox"
189
208
  aria-expanded=${String(t)}
190
209
  aria-controls=${this._controls(t)}
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}
210
+ aria-description=${n ? i(this, "multiselect.selected", { count: n }) : h}
211
+ aria-disabled=${this.formDisabled ? "true" : h}
212
+ aria-required=${this.required ? "true" : h}
213
+ aria-invalid=${this.error ? "true" : h}
195
214
  @keydown=${this._onTriggerKeydown}
196
215
  >
197
- ${n > 0 ? e.map((e) => d`
216
+ ${n > 0 ? e.map((e) => m`
198
217
  <span class="void-multiselect-pill">
199
- <span class="void-multiselect-pill-label">${_(e)}</span>
218
+ <span class="void-multiselect-pill-label">${b(e)}</span>
200
219
  <button
201
220
  type="button"
202
221
  class="void-multiselect-pill-remove"
203
222
  tabindex="-1"
204
- aria-label="Remove ${_(e)}"
223
+ aria-label=${i(this, "removeItem", { name: b(e) })}
205
224
  data-value=${e.value}
206
225
  >×</button>
207
226
  </span>
208
- `) : d`<span class="void-multiselect-placeholder">${this.placeholder}</span>`}
227
+ `) : m`<span class="void-multiselect-placeholder">${this._hint}</span>`}
209
228
  </div>
210
- ${this.error ? d`<span class="void-multiselect-error">${this.error}</span>` : f}
229
+ ${this.error ? m`<span class="void-multiselect-error">${this.error}</span>` : h}
211
230
  `;
212
231
  }
213
232
  _openList(e, t = "keyboard") {
214
233
  if (this._overlay.requestOpen(t), !this.open) return;
215
234
  let n = this._options, r = n.map((e) => e.disabled), i = -1;
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();
235
+ e === "first" ? i = c(r, 1) : e === "last" ? i = c(r, -1) : e === "selected" && (i = n.findIndex((e) => e.selected && !e.disabled), i < 0 && (i = c(r, 1))), this._active = i >= 0 ? n[i] : null, this.requestUpdate();
217
236
  }
218
237
  _close(e = "api") {
219
238
  this.open && this._overlay.requestClose(e);
@@ -222,16 +241,16 @@ var v = class extends n(e) {
222
241
  e < 0 || (this._active = this._options[e], this.requestUpdate());
223
242
  }
224
243
  _stepBy(e) {
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;) {
227
- let e = a(n, t, i, !1);
244
+ let t = this._options, n = t.map((e) => e.disabled), r = this._active ? t.indexOf(this._active) : -1, i = e > 0 ? 1 : -1, a = r;
245
+ for (let t = r, o = Math.abs(e); o > 0;) {
246
+ let e = l(n, t, i, !1);
228
247
  if (e < 0) break;
229
- o = t = e, s--;
248
+ a = t = e, o--;
230
249
  }
231
- return o >= 0 ? o : s(n, i);
250
+ return a >= 0 ? a : c(n, i);
232
251
  }
233
252
  _typeaheadTo(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);
253
+ let t = this._options, n = this._active ? t.indexOf(this._active) : -1, r = this._typeahead.match(e, t.map((e) => b(e)), t.map((e) => e.disabled), n);
235
254
  this._moveActive(r);
236
255
  }
237
256
  _toggleOption(e, t = !e.selected) {
@@ -242,24 +261,27 @@ var v = class extends n(e) {
242
261
  }));
243
262
  }
244
263
  };
245
- t([p({ type: String })], v.prototype, "placeholder", void 0), t([p({
264
+ t([g({
265
+ attribute: "keys",
266
+ converter: r
267
+ })], x.prototype, "keys", void 0), t([g({ type: String })], x.prototype, "placeholder", void 0), t([g({
246
268
  type: Boolean,
247
269
  reflect: !0
248
- })], v.prototype, "disabled", void 0), t([p({
270
+ })], x.prototype, "disabled", void 0), t([g({
249
271
  type: String,
250
272
  reflect: !0
251
- })], v.prototype, "size", void 0), t([p({
273
+ })], x.prototype, "size", void 0), t([g({
252
274
  type: String,
253
275
  reflect: !0
254
- })], v.prototype, "error", void 0), t([p({
276
+ })], x.prototype, "error", void 0), t([g({
255
277
  type: String,
256
278
  reflect: !0
257
- })], v.prototype, "name", void 0), t([p({
279
+ })], x.prototype, "name", void 0), t([g({
258
280
  type: Boolean,
259
281
  reflect: !0
260
- })], v.prototype, "open", void 0), t([p({
261
- converter: u,
282
+ })], x.prototype, "open", void 0), t([g({
283
+ converter: p,
262
284
  reflect: !0
263
- })], v.prototype, "value", null), customElements.get("void-multiselect") || customElements.define("void-multiselect", v);
285
+ })], x.prototype, "value", null), customElements.get("void-multiselect") || customElements.define("void-multiselect", x);
264
286
  //#endregion
265
- export { v as VoidMultiselect, m as VoidOption, _ as optionLabel };
287
+ export { x as VoidMultiselect, _ as VoidOption, b as optionLabel };
@@ -1,4 +1,5 @@
1
1
  import { VoidElement } from '../base.js';
2
+ import { KeyOverrides } from '../keys.js';
2
3
  import { PartsController } from '../parts.js';
3
4
  /**
4
5
  * Horizontal navigation bar with dropdown sub-menus for site headers, application nav bars, and mega-menu layouts.
@@ -7,6 +8,14 @@ import { PartsController } from '../parts.js';
7
8
  * returns focus to its trigger.
8
9
  */
9
10
  export declare class VoidNavMenu extends VoidElement {
11
+ /** Key bindings for this element's actions, as JSON (`{"close":[]}`); `[]` switches an action off. See the keyboard guide. */
12
+ keys: KeyOverrides | null;
13
+ /** @internal The actions of this element and their default keys (horizontal; a vertical menu starts with ArrowDown and ArrowUp). */
14
+ static readonly keyMap: {
15
+ next: string[];
16
+ previous: string[];
17
+ close: string[];
18
+ };
10
19
  /**
11
20
  * `horizontal` (default) lays the items out in a row with Left and Right arrow keys; `vertical` stacks
12
21
  * them.
@@ -1,29 +1,33 @@
1
1
  import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
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";
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 o = class extends e {
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 s)) return;
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 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();
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 (e.key === "Escape") for (let e of t) e.open && (e._closeDropdown("escape"), e._control()?.focus());
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([a({
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
- })], o.prototype, "orientation", void 0), t([a({
50
+ })], l.prototype, "orientation", void 0), t([c({
44
51
  type: String,
45
52
  reflect: !0
46
- })], o.prototype, "width", void 0), customElements.get("void-nav-menu") || customElements.define("void-nav-menu", o);
47
- var s = class extends e {
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 r(this, {
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 n(this._parts.one("void-nav-menu-trigger"));
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([a({
117
+ t([c({
111
118
  type: Boolean,
112
119
  reflect: !0
113
- })], s.prototype, "open", void 0), t([a({
120
+ })], u.prototype, "open", void 0), t([c({
114
121
  type: Boolean,
115
122
  reflect: !0
116
- })], s.prototype, "disabled", void 0), t([a({
123
+ })], u.prototype, "disabled", void 0), t([c({
117
124
  type: Boolean,
118
125
  reflect: !0
119
- })], s.prototype, "current", void 0), customElements.get("void-nav-menu-item") || customElements.define("void-nav-menu-item", s);
126
+ })], u.prototype, "current", void 0), customElements.get("void-nav-menu-item") || customElements.define("void-nav-menu-item", u);
120
127
  //#endregion
121
- export { o as VoidNavMenu, s as VoidNavMenuItem };
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`, so
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;