@voidable/ui 0.11.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.
Files changed (151) hide show
  1. package/dist/angular/index.d.ts +2 -2
  2. package/dist/angular/index.js +2 -1
  3. package/dist/chunks/activation-B8aBarKd.js +4 -0
  4. package/dist/chunks/carousel-C9u0bg5l.js +10 -0
  5. package/dist/chunks/choice-BTrsi7OW.js +16 -0
  6. package/dist/chunks/data-Baycjoo4.js +96 -0
  7. package/dist/chunks/fields-MEqz-olE.js +21 -0
  8. package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
  9. package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
  10. package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
  11. package/dist/chunks/menu-CxRRgkJI.js +21 -0
  12. package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
  13. package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
  14. package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
  15. package/dist/chunks/overlay-K1ilWC1p.js +4 -0
  16. package/dist/chunks/pickers-CjlFgNke.js +36 -0
  17. package/dist/chunks/table-BBpqwWEi.js +4 -0
  18. package/dist/chunks/tabs-Buf3EBWq.js +10 -0
  19. package/dist/components/accordion.d.ts +7 -0
  20. package/dist/components/accordion.js +22 -14
  21. package/dist/components/action-input.d.ts +2 -1
  22. package/dist/components/action-input.js +59 -55
  23. package/dist/components/bar-chart.js +41 -40
  24. package/dist/components/breadcrumbs.d.ts +2 -0
  25. package/dist/components/breadcrumbs.js +15 -11
  26. package/dist/components/button.d.ts +7 -0
  27. package/dist/components/button.js +23 -16
  28. package/dist/components/calendar.d.ts +45 -10
  29. package/dist/components/calendar.js +183 -129
  30. package/dist/components/carousel.d.ts +22 -0
  31. package/dist/components/carousel.js +64 -35
  32. package/dist/components/charts/data.d.ts +2 -2
  33. package/dist/components/checkbox-group.js +22 -21
  34. package/dist/components/checkbox.d.ts +7 -0
  35. package/dist/components/checkbox.js +29 -24
  36. package/dist/components/collapsible.d.ts +7 -0
  37. package/dist/components/collapsible.js +19 -11
  38. package/dist/components/color-picker.js +28 -27
  39. package/dist/components/combobox.d.ts +13 -1
  40. package/dist/components/combobox.js +54 -41
  41. package/dist/components/compose-input.d.ts +9 -1
  42. package/dist/components/compose-input.js +28 -16
  43. package/dist/components/dialog.js +1 -1
  44. package/dist/components/donut-chart.js +57 -56
  45. package/dist/components/drawer.js +1 -1
  46. package/dist/components/dropdown-menu.d.ts +22 -0
  47. package/dist/components/dropdown-menu.js +54 -39
  48. package/dist/components/editable.d.ts +11 -1
  49. package/dist/components/editable.js +35 -22
  50. package/dist/components/error-fallback.d.ts +4 -2
  51. package/dist/components/error-fallback.js +34 -28
  52. package/dist/components/file-upload.d.ts +9 -0
  53. package/dist/components/file-upload.js +54 -28
  54. package/dist/components/gauge.js +108 -107
  55. package/dist/components/hamburger.d.ts +7 -0
  56. package/dist/components/hamburger.js +28 -19
  57. package/dist/components/hover-card.d.ts +7 -0
  58. package/dist/components/hover-card.js +22 -14
  59. package/dist/components/indicator.js +15 -14
  60. package/dist/components/input.js +1 -1
  61. package/dist/components/line-chart.js +43 -42
  62. package/dist/components/menu.d.ts +25 -0
  63. package/dist/components/menu.js +55 -33
  64. package/dist/components/multiselect.d.ts +17 -1
  65. package/dist/components/multiselect.js +96 -74
  66. package/dist/components/nav-menu.d.ts +9 -0
  67. package/dist/components/nav-menu.js +30 -23
  68. package/dist/components/number-input.d.ts +15 -1
  69. package/dist/components/number-input.js +71 -37
  70. package/dist/components/pagination.js +25 -24
  71. package/dist/components/pin-input.d.ts +11 -0
  72. package/dist/components/pin-input.js +46 -32
  73. package/dist/components/popover.d.ts +7 -0
  74. package/dist/components/popover.js +21 -13
  75. package/dist/components/radio-group.js +1 -1
  76. package/dist/components/radio.d.ts +10 -1
  77. package/dist/components/radio.js +37 -32
  78. package/dist/components/segmented-control.d.ts +14 -0
  79. package/dist/components/segmented-control.js +40 -28
  80. package/dist/components/sidebar.d.ts +1 -0
  81. package/dist/components/sidebar.js +14 -10
  82. package/dist/components/slider.js +1 -1
  83. package/dist/components/spinner.d.ts +5 -3
  84. package/dist/components/spinner.js +21 -14
  85. package/dist/components/stat.js +1 -1
  86. package/dist/components/status-dot.d.ts +2 -2
  87. package/dist/components/status-dot.js +12 -14
  88. package/dist/components/stepper.d.ts +2 -0
  89. package/dist/components/stepper.js +20 -13
  90. package/dist/components/switch.d.ts +7 -0
  91. package/dist/components/switch.js +24 -16
  92. package/dist/components/table.d.ts +77 -1
  93. package/dist/components/table.js +562 -73
  94. package/dist/components/tabs.d.ts +11 -0
  95. package/dist/components/tabs.js +42 -33
  96. package/dist/components/tag.js +12 -11
  97. package/dist/components/tags-input.d.ts +10 -1
  98. package/dist/components/tags-input.js +42 -30
  99. package/dist/components/textarea.js +1 -1
  100. package/dist/components/toast.d.ts +2 -0
  101. package/dist/components/toast.js +35 -28
  102. package/dist/components/toggle-group.d.ts +8 -0
  103. package/dist/components/toggle-group.js +24 -17
  104. package/dist/components/toggle.d.ts +7 -0
  105. package/dist/components/toggle.js +23 -15
  106. package/dist/components/tooltip.d.ts +7 -0
  107. package/dist/components/tooltip.js +20 -12
  108. package/dist/components.json +96 -74
  109. package/dist/custom-elements.json +4213 -131
  110. package/dist/dev/rules.d.ts +0 -1
  111. package/dist/dev/types.d.ts +3 -1
  112. package/dist/dev.js +244 -113
  113. package/dist/index.d.ts +4 -0
  114. package/dist/index.js +68 -66
  115. package/dist/keyboard-activation.d.ts +9 -9
  116. package/dist/keyboard.d.ts +2 -10
  117. package/dist/keymaps/activation.d.ts +8 -0
  118. package/dist/keymaps/carousel.d.ts +9 -0
  119. package/dist/keymaps/choice.d.ts +21 -0
  120. package/dist/keymaps/fields.d.ts +31 -0
  121. package/dist/keymaps/index.d.ts +2 -0
  122. package/dist/keymaps/menu.d.ts +36 -0
  123. package/dist/keymaps/nav-menu.d.ts +11 -0
  124. package/dist/keymaps/overlay.d.ts +4 -0
  125. package/dist/keymaps/pickers.d.ts +36 -0
  126. package/dist/keymaps/table.d.ts +8 -0
  127. package/dist/keymaps/tabs.d.ts +7 -0
  128. package/dist/keymaps.js +51 -0
  129. package/dist/keys.d.ts +46 -0
  130. package/dist/keys.js +57 -0
  131. package/dist/llms.txt +11 -3
  132. package/dist/messages/ar.d.ts +1 -0
  133. package/dist/messages/ar.js +130 -0
  134. package/dist/messages/fr.d.ts +1 -0
  135. package/dist/messages/fr.js +109 -0
  136. package/dist/messages.d.ts +213 -0
  137. package/dist/messages.js +190 -0
  138. package/dist/modal.d.ts +7 -0
  139. package/dist/reference.md +817 -17
  140. package/dist/testing/index.d.ts +46 -0
  141. package/dist/testing.js +79 -0
  142. package/dist/types/elements.d.ts +89 -73
  143. package/dist/types/react.d.ts +5 -1
  144. package/dist/types/solid.d.ts +5 -1
  145. package/dist/types/solid2.d.ts +4 -0
  146. package/dist/types/svelte.d.ts +5 -1
  147. package/dist/types/vue.d.ts +5 -1
  148. package/dist/vscode.html-custom-data.json +384 -18
  149. package/dist/web-types.json +830 -69
  150. package/package.json +22 -2
  151. package/dist/chunks/data-BpiiNapL.js +0 -95
@@ -1,14 +1,20 @@
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 { n as r } from "../chunks/projection-oPe6ipjL.js";
5
- import { html as i, nothing as a } from "lit";
6
- import { property as o, query as s } from "lit/decorators.js";
7
- import { live as c } from "lit/directives/live.js";
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 l = class extends n(e) {
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 = parseFloat(e);
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
- return this.precision >= 0 ? e.toFixed(this.precision) : String(e);
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 || (e.key === "ArrowUp" ? (e.preventDefault(), this._increment()) : e.key === "ArrowDown" && (e.preventDefault(), this._decrement()));
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 || r(this)) return;
133
+ if (!this._input || this.readonly || s(this)) return;
103
134
  this._pendingText = null;
104
- let e = parseFloat(this._input.value);
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 = parseFloat(this._pendingText ?? ""), t = Number.isNaN(e) ? null : 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 = i`
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="Decrement"
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 = i`
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="Increment"
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 i`
189
+ return l`
159
190
  ${this.controls !== "none" && this.controls !== "right" ? e : ""}
160
- ${this.prefix ? i`<span class="void-number-input-prefix">${this.prefix}</span>` : a}
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=${c(this._pendingText ?? (this.value === null ? "" : this._format(this.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 ?? a}
171
- aria-valuetext=${this.value === null ? a : this._format(this.value)}
172
- aria-required=${this.required ? "true" : a}
173
- aria-valuemin=${isFinite(this.min) ? this.min : a}
174
- aria-valuemax=${isFinite(this.max) ? this.max : a}
175
- aria-label=${this.label || "Number input"}
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 ? i`<span class="void-number-input-unit">${this.unit}</span>` : a}
182
- ${this.controls === "right" ? i`<div class="void-number-input-btn-group">${t}${e}</div>` : ""}
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([o({
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
- })], l.prototype, "value", void 0), t([o({ type: Number })], l.prototype, "min", void 0), t([o({ type: Number })], l.prototype, "max", void 0), t([o({ converter: {
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
- } })], l.prototype, "step", void 0), t([o({ type: Number })], l.prototype, "precision", void 0), t([o({
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
- })], l.prototype, "disabled", void 0), t([o({
233
+ })], m.prototype, "disabled", void 0), t([d({
200
234
  type: Boolean,
201
235
  reflect: !0
202
- })], l.prototype, "readonly", void 0), t([o({
236
+ })], m.prototype, "readonly", void 0), t([d({
203
237
  type: String,
204
238
  reflect: !0
205
- })], l.prototype, "size", void 0), t([o({
239
+ })], m.prototype, "size", void 0), t([d({
206
240
  type: String,
207
241
  reflect: !0
208
- })], l.prototype, "color", void 0), t([o({ type: String })], l.prototype, "placeholder", void 0), t([o({
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
- })], l.prototype, "controls", void 0), t([o({ type: String })], l.prototype, "label", void 0), t([o({ type: String })], l.prototype, "prefix", void 0), t([o({ type: String })], l.prototype, "unit", void 0), t([s(".void-number-input-field")], l.prototype, "_input", void 0), customElements.get("void-number-input") || customElements.define("void-number-input", l);
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 { l as VoidNumberInput };
247
+ export { m as VoidNumberInput };
@@ -1,11 +1,12 @@
1
1
  import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
- import { html as r, nothing as i } from "lit";
5
- import { property as a } from "lit/decorators.js";
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
- n();
8
- var o = class extends e {
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, n = (e, t, n, i) => i ? r`<span class="void-pagination-btn" aria-disabled="true" aria-label=${e}>${t}</span>` : r`<a class="void-pagination-btn" href=${this._href(n)} aria-label=${e}
47
+ 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 r`
49
- <nav role="navigation" aria-label="Pagination">
50
- ${n("Previous page", "«", this.value - 1, this.value <= 1)}
51
- ${e.map((e) => e === "ellipsis" ? (t++, r`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : r`<a
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" : i}
55
+ aria-current=${e === this.value ? "page" : a}
55
56
  @click=${(t) => this._onLinkClick(t, e)}
56
57
  >${e}</a>`)}
57
- ${n("Next page", "»", this.value + 1, this.value >= this.total)}
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 r`
82
- <nav role="navigation" aria-label="Pagination">
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="Previous page"
89
+ aria-label=${n(this, "pagination.previous")}
89
90
  >«</button>
90
- ${e.map((e) => e === "ellipsis" ? (t++, r`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : r`
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" : i}
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="Next page"
105
+ aria-label=${n(this, "pagination.next")}
105
106
  >»</button>
106
107
  </nav>
107
108
  `;
108
109
  }
109
110
  };
110
- t([a({ type: Number })], o.prototype, "total", void 0), t([a({
111
+ t([o({ type: Number })], s.prototype, "total", void 0), t([o({
111
112
  type: Number,
112
113
  reflect: !0
113
- })], o.prototype, "value", void 0), t([a({ type: Number })], o.prototype, "siblings", void 0), t([a({
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
- })], o.prototype, "size", void 0), t([a({
117
+ })], s.prototype, "size", void 0), t([o({
117
118
  type: String,
118
119
  attribute: "href-template",
119
120
  reflect: !0
120
- })], o.prototype, "hrefTemplate", void 0), t([a({
121
+ })], s.prototype, "hrefTemplate", void 0), t([o({
121
122
  type: String,
122
123
  reflect: !0
123
- })], o.prototype, "param", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", o);
124
+ })], s.prototype, "param", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", s);
124
125
  //#endregion
125
- export { o as VoidPagination };
126
+ export { s as VoidPagination };
@@ -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();
@@ -1,19 +1,21 @@
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 { n as r } from "../chunks/projection-oPe6ipjL.js";
5
- import { n as i, t as a } from "../chunks/secret-value-CmTtVkMg.js";
6
- import { r as o } from "../chunks/keyboard-CEhMSkws.js";
7
- import { html as s, nothing as c } from "lit";
8
- import { property as l } from "lit/decorators.js";
9
- import { live as u } from "lit/directives/live.js";
3
+ import { actionFor as n, keysConverter as r } from "../keys.js";
4
+ import { msg as i, nameHost 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 { n as c, t as l } from "../chunks/secret-value-CmTtVkMg.js";
8
+ import { o as u } from "../chunks/fields-MEqz-olE.js";
9
+ import { html as d, nothing as f } from "lit";
10
+ import { property as p } from "lit/decorators.js";
11
+ import { live as m } from "lit/directives/live.js";
10
12
  //#region src/components/pin-input.ts
11
- var d = class t extends n(e) {
13
+ var h = class t extends o(e) {
12
14
  constructor(...e) {
13
- super(...e), this.length = 6, this.groups = "", this.value = "", this.disabled = !1, this.mask = !1, this.type = "numeric", this.size = "md", this.color = "default", this.placeholder = "", this._focusValue = null, this._onFocusIn = () => {
15
+ super(...e), this.keys = null, this.length = 6, this.groups = "", this.value = "", this.disabled = !1, this.mask = !1, this.type = "numeric", this.size = "md", this.color = "default", this.placeholder = "", this._focusValue = null, this._onFocusIn = () => {
14
16
  this._focusValue ??= this.value;
15
17
  }, this._onFocusOut = (e) => {
16
- if (e.relatedTarget instanceof Node && this.contains(e.relatedTarget) || r(this)) return;
18
+ if (e.relatedTarget instanceof Node && this.contains(e.relatedTarget) || s(this)) return;
17
19
  let t = this._focusValue;
18
20
  this._focusValue = null, t !== null && t !== this.value && this.dispatchEvent(new CustomEvent("void-change", {
19
21
  bubbles: !0,
@@ -22,14 +24,20 @@ var d = class t extends n(e) {
22
24
  }));
23
25
  };
24
26
  }
27
+ static {
28
+ this.keyMap = u;
29
+ }
25
30
  static {
26
31
  this.editState = ["value"];
27
32
  }
28
33
  requestUpdate(e, n, r) {
29
- super.requestUpdate(e, n, i(this.mask, e, r, () => t.getPropertyOptions("value")));
34
+ super.requestUpdate(e, n, c(this.mask, e, r, () => t.getPropertyOptions("value")));
35
+ }
36
+ _name() {
37
+ a(this, i(this, "pinInput.label"), (e, t) => this.setHostAttribute(e, t));
30
38
  }
31
39
  updated(e) {
32
- super.updated(e), this.mask && e.get("mask") !== void 0 && a(this);
40
+ super.updated(e), this._name(), this.mask && e.get("mask") !== void 0 && l(this);
33
41
  }
34
42
  get _effectiveLength() {
35
43
  let e = this._parsedGroups;
@@ -46,7 +54,7 @@ var d = class t extends n(e) {
46
54
  return t;
47
55
  }
48
56
  connectedCallback() {
49
- super.connectedCallback(), this.setHostAttribute("role", "group"), this.setHostAttribute("aria-label", "PIN input"), this.addEventListener("focusin", this._onFocusIn), this.addEventListener("focusout", this._onFocusOut);
57
+ super.connectedCallback(), this.setHostAttribute("role", "group"), this._name(), this.addEventListener("focusin", this._onFocusIn), this.addEventListener("focusout", this._onFocusOut);
50
58
  }
51
59
  disconnectedCallback() {
52
60
  super.disconnectedCallback(), this.removeEventListener("focusin", this._onFocusIn), this.removeEventListener("focusout", this._onFocusOut);
@@ -85,16 +93,16 @@ var d = class t extends n(e) {
85
93
  this._syncValue(), r && t < this._effectiveLength - 1 && this._focusCell(t + 1);
86
94
  }
87
95
  _onKeydown(e, t) {
88
- let n = e.target;
89
- if (e.key === "Backspace") {
90
- if (n.value) n.value = "", this._syncValue();
96
+ let r = e.target, i = n(this, e);
97
+ if (i === "deleteBackward") {
98
+ if (r.value) r.value = "", this._syncValue();
91
99
  else if (t > 0) {
92
100
  this._focusCell(t - 1);
93
101
  let e = this._getCells()[t - 1];
94
102
  e.value = "", this._syncValue();
95
103
  }
96
104
  e.preventDefault();
97
- } else e.key === o(this).prev ? (e.preventDefault(), this._focusCell(t - 1)) : e.key === o(this).next ? (e.preventDefault(), this._focusCell(t + 1)) : e.key === "Delete" && (n.value = "", this._syncValue(), e.preventDefault());
105
+ } else i === "previous" ? (e.preventDefault(), this._focusCell(t - 1)) : i === "next" ? (e.preventDefault(), this._focusCell(t + 1)) : i === "deleteForward" && (r.value = "", this._syncValue(), e.preventDefault());
98
106
  }
99
107
  _onPaste(e) {
100
108
  e.preventDefault();
@@ -113,19 +121,22 @@ var d = class t extends n(e) {
113
121
  render() {
114
122
  let e = [], t = this._separatorIndices();
115
123
  for (let n = 0; n < this._effectiveLength; n++) {
116
- t.has(n) && e.push(s`<span class="void-pin-separator" aria-hidden="true">–</span>`);
124
+ t.has(n) && e.push(d`<span class="void-pin-separator" aria-hidden="true">–</span>`);
117
125
  let r = this.value[n] ?? "";
118
- e.push(s`
126
+ e.push(d`
119
127
  <input
120
128
  class="void-pin-cell"
121
129
  type=${this.mask ? "password" : "text"}
122
130
  inputmode=${this.type === "numeric" ? "numeric" : "text"}
123
131
  maxlength="1"
124
- .value=${u(r)}
125
- placeholder=${this.placeholder || c}
132
+ .value=${m(r)}
133
+ placeholder=${this.placeholder || f}
126
134
  ?disabled=${this.disabled}
127
135
  autocomplete="one-time-code"
128
- aria-label=${`Digit ${n + 1} of ${this._effectiveLength}`}
136
+ aria-label=${i(this, "pinInput.digit", {
137
+ index: n + 1,
138
+ count: this._effectiveLength
139
+ })}
129
140
  @input=${(e) => this._onInput(e, n)}
130
141
  @keydown=${(e) => this._onKeydown(e, n)}
131
142
  @paste=${this._onPaste}
@@ -133,30 +144,33 @@ var d = class t extends n(e) {
133
144
  />
134
145
  `);
135
146
  }
136
- return s`<div class="void-pin-input">${e}</div>`;
147
+ return d`<div class="void-pin-input">${e}</div>`;
137
148
  }
138
149
  };
139
- t([l({ type: Number })], d.prototype, "length", void 0), t([l({
150
+ t([p({
151
+ attribute: "keys",
152
+ converter: r
153
+ })], h.prototype, "keys", void 0), t([p({ type: Number })], h.prototype, "length", void 0), t([p({
140
154
  type: String,
141
155
  reflect: !0
142
- })], d.prototype, "groups", void 0), t([l({
156
+ })], h.prototype, "groups", void 0), t([p({
143
157
  type: String,
144
158
  reflect: !0
145
- })], d.prototype, "value", void 0), t([l({
159
+ })], h.prototype, "value", void 0), t([p({
146
160
  type: Boolean,
147
161
  reflect: !0
148
- })], d.prototype, "disabled", void 0), t([l({
162
+ })], h.prototype, "disabled", void 0), t([p({
149
163
  type: Boolean,
150
164
  reflect: !0
151
- })], d.prototype, "mask", void 0), t([l({
165
+ })], h.prototype, "mask", void 0), t([p({
152
166
  type: String,
153
167
  reflect: !0
154
- })], d.prototype, "type", void 0), t([l({
168
+ })], h.prototype, "type", void 0), t([p({
155
169
  type: String,
156
170
  reflect: !0
157
- })], d.prototype, "size", void 0), t([l({
171
+ })], h.prototype, "size", void 0), t([p({
158
172
  type: String,
159
173
  reflect: !0
160
- })], d.prototype, "color", void 0), t([l({ type: String })], d.prototype, "placeholder", void 0), customElements.get("void-pin-input") || customElements.define("void-pin-input", d);
174
+ })], h.prototype, "color", void 0), t([p({ type: String })], h.prototype, "placeholder", void 0), customElements.get("void-pin-input") || customElements.define("void-pin-input", h);
161
175
  //#endregion
162
- export { d as VoidPinInput };
176
+ export { h as VoidPinInput };
@@ -1,6 +1,7 @@
1
1
  import { VoidElement } from '../base.js';
2
2
  import { OverlayController } from '../overlay.js';
3
3
  import { PartsController } from '../parts.js';
4
+ import { KeyOverrides } from '../keys.js';
4
5
  /**
5
6
  * Anchored overlay for contextual detail and mini-forms that need more room than a tooltip.
6
7
  *
@@ -18,6 +19,12 @@ import { PartsController } from '../parts.js';
18
19
  * popover is closing. Cancelable when the user caused it (every reason but `parent` and `api`).
19
20
  */
20
21
  export declare class VoidPopover extends VoidElement {
22
+ /** Key bindings for this element's actions, as JSON (`{"close":["Escape"]}`); `[]` switches an action off. See the keyboard guide. */
23
+ keys: KeyOverrides | null;
24
+ /** @internal The actions of this element and their default keys. */
25
+ static readonly keyMap: {
26
+ close: string[];
27
+ };
21
28
  /** Whether the popover is open. */
22
29
  open: boolean;
23
30
  /** Side of the trigger it opens on; it flips to the opposite side when there is no room. */
@@ -1,17 +1,19 @@
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 { t as i } from "../chunks/overlay-CH7L4N-h.js";
5
- import { property as a } from "lit/decorators.js";
3
+ import { keysConverter as n } from "../keys.js";
4
+ import { i as r, n as i } from "../chunks/parts-DI_3VpSy.js";
5
+ import { t as a } from "../chunks/overlay-BuV-4Yvt.js";
6
+ import { t as o } from "../chunks/overlay-K1ilWC1p.js";
7
+ import { property as s } from "lit/decorators.js";
6
8
  //#region src/components/popover.ts
7
- var o = class extends e {
9
+ var c = class extends e {
8
10
  constructor(...e) {
9
- super(...e), this.open = !1, this.side = "bottom", this.align = "start", this.trigger = "click", this._parts = new r(this, {
11
+ super(...e), this.keys = null, this.open = !1, this.side = "bottom", this.align = "start", this.trigger = "click", this._parts = new i(this, {
10
12
  tags: ["void-popover-trigger", "void-popover-content"],
11
13
  onChange: () => {
12
14
  this._wire(), this.requestUpdate();
13
15
  }
14
- }), this._overlay = new i(this, {
16
+ }), this._overlay = new a(this, {
15
17
  kind: "dialog",
16
18
  surface: () => this._parts.one("void-popover-content"),
17
19
  isOpen: () => this.open,
@@ -33,8 +35,11 @@ var o = class extends e {
33
35
  this.trigger !== "click" || !t || !t.contains(e.target) || this._overlay.toggle("trigger");
34
36
  };
35
37
  }
38
+ static {
39
+ this.keyMap = o;
40
+ }
36
41
  _control() {
37
- return n(this._parts.one("void-popover-trigger"));
42
+ return r(this._parts.one("void-popover-trigger"));
38
43
  }
39
44
  _wire() {
40
45
  let e = this._parts.one("void-popover-content"), t = this._control();
@@ -47,18 +52,21 @@ var o = class extends e {
47
52
  super.disconnectedCallback(), this.removeEventListener("click", this._handleTriggerClick);
48
53
  }
49
54
  };
50
- t([a({
55
+ t([s({
56
+ attribute: "keys",
57
+ converter: n
58
+ })], c.prototype, "keys", void 0), t([s({
51
59
  type: Boolean,
52
60
  reflect: !0
53
- })], o.prototype, "open", void 0), t([a({
61
+ })], c.prototype, "open", void 0), t([s({
54
62
  type: String,
55
63
  reflect: !0
56
- })], o.prototype, "side", void 0), t([a({
64
+ })], c.prototype, "side", void 0), t([s({
57
65
  type: String,
58
66
  reflect: !0
59
- })], o.prototype, "align", void 0), t([a({
67
+ })], c.prototype, "align", void 0), t([s({
60
68
  type: String,
61
69
  reflect: !0
62
- })], o.prototype, "trigger", void 0), customElements.get("void-popover") || customElements.define("void-popover", o);
70
+ })], c.prototype, "trigger", void 0), customElements.get("void-popover") || customElements.define("void-popover", c);
63
71
  //#endregion
64
- export { o as VoidPopover };
72
+ export { c as VoidPopover };
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { n } from "../chunks/form-control-C0vH6gii.js";
3
+ import { n } from "../chunks/form-control-fL-Hhy91.js";
4
4
  import { t as r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { html as i, nothing as a } from "lit";
6
6
  import { property as o } from "lit/decorators.js";
@@ -1,10 +1,19 @@
1
1
  import { VoidElement } from '../base.js';
2
2
  import { KeyboardActivation } from '../keyboard-activation.js';
3
3
  import { ProjectionController } from '../projection.js';
4
+ import { KeyOverrides } from '../keys.js';
4
5
  declare const VoidRadio_base: (new (...args: any[]) => import('../form-control.js').VoidNativeFormControl) & typeof VoidElement;
5
6
  /** Single mutually exclusive option for forms and surveys; typically used inside VoidRadioGroup. */
6
7
  export declare class VoidRadio extends VoidRadio_base {
7
- /** Enter and Space fire a real `click`, as on a native button. */
8
+ /** Key bindings for this element's actions, as JSON (`{"next":["ArrowRight"]}`); `[]` switches an action off. See the keyboard guide. */
9
+ keys: KeyOverrides | null;
10
+ /** @internal The actions of this element and their default keys. */
11
+ static readonly keyMap: {
12
+ activate: string[];
13
+ next: string[];
14
+ previous: string[];
15
+ };
16
+ /** Space fires a real `click`, as on a native button. */
8
17
  protected readonly _activation: KeyboardActivation;
9
18
  /** Whether this radio is the selected one. Checking one radio unchecks the others with the same `name`. */
10
19
  checked: boolean;