@voidable/ui 0.8.1 → 0.10.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 (118) hide show
  1. package/README.md +8 -0
  2. package/dist/base-entry.d.ts +1 -0
  3. package/dist/base.d.ts +2 -1
  4. package/dist/base.js +5 -1
  5. package/dist/chunks/base-BxmMM3B7.js +298 -0
  6. package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
  7. package/dist/chunks/{modal-D_YVy2vg.js → modal-CgGp_fCs.js} +3 -3
  8. package/dist/chunks/{overlay-BywGMcDW.js → overlay-hLJ7IQHx.js} +2 -2
  9. package/dist/chunks/{parts-D30c8OoG.js → parts-DI_3VpSy.js} +25 -18
  10. package/dist/chunks/{base-CMruMbxC.js → projection-SnR79EHI.js} +105 -389
  11. package/dist/chunks/secret-value-CmTtVkMg.js +14 -0
  12. package/dist/chunks/value-list-CH6GjYXM.js +28 -0
  13. package/dist/components/accordion.js +2 -2
  14. package/dist/components/action-input.d.ts +8 -4
  15. package/dist/components/action-input.js +61 -49
  16. package/dist/components/alert.js +2 -2
  17. package/dist/components/avatar.js +13 -11
  18. package/dist/components/badge.js +1 -1
  19. package/dist/components/banner.js +2 -2
  20. package/dist/components/bar-chart.js +31 -29
  21. package/dist/components/breadcrumbs.js +2 -2
  22. package/dist/components/button.js +1 -1
  23. package/dist/components/calendar.js +78 -76
  24. package/dist/components/card.js +1 -1
  25. package/dist/components/carousel.js +18 -17
  26. package/dist/components/checkbox-group.d.ts +10 -0
  27. package/dist/components/checkbox-group.js +36 -23
  28. package/dist/components/checkbox.d.ts +2 -2
  29. package/dist/components/checkbox.js +17 -16
  30. package/dist/components/collapsible.js +2 -2
  31. package/dist/components/color-picker.d.ts +2 -2
  32. package/dist/components/color-picker.js +26 -24
  33. package/dist/components/combobox.d.ts +4 -2
  34. package/dist/components/combobox.js +22 -18
  35. package/dist/components/compose-input.d.ts +1 -1
  36. package/dist/components/compose-input.js +15 -10
  37. package/dist/components/dialog.js +1 -1
  38. package/dist/components/divider.js +11 -9
  39. package/dist/components/donut-chart.js +51 -49
  40. package/dist/components/drawer.d.ts +2 -2
  41. package/dist/components/drawer.js +1 -1
  42. package/dist/components/dropdown-menu.js +4 -4
  43. package/dist/components/editable.d.ts +1 -1
  44. package/dist/components/editable.js +13 -12
  45. package/dist/components/error-fallback.js +2 -2
  46. package/dist/components/field.js +10 -9
  47. package/dist/components/file-upload.js +19 -17
  48. package/dist/components/gauge.js +90 -85
  49. package/dist/components/hamburger.js +11 -9
  50. package/dist/components/hover-card.js +3 -3
  51. package/dist/components/indicator.js +14 -12
  52. package/dist/components/input.d.ts +6 -2
  53. package/dist/components/input.js +46 -34
  54. package/dist/components/line-chart.js +41 -39
  55. package/dist/components/list.js +1 -1
  56. package/dist/components/menu.js +3 -3
  57. package/dist/components/multiselect.d.ts +9 -0
  58. package/dist/components/multiselect.js +64 -54
  59. package/dist/components/nav-bar.js +1 -1
  60. package/dist/components/nav-menu.js +20 -19
  61. package/dist/components/number-input.d.ts +2 -2
  62. package/dist/components/number-input.js +17 -15
  63. package/dist/components/pagination.js +22 -20
  64. package/dist/components/panel.js +2 -2
  65. package/dist/components/pin-input.d.ts +6 -2
  66. package/dist/components/pin-input.js +39 -27
  67. package/dist/components/popover.js +3 -3
  68. package/dist/components/progress.js +14 -12
  69. package/dist/components/radio-group.d.ts +2 -2
  70. package/dist/components/radio-group.js +15 -10
  71. package/dist/components/radio.d.ts +25 -0
  72. package/dist/components/radio.js +78 -29
  73. package/dist/components/scroll-area.js +8 -7
  74. package/dist/components/segmented-control.d.ts +1 -1
  75. package/dist/components/segmented-control.js +21 -21
  76. package/dist/components/select.d.ts +67 -16
  77. package/dist/components/select.js +183 -56
  78. package/dist/components/sidebar.d.ts +2 -2
  79. package/dist/components/sidebar.js +2 -2
  80. package/dist/components/skeleton.js +1 -1
  81. package/dist/components/slider.d.ts +2 -2
  82. package/dist/components/slider.js +18 -13
  83. package/dist/components/spinner.js +11 -9
  84. package/dist/components/stat.js +19 -17
  85. package/dist/components/status-dot.js +1 -1
  86. package/dist/components/stepper.js +15 -13
  87. package/dist/components/switch.d.ts +1 -1
  88. package/dist/components/switch.js +14 -12
  89. package/dist/components/table.js +1 -1
  90. package/dist/components/tabs.js +29 -29
  91. package/dist/components/tag.js +9 -8
  92. package/dist/components/tags-input.d.ts +1 -1
  93. package/dist/components/tags-input.js +25 -19
  94. package/dist/components/textarea.d.ts +2 -2
  95. package/dist/components/textarea.js +36 -31
  96. package/dist/components/toast.d.ts +19 -2
  97. package/dist/components/toast.js +43 -10
  98. package/dist/components/toggle-group.d.ts +2 -2
  99. package/dist/components/toggle-group.js +16 -15
  100. package/dist/components/toggle.js +5 -2
  101. package/dist/components/tooltip.js +3 -3
  102. package/dist/components.json +3 -3
  103. package/dist/custom-elements.json +133 -67
  104. package/dist/dev/types.d.ts +2 -3
  105. package/dist/dev.js +81 -55
  106. package/dist/index.js +1 -1
  107. package/dist/keyboard.d.ts +10 -0
  108. package/dist/llms.txt +125 -0
  109. package/dist/parts.d.ts +8 -1
  110. package/dist/projection-api.d.ts +23 -0
  111. package/dist/projection.d.ts +8 -2
  112. package/dist/reference.md +4575 -0
  113. package/dist/secret-value.d.ts +17 -0
  114. package/dist/types/elements.d.ts +2 -2
  115. package/dist/value-list.d.ts +14 -0
  116. package/dist/vscode.html-custom-data.json +46 -26
  117. package/dist/web-types.json +73 -53
  118. package/package.json +5 -3
@@ -1,18 +1,21 @@
1
- import { r as e, t } from "../chunks/base-CMruMbxC.js";
2
- import { t as n } from "../chunks/decorate-CaYbmmmm.js";
3
- import { t as r } from "../chunks/form-control-C0vH6gii.js";
4
- import { html as i, nothing as a } from "lit";
5
- import { property as o } from "lit/decorators.js";
6
- import { live as s } from "lit/directives/live.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
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";
7
10
  //#region src/components/pin-input.ts
8
- var c = class extends r(t) {
9
- constructor(...t) {
10
- super(...t), 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 = () => {
11
+ var d = class t extends n(e) {
12
+ 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 = () => {
11
14
  this._focusValue ??= this.value;
12
- }, this._onFocusOut = (t) => {
13
- if (t.relatedTarget instanceof Node && this.contains(t.relatedTarget) || e(this)) return;
14
- let n = this._focusValue;
15
- this._focusValue = null, n !== null && n !== this.value && this.dispatchEvent(new CustomEvent("void-change", {
15
+ }, this._onFocusOut = (e) => {
16
+ if (e.relatedTarget instanceof Node && this.contains(e.relatedTarget) || r(this)) return;
17
+ let t = this._focusValue;
18
+ this._focusValue = null, t !== null && t !== this.value && this.dispatchEvent(new CustomEvent("void-change", {
16
19
  bubbles: !0,
17
20
  composed: !0,
18
21
  detail: { value: this.value }
@@ -22,6 +25,12 @@ var c = class extends r(t) {
22
25
  static {
23
26
  this.editState = ["value"];
24
27
  }
28
+ requestUpdate(e, n, r) {
29
+ super.requestUpdate(e, n, i(this.mask, e, r, () => t.getPropertyOptions("value")));
30
+ }
31
+ updated(e) {
32
+ super.updated(e), this.mask && e.get("mask") !== void 0 && a(this);
33
+ }
25
34
  get _effectiveLength() {
26
35
  let e = this._parsedGroups;
27
36
  return e.length > 0 ? e.reduce((e, t) => e + t, 0) : this.length;
@@ -85,7 +94,7 @@ var c = class extends r(t) {
85
94
  e.value = "", this._syncValue();
86
95
  }
87
96
  e.preventDefault();
88
- } else e.key === "ArrowLeft" ? (e.preventDefault(), this._focusCell(t - 1)) : e.key === "ArrowRight" ? (e.preventDefault(), this._focusCell(t + 1)) : e.key === "Delete" && (n.value = "", this._syncValue(), 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());
89
98
  }
90
99
  _onPaste(e) {
91
100
  e.preventDefault();
@@ -104,16 +113,16 @@ var c = class extends r(t) {
104
113
  render() {
105
114
  let e = [], t = this._separatorIndices();
106
115
  for (let n = 0; n < this._effectiveLength; n++) {
107
- t.has(n) && e.push(i`<span class="void-pin-separator" aria-hidden="true">–</span>`);
116
+ t.has(n) && e.push(s`<span class="void-pin-separator" aria-hidden="true">–</span>`);
108
117
  let r = this.value[n] ?? "";
109
- e.push(i`
118
+ e.push(s`
110
119
  <input
111
120
  class="void-pin-cell"
112
121
  type=${this.mask ? "password" : "text"}
113
122
  inputmode=${this.type === "numeric" ? "numeric" : "text"}
114
123
  maxlength="1"
115
- .value=${s(r)}
116
- placeholder=${this.placeholder || a}
124
+ .value=${u(r)}
125
+ placeholder=${this.placeholder || c}
117
126
  ?disabled=${this.disabled}
118
127
  autocomplete="one-time-code"
119
128
  aria-label=${`Digit ${n + 1} of ${this._effectiveLength}`}
@@ -124,27 +133,30 @@ var c = class extends r(t) {
124
133
  />
125
134
  `);
126
135
  }
127
- return i`<div class="void-pin-input">${e}</div>`;
136
+ return s`<div class="void-pin-input">${e}</div>`;
128
137
  }
129
138
  };
130
- n([o({ type: Number })], c.prototype, "length", void 0), n([o({
139
+ t([l({ type: Number })], d.prototype, "length", void 0), t([l({
140
+ type: String,
141
+ reflect: !0
142
+ })], d.prototype, "groups", void 0), t([l({
131
143
  type: String,
132
144
  reflect: !0
133
- })], c.prototype, "groups", void 0), n([o({ type: String })], c.prototype, "value", void 0), n([o({
145
+ })], d.prototype, "value", void 0), t([l({
134
146
  type: Boolean,
135
147
  reflect: !0
136
- })], c.prototype, "disabled", void 0), n([o({
148
+ })], d.prototype, "disabled", void 0), t([l({
137
149
  type: Boolean,
138
150
  reflect: !0
139
- })], c.prototype, "mask", void 0), n([o({
151
+ })], d.prototype, "mask", void 0), t([l({
140
152
  type: String,
141
153
  reflect: !0
142
- })], c.prototype, "type", void 0), n([o({
154
+ })], d.prototype, "type", void 0), t([l({
143
155
  type: String,
144
156
  reflect: !0
145
- })], c.prototype, "size", void 0), n([o({
157
+ })], d.prototype, "size", void 0), t([l({
146
158
  type: String,
147
159
  reflect: !0
148
- })], c.prototype, "color", void 0), n([o({ type: String })], c.prototype, "placeholder", void 0), customElements.get("void-pin-input") || customElements.define("void-pin-input", c);
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);
149
161
  //#endregion
150
- export { c as VoidPinInput };
162
+ export { d as VoidPinInput };
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { i as n, n as r } from "../chunks/parts-D30c8OoG.js";
4
- import { t as i } from "../chunks/overlay-BywGMcDW.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
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/components/popover.ts
7
7
  var o = class extends e {
@@ -1,9 +1,11 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { html as n } from "lit";
4
- import { property as r } from "lit/decorators.js";
3
+ import { r as n } from "../chunks/projection-SnR79EHI.js";
4
+ import { html as r } from "lit";
5
+ import { property as i } from "lit/decorators.js";
5
6
  //#region src/components/progress.ts
6
- var i = class extends e {
7
+ n();
8
+ var a = class extends e {
7
9
  constructor(...e) {
8
10
  super(...e), this.value = 0, this.max = 100, this.color = "default", this.size = "md", this.indeterminate = !1;
9
11
  }
@@ -15,24 +17,24 @@ var i = class extends e {
15
17
  }
16
18
  render() {
17
19
  let e = Math.min(100, Math.max(0, this.value / this.max * 100));
18
- return n`<div class="void-progress-track"><div class="void-progress-fill" style="--void-progress-fill: ${this.indeterminate ? "0%" : e + "%"}"></div></div>`;
20
+ return r`<div class="void-progress-track"><div class="void-progress-fill" style="--void-progress-fill: ${this.indeterminate ? "0%" : e + "%"}"></div></div>`;
19
21
  }
20
22
  };
21
- t([r({
23
+ t([i({
22
24
  type: Number,
23
25
  reflect: !0
24
- })], i.prototype, "value", void 0), t([r({
26
+ })], a.prototype, "value", void 0), t([i({
25
27
  type: Number,
26
28
  reflect: !0
27
- })], i.prototype, "max", void 0), t([r({
29
+ })], a.prototype, "max", void 0), t([i({
28
30
  type: String,
29
31
  reflect: !0
30
- })], i.prototype, "color", void 0), t([r({
32
+ })], a.prototype, "color", void 0), t([i({
31
33
  type: String,
32
34
  reflect: !0
33
- })], i.prototype, "size", void 0), t([r({
35
+ })], a.prototype, "size", void 0), t([i({
34
36
  type: Boolean,
35
37
  reflect: !0
36
- })], i.prototype, "indeterminate", void 0), customElements.get("void-progress") || customElements.define("void-progress", i);
38
+ })], a.prototype, "indeterminate", void 0), customElements.get("void-progress") || customElements.define("void-progress", a);
37
39
  //#endregion
38
- export { i as VoidProgress };
40
+ export { a as VoidProgress };
@@ -11,8 +11,8 @@ export declare class VoidRadioGroup extends VoidRadioGroup_base {
11
11
  /** Name of the group, shown above the radios and used as its accessible name. */
12
12
  label: string;
13
13
  /**
14
- * `value` of the selected radio. Set it to choose one; it is the initial selection and the form's
15
- * reset target.
14
+ * `value` of the selected radio. Set it to choose one; it follows the user's choice and is reflected
15
+ * to the attribute. The form's reset target stays the initial selection.
16
16
  */
17
17
  value: string;
18
18
  name: string;
@@ -1,12 +1,13 @@
1
- import { n as e, t } from "../chunks/base-CMruMbxC.js";
2
- import { t as n } from "../chunks/decorate-CaYbmmmm.js";
3
- import { n as r } from "../chunks/form-control-C0vH6gii.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
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";
4
5
  import { html as i, nothing as a } from "lit";
5
6
  import { property as o } from "lit/decorators.js";
6
7
  //#region src/components/radio-group.ts
7
- var s = class extends r(t) {
8
- constructor(...t) {
9
- super(...t), this.label = "", this.value = "", this.name = "", this.required = !1, this.disabled = !1, this.orientation = "vertical", this._projection = new e(this, {
8
+ var s = class extends n(e) {
9
+ constructor(...e) {
10
+ super(...e), this.label = "", this.value = "", this.name = "", this.required = !1, this.disabled = !1, this.orientation = "vertical", this._projection = new r(this, {
10
11
  regions: [{
11
12
  name: "options",
12
13
  target: () => this.querySelector(":scope > .void-radio-group-options")
@@ -68,6 +69,7 @@ var s = class extends r(t) {
68
69
  }
69
70
  _syncChecked() {
70
71
  for (let e of this._radios()) e.checked = e.value === this.value;
72
+ this._radios()[0]?._syncTabStops?.();
71
73
  }
72
74
  render() {
73
75
  return i`
@@ -76,16 +78,19 @@ var s = class extends r(t) {
76
78
  `;
77
79
  }
78
80
  };
79
- n([o({ type: String })], s.prototype, "label", void 0), n([o({ type: String })], s.prototype, "value", void 0), n([o({
81
+ t([o({ type: String })], s.prototype, "label", void 0), t([o({
80
82
  type: String,
81
83
  reflect: !0
82
- })], s.prototype, "name", void 0), n([o({
84
+ })], s.prototype, "value", void 0), t([o({
85
+ type: String,
86
+ reflect: !0
87
+ })], s.prototype, "name", void 0), t([o({
83
88
  type: Boolean,
84
89
  reflect: !0
85
- })], s.prototype, "required", void 0), n([o({
90
+ })], s.prototype, "required", void 0), t([o({
86
91
  type: Boolean,
87
92
  reflect: !0
88
- })], s.prototype, "disabled", void 0), n([o({
93
+ })], s.prototype, "disabled", void 0), t([o({
89
94
  type: String,
90
95
  reflect: !0
91
96
  })], s.prototype, "orientation", void 0), customElements.get("void-radio-group") || customElements.define("void-radio-group", s);
@@ -36,6 +36,31 @@ export declare class VoidRadio extends VoidRadio_base {
36
36
  connectedCallback(): void;
37
37
  disconnectedCallback(): void;
38
38
  protected updated(changed: Map<string, unknown>): void;
39
+ /** A morph may have changed which radio is checked or enabled. */
40
+ protected morphedCallback(): void;
41
+ private _anchor;
42
+ private _hasFocus;
43
+ /** Checked, or chosen by the group's value which has not reached `checked` yet. */
44
+ private _isOn;
45
+ /**
46
+ * The radios that behave as one group with this one: those of the same `void-radio-group`, or,
47
+ * outside one, those with the same `name` in the same form (or document), as native radios do.
48
+ */
49
+ private _peers;
50
+ /**
51
+ * Roving tabindex: one radio of the group is tabbable: the checked one, else (nothing checked) the
52
+ * focused one, else the first enabled one. Disabled radios are never tabbable.
53
+ * @internal
54
+ */
55
+ _syncTabStops(): void;
56
+ /**
57
+ * Arrow keys move to the next or previous enabled radio of the group, wrapping, and check it with a
58
+ * real `click`, as native radios do (so a click listener, `void-change` and the form value all follow
59
+ * as for a pointer click). The inline arrows follow the reading direction.
60
+ */
61
+ private _handleKeydown;
62
+ private _handleFocus;
63
+ private _handleBlur;
39
64
  render(): import('lit').TemplateResult<1>;
40
65
  /** Form reset target is the checked state; the native radio submits. */
41
66
  protected formSnapshot(): unknown;
@@ -1,19 +1,48 @@
1
- import { n as e, t } from "../chunks/base-CMruMbxC.js";
2
- import { t as n } from "../chunks/decorate-CaYbmmmm.js";
3
- import { t as r } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
- import { n as i } from "../chunks/form-control-C0vH6gii.js";
5
- import { html as a, nothing as o } from "lit";
6
- import { property as s } from "lit/decorators.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
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";
7
9
  //#region src/components/radio.ts
8
- var c = class extends i(t) {
9
- constructor(...t) {
10
- super(...t), this._activation = new r(this, {
10
+ var u = !1;
11
+ typeof document < "u" && (document.addEventListener("keydown", (e) => {
12
+ u = e.key === "Tab" && e.shiftKey;
13
+ }, !0), document.addEventListener("pointerdown", () => {
14
+ u = !1;
15
+ }, !0));
16
+ var d = class t extends r(e) {
17
+ constructor(...e) {
18
+ super(...e), this._activation = new n(this, {
11
19
  enter: !1,
12
20
  disabled: () => this.formDisabled
13
- }), this.checked = !1, this.disabled = !1, this.name = "", this.value = "on", this.required = !1, this.color = "default", this.size = "md", this._projection = new e(this, { regions: [{
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: [{
14
22
  name: "label",
15
23
  target: "after"
16
- }] }), this._onNativeFocus = () => {
24
+ }] }), 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;
28
+ 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());
31
+ }, this._handleFocus = (e) => {
32
+ 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) {
34
+ let e = t.filter((e) => !e.formDisabled).pop();
35
+ if (e && e !== this) {
36
+ e.focus();
37
+ return;
38
+ }
39
+ }
40
+ this._hasFocus = !0, this._syncTabStops();
41
+ }, this._handleBlur = (e) => {
42
+ this._hasFocus = !1;
43
+ let t = e.relatedTarget;
44
+ (!t || !this._peers().some((e) => e.contains(t))) && this._syncTabStops();
45
+ }, this._onNativeFocus = () => {
17
46
  this.focus();
18
47
  }, this._onNativeInvalid = (e) => {
19
48
  let t = e.target;
@@ -39,22 +68,42 @@ var c = class extends i(t) {
39
68
  };
40
69
  }
41
70
  connectedCallback() {
42
- super.connectedCallback(), this.setHostAttribute("role", "radio"), this.setHostAttribute("tabindex", "0"), this.setHostAttribute("aria-checked", String(this.checked)), this.addEventListener("click", this._handleClick);
71
+ 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);
43
72
  }
44
73
  disconnectedCallback() {
45
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
74
+ super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown), this.removeEventListener("focus", this._handleFocus), this.removeEventListener("blur", this._handleBlur), this._hasFocus = !1;
75
+ let e = this._anchor;
76
+ this._anchor = null, e && queueMicrotask(() => {
77
+ Array.from(e.querySelectorAll("void-radio")).find((t) => t.isConnected && t.name === this.name && t._anchor === e)?._syncTabStops();
78
+ });
46
79
  }
47
80
  updated(e) {
48
- if (super.updated(e), e.has("checked") && this.setHostAttribute("aria-checked", String(this.checked)), e.has("disabled") || e.has("ancestorDisabled")) {
49
- let e = this.formDisabled;
50
- this.setHostAttribute("aria-disabled", e ? "true" : null), this.setHostAttribute("tabindex", e ? "-1" : "0");
51
- }
81
+ super.updated(e), e.has("checked") && this.setHostAttribute("aria-checked", String(this.checked)), (e.has("disabled") || e.has("ancestorDisabled")) && this.setHostAttribute("aria-disabled", this.formDisabled ? "true" : null), (e.has("checked") || e.has("disabled") || e.has("ancestorDisabled") || e.has("name")) && this._syncTabStops();
82
+ }
83
+ morphedCallback() {
84
+ this._syncTabStops();
85
+ }
86
+ _isOn() {
87
+ if (this.checked) return !0;
88
+ let e = this.closest("void-radio-group");
89
+ return !!e?.value && e.value === this.value;
90
+ }
91
+ _peers() {
92
+ let e = this.closest("void-radio-group");
93
+ if (e) return Array.from(e.querySelectorAll("void-radio")).filter((n) => n instanceof t && n.closest("void-radio-group") === e);
94
+ if (!this.name) return [this];
95
+ let n = this.form ?? this.getRootNode();
96
+ return Array.from(n.querySelectorAll("void-radio")).filter((e) => e instanceof t && e.name === this.name && e.form === this.form && !e.closest("void-radio-group"));
97
+ }
98
+ _syncTabStops() {
99
+ let e = this._peers(), t = e.filter((e) => !e.formDisabled), n = t.find((e) => e._isOn()) ?? t.find((e) => e._hasFocus) ?? t[0];
100
+ for (let t of e) t.setHostAttribute("tabindex", t === n ? "0" : "-1");
52
101
  }
53
102
  render() {
54
- return a`
55
- <input type="radio" .checked=${this.checked} ?disabled=${this.formDisabled} ?required=${this.required} name=${this.name} value=${this.value} form=${this.formAttr ?? o} tabindex="-1" aria-hidden="true" inert @invalid=${this._onNativeInvalid} @focus=${this._onNativeFocus} />
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} />
56
105
  <span class="void-radio-circle">
57
- ${this.checked ? a`<span class="void-radio-dot"></span>` : ""}
106
+ ${this.checked ? s`<span class="void-radio-dot"></span>` : ""}
58
107
  </span>
59
108
  `;
60
109
  }
@@ -81,27 +130,27 @@ var c = class extends i(t) {
81
130
  }
82
131
  }
83
132
  };
84
- n([s({
133
+ t([l({
85
134
  type: Boolean,
86
135
  reflect: !0
87
- })], c.prototype, "checked", void 0), n([s({
136
+ })], d.prototype, "checked", void 0), t([l({
88
137
  type: Boolean,
89
138
  reflect: !0
90
- })], c.prototype, "disabled", void 0), n([s({
139
+ })], d.prototype, "disabled", void 0), t([l({
91
140
  type: String,
92
141
  reflect: !0
93
- })], c.prototype, "name", void 0), n([s({
142
+ })], d.prototype, "name", void 0), t([l({
94
143
  type: String,
95
144
  reflect: !0
96
- })], c.prototype, "value", void 0), n([s({
145
+ })], d.prototype, "value", void 0), t([l({
97
146
  type: Boolean,
98
147
  reflect: !0
99
- })], c.prototype, "required", void 0), n([s({
148
+ })], d.prototype, "required", void 0), t([l({
100
149
  type: String,
101
150
  reflect: !0
102
- })], c.prototype, "color", void 0), n([s({
151
+ })], d.prototype, "color", void 0), t([l({
103
152
  type: String,
104
153
  reflect: !0
105
- })], c.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", c);
154
+ })], d.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", d);
106
155
  //#endregion
107
- export { c as VoidRadio };
156
+ export { d as VoidRadio };
@@ -1,11 +1,12 @@
1
- import { n as e, t } from "../chunks/base-CMruMbxC.js";
2
- import { t as n } from "../chunks/decorate-CaYbmmmm.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
+ import { t } from "../chunks/decorate-CaYbmmmm.js";
3
+ import { t as n } from "../chunks/projection-SnR79EHI.js";
3
4
  import { html as r } from "lit";
4
5
  import { property as i } from "lit/decorators.js";
5
6
  //#region src/components/scroll-area.ts
6
- var a = class extends t {
7
- constructor(...t) {
8
- super(...t), this.maxHeight = "", this.orientation = "vertical", this._projection = new e(this, { regions: [{
7
+ var a = class extends e {
8
+ constructor(...e) {
9
+ super(...e), this.maxHeight = "", this.orientation = "vertical", this._projection = new n(this, { regions: [{
9
10
  name: "viewport",
10
11
  target: () => this.querySelector(":scope > .void-scroll-area-viewport"),
11
12
  scrolls: !0
@@ -18,10 +19,10 @@ var a = class extends t {
18
19
  return r`<div class="void-scroll-area-viewport"></div>`;
19
20
  }
20
21
  };
21
- n([i({
22
+ t([i({
22
23
  type: String,
23
24
  attribute: "max-height"
24
- })], a.prototype, "maxHeight", void 0), n([i({
25
+ })], a.prototype, "maxHeight", void 0), t([i({
25
26
  type: String,
26
27
  reflect: !0
27
28
  })], a.prototype, "orientation", void 0), customElements.get("void-scroll-area") || customElements.define("void-scroll-area", a);
@@ -34,7 +34,7 @@ declare const VoidSegmentedControl_base: (new (...args: any[]) => import('../for
34
34
  export declare class VoidSegmentedControl extends VoidSegmentedControl_base {
35
35
  /**
36
36
  * `value` of the selected item. Selection follows focus, so each arrow key changes it and fires
37
- * `void-change`. As an attribute it is the initial value and the form's reset target.
37
+ * `void-change`. Reflected to the attribute as it changes; the form's reset target stays the value it started with.
38
38
  */
39
39
  value: string;
40
40
  /** Stop the whole control reacting and exclude the value from the form submission. */
@@ -1,11 +1,11 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BxmMM3B7.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
4
  import { t as r } from "../chunks/form-control-C0vH6gii.js";
5
- import { i, n as a } from "../chunks/keyboard-MQpfTX5I.js";
6
- import { property as o } from "lit/decorators.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";
7
7
  //#region src/components/segmented-control.ts
8
- var s = class extends e {
8
+ var c = class extends e {
9
9
  constructor(...e) {
10
10
  super(...e), this._activation = new n(this, {
11
11
  enter: !1,
@@ -27,27 +27,27 @@ var s = class extends e {
27
27
  this.setHostAttribute("aria-checked", String(e)), this.setHostAttribute("tabindex", t && !n ? "0" : "-1"), this.setHostAttribute("aria-disabled", n ? "true" : null);
28
28
  }
29
29
  };
30
- t([o({
30
+ t([s({
31
31
  type: String,
32
32
  reflect: !0
33
- })], s.prototype, "value", void 0), t([o({
33
+ })], c.prototype, "value", void 0), t([s({
34
34
  type: Boolean,
35
35
  reflect: !0
36
- })], s.prototype, "disabled", void 0), customElements.get("void-segmented-control-item") || customElements.define("void-segmented-control-item", s);
37
- var c = class extends r(e) {
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) {
38
38
  constructor(...e) {
39
39
  super(...e), this.value = "", this.disabled = !1, this.size = "md", this.color = "default", this._observer = null, this._itemsSynced = !1, this._handleClick = (e) => {
40
40
  let t = e.target.closest("void-segmented-control-item");
41
41
  t && this._select(t);
42
42
  }, this._handleKeydown = (e) => {
43
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 = e.key === "ArrowRight" || e.key === "ArrowDown";
45
- if (!r && e.key !== "ArrowLeft" && e.key !== "ArrowUp") 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;
46
46
  e.preventDefault();
47
- let o = t.map((e) => e.disabled), s = n ? t.indexOf(n) : t.findIndex((e) => e.value === this.value), c;
48
- c = s < 0 ? a(o, r ? 1 : -1) : i(o, s, r ? 1 : -1);
49
- let l = t[c];
50
- l && (l.focus(), this._select(l));
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];
50
+ d && (d.focus(), this._select(d));
51
51
  };
52
52
  }
53
53
  connectedCallback() {
@@ -69,7 +69,7 @@ var c = class extends r(e) {
69
69
  return this.value || null;
70
70
  }
71
71
  get _items() {
72
- return Array.from(this.querySelectorAll("void-segmented-control-item")).filter((e) => e instanceof s);
72
+ return Array.from(this.querySelectorAll("void-segmented-control-item")).filter((e) => e instanceof c);
73
73
  }
74
74
  _syncItems() {
75
75
  let e = this._items, t = this.formDisabled, n = e.findIndex((e) => e.value === this.value), r = n >= 0 && !e[n].disabled ? n : -1;
@@ -83,18 +83,18 @@ var c = class extends r(e) {
83
83
  })));
84
84
  }
85
85
  };
86
- t([o({
86
+ t([s({
87
87
  type: String,
88
88
  reflect: !0
89
- })], c.prototype, "value", void 0), t([o({
89
+ })], l.prototype, "value", void 0), t([s({
90
90
  type: Boolean,
91
91
  reflect: !0
92
- })], c.prototype, "disabled", void 0), t([o({
92
+ })], l.prototype, "disabled", void 0), t([s({
93
93
  type: String,
94
94
  reflect: !0
95
- })], c.prototype, "size", void 0), t([o({
95
+ })], l.prototype, "size", void 0), t([s({
96
96
  type: String,
97
97
  reflect: !0
98
- })], c.prototype, "color", void 0), customElements.get("void-segmented-control") || customElements.define("void-segmented-control", c);
98
+ })], l.prototype, "color", void 0), customElements.get("void-segmented-control") || customElements.define("void-segmented-control", l);
99
99
  //#endregion
100
- export { c as VoidSegmentedControl, s as VoidSegmentedControlItem };
100
+ export { l as VoidSegmentedControl, c as VoidSegmentedControlItem };