@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.
Files changed (177) hide show
  1. package/dist/angular/index.d.ts +2 -2
  2. package/dist/angular/index.js +2 -1
  3. package/dist/base.d.ts +6 -0
  4. package/dist/base.js +2 -2
  5. package/dist/chunks/activation-B8aBarKd.js +4 -0
  6. package/dist/chunks/{base-BxmMM3B7.js → base-BGrS4eIl.js} +9 -0
  7. package/dist/chunks/carousel-C9u0bg5l.js +10 -0
  8. package/dist/chunks/choice-BTrsi7OW.js +16 -0
  9. package/dist/chunks/data-Baycjoo4.js +96 -0
  10. package/dist/chunks/fields-MEqz-olE.js +21 -0
  11. package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
  12. package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
  13. package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
  14. package/dist/chunks/menu-CxRRgkJI.js +21 -0
  15. package/dist/chunks/{modal-CgGp_fCs.js → modal-Cz2-Ov76.js} +24 -16
  16. package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
  17. package/dist/chunks/{overlay-hLJ7IQHx.js → overlay-BuV-4Yvt.js} +76 -69
  18. package/dist/chunks/overlay-K1ilWC1p.js +4 -0
  19. package/dist/chunks/pickers-CjlFgNke.js +36 -0
  20. package/dist/chunks/{projection-SnR79EHI.js → projection-oPe6ipjL.js} +1 -1
  21. package/dist/chunks/table-BBpqwWEi.js +4 -0
  22. package/dist/chunks/tabs-Buf3EBWq.js +10 -0
  23. package/dist/components/accordion.d.ts +7 -0
  24. package/dist/components/accordion.js +23 -15
  25. package/dist/components/action-input.d.ts +2 -1
  26. package/dist/components/action-input.js +60 -56
  27. package/dist/components/alert.d.ts +11 -0
  28. package/dist/components/alert.js +10 -3
  29. package/dist/components/avatar.js +2 -2
  30. package/dist/components/badge.d.ts +8 -2
  31. package/dist/components/badge.js +1 -4
  32. package/dist/components/banner.d.ts +9 -0
  33. package/dist/components/banner.js +10 -3
  34. package/dist/components/bar-chart.d.ts +21 -7
  35. package/dist/components/bar-chart.js +68 -45
  36. package/dist/components/breadcrumbs.d.ts +2 -0
  37. package/dist/components/breadcrumbs.js +16 -12
  38. package/dist/components/button.d.ts +7 -0
  39. package/dist/components/button.js +24 -17
  40. package/dist/components/calendar.d.ts +85 -12
  41. package/dist/components/calendar.js +263 -120
  42. package/dist/components/card.js +1 -1
  43. package/dist/components/carousel.d.ts +22 -0
  44. package/dist/components/carousel.js +66 -37
  45. package/dist/components/charts/data.d.ts +72 -0
  46. package/dist/components/checkbox-group.js +23 -22
  47. package/dist/components/checkbox.d.ts +7 -0
  48. package/dist/components/checkbox.js +30 -25
  49. package/dist/components/collapsible.d.ts +7 -0
  50. package/dist/components/collapsible.js +20 -12
  51. package/dist/components/color-picker.js +29 -28
  52. package/dist/components/combobox.d.ts +13 -1
  53. package/dist/components/combobox.js +55 -42
  54. package/dist/components/compose-input.d.ts +9 -1
  55. package/dist/components/compose-input.js +29 -17
  56. package/dist/components/dialog.js +1 -1
  57. package/dist/components/divider.js +2 -2
  58. package/dist/components/donut-chart.d.ts +22 -6
  59. package/dist/components/donut-chart.js +97 -70
  60. package/dist/components/drawer.js +1 -1
  61. package/dist/components/dropdown-menu.d.ts +22 -0
  62. package/dist/components/dropdown-menu.js +55 -40
  63. package/dist/components/editable.d.ts +11 -1
  64. package/dist/components/editable.js +36 -23
  65. package/dist/components/error-fallback.d.ts +4 -2
  66. package/dist/components/error-fallback.js +35 -29
  67. package/dist/components/field.js +2 -2
  68. package/dist/components/file-upload.d.ts +29 -5
  69. package/dist/components/file-upload.js +84 -28
  70. package/dist/components/gauge.d.ts +32 -8
  71. package/dist/components/gauge.js +206 -133
  72. package/dist/components/hamburger.d.ts +19 -1
  73. package/dist/components/hamburger.js +45 -25
  74. package/dist/components/hover-card.d.ts +7 -0
  75. package/dist/components/hover-card.js +23 -15
  76. package/dist/components/indicator.js +16 -15
  77. package/dist/components/input.js +3 -3
  78. package/dist/components/line-chart.d.ts +22 -7
  79. package/dist/components/line-chart.js +80 -57
  80. package/dist/components/list.js +1 -1
  81. package/dist/components/menu.d.ts +25 -0
  82. package/dist/components/menu.js +56 -34
  83. package/dist/components/multiselect.d.ts +17 -1
  84. package/dist/components/multiselect.js +97 -75
  85. package/dist/components/nav-bar.d.ts +9 -0
  86. package/dist/components/nav-bar.js +16 -3
  87. package/dist/components/nav-menu.d.ts +9 -0
  88. package/dist/components/nav-menu.js +31 -24
  89. package/dist/components/number-input.d.ts +15 -1
  90. package/dist/components/number-input.js +72 -38
  91. package/dist/components/pagination.js +26 -25
  92. package/dist/components/panel.js +1 -1
  93. package/dist/components/pin-input.d.ts +11 -0
  94. package/dist/components/pin-input.js +47 -33
  95. package/dist/components/popover.d.ts +7 -0
  96. package/dist/components/popover.js +22 -14
  97. package/dist/components/progress.js +2 -2
  98. package/dist/components/radio-group.js +3 -3
  99. package/dist/components/radio.d.ts +10 -1
  100. package/dist/components/radio.js +38 -33
  101. package/dist/components/scroll-area.js +2 -2
  102. package/dist/components/segmented-control.d.ts +14 -0
  103. package/dist/components/segmented-control.js +41 -29
  104. package/dist/components/select.js +2 -2
  105. package/dist/components/sidebar.d.ts +1 -0
  106. package/dist/components/sidebar.js +15 -11
  107. package/dist/components/skeleton.js +1 -1
  108. package/dist/components/slider.js +3 -3
  109. package/dist/components/spinner.d.ts +5 -3
  110. package/dist/components/spinner.js +22 -15
  111. package/dist/components/stat.d.ts +13 -1
  112. package/dist/components/stat.js +28 -20
  113. package/dist/components/status-dot.d.ts +2 -2
  114. package/dist/components/status-dot.js +13 -15
  115. package/dist/components/stepper.d.ts +2 -0
  116. package/dist/components/stepper.js +21 -14
  117. package/dist/components/switch.d.ts +7 -0
  118. package/dist/components/switch.js +25 -17
  119. package/dist/components/table.d.ts +81 -1
  120. package/dist/components/table.js +571 -69
  121. package/dist/components/tabs.d.ts +11 -0
  122. package/dist/components/tabs.js +43 -34
  123. package/dist/components/tag.js +13 -12
  124. package/dist/components/tags-input.d.ts +10 -1
  125. package/dist/components/tags-input.js +43 -31
  126. package/dist/components/textarea.js +3 -3
  127. package/dist/components/toast.d.ts +2 -0
  128. package/dist/components/toast.js +36 -29
  129. package/dist/components/toggle-group.d.ts +8 -0
  130. package/dist/components/toggle-group.js +25 -18
  131. package/dist/components/toggle.d.ts +7 -0
  132. package/dist/components/toggle.js +24 -16
  133. package/dist/components/tooltip.d.ts +7 -0
  134. package/dist/components/tooltip.js +21 -13
  135. package/dist/components.json +108 -84
  136. package/dist/custom-elements.json +4520 -236
  137. package/dist/dev/rules.d.ts +0 -1
  138. package/dist/dev/types.d.ts +5 -1
  139. package/dist/dev.js +298 -122
  140. package/dist/index.d.ts +4 -0
  141. package/dist/index.js +69 -67
  142. package/dist/keyboard-activation.d.ts +9 -9
  143. package/dist/keyboard.d.ts +2 -10
  144. package/dist/keymaps/activation.d.ts +8 -0
  145. package/dist/keymaps/carousel.d.ts +9 -0
  146. package/dist/keymaps/choice.d.ts +21 -0
  147. package/dist/keymaps/fields.d.ts +31 -0
  148. package/dist/keymaps/index.d.ts +2 -0
  149. package/dist/keymaps/menu.d.ts +36 -0
  150. package/dist/keymaps/nav-menu.d.ts +11 -0
  151. package/dist/keymaps/overlay.d.ts +4 -0
  152. package/dist/keymaps/pickers.d.ts +36 -0
  153. package/dist/keymaps/table.d.ts +8 -0
  154. package/dist/keymaps/tabs.d.ts +7 -0
  155. package/dist/keymaps.js +51 -0
  156. package/dist/keys.d.ts +46 -0
  157. package/dist/keys.js +57 -0
  158. package/dist/llms.txt +11 -3
  159. package/dist/messages/ar.d.ts +1 -0
  160. package/dist/messages/ar.js +130 -0
  161. package/dist/messages/fr.d.ts +1 -0
  162. package/dist/messages/fr.js +109 -0
  163. package/dist/messages.d.ts +213 -0
  164. package/dist/messages.js +190 -0
  165. package/dist/modal.d.ts +7 -0
  166. package/dist/reference.md +885 -60
  167. package/dist/testing/index.d.ts +46 -0
  168. package/dist/testing.js +79 -0
  169. package/dist/types/elements.d.ts +100 -84
  170. package/dist/types/react.d.ts +7 -3
  171. package/dist/types/solid.d.ts +7 -3
  172. package/dist/types/solid2.d.ts +4 -0
  173. package/dist/types/svelte.d.ts +7 -3
  174. package/dist/types/vue.d.ts +7 -3
  175. package/dist/vscode.html-custom-data.json +478 -38
  176. package/dist/web-types.json +1001 -111
  177. package/package.json +22 -2
@@ -1,19 +1,21 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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-SnR79EHI.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
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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-hLJ7IQHx.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
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r } from "lit";
5
5
  import { property as i } from "lit/decorators.js";
6
6
  //#region src/components/progress.ts
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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";
4
- import { t as r } from "../chunks/projection-SnR79EHI.js";
3
+ import { n } from "../chunks/form-control-fL-Hhy91.js";
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";
7
7
  //#region src/components/radio-group.ts
@@ -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;
@@ -1,36 +1,35 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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/keyboard-activation-CV0m4hkn.js";
4
- import { n as r } from "../chunks/form-control-C0vH6gii.js";
5
- import { t as i } from "../chunks/projection-SnR79EHI.js";
6
- import { a, 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";
3
+ import { actionFor as n, keysConverter as r } from "../keys.js";
4
+ import { t as i } from "../chunks/keyboard-activation-BfEyoaMT.js";
5
+ import { n as a } from "../chunks/form-control-fL-Hhy91.js";
6
+ import { t as o } from "../chunks/projection-oPe6ipjL.js";
7
+ import { r as s } from "../chunks/keyboard-ChtDvhB_.js";
8
+ import { n as c } from "../chunks/choice-BTrsi7OW.js";
9
+ import { html as l, nothing as u } from "lit";
10
+ import { property as d } from "lit/decorators.js";
9
11
  //#region src/components/radio.ts
10
- var u = !1;
12
+ var f = !1;
11
13
  typeof document < "u" && (document.addEventListener("keydown", (e) => {
12
- u = e.key === "Tab" && e.shiftKey;
14
+ f = e.key === "Tab" && e.shiftKey;
13
15
  }, !0), document.addEventListener("pointerdown", () => {
14
- u = !1;
16
+ f = !1;
15
17
  }, !0));
16
- var d = class t extends r(e) {
18
+ var p = class t extends a(e) {
17
19
  constructor(...e) {
18
- super(...e), this._activation = new n(this, {
19
- enter: !1,
20
- disabled: () => this.formDisabled
21
- }), this.checked = !1, this.disabled = !1, this.name = "", this.value = "on", this.required = !1, this.color = "default", this.size = "md", this._projection = new i(this, { regions: [{
20
+ super(...e), this.keys = null, this._activation = new i(this, { disabled: () => this.formDisabled }), this.checked = !1, this.disabled = !1, this.name = "", this.value = "on", this.required = !1, this.color = "default", this.size = "md", this._projection = new o(this, { regions: [{
22
21
  name: "label",
23
22
  target: "after"
24
23
  }] }), this._anchor = null, this._hasFocus = !1, this._handleKeydown = (e) => {
25
- if (e.altKey || e.ctrlKey || e.metaKey || e.defaultPrevented || e.target !== this) return;
26
- let t = o(this), n = e.key === t.next || e.key === "ArrowDown";
27
- if (!n && e.key !== t.prev && e.key !== "ArrowUp") return;
24
+ let t = n(this, e);
25
+ if (t !== "next" && t !== "previous" || e.target !== this) return;
26
+ let r = t === "next";
28
27
  e.preventDefault();
29
- let r = this._peers(), i = r[a(r.map((e) => e.formDisabled), r.indexOf(this), n ? 1 : -1)];
30
- i && (i.focus(), i.click());
28
+ let i = this._peers(), a = i[s(i.map((e) => e.formDisabled), i.indexOf(this), r ? 1 : -1)];
29
+ a && (a.focus(), a.click());
31
30
  }, this._handleFocus = (e) => {
32
31
  let t = this._peers(), n = e.relatedTarget;
33
- if (u && n && !t.some((e) => e.contains(n)) && !t.some((e) => !e.formDisabled && e._isOn()) && this.compareDocumentPosition(n) & Node.DOCUMENT_POSITION_FOLLOWING) {
32
+ if (f && n && !t.some((e) => e.contains(n)) && !t.some((e) => !e.formDisabled && e._isOn()) && this.compareDocumentPosition(n) & Node.DOCUMENT_POSITION_FOLLOWING) {
34
33
  let e = t.filter((e) => !e.formDisabled).pop();
35
34
  if (e && e !== this) {
36
35
  e.focus();
@@ -67,6 +66,9 @@ var d = class t extends r(e) {
67
66
  }));
68
67
  };
69
68
  }
69
+ static {
70
+ this.keyMap = c;
71
+ }
70
72
  connectedCallback() {
71
73
  super.connectedCallback(), this.setHostAttribute("role", "radio"), this.setHostAttribute("aria-checked", String(this._isOn())), this._anchor = this.closest("void-radio-group") ?? this.form ?? this.getRootNode(), this.setHostAttribute("tabindex", "-1"), this._syncTabStops(), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown), this.addEventListener("focus", this._handleFocus), this.addEventListener("blur", this._handleBlur);
72
74
  }
@@ -100,10 +102,10 @@ var d = class t extends r(e) {
100
102
  for (let t of e) t.setHostAttribute("tabindex", t === n ? "0" : "-1");
101
103
  }
102
104
  render() {
103
- return s`
104
- <input type="radio" .checked=${this.checked} ?disabled=${this.formDisabled} ?required=${this.required} name=${this.name} value=${this.value} form=${this.formAttr ?? c} tabindex="-1" aria-hidden="true" inert @invalid=${this._onNativeInvalid} @focus=${this._onNativeFocus} />
105
+ return l`
106
+ <input type="radio" .checked=${this.checked} ?disabled=${this.formDisabled} ?required=${this.required} name=${this.name} value=${this.value} form=${this.formAttr ?? u} tabindex="-1" aria-hidden="true" inert @invalid=${this._onNativeInvalid} @focus=${this._onNativeFocus} />
105
107
  <span class="void-radio-circle">
106
- ${this.checked ? s`<span class="void-radio-dot"></span>` : ""}
108
+ ${this.checked ? l`<span class="void-radio-dot"></span>` : ""}
107
109
  </span>
108
110
  `;
109
111
  }
@@ -130,27 +132,30 @@ var d = class t extends r(e) {
130
132
  }
131
133
  }
132
134
  };
133
- t([l({
135
+ t([d({
136
+ attribute: "keys",
137
+ converter: r
138
+ })], p.prototype, "keys", void 0), t([d({
134
139
  type: Boolean,
135
140
  reflect: !0
136
- })], d.prototype, "checked", void 0), t([l({
141
+ })], p.prototype, "checked", void 0), t([d({
137
142
  type: Boolean,
138
143
  reflect: !0
139
- })], d.prototype, "disabled", void 0), t([l({
144
+ })], p.prototype, "disabled", void 0), t([d({
140
145
  type: String,
141
146
  reflect: !0
142
- })], d.prototype, "name", void 0), t([l({
147
+ })], p.prototype, "name", void 0), t([d({
143
148
  type: String,
144
149
  reflect: !0
145
- })], d.prototype, "value", void 0), t([l({
150
+ })], p.prototype, "value", void 0), t([d({
146
151
  type: Boolean,
147
152
  reflect: !0
148
- })], d.prototype, "required", void 0), t([l({
153
+ })], p.prototype, "required", void 0), t([d({
149
154
  type: String,
150
155
  reflect: !0
151
- })], d.prototype, "color", void 0), t([l({
156
+ })], p.prototype, "color", void 0), t([d({
152
157
  type: String,
153
158
  reflect: !0
154
- })], d.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", d);
159
+ })], p.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", p);
155
160
  //#endregion
156
- export { d as VoidRadio };
161
+ export { p as VoidRadio };
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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/projection-SnR79EHI.js";
3
+ import { t as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r } from "lit";
5
5
  import { property as i } from "lit/decorators.js";
6
6
  //#region src/components/scroll-area.ts
@@ -1,8 +1,15 @@
1
1
  import { VoidElement } from '../base.js';
2
2
  import { KeyboardActivation } from '../keyboard-activation.js';
3
3
  import { FormSubmission } from '../form-control.js';
4
+ import { KeyOverrides } from '../keys.js';
4
5
  /** Individual option within a VoidSegmentedControl button group. */
5
6
  export declare class VoidSegmentedControlItem extends VoidElement {
7
+ /** Key bindings for this element's actions, as JSON (`{"activate":["Space"]}`); `[]` switches an action off. See the keyboard guide. */
8
+ keys: KeyOverrides | null;
9
+ /** @internal The actions of this element and their default keys. */
10
+ static readonly keyMap: {
11
+ activate: string[];
12
+ };
6
13
  /** Space fires a real `click`, which the control turns into a selection. */
7
14
  protected readonly _activation: KeyboardActivation;
8
15
  /**
@@ -32,6 +39,13 @@ declare const VoidSegmentedControl_base: (new (...args: any[]) => import('../for
32
39
  * items; with nothing selected, the first or the last); Space selects the focused item.
33
40
  */
34
41
  export declare class VoidSegmentedControl extends VoidSegmentedControl_base {
42
+ /** Key bindings for this element's actions, as JSON (`{"next":["ArrowRight"]}`); `[]` switches an action off. See the keyboard guide. */
43
+ keys: KeyOverrides | null;
44
+ /** @internal The actions of this element and their default keys. */
45
+ static readonly keyMap: {
46
+ next: string[];
47
+ previous: string[];
48
+ };
35
49
  /**
36
50
  * `value` of the selected item. Selection follows focus, so each arrow key changes it and fires
37
51
  * `void-change`. Reflected to the attribute as it changes; the form's reset target stays the value it started with.
@@ -1,16 +1,19 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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/keyboard-activation-CV0m4hkn.js";
4
- import { t as r } from "../chunks/form-control-C0vH6gii.js";
5
- import { a as i, n as a, r as o } from "../chunks/keyboard-CEhMSkws.js";
6
- import { property as s } from "lit/decorators.js";
3
+ import { actionFor as n, keysConverter as r } from "../keys.js";
4
+ import { t as i } from "../chunks/keyboard-activation-BfEyoaMT.js";
5
+ import { n as a } from "../chunks/activation-B8aBarKd.js";
6
+ import { t as o } from "../chunks/form-control-fL-Hhy91.js";
7
+ import { n as s, r as c } from "../chunks/keyboard-ChtDvhB_.js";
8
+ import { t as l } from "../chunks/choice-BTrsi7OW.js";
9
+ import { property as u } from "lit/decorators.js";
7
10
  //#region src/components/segmented-control.ts
8
- var c = class extends e {
11
+ var d = class extends e {
9
12
  constructor(...e) {
10
- super(...e), this._activation = new n(this, {
11
- enter: !1,
12
- disabled: () => this.disabled
13
- }), this.value = "", this.disabled = !1;
13
+ super(...e), this.keys = null, this._activation = new i(this, { disabled: () => this.disabled }), this.value = "", this.disabled = !1;
14
+ }
15
+ static {
16
+ this.keyMap = a;
14
17
  }
15
18
  connectedCallback() {
16
19
  super.connectedCallback(), this.setHostAttribute("role", "radio");
@@ -27,29 +30,35 @@ var c = class extends e {
27
30
  this.setHostAttribute("aria-checked", String(e)), this.setHostAttribute("tabindex", t && !n ? "0" : "-1"), this.setHostAttribute("aria-disabled", n ? "true" : null);
28
31
  }
29
32
  };
30
- t([s({
33
+ t([u({
34
+ attribute: "keys",
35
+ converter: r
36
+ })], d.prototype, "keys", void 0), t([u({
31
37
  type: String,
32
38
  reflect: !0
33
- })], c.prototype, "value", void 0), t([s({
39
+ })], d.prototype, "value", void 0), t([u({
34
40
  type: Boolean,
35
41
  reflect: !0
36
- })], c.prototype, "disabled", void 0), customElements.get("void-segmented-control-item") || customElements.define("void-segmented-control-item", c);
37
- var l = class extends r(e) {
42
+ })], d.prototype, "disabled", void 0), customElements.get("void-segmented-control-item") || customElements.define("void-segmented-control-item", d);
43
+ var f = class extends o(e) {
38
44
  constructor(...e) {
39
- super(...e), this.value = "", this.disabled = !1, this.size = "md", this.color = "default", this._observer = null, this._itemsSynced = !1, this._handleClick = (e) => {
45
+ super(...e), this.keys = null, this.value = "", this.disabled = !1, this.size = "md", this.color = "default", this._observer = null, this._itemsSynced = !1, this._handleClick = (e) => {
40
46
  let t = e.target.closest("void-segmented-control-item");
41
47
  t && this._select(t);
42
48
  }, this._handleKeydown = (e) => {
43
- if (e.altKey || e.ctrlKey || e.metaKey || this.formDisabled) return;
44
- let t = this._items, n = e.target?.closest?.("void-segmented-control-item"), r = o(this), s = e.key === r.next || e.key === "ArrowDown";
45
- if (!s && e.key !== r.prev && e.key !== "ArrowUp") return;
49
+ let t = n(this, e);
50
+ if (t !== "next" && t !== "previous" || this.formDisabled) return;
51
+ let r = this._items, i = e.target?.closest?.("void-segmented-control-item"), a = t === "next";
46
52
  e.preventDefault();
47
- let c = t.map((e) => e.disabled), l = n ? t.indexOf(n) : t.findIndex((e) => e.value === this.value), u;
48
- u = l < 0 ? a(c, s ? 1 : -1) : i(c, l, s ? 1 : -1);
49
- let d = t[u];
53
+ let o = r.map((e) => e.disabled), l = i ? r.indexOf(i) : r.findIndex((e) => e.value === this.value), u;
54
+ u = l < 0 ? s(o, a ? 1 : -1) : c(o, l, a ? 1 : -1);
55
+ let d = r[u];
50
56
  d && (d.focus(), this._select(d));
51
57
  };
52
58
  }
59
+ static {
60
+ this.keyMap = l;
61
+ }
53
62
  connectedCallback() {
54
63
  super.connectedCallback(), this.setHostAttribute("role", "radiogroup"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown), this._observer ??= new MutationObserver(() => this._syncItems()), this._observer.observe(this, {
55
64
  childList: !0,
@@ -69,11 +78,11 @@ var l = class extends r(e) {
69
78
  return this.value || null;
70
79
  }
71
80
  get _items() {
72
- return Array.from(this.querySelectorAll("void-segmented-control-item")).filter((e) => e instanceof c);
81
+ return Array.from(this.querySelectorAll("void-segmented-control-item")).filter((e) => e instanceof d);
73
82
  }
74
83
  _syncItems() {
75
84
  let e = this._items, t = this.formDisabled, n = e.findIndex((e) => e.value === this.value), r = n >= 0 && !e[n].disabled ? n : -1;
76
- r < 0 && (r = a(e.map((e) => e.disabled), 1)), e.forEach((e, i) => e._apply(i === n, i === r, t || e.disabled));
85
+ r < 0 && (r = s(e.map((e) => e.disabled), 1)), e.forEach((e, i) => e._apply(i === n, i === r, t || e.disabled));
77
86
  }
78
87
  _select(e) {
79
88
  e.disabled || this.formDisabled || e.value === this.value || (this.value = e.value, this._syncItems(), this.dispatchEvent(new CustomEvent("void-change", {
@@ -83,18 +92,21 @@ var l = class extends r(e) {
83
92
  })));
84
93
  }
85
94
  };
86
- t([s({
95
+ t([u({
96
+ attribute: "keys",
97
+ converter: r
98
+ })], f.prototype, "keys", void 0), t([u({
87
99
  type: String,
88
100
  reflect: !0
89
- })], l.prototype, "value", void 0), t([s({
101
+ })], f.prototype, "value", void 0), t([u({
90
102
  type: Boolean,
91
103
  reflect: !0
92
- })], l.prototype, "disabled", void 0), t([s({
104
+ })], f.prototype, "disabled", void 0), t([u({
93
105
  type: String,
94
106
  reflect: !0
95
- })], l.prototype, "size", void 0), t([s({
107
+ })], f.prototype, "size", void 0), t([u({
96
108
  type: String,
97
109
  reflect: !0
98
- })], l.prototype, "color", void 0), customElements.get("void-segmented-control") || customElements.define("void-segmented-control", l);
110
+ })], f.prototype, "color", void 0), customElements.get("void-segmented-control") || customElements.define("void-segmented-control", f);
99
111
  //#endregion
100
- export { l as VoidSegmentedControl, c as VoidSegmentedControlItem };
112
+ export { f as VoidSegmentedControl, d as VoidSegmentedControlItem };
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
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-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { n as r } from "../chunks/parts-DI_3VpSy.js";
5
5
  import { html as i, nothing as a } from "lit";
6
6
  import { property as o } from "lit/decorators.js";
@@ -27,6 +27,7 @@ export declare class VoidSidebar extends VoidElement {
27
27
  toggle(force?: boolean): void;
28
28
  connectedCallback(): void;
29
29
  disconnectedCallback(): void;
30
+ private _name;
30
31
  updated(changed: Map<string, unknown>): void;
31
32
  private _updateWidth;
32
33
  }