@voidable/ui 0.9.0 → 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 (93) hide show
  1. package/dist/base-entry.d.ts +1 -0
  2. package/dist/base.d.ts +2 -1
  3. package/dist/base.js +5 -1
  4. package/dist/chunks/base-BxmMM3B7.js +298 -0
  5. package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
  6. package/dist/chunks/{modal-hivQ4YoU.js → modal-CgGp_fCs.js} +3 -3
  7. package/dist/chunks/{overlay-BywGMcDW.js → overlay-hLJ7IQHx.js} +2 -2
  8. package/dist/chunks/{parts-CMQQop0D.js → parts-DI_3VpSy.js} +21 -17
  9. package/dist/chunks/{base-CMruMbxC.js → projection-SnR79EHI.js} +105 -389
  10. package/dist/components/accordion.js +2 -2
  11. package/dist/components/action-input.d.ts +2 -2
  12. package/dist/components/action-input.js +56 -54
  13. package/dist/components/alert.js +2 -2
  14. package/dist/components/avatar.js +13 -11
  15. package/dist/components/badge.js +1 -1
  16. package/dist/components/banner.js +2 -2
  17. package/dist/components/bar-chart.js +31 -29
  18. package/dist/components/breadcrumbs.js +2 -2
  19. package/dist/components/button.js +1 -1
  20. package/dist/components/calendar.js +78 -76
  21. package/dist/components/card.js +1 -1
  22. package/dist/components/carousel.js +18 -17
  23. package/dist/components/checkbox-group.js +13 -12
  24. package/dist/components/checkbox.js +17 -16
  25. package/dist/components/collapsible.js +2 -2
  26. package/dist/components/color-picker.js +26 -24
  27. package/dist/components/combobox.js +17 -16
  28. package/dist/components/compose-input.js +13 -11
  29. package/dist/components/dialog.js +1 -1
  30. package/dist/components/divider.js +11 -9
  31. package/dist/components/donut-chart.js +51 -49
  32. package/dist/components/drawer.d.ts +2 -2
  33. package/dist/components/drawer.js +1 -1
  34. package/dist/components/dropdown-menu.js +4 -4
  35. package/dist/components/editable.js +13 -12
  36. package/dist/components/error-fallback.js +2 -2
  37. package/dist/components/field.js +10 -9
  38. package/dist/components/file-upload.js +19 -17
  39. package/dist/components/gauge.js +88 -86
  40. package/dist/components/hamburger.js +11 -9
  41. package/dist/components/hover-card.js +3 -3
  42. package/dist/components/indicator.js +14 -12
  43. package/dist/components/input.js +41 -39
  44. package/dist/components/line-chart.js +41 -39
  45. package/dist/components/list.js +1 -1
  46. package/dist/components/menu.js +3 -3
  47. package/dist/components/multiselect.js +30 -29
  48. package/dist/components/nav-bar.js +1 -1
  49. package/dist/components/nav-menu.js +20 -19
  50. package/dist/components/number-input.js +17 -15
  51. package/dist/components/pagination.js +22 -20
  52. package/dist/components/panel.js +2 -2
  53. package/dist/components/pin-input.js +32 -30
  54. package/dist/components/popover.js +3 -3
  55. package/dist/components/progress.js +14 -12
  56. package/dist/components/radio-group.js +13 -11
  57. package/dist/components/radio.d.ts +25 -0
  58. package/dist/components/radio.js +78 -29
  59. package/dist/components/scroll-area.js +8 -7
  60. package/dist/components/segmented-control.js +21 -21
  61. package/dist/components/select.js +49 -47
  62. package/dist/components/sidebar.d.ts +2 -2
  63. package/dist/components/sidebar.js +2 -2
  64. package/dist/components/skeleton.js +1 -1
  65. package/dist/components/slider.js +16 -14
  66. package/dist/components/spinner.js +11 -9
  67. package/dist/components/stat.js +19 -17
  68. package/dist/components/status-dot.js +1 -1
  69. package/dist/components/stepper.js +15 -13
  70. package/dist/components/switch.js +14 -12
  71. package/dist/components/table.js +1 -1
  72. package/dist/components/tabs.js +29 -29
  73. package/dist/components/tag.js +9 -8
  74. package/dist/components/tags-input.js +24 -22
  75. package/dist/components/textarea.js +34 -32
  76. package/dist/components/toast.d.ts +19 -2
  77. package/dist/components/toast.js +43 -10
  78. package/dist/components/toggle-group.js +16 -15
  79. package/dist/components/toggle.js +1 -1
  80. package/dist/components/tooltip.js +3 -3
  81. package/dist/components.json +1 -1
  82. package/dist/custom-elements.json +48 -18
  83. package/dist/dev.js +31 -7
  84. package/dist/index.js +1 -1
  85. package/dist/keyboard.d.ts +10 -0
  86. package/dist/llms.txt +1 -1
  87. package/dist/parts.d.ts +5 -0
  88. package/dist/projection-api.d.ts +23 -0
  89. package/dist/projection.d.ts +8 -2
  90. package/dist/reference.md +4 -4
  91. package/dist/vscode.html-custom-data.json +13 -7
  92. package/dist/web-types.json +17 -17
  93. package/package.json +1 -1
@@ -1,11 +1,12 @@
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-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";
4
5
  import { html as i, nothing as a } from "lit";
5
6
  import { property as o, query as s } from "lit/decorators.js";
6
7
  import { live as c } from "lit/directives/live.js";
7
8
  //#region src/components/number-input.ts
8
- var l = class extends r(t) {
9
+ var l = class extends n(e) {
9
10
  constructor(...e) {
10
11
  super(...e), this.value = null, this.min = -Infinity, this.max = Infinity, this.step = 1, this.precision = -1, this.disabled = !1, this.readonly = !1, this.size = "md", this.color = "default", this.placeholder = "", this.controls = "sides", this.label = "", this.prefix = "", this.unit = "", this._pressTimer = null, this._repeatTimer = null, this._repeatInterval = 300, this._repeatCount = 0, this._pendingText = null;
11
12
  }
@@ -98,10 +99,10 @@ var l = class extends r(t) {
98
99
  this.formDisabled || this.readonly || (e.key === "ArrowUp" ? (e.preventDefault(), this._increment()) : e.key === "ArrowDown" && (e.preventDefault(), this._decrement()));
99
100
  }
100
101
  _onBlur() {
101
- if (!this._input || this.readonly || e(this)) return;
102
+ if (!this._input || this.readonly || r(this)) return;
102
103
  this._pendingText = null;
103
- let t = parseFloat(this._input.value);
104
- this._input.value.trim() ? isNaN(t) ? this._input.value = this.value === null ? "" : this._format(this.value) : this._commit(t) : this._commit(null);
104
+ let e = parseFloat(this._input.value);
105
+ this._input.value.trim() ? isNaN(e) ? this._input.value = this.value === null ? "" : this._format(this.value) : this._commit(e) : this._commit(null);
105
106
  }
106
107
  _onFieldInput() {
107
108
  this._pendingText = this._input?.value ?? null, this.formSync();
@@ -167,6 +168,7 @@ var l = class extends r(t) {
167
168
  ?readonly=${this.readonly}
168
169
  role="spinbutton"
169
170
  aria-valuenow=${this.value ?? a}
171
+ aria-valuetext=${this.value === null ? a : this._format(this.value)}
170
172
  aria-required=${this.required ? "true" : a}
171
173
  aria-valuemin=${isFinite(this.min) ? this.min : a}
172
174
  aria-valuemax=${isFinite(this.max) ? this.max : a}
@@ -182,30 +184,30 @@ var l = class extends r(t) {
182
184
  `;
183
185
  }
184
186
  };
185
- n([o({
187
+ t([o({
186
188
  reflect: !0,
187
189
  converter: {
188
190
  fromAttribute: (e) => e === null || e.trim() === "" ? null : Number(e),
189
191
  toAttribute: (e) => e == null ? null : String(e)
190
192
  }
191
- })], l.prototype, "value", void 0), n([o({ type: Number })], l.prototype, "min", void 0), n([o({ type: Number })], l.prototype, "max", void 0), n([o({ converter: {
193
+ })], l.prototype, "value", void 0), t([o({ type: Number })], l.prototype, "min", void 0), t([o({ type: Number })], l.prototype, "max", void 0), t([o({ converter: {
192
194
  fromAttribute: (e) => e === "any" ? "any" : e === null ? 1 : Number(e),
193
195
  toAttribute: (e) => String(e)
194
- } })], l.prototype, "step", void 0), n([o({ type: Number })], l.prototype, "precision", void 0), n([o({
196
+ } })], l.prototype, "step", void 0), t([o({ type: Number })], l.prototype, "precision", void 0), t([o({
195
197
  type: Boolean,
196
198
  reflect: !0
197
- })], l.prototype, "disabled", void 0), n([o({
199
+ })], l.prototype, "disabled", void 0), t([o({
198
200
  type: Boolean,
199
201
  reflect: !0
200
- })], l.prototype, "readonly", void 0), n([o({
202
+ })], l.prototype, "readonly", void 0), t([o({
201
203
  type: String,
202
204
  reflect: !0
203
- })], l.prototype, "size", void 0), n([o({
205
+ })], l.prototype, "size", void 0), t([o({
204
206
  type: String,
205
207
  reflect: !0
206
- })], l.prototype, "color", void 0), n([o({ type: String })], l.prototype, "placeholder", void 0), n([o({
208
+ })], l.prototype, "color", void 0), t([o({ type: String })], l.prototype, "placeholder", void 0), t([o({
207
209
  type: String,
208
210
  reflect: !0
209
- })], l.prototype, "controls", void 0), n([o({ type: String })], l.prototype, "label", void 0), n([o({ type: String })], l.prototype, "prefix", void 0), n([o({ type: String })], l.prototype, "unit", void 0), n([s(".void-number-input-field")], l.prototype, "_input", void 0), customElements.get("void-number-input") || customElements.define("void-number-input", l);
211
+ })], l.prototype, "controls", void 0), t([o({ type: String })], l.prototype, "label", void 0), t([o({ type: String })], l.prototype, "prefix", void 0), t([o({ type: String })], l.prototype, "unit", void 0), t([s(".void-number-input-field")], l.prototype, "_input", void 0), customElements.get("void-number-input") || customElements.define("void-number-input", l);
210
212
  //#endregion
211
213
  export { l as VoidNumberInput };
@@ -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, nothing as r } from "lit";
4
- import { property as i } from "lit/decorators.js";
3
+ import { r as n } from "../chunks/projection-SnR79EHI.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-BxmMM3B7.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-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";
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-BxmMM3B7.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-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 };
@@ -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,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-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);