@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,28 +1,32 @@
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/scale-_ccSuoYg.js";
4
- import { a as r, i, n as a, r as o } from "../chunks/shape-C_LW7EjG.js";
5
- import { html as s, nothing as c, svg as l } from "lit";
6
- import { property as u, state as d } from "lit/decorators.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
+ import { n as r } from "../chunks/scale-_ccSuoYg.js";
5
+ import { a as i, c as a, n as o, o as s, t as c } from "../chunks/data-BpiiNapL.js";
6
+ import { a as l, i as u, n as d, r as f } from "../chunks/shape-C_LW7EjG.js";
7
+ import { html as p, nothing as m, svg as h } from "lit";
8
+ import { property as g, state as _ } from "lit/decorators.js";
9
+ import { guard as v } from "lit/directives/guard.js";
7
10
  //#region src/components/line-chart.ts
8
- function f(e) {
11
+ n();
12
+ function y(e) {
9
13
  return 1 - (1 - e) ** 3;
10
14
  }
11
- function p(e) {
15
+ function b(e) {
12
16
  return e === 0 ? "0" : Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Number.isInteger(e) ? String(e) : e.toFixed(1);
13
17
  }
14
- function m(e) {
18
+ function x(e) {
15
19
  return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
16
20
  }
17
- function h(e) {
21
+ function S(e) {
18
22
  if (e <= 0) return 1;
19
23
  let t = 10 ** Math.floor(Math.log10(e)), n = e / t;
20
24
  return (n <= 1 ? 1 : n <= 2 ? 2 : n <= 5 ? 5 : 10) * t;
21
25
  }
22
- var g = class extends e {
26
+ var C = class extends e {
23
27
  constructor(...e) {
24
- super(...e), this.height = 220, this.showValue = !1, this.variant = "outline", this.interpolation = "linear", this.ariaLabel = "", this._data = { series: [] }, this._phase = "pre", this._display = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._reveal = 0, this._revealFrom = 0, this._hoverIndex = null, this._tick = (e) => {
25
- let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = f(n);
28
+ super(...e), this.height = 220, this.showValue = !1, this.variant = "outline", this.interpolation = "linear", this.ariaLabel = "", this.showTable = !1, this._data = { series: [] }, this._source = { text: null }, this._entered = !1, this._phase = "pre", this._display = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._reveal = 0, this._revealFrom = 0, this._hoverIndex = null, this._tick = (e) => {
29
+ let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = y(n);
26
30
  this._reveal = this._revealFrom + (1 - this._revealFrom) * r;
27
31
  for (let [e, t] of this._targets) {
28
32
  let n = this._animFrom.get(e) ?? 0;
@@ -51,8 +55,16 @@ var g = class extends e {
51
55
  return this._data;
52
56
  }
53
57
  set data(e) {
54
- let t = new Map(this._display);
55
- this._data = e, this._refreshTargets(), this.requestUpdate(), this.updateComplete.then(() => this._startAnimation(t, !1));
58
+ let t = s(e, this._source, {
59
+ attr: "data",
60
+ shape: "{\"series\":[{\"name\":\"Visitors\",\"values\":[3,5,4]}],\"labels\":[\"Mon\",\"Tue\",\"Wed\"]}",
61
+ empty: () => ({ series: [] }),
62
+ normalize: i,
63
+ warn: (e, t) => this.reportDev("invalid-data", e, t)
64
+ });
65
+ if (!t) return;
66
+ let n = new Map(this._display);
67
+ this._data = t.value, this._refreshTargets(), this.requestUpdate(), this._entered && this.updateComplete.then(() => this._startAnimation(n, !1));
56
68
  }
57
69
  _key(e, t) {
58
70
  return `${e}-${t}`;
@@ -63,8 +75,8 @@ var g = class extends e {
63
75
  });
64
76
  }
65
77
  connectedCallback() {
66
- super.connectedCallback(), this.setHostAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
67
- this._startAnimation(/* @__PURE__ */ new Map(), !0);
78
+ super.connectedCallback(), this.setHostAttribute("role", "figure"), this._refreshTargets(), requestAnimationFrame(() => {
79
+ this._entered = !0, this._startAnimation(/* @__PURE__ */ new Map(), !0);
68
80
  }), this.addEventListener("mousemove", this._onMouseMove), this.addEventListener("mouseleave", this._onMouseLeave);
69
81
  }
70
82
  disconnectedCallback() {
@@ -81,12 +93,12 @@ var g = class extends e {
81
93
  }
82
94
  render() {
83
95
  let { series: e, labels: t = [] } = this._data;
84
- if (e.length === 0) return s`<svg viewBox="0 0 600 ${this.height}" role="img" aria-label=${this.ariaLabel || "Line chart"}></svg>`;
85
- let u = this.height - 16 - 32, d = Math.max(...e.map((e) => e.values.length)), f = e.flatMap((e) => e.values).filter(Number.isFinite), g = h(Math.max(...f, 0) * 1.1) || 1, _ = new n([0, Math.max(0, d - 1)], [40, 584]), v = new n([0, g], [16 + u, 16]), y = v.ticks(5), b = 16 + u, x = getComputedStyle(this), S = (parseFloat(x.getPropertyValue("--void-radius-sm")) || 0) > 0 && this.interpolation === "linear", C = S ? r : o, w = S ? i : a, T = e.map((e, t) => {
96
+ if (e.length === 0) return p`<svg viewBox="0 0 600 ${this.height}" aria-hidden="true"></svg>`;
97
+ let n = this.height - 16 - 32, i = Math.max(...e.map((e) => e.values.length)), a = e.flatMap((e) => e.values).filter(Number.isFinite), o = S(Math.max(...a, 0) * 1.1) || 1, s = new r([0, Math.max(0, i - 1)], [40, 584]), c = new r([0, o], [16 + n, 16]), g = c.ticks(5), _ = 16 + n, v = getComputedStyle(this), y = (parseFloat(v.getPropertyValue("--void-radius-sm")) || 0) > 0 && this.interpolation === "linear", C = y ? l : f, w = y ? u : d, T = e.map((e, t) => {
86
98
  let n = [];
87
99
  for (let r = 0; r < e.values.length; r++) {
88
100
  let e = this._display.get(this._key(t, r)) ?? 0;
89
- n.push([_.scale(r), v.scale(e)]);
101
+ n.push([s.scale(r), c.scale(e)]);
90
102
  }
91
103
  if (this.interpolation === "step") {
92
104
  let e = [];
@@ -95,55 +107,63 @@ var g = class extends e {
95
107
  }
96
108
  return n;
97
109
  });
98
- return s`
110
+ return p`
99
111
  <svg
100
112
  viewBox="0 0 ${600} ${this.height}"
101
113
  preserveAspectRatio="none"
102
- role="img"
103
- aria-label=${this.ariaLabel || "Line chart"}
114
+ aria-hidden="true"
104
115
  data-phase=${this._phase}
105
116
  style="--reveal: ${this._reveal}"
106
117
  >
107
118
  <g class="void-line-chart-grid">
108
- ${y.map((e) => {
109
- let t = v.scale(e);
110
- return l`<line x1=${40} x2=${584} y1=${t} y2=${t}></line>`;
119
+ ${g.map((e) => {
120
+ let t = c.scale(e);
121
+ return h`<line x1=${40} x2=${584} y1=${t} y2=${t}></line>`;
111
122
  })}
112
123
  </g>
113
124
 
114
125
  <g class="void-line-chart-y-axis">
115
- ${y.map((e) => l`<text x=${32} y=${v.scale(e)} dy="0.32em" text-anchor="end">${p(e)}</text>`)}
126
+ ${g.map((e) => h`<text x=${32} y=${c.scale(e)} dy="0.32em" text-anchor="end">${b(e)}</text>`)}
116
127
  </g>
117
128
 
118
129
  ${e.map((e, t) => {
119
130
  let n = e.color ?? `var(--void-chart-series-${t % 6 + 1})`, r = T[t];
120
- return l`
131
+ return h`
121
132
  <g class="void-line-chart-series" style="--series-color: ${n}">
122
- <path class="void-line-chart-area" d=${w(r, b)}></path>
133
+ <path class="void-line-chart-area" d=${w(r, _)}></path>
123
134
  <path class="void-line-chart-line" d=${C(r)}></path>
124
135
  </g>
125
136
  `;
126
137
  })}
127
138
 
128
- ${this.showValue ? e.map((e, t) => l`
139
+ ${this.showValue ? e.map((e, t) => h`
129
140
  <g class="void-line-chart-values">
130
141
  ${e.values.map((e, n) => {
131
142
  let r = this._display.get(this._key(t, n)) ?? 0;
132
- return l`<text x=${_.scale(n)} y=${v.scale(r) - 8} text-anchor="middle">${m(r)}</text>`;
143
+ return h`<text x=${s.scale(n)} y=${c.scale(r) - 8} text-anchor="middle">${x(r)}</text>`;
133
144
  })}
134
145
  </g>
135
- `) : c}
146
+ `) : m}
136
147
 
137
148
  <g class="void-line-chart-x-axis">
138
- ${t.slice(0, d).map((e, t) => l`<text x=${_.scale(t)} y=${16 + u + 18} text-anchor="middle">${e}</text>`)}
149
+ ${t.slice(0, i).map((e, t) => h`<text x=${s.scale(t)} y=${16 + n + 18} text-anchor="middle">${e}</text>`)}
139
150
  </g>
140
151
 
141
- ${this._hoverIndex !== null && this._hoverIndex < d ? this._renderHover(e, t, _, v, this._hoverIndex, 16, u, 40, 544) : c}
152
+ ${this._hoverIndex !== null && this._hoverIndex < i ? this._renderHover(e, t, s, c, this._hoverIndex, 16, n, 40, 544) : m}
142
153
  </svg>
154
+ ${this._table()}
143
155
  `;
144
156
  }
157
+ _table() {
158
+ let e = this._data, t = this.ariaLabel || "Line chart";
159
+ return v([
160
+ e,
161
+ t,
162
+ c(this)
163
+ ], () => o("void-line-chart-table", a(this, t, e.series, e.labels ?? [])));
164
+ }
145
165
  _renderHover(e, t, n, r, i, a, o, s, c) {
146
- let u = n.scale(i), d = e.map((e, t) => {
166
+ let l = n.scale(i), u = e.map((e, t) => {
147
167
  let n = this._display.get(this._key(t, i)) ?? 0, a = e.color ?? `var(--void-chart-series-${t % 6 + 1})`;
148
168
  return {
149
169
  name: e.name,
@@ -151,64 +171,68 @@ var g = class extends e {
151
171
  color: a,
152
172
  y: r.scale(n)
153
173
  };
154
- }), f = 16 + d.length * 14 + 16, p = u + 12 + 140 > s + c ? u - 12 - 140 : u + 12, h = Math.max(a, Math.min(a + o - f, a + 8)), g = t[i] ?? String(i);
155
- return l`
174
+ }), d = 16 + u.length * 14 + 16, f = l + 12 + 140 > s + c ? l - 12 - 140 : l + 12, p = Math.max(a, Math.min(a + o - d, a + 8)), m = t[i] ?? String(i);
175
+ return h`
156
176
  <g class="void-line-chart-hover">
157
177
  <line
158
178
  class="void-line-chart-hairline"
159
- x1=${u} x2=${u}
179
+ x1=${l} x2=${l}
160
180
  y1=${a} y2=${a + o}
161
181
  ></line>
162
- ${d.map((e) => l`
182
+ ${u.map((e) => h`
163
183
  <rect
164
184
  class="void-line-chart-marker"
165
- x=${u - 5} y=${e.y - 5}
185
+ x=${l - 5} y=${e.y - 5}
166
186
  width="10" height="10"
167
187
  style="--marker-color: ${e.color}"
168
188
  ></rect>
169
189
  `)}
170
190
  <rect
171
191
  class="void-line-chart-tooltip-bg"
172
- x=${p} y=${h}
173
- width=${140} height=${f}
192
+ x=${f} y=${p}
193
+ width=${140} height=${d}
174
194
  rx="6" ry="6"
175
195
  ></rect>
176
196
  <text
177
197
  class="void-line-chart-tooltip-label"
178
- x=${p + 8}
179
- y=${h + 8 + 10}
180
- >${g}</text>
181
- ${d.map((e, t) => l`
198
+ x=${f + 8}
199
+ y=${p + 8 + 10}
200
+ >${m}</text>
201
+ ${u.map((e, t) => h`
182
202
  <circle
183
203
  class="void-line-chart-tooltip-swatch"
184
- cx=${p + 8 + 5}
185
- cy=${h + 16 + 8 + t * 14 + 4}
204
+ cx=${f + 8 + 5}
205
+ cy=${p + 16 + 8 + t * 14 + 4}
186
206
  r="4"
187
207
  style="--swatch-color: ${e.color}"
188
208
  ></circle>
189
209
  <text
190
210
  class="void-line-chart-tooltip-name"
191
- x=${p + 8 + 14}
192
- y=${h + 16 + 8 + t * 14 + 8}
211
+ x=${f + 8 + 14}
212
+ y=${p + 16 + 8 + t * 14 + 8}
193
213
  >${e.name}</text>
194
214
  <text
195
215
  class="void-line-chart-tooltip-value"
196
- x=${p + 140 - 8}
197
- y=${h + 16 + 8 + t * 14 + 8}
216
+ x=${f + 140 - 8}
217
+ y=${p + 16 + 8 + t * 14 + 8}
198
218
  text-anchor="end"
199
- >${m(e.value)}</text>
219
+ >${x(e.value)}</text>
200
220
  `)}
201
221
  </g>
202
222
  `;
203
223
  }
204
224
  };
205
- t([u({
225
+ t([g({
206
226
  type: Number,
207
227
  reflect: !0
208
- })], g.prototype, "height", void 0), t([u({
228
+ })], C.prototype, "height", void 0), t([g({
209
229
  type: Boolean,
210
230
  attribute: "show-value",
211
231
  reflect: !0
212
- })], g.prototype, "showValue", void 0), t([u({ reflect: !0 })], g.prototype, "variant", void 0), t([u({ reflect: !0 })], g.prototype, "interpolation", void 0), t([u({ attribute: "aria-label" })], g.prototype, "ariaLabel", void 0), t([d()], g.prototype, "_phase", void 0), t([d()], g.prototype, "_hoverIndex", void 0), customElements.get("void-line-chart") || customElements.define("void-line-chart", g);
232
+ })], C.prototype, "showValue", void 0), t([g({ reflect: !0 })], C.prototype, "variant", void 0), t([g({ reflect: !0 })], C.prototype, "interpolation", void 0), t([g({ attribute: "aria-label" })], C.prototype, "ariaLabel", void 0), t([g({
233
+ type: Boolean,
234
+ attribute: "show-table",
235
+ reflect: !0
236
+ })], C.prototype, "showTable", void 0), t([g({ attribute: "data" })], C.prototype, "data", null), t([_()], C.prototype, "_phase", void 0), t([_()], C.prototype, "_hoverIndex", void 0), customElements.get("void-line-chart") || customElements.define("void-line-chart", C);
213
237
  //#endregion
214
- export { g as VoidLineChart };
238
+ export { C as VoidLineChart };
@@ -1,4 +1,4 @@
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 { property as n } from "lit/decorators.js";
4
4
  //#region src/components/list.ts
@@ -1,8 +1,8 @@
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
- import { n as r } from "../chunks/parts-CMQQop0D.js";
5
- import { i, r as a, t as o } from "../chunks/keyboard-MQpfTX5I.js";
4
+ import { n as r } from "../chunks/parts-DI_3VpSy.js";
5
+ import { a as i, i as a, t as o } from "../chunks/keyboard-CEhMSkws.js";
6
6
  import { property as s } from "lit/decorators.js";
7
7
  //#region src/components/menu.ts
8
8
  var c = class extends e {
@@ -1,14 +1,15 @@
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/form-control-C0vH6gii.js";
4
- import { n as i } from "../chunks/parts-CMQQop0D.js";
5
- import { i as a, n as o, r as s, t as c } from "../chunks/keyboard-MQpfTX5I.js";
6
- import { t as l } from "../chunks/overlay-BywGMcDW.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 { t as r } from "../chunks/projection-oPe6ipjL.js";
5
+ import { n as i } from "../chunks/parts-DI_3VpSy.js";
6
+ import { a, i as o, n as s, t as c } from "../chunks/keyboard-CEhMSkws.js";
7
+ import { t as l } from "../chunks/overlay-CH7L4N-h.js";
7
8
  import { n as u } from "../chunks/value-list-CH6GjYXM.js";
8
9
  import { html as d, nothing as f } from "lit";
9
10
  import { property as p } from "lit/decorators.js";
10
11
  //#region src/components/multiselect.ts
11
- var m = class extends t {
12
+ var m = class extends e {
12
13
  constructor(...e) {
13
14
  super(...e), this.value = "", this.selected = !1, this.disabled = !1, this.label = "";
14
15
  }
@@ -21,23 +22,23 @@ var m = class extends t {
21
22
  ].some((t) => e.has(t) && e.get(t) !== void 0) && (this.closest("void-multiselect") ?? this.closest("void-combobox"))?.requestUpdate();
22
23
  }
23
24
  };
24
- n([p({
25
+ t([p({
25
26
  type: String,
26
27
  reflect: !0
27
- })], m.prototype, "value", void 0), n([p({
28
+ })], m.prototype, "value", void 0), t([p({
28
29
  type: Boolean,
29
30
  reflect: !0
30
- })], m.prototype, "selected", void 0), n([p({
31
+ })], m.prototype, "selected", void 0), t([p({
31
32
  type: Boolean,
32
33
  reflect: !0
33
- })], m.prototype, "disabled", void 0), n([p({ type: String })], m.prototype, "label", void 0), customElements.get("void-option") || customElements.define("void-option", m);
34
+ })], m.prototype, "disabled", void 0), t([p({ type: String })], m.prototype, "label", void 0), customElements.get("void-option") || customElements.define("void-option", m);
34
35
  var h = (e) => e instanceof m ? e.value : e.getAttribute("value") ?? "", g = (e) => e instanceof m ? e.selected : e.hasAttribute("selected");
35
36
  function _(e) {
36
37
  return e.getAttribute("label") || e.textContent?.trim() || e.getAttribute("value") || "";
37
38
  }
38
- var v = class extends r(t) {
39
- constructor(...t) {
40
- super(...t), this.placeholder = "Select...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._active = null, this._typeahead = new c(), this._wiring = !1, this._projection = new e(this, { placement: "start" }), this._parts = new i(this, {
39
+ var v = class extends n(e) {
40
+ constructor(...e) {
41
+ super(...e), this.placeholder = "Select...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._active = null, this._typeahead = new c(), this._wiring = !1, this._projection = new r(this, { placement: "start" }), this._parts = new i(this, {
41
42
  tags: ["void-multiselect-content", "void-option"],
42
43
  onChange: () => {
43
44
  this._wire(), this._wiring || this.requestUpdate();
@@ -75,7 +76,7 @@ var v = class extends r(t) {
75
76
  if (this.formDisabled || e.target !== e.currentTarget || e.isComposing) return;
76
77
  let t = this._options.map((e) => e.disabled), n = e.key;
77
78
  if (!this.open) {
78
- n === "Home" || n === "End" ? (e.preventDefault(), this._openList(n === "Home" ? "first" : "last")) : n === "ArrowUp" ? (e.preventDefault(), this._openList("first")) : n === "Enter" || n === " " || n === "ArrowDown" ? (e.preventDefault(), this._openList("selected")) : s(e) && (e.preventDefault(), this._openList("selected"), this._typeaheadTo(e.key));
79
+ n === "Home" || n === "End" ? (e.preventDefault(), this._openList(n === "Home" ? "first" : "last")) : n === "ArrowUp" ? (e.preventDefault(), this._openList("first")) : n === "Enter" || n === " " || n === "ArrowDown" ? (e.preventDefault(), this._openList("selected")) : o(e) && (e.preventDefault(), this._openList("selected"), this._typeaheadTo(e.key));
79
80
  return;
80
81
  }
81
82
  switch (n) {
@@ -92,10 +93,10 @@ var v = class extends r(t) {
92
93
  e.preventDefault(), this._moveActive(this._stepBy(-10));
93
94
  break;
94
95
  case "Home":
95
- e.preventDefault(), this._moveActive(o(t, 1));
96
+ e.preventDefault(), this._moveActive(s(t, 1));
96
97
  break;
97
98
  case "End":
98
- e.preventDefault(), this._moveActive(o(t, -1));
99
+ e.preventDefault(), this._moveActive(s(t, -1));
99
100
  break;
100
101
  case "Enter":
101
102
  case " ":
@@ -107,7 +108,7 @@ var v = class extends r(t) {
107
108
  case "Tab":
108
109
  this._close("blur");
109
110
  break;
110
- default: s(e) && (e.preventDefault(), this._typeaheadTo(e.key));
111
+ default: o(e) && (e.preventDefault(), this._typeaheadTo(e.key));
111
112
  }
112
113
  }, this._onFocusOut = (e) => {
113
114
  this.open && !this.contains(e.relatedTarget) && this._close("blur");
@@ -212,7 +213,7 @@ var v = class extends r(t) {
212
213
  _openList(e, t = "keyboard") {
213
214
  if (this._overlay.requestOpen(t), !this.open) return;
214
215
  let n = this._options, r = n.map((e) => e.disabled), i = -1;
215
- e === "first" ? i = o(r, 1) : e === "last" ? i = o(r, -1) : e === "selected" && (i = n.findIndex((e) => e.selected && !e.disabled), i < 0 && (i = o(r, 1))), this._active = i >= 0 ? n[i] : null, this.requestUpdate();
216
+ e === "first" ? i = s(r, 1) : e === "last" ? i = s(r, -1) : e === "selected" && (i = n.findIndex((e) => e.selected && !e.disabled), i < 0 && (i = s(r, 1))), this._active = i >= 0 ? n[i] : null, this.requestUpdate();
216
217
  }
217
218
  _close(e = "api") {
218
219
  this.open && this._overlay.requestClose(e);
@@ -221,13 +222,13 @@ var v = class extends r(t) {
221
222
  e < 0 || (this._active = this._options[e], this.requestUpdate());
222
223
  }
223
224
  _stepBy(e) {
224
- let t = this._options, n = t.map((e) => e.disabled), r = this._active ? t.indexOf(this._active) : -1, i = e > 0 ? 1 : -1, s = r;
225
- for (let t = r, o = Math.abs(e); o > 0;) {
225
+ let t = this._options, n = t.map((e) => e.disabled), r = this._active ? t.indexOf(this._active) : -1, i = e > 0 ? 1 : -1, o = r;
226
+ for (let t = r, s = Math.abs(e); s > 0;) {
226
227
  let e = a(n, t, i, !1);
227
228
  if (e < 0) break;
228
- s = t = e, o--;
229
+ o = t = e, s--;
229
230
  }
230
- return s >= 0 ? s : o(n, i);
231
+ return o >= 0 ? o : s(n, i);
231
232
  }
232
233
  _typeaheadTo(e) {
233
234
  let t = this._options, n = this._active ? t.indexOf(this._active) : -1, r = this._typeahead.match(e, t.map((e) => _(e)), t.map((e) => e.disabled), n);
@@ -241,22 +242,22 @@ var v = class extends r(t) {
241
242
  }));
242
243
  }
243
244
  };
244
- n([p({ type: String })], v.prototype, "placeholder", void 0), n([p({
245
+ t([p({ type: String })], v.prototype, "placeholder", void 0), t([p({
245
246
  type: Boolean,
246
247
  reflect: !0
247
- })], v.prototype, "disabled", void 0), n([p({
248
+ })], v.prototype, "disabled", void 0), t([p({
248
249
  type: String,
249
250
  reflect: !0
250
- })], v.prototype, "size", void 0), n([p({
251
+ })], v.prototype, "size", void 0), t([p({
251
252
  type: String,
252
253
  reflect: !0
253
- })], v.prototype, "error", void 0), n([p({
254
+ })], v.prototype, "error", void 0), t([p({
254
255
  type: String,
255
256
  reflect: !0
256
- })], v.prototype, "name", void 0), n([p({
257
+ })], v.prototype, "name", void 0), t([p({
257
258
  type: Boolean,
258
259
  reflect: !0
259
- })], v.prototype, "open", void 0), n([p({
260
+ })], v.prototype, "open", void 0), t([p({
260
261
  converter: u,
261
262
  reflect: !0
262
263
  })], v.prototype, "value", null), customElements.get("void-multiselect") || customElements.define("void-multiselect", v);
@@ -6,6 +6,11 @@ import { VoidElement } from '../base.js';
6
6
  * nothing rendered. Use the patterns beside it for the usual contents: `<void-brand>` for the name or logo,
7
7
  * `<void-nav-links>` for the links (mark the current page with `aria-current="page"`) and `<void-spacer>` to
8
8
  * push what follows to the far end.
9
+ *
10
+ * The bar is a `navigation` landmark. Where the page already has one around it (the bar sits inside a `<nav>`
11
+ * or an element with a navigation or other role of its own) or inside it (the links are already in a `<nav>`),
12
+ * it adds nothing, so landmarks never nest; a role you write on it is kept. When a page has more than one
13
+ * navigation landmark, give each an `aria-label` (`<void-nav-bar aria-label="Primary">`); with one, a name is optional.
9
14
  */
10
15
  export declare class VoidNavBar extends VoidElement {
11
16
  /** Stay at the top of the viewport while the page scrolls. */
@@ -15,6 +20,10 @@ export declare class VoidNavBar extends VoidElement {
15
20
  /** `default` sits on the page; `elevated` uses the raised surface colour. */
16
21
  variant: 'default' | 'elevated';
17
22
  connectedCallback(): void;
23
+ protected firstUpdated(changed: Map<string, unknown>): void;
24
+ /** `navigation`, unless the author wrote a role or a navigation landmark already encloses or fills the bar. */
25
+ private _syncRole;
26
+ private _writtenRole;
18
27
  }
19
28
  declare global {
20
29
  interface HTMLElementTagNameMap {
@@ -1,13 +1,26 @@
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 { property as n } from "lit/decorators.js";
4
4
  //#region src/components/nav-bar.ts
5
5
  var r = class extends e {
6
6
  constructor(...e) {
7
- super(...e), this.sticky = !1, this.hideBorder = !1, this.variant = "default";
7
+ super(...e), this.sticky = !1, this.hideBorder = !1, this.variant = "default", this._writtenRole = null;
8
8
  }
9
9
  connectedCallback() {
10
- super.connectedCallback(), this.setHostAttribute("role", "navigation");
10
+ super.connectedCallback(), this._syncRole();
11
+ }
12
+ firstUpdated(e) {
13
+ super.firstUpdated(e), this._syncRole();
14
+ }
15
+ _syncRole() {
16
+ let e = this.getAttribute("role"), t = !!this.parentElement?.closest("nav, [role]") || !!this.querySelector("nav, [role=\"navigation\"]");
17
+ if (!(e !== null && e !== this._writtenRole)) {
18
+ if (t) {
19
+ e !== null && (this.removeAttribute("role"), this._writtenRole = null);
20
+ return;
21
+ }
22
+ this._writtenRole = "navigation", this.setHostAttribute("role", "navigation");
23
+ }
11
24
  }
12
25
  };
13
26
  t([n({
@@ -1,23 +1,24 @@
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 { property as i } from "lit/decorators.js";
3
+ import { i as n, n as r } from "../chunks/parts-DI_3VpSy.js";
4
+ import { r as i } from "../chunks/keyboard-CEhMSkws.js";
5
+ import { property as a } from "lit/decorators.js";
5
6
  //#region src/components/nav-menu.ts
6
- var a = class extends e {
7
+ var o = class extends e {
7
8
  constructor(...e) {
8
9
  super(...e), this.orientation = "horizontal", this.width = "", this._handleItemOpen = (e) => {
9
10
  let t = e.target;
10
- if (!(t instanceof o)) return;
11
+ if (!(t instanceof s)) return;
11
12
  let n = e.detail?.reason === "hover" ? "hover" : "outside";
12
13
  for (let e of this._getItems()) e !== t && e.open && e._closeDropdown(n);
13
14
  }, this._handleKeydown = (e) => {
14
15
  let t = this._getItems();
15
16
  if (!t.length) return;
16
- let n = this.orientation === "horizontal", r = n ? "ArrowRight" : "ArrowDown", i = n ? "ArrowLeft" : "ArrowUp";
17
- if (e.key === r || e.key === i) {
18
- let n = t.map((e) => e._control()).filter((e) => !!e), i = n.indexOf(document.activeElement);
19
- if (i < 0) return;
20
- e.preventDefault(), e.key === r ? (n[i + 1] ?? n[0])?.focus() : (n[i - 1] ?? n[n.length - 1])?.focus();
17
+ let n = this.orientation === "horizontal", r = i(this), a = n ? r.next : "ArrowDown", o = n ? r.prev : "ArrowUp";
18
+ if (e.key === a || e.key === o) {
19
+ let n = t.map((e) => e._control()).filter((e) => !!e), r = n.indexOf(document.activeElement);
20
+ if (r < 0) return;
21
+ e.preventDefault(), e.key === a ? (n[r + 1] ?? n[0])?.focus() : (n[r - 1] ?? n[n.length - 1])?.focus();
21
22
  return;
22
23
  }
23
24
  if (e.key === "Escape") for (let e of t) e.open && (e._closeDropdown("escape"), e._control()?.focus());
@@ -36,14 +37,14 @@ var a = class extends e {
36
37
  return Array.from(this.querySelectorAll("void-nav-menu-item")).filter((e) => e.closest("void-nav-menu") === this);
37
38
  }
38
39
  };
39
- t([i({
40
+ t([a({
40
41
  type: String,
41
42
  reflect: !0
42
- })], a.prototype, "orientation", void 0), t([i({
43
+ })], o.prototype, "orientation", void 0), t([a({
43
44
  type: String,
44
45
  reflect: !0
45
- })], a.prototype, "width", void 0), customElements.get("void-nav-menu") || customElements.define("void-nav-menu", a);
46
- var o = class extends e {
46
+ })], o.prototype, "width", void 0), customElements.get("void-nav-menu") || customElements.define("void-nav-menu", o);
47
+ var s = class extends e {
47
48
  constructor(...e) {
48
49
  super(...e), this.open = !1, this.disabled = !1, this.current = !1, this._openedByHover = !1, this._parts = new r(this, {
49
50
  tags: ["void-nav-menu-trigger", "void-nav-menu-content"],
@@ -106,15 +107,15 @@ var o = class extends e {
106
107
  })));
107
108
  }
108
109
  };
109
- t([i({
110
+ t([a({
110
111
  type: Boolean,
111
112
  reflect: !0
112
- })], o.prototype, "open", void 0), t([i({
113
+ })], s.prototype, "open", void 0), t([a({
113
114
  type: Boolean,
114
115
  reflect: !0
115
- })], o.prototype, "disabled", void 0), t([i({
116
+ })], s.prototype, "disabled", void 0), t([a({
116
117
  type: Boolean,
117
118
  reflect: !0
118
- })], o.prototype, "current", void 0), customElements.get("void-nav-menu-item") || customElements.define("void-nav-menu-item", o);
119
+ })], s.prototype, "current", void 0), customElements.get("void-nav-menu-item") || customElements.define("void-nav-menu-item", s);
119
120
  //#endregion
120
- export { a as VoidNavMenu, o as VoidNavMenuItem };
121
+ export { o as VoidNavMenu, s as VoidNavMenuItem };
@@ -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-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 { 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 };