@voidable/ui 0.9.0 → 0.11.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 (114) hide show
  1. package/dist/base-entry.d.ts +1 -0
  2. package/dist/base.d.ts +8 -1
  3. package/dist/base.js +5 -1
  4. package/dist/chunks/base-BGrS4eIl.js +307 -0
  5. package/dist/chunks/data-BpiiNapL.js +95 -0
  6. package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
  7. package/dist/chunks/{modal-hivQ4YoU.js → modal-DWGkNdNG.js} +3 -3
  8. package/dist/chunks/{overlay-BywGMcDW.js → overlay-CH7L4N-h.js} +2 -2
  9. package/dist/chunks/{parts-CMQQop0D.js → parts-DI_3VpSy.js} +21 -17
  10. package/dist/chunks/{base-CMruMbxC.js → projection-oPe6ipjL.js} +105 -389
  11. package/dist/components/accordion.js +2 -2
  12. package/dist/components/action-input.d.ts +2 -2
  13. package/dist/components/action-input.js +56 -54
  14. package/dist/components/alert.d.ts +11 -0
  15. package/dist/components/alert.js +11 -4
  16. package/dist/components/avatar.js +13 -11
  17. package/dist/components/badge.d.ts +8 -2
  18. package/dist/components/badge.js +1 -4
  19. package/dist/components/banner.d.ts +9 -0
  20. package/dist/components/banner.js +11 -4
  21. package/dist/components/bar-chart.d.ts +21 -7
  22. package/dist/components/bar-chart.js +67 -43
  23. package/dist/components/breadcrumbs.js +2 -2
  24. package/dist/components/button.js +1 -1
  25. package/dist/components/calendar.d.ts +40 -2
  26. package/dist/components/calendar.js +170 -79
  27. package/dist/components/card.js +1 -1
  28. package/dist/components/carousel.js +20 -19
  29. package/dist/components/charts/data.d.ts +72 -0
  30. package/dist/components/checkbox-group.js +13 -12
  31. package/dist/components/checkbox.js +17 -16
  32. package/dist/components/collapsible.js +2 -2
  33. package/dist/components/color-picker.js +26 -24
  34. package/dist/components/combobox.js +17 -16
  35. package/dist/components/compose-input.js +13 -11
  36. package/dist/components/dialog.js +1 -1
  37. package/dist/components/divider.js +11 -9
  38. package/dist/components/donut-chart.d.ts +22 -6
  39. package/dist/components/donut-chart.js +96 -68
  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.js +13 -12
  44. package/dist/components/error-fallback.js +2 -2
  45. package/dist/components/field.js +10 -9
  46. package/dist/components/file-upload.d.ts +20 -5
  47. package/dist/components/file-upload.js +52 -20
  48. package/dist/components/gauge.d.ts +32 -8
  49. package/dist/components/gauge.js +209 -135
  50. package/dist/components/hamburger.d.ts +12 -1
  51. package/dist/components/hamburger.js +33 -20
  52. package/dist/components/hover-card.js +3 -3
  53. package/dist/components/indicator.js +14 -12
  54. package/dist/components/input.js +41 -39
  55. package/dist/components/line-chart.d.ts +22 -7
  56. package/dist/components/line-chart.js +80 -56
  57. package/dist/components/list.js +1 -1
  58. package/dist/components/menu.js +3 -3
  59. package/dist/components/multiselect.js +30 -29
  60. package/dist/components/nav-bar.d.ts +9 -0
  61. package/dist/components/nav-bar.js +16 -3
  62. package/dist/components/nav-menu.js +20 -19
  63. package/dist/components/number-input.js +17 -15
  64. package/dist/components/pagination.js +22 -20
  65. package/dist/components/panel.js +2 -2
  66. package/dist/components/pin-input.js +32 -30
  67. package/dist/components/popover.js +3 -3
  68. package/dist/components/progress.js +14 -12
  69. package/dist/components/radio-group.js +13 -11
  70. package/dist/components/radio.d.ts +25 -0
  71. package/dist/components/radio.js +78 -29
  72. package/dist/components/scroll-area.js +8 -7
  73. package/dist/components/segmented-control.js +21 -21
  74. package/dist/components/select.js +49 -47
  75. package/dist/components/sidebar.d.ts +2 -2
  76. package/dist/components/sidebar.js +2 -2
  77. package/dist/components/skeleton.js +1 -1
  78. package/dist/components/slider.js +16 -14
  79. package/dist/components/spinner.js +11 -9
  80. package/dist/components/stat.d.ts +13 -1
  81. package/dist/components/stat.js +29 -19
  82. package/dist/components/status-dot.js +1 -1
  83. package/dist/components/stepper.js +15 -13
  84. package/dist/components/switch.js +14 -12
  85. package/dist/components/table.d.ts +4 -0
  86. package/dist/components/table.js +42 -29
  87. package/dist/components/tabs.js +29 -29
  88. package/dist/components/tag.js +9 -8
  89. package/dist/components/tags-input.js +24 -22
  90. package/dist/components/textarea.js +34 -32
  91. package/dist/components/toast.d.ts +19 -2
  92. package/dist/components/toast.js +43 -10
  93. package/dist/components/toggle-group.js +16 -15
  94. package/dist/components/toggle.js +1 -1
  95. package/dist/components/tooltip.js +3 -3
  96. package/dist/components.json +15 -13
  97. package/dist/custom-elements.json +320 -88
  98. package/dist/dev/types.d.ts +3 -1
  99. package/dist/dev.js +85 -16
  100. package/dist/index.js +1 -1
  101. package/dist/keyboard.d.ts +10 -0
  102. package/dist/llms.txt +1 -1
  103. package/dist/parts.d.ts +5 -0
  104. package/dist/projection-api.d.ts +23 -0
  105. package/dist/projection.d.ts +8 -2
  106. package/dist/reference.md +84 -59
  107. package/dist/types/elements.d.ts +13 -13
  108. package/dist/types/react.d.ts +2 -2
  109. package/dist/types/solid.d.ts +2 -2
  110. package/dist/types/svelte.d.ts +2 -2
  111. package/dist/types/vue.d.ts +2 -2
  112. package/dist/vscode.html-custom-data.json +108 -28
  113. package/dist/web-types.json +189 -60
  114. package/package.json +1 -1
@@ -1,9 +1,11 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { html as n, nothing as r } from "lit";
4
- import { property as i } from "lit/decorators.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";
5
6
  //#region src/components/pagination.ts
6
- var a = class extends e {
7
+ n();
8
+ var o = class extends e {
7
9
  constructor(...e) {
8
10
  super(...e), this.total = 1, this.value = 1, this.siblings = 1, this.size = "md", this.hrefTemplate = "", this.param = "";
9
11
  }
@@ -41,18 +43,18 @@ var a = class extends e {
41
43
  }, 0);
42
44
  }
43
45
  _renderLinks(e) {
44
- let t = 0, i = (e, t, r, i) => i ? n`<span class="void-pagination-btn" aria-disabled="true" aria-label=${e}>${t}</span>` : n`<a class="void-pagination-btn" href=${this._href(r)} aria-label=${e}
45
- @click=${(e) => this._onLinkClick(e, r)}>${t}</a>`;
46
- return n`
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
+ @click=${(e) => this._onLinkClick(e, n)}>${t}</a>`;
48
+ return r`
47
49
  <nav role="navigation" aria-label="Pagination">
48
- ${i("Previous page", "«", this.value - 1, this.value <= 1)}
49
- ${e.map((e) => e === "ellipsis" ? (t++, n`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : n`<a
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
50
52
  class="void-pagination-btn"
51
53
  href=${this._href(e)}
52
- aria-current=${e === this.value ? "page" : r}
54
+ aria-current=${e === this.value ? "page" : i}
53
55
  @click=${(t) => this._onLinkClick(t, e)}
54
56
  >${e}</a>`)}
55
- ${i("Next page", "»", this.value + 1, this.value >= this.total)}
57
+ ${n("Next page", "»", this.value + 1, this.value >= this.total)}
56
58
  </nav>
57
59
  `;
58
60
  }
@@ -76,7 +78,7 @@ var a = class extends e {
76
78
  let e = this._pages();
77
79
  if (this._linkMode) return this._renderLinks(e);
78
80
  let t = 0;
79
- return n`
81
+ return r`
80
82
  <nav role="navigation" aria-label="Pagination">
81
83
  <button
82
84
  type="button"
@@ -85,12 +87,12 @@ var a = class extends e {
85
87
  @click=${() => this._go(this.value - 1)}
86
88
  aria-label="Previous page"
87
89
  >«</button>
88
- ${e.map((e) => e === "ellipsis" ? (t++, n`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : n`
90
+ ${e.map((e) => e === "ellipsis" ? (t++, r`<span class="void-pagination-ellipsis" aria-hidden="true" data-key=${t}>…</span>`) : r`
89
91
  <button
90
92
  type="button"
91
93
  class="void-pagination-btn"
92
94
  ?disabled=${e === this.value}
93
- aria-current=${e === this.value ? "page" : r}
95
+ aria-current=${e === this.value ? "page" : i}
94
96
  @click=${() => this._go(e)}
95
97
  >${e}</button>
96
98
  `)}
@@ -105,19 +107,19 @@ var a = class extends e {
105
107
  `;
106
108
  }
107
109
  };
108
- t([i({ type: Number })], a.prototype, "total", void 0), t([i({
110
+ t([a({ type: Number })], o.prototype, "total", void 0), t([a({
109
111
  type: Number,
110
112
  reflect: !0
111
- })], a.prototype, "value", void 0), t([i({ type: Number })], a.prototype, "siblings", void 0), t([i({
113
+ })], o.prototype, "value", void 0), t([a({ type: Number })], o.prototype, "siblings", void 0), t([a({
112
114
  type: String,
113
115
  reflect: !0
114
- })], a.prototype, "size", void 0), t([i({
116
+ })], o.prototype, "size", void 0), t([a({
115
117
  type: String,
116
118
  attribute: "href-template",
117
119
  reflect: !0
118
- })], a.prototype, "hrefTemplate", void 0), t([i({
120
+ })], o.prototype, "hrefTemplate", void 0), t([a({
119
121
  type: String,
120
122
  reflect: !0
121
- })], a.prototype, "param", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", a);
123
+ })], o.prototype, "param", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", o);
122
124
  //#endregion
123
- export { a as VoidPagination };
125
+ export { o as VoidPagination };
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.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/parts-CMQQop0D.js";
3
+ import { n } from "../chunks/parts-DI_3VpSy.js";
4
4
  import { property as r } from "lit/decorators.js";
5
5
  //#region src/components/panel.ts
6
6
  var i = class extends e {
@@ -1,19 +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";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.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-oPe6ipjL.js";
4
5
  import { n as i, t as a } from "../chunks/secret-value-CmTtVkMg.js";
5
- import { html as o, nothing as s } from "lit";
6
- import { property as c } from "lit/decorators.js";
7
- import { live as l } from "lit/directives/live.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";
8
10
  //#region src/components/pin-input.ts
9
- var u = class n extends r(t) {
10
- constructor(...t) {
11
- 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 = () => {
12
14
  this._focusValue ??= this.value;
13
- }, this._onFocusOut = (t) => {
14
- if (t.relatedTarget instanceof Node && this.contains(t.relatedTarget) || e(this)) return;
15
- let n = this._focusValue;
16
- 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", {
17
19
  bubbles: !0,
18
20
  composed: !0,
19
21
  detail: { value: this.value }
@@ -23,8 +25,8 @@ var u = class n extends r(t) {
23
25
  static {
24
26
  this.editState = ["value"];
25
27
  }
26
- requestUpdate(e, t, r) {
27
- super.requestUpdate(e, t, i(this.mask, e, r, () => n.getPropertyOptions("value")));
28
+ requestUpdate(e, n, r) {
29
+ super.requestUpdate(e, n, i(this.mask, e, r, () => t.getPropertyOptions("value")));
28
30
  }
29
31
  updated(e) {
30
32
  super.updated(e), this.mask && e.get("mask") !== void 0 && a(this);
@@ -92,7 +94,7 @@ var u = class n extends r(t) {
92
94
  e.value = "", this._syncValue();
93
95
  }
94
96
  e.preventDefault();
95
- } 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());
96
98
  }
97
99
  _onPaste(e) {
98
100
  e.preventDefault();
@@ -111,16 +113,16 @@ var u = class n extends r(t) {
111
113
  render() {
112
114
  let e = [], t = this._separatorIndices();
113
115
  for (let n = 0; n < this._effectiveLength; n++) {
114
- t.has(n) && e.push(o`<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>`);
115
117
  let r = this.value[n] ?? "";
116
- e.push(o`
118
+ e.push(s`
117
119
  <input
118
120
  class="void-pin-cell"
119
121
  type=${this.mask ? "password" : "text"}
120
122
  inputmode=${this.type === "numeric" ? "numeric" : "text"}
121
123
  maxlength="1"
122
- .value=${l(r)}
123
- placeholder=${this.placeholder || s}
124
+ .value=${u(r)}
125
+ placeholder=${this.placeholder || c}
124
126
  ?disabled=${this.disabled}
125
127
  autocomplete="one-time-code"
126
128
  aria-label=${`Digit ${n + 1} of ${this._effectiveLength}`}
@@ -131,30 +133,30 @@ var u = class n extends r(t) {
131
133
  />
132
134
  `);
133
135
  }
134
- return o`<div class="void-pin-input">${e}</div>`;
136
+ return s`<div class="void-pin-input">${e}</div>`;
135
137
  }
136
138
  };
137
- n([c({ type: Number })], u.prototype, "length", void 0), n([c({
139
+ t([l({ type: Number })], d.prototype, "length", void 0), t([l({
138
140
  type: String,
139
141
  reflect: !0
140
- })], u.prototype, "groups", void 0), n([c({
142
+ })], d.prototype, "groups", void 0), t([l({
141
143
  type: String,
142
144
  reflect: !0
143
- })], u.prototype, "value", void 0), n([c({
145
+ })], d.prototype, "value", void 0), t([l({
144
146
  type: Boolean,
145
147
  reflect: !0
146
- })], u.prototype, "disabled", void 0), n([c({
148
+ })], d.prototype, "disabled", void 0), t([l({
147
149
  type: Boolean,
148
150
  reflect: !0
149
- })], u.prototype, "mask", void 0), n([c({
151
+ })], d.prototype, "mask", void 0), t([l({
150
152
  type: String,
151
153
  reflect: !0
152
- })], u.prototype, "type", void 0), n([c({
154
+ })], d.prototype, "type", void 0), t([l({
153
155
  type: String,
154
156
  reflect: !0
155
- })], u.prototype, "size", void 0), n([c({
157
+ })], d.prototype, "size", void 0), t([l({
156
158
  type: String,
157
159
  reflect: !0
158
- })], u.prototype, "color", void 0), n([c({ type: String })], u.prototype, "placeholder", void 0), customElements.get("void-pin-input") || customElements.define("void-pin-input", u);
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);
159
161
  //#endregion
160
- export { u 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-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { i as n, n as r } from "../chunks/parts-CMQQop0D.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-CH7L4N-h.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-BGrS4eIl.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-oPe6ipjL.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 };
@@ -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-BGrS4eIl.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-oPe6ipjL.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,19 +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({
81
+ t([o({ type: String })], s.prototype, "label", void 0), t([o({
80
82
  type: String,
81
83
  reflect: !0
82
- })], s.prototype, "value", void 0), n([o({
84
+ })], s.prototype, "value", void 0), t([o({
83
85
  type: String,
84
86
  reflect: !0
85
- })], s.prototype, "name", void 0), n([o({
87
+ })], s.prototype, "name", void 0), t([o({
86
88
  type: Boolean,
87
89
  reflect: !0
88
- })], s.prototype, "required", void 0), n([o({
90
+ })], s.prototype, "required", void 0), t([o({
89
91
  type: Boolean,
90
92
  reflect: !0
91
- })], s.prototype, "disabled", void 0), n([o({
93
+ })], s.prototype, "disabled", void 0), t([o({
92
94
  type: String,
93
95
  reflect: !0
94
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-BGrS4eIl.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-oPe6ipjL.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-BGrS4eIl.js";
2
+ import { t } from "../chunks/decorate-CaYbmmmm.js";
3
+ import { t as n } from "../chunks/projection-oPe6ipjL.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);
@@ -1,11 +1,11 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.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 };