@voidable/ui 0.6.0 → 0.8.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 (252) hide show
  1. package/README.md +168 -9
  2. package/dist/angular/index.d.ts +20 -0
  3. package/dist/angular/index.js +78 -0
  4. package/dist/autoloader-core.d.ts +45 -0
  5. package/dist/autoloader-table.generated.d.ts +5 -0
  6. package/dist/autoloader.d.ts +13 -0
  7. package/dist/autoloader.js +229 -0
  8. package/dist/base.d.ts +173 -2
  9. package/dist/base.js +2 -9
  10. package/dist/chunks/base-CMruMbxC.js +824 -0
  11. package/dist/chunks/{decorate-DKuCkHK4.js → decorate-CaYbmmmm.js} +1 -1
  12. package/dist/chunks/disclosure-Bj_49GcC.js +23 -0
  13. package/dist/chunks/dismiss-Drsy_dE5.js +37 -0
  14. package/dist/chunks/form-control-C0vH6gii.js +300 -0
  15. package/dist/chunks/keyboard-MQpfTX5I.js +46 -0
  16. package/dist/chunks/keyboard-activation-CV0m4hkn.js +29 -0
  17. package/dist/chunks/modal-D_YVy2vg.js +71 -0
  18. package/dist/chunks/overlay-BywGMcDW.js +467 -0
  19. package/dist/chunks/parts-D30c8OoG.js +229 -0
  20. package/dist/chunks/{shape-DmgCwYvY.js → shape-C_LW7EjG.js} +12 -4
  21. package/dist/components/accordion.d.ts +38 -10
  22. package/dist/components/accordion.js +52 -54
  23. package/dist/components/action-input.d.ts +64 -6
  24. package/dist/components/action-input.js +85 -42
  25. package/dist/components/alert.d.ts +24 -10
  26. package/dist/components/alert.js +27 -28
  27. package/dist/components/avatar.d.ts +8 -2
  28. package/dist/components/avatar.js +4 -4
  29. package/dist/components/badge.d.ts +8 -3
  30. package/dist/components/badge.js +3 -3
  31. package/dist/components/banner.d.ts +21 -10
  32. package/dist/components/banner.js +28 -28
  33. package/dist/components/bar-chart.d.ts +30 -6
  34. package/dist/components/bar-chart.js +29 -39
  35. package/dist/components/breadcrumbs.d.ts +19 -6
  36. package/dist/components/breadcrumbs.js +17 -23
  37. package/dist/components/button.d.ts +64 -10
  38. package/dist/components/button.js +71 -27
  39. package/dist/components/calendar.d.ts +65 -10
  40. package/dist/components/calendar.js +158 -107
  41. package/dist/components/card.d.ts +14 -9
  42. package/dist/components/card.js +9 -23
  43. package/dist/components/carousel.d.ts +65 -14
  44. package/dist/components/carousel.js +85 -94
  45. package/dist/components/charts/scale.d.ts +0 -1
  46. package/dist/components/charts/shape.d.ts +0 -1
  47. package/dist/components/checkbox-group.d.ts +38 -5
  48. package/dist/components/checkbox-group.js +61 -20
  49. package/dist/components/checkbox.d.ts +53 -7
  50. package/dist/components/checkbox.js +66 -29
  51. package/dist/components/collapsible.d.ts +29 -9
  52. package/dist/components/collapsible.js +43 -45
  53. package/dist/components/color-picker.d.ts +20 -4
  54. package/dist/components/color-picker.js +36 -30
  55. package/dist/components/combobox.d.ts +84 -10
  56. package/dist/components/combobox.js +142 -45
  57. package/dist/components/compose-input.d.ts +8 -1
  58. package/dist/components/compose-input.js +10 -4
  59. package/dist/components/dialog.d.ts +24 -20
  60. package/dist/components/dialog.js +8 -57
  61. package/dist/components/divider.d.ts +8 -1
  62. package/dist/components/divider.js +4 -4
  63. package/dist/components/donut-chart.d.ts +28 -5
  64. package/dist/components/donut-chart.js +55 -54
  65. package/dist/components/drawer.d.ts +19 -18
  66. package/dist/components/drawer.js +9 -53
  67. package/dist/components/dropdown-menu.d.ts +62 -7
  68. package/dist/components/dropdown-menu.js +125 -34
  69. package/dist/components/editable.d.ts +37 -3
  70. package/dist/components/editable.js +45 -24
  71. package/dist/components/error-fallback.d.ts +36 -5
  72. package/dist/components/error-fallback.js +74 -24
  73. package/dist/components/field.d.ts +38 -4
  74. package/dist/components/field.js +63 -21
  75. package/dist/components/file-upload.d.ts +23 -2
  76. package/dist/components/file-upload.js +48 -25
  77. package/dist/components/gauge.d.ts +48 -9
  78. package/dist/components/gauge.js +57 -55
  79. package/dist/components/hamburger.d.ts +19 -4
  80. package/dist/components/hamburger.js +29 -20
  81. package/dist/components/hover-card.d.ts +40 -14
  82. package/dist/components/hover-card.js +77 -60
  83. package/dist/components/indicator.d.ts +18 -7
  84. package/dist/components/indicator.js +17 -19
  85. package/dist/components/input.d.ts +70 -5
  86. package/dist/components/input.js +84 -21
  87. package/dist/components/line-chart.d.ts +27 -5
  88. package/dist/components/line-chart.js +19 -21
  89. package/dist/components/list.d.ts +10 -1
  90. package/dist/components/list.js +4 -4
  91. package/dist/components/menu.d.ts +67 -21
  92. package/dist/components/menu.js +117 -116
  93. package/dist/components/multiselect.d.ts +108 -13
  94. package/dist/components/multiselect.js +207 -70
  95. package/dist/components/nav-bar.d.ts +12 -7
  96. package/dist/components/nav-bar.js +12 -22
  97. package/dist/components/nav-menu.d.ts +52 -12
  98. package/dist/components/nav-menu.js +69 -71
  99. package/dist/components/number-input.d.ts +76 -8
  100. package/dist/components/number-input.js +117 -51
  101. package/dist/components/pagination.d.ts +19 -1
  102. package/dist/components/pagination.js +69 -8
  103. package/dist/components/panel.d.ts +16 -8
  104. package/dist/components/panel.js +21 -21
  105. package/dist/components/pin-input.d.ts +41 -4
  106. package/dist/components/pin-input.js +45 -27
  107. package/dist/components/popover.d.ts +29 -11
  108. package/dist/components/popover.js +48 -36
  109. package/dist/components/progress.d.ts +7 -3
  110. package/dist/components/progress.js +4 -4
  111. package/dist/components/radio-group.d.ts +30 -5
  112. package/dist/components/radio-group.js +56 -19
  113. package/dist/components/radio.d.ts +47 -7
  114. package/dist/components/radio.js +68 -29
  115. package/dist/components/scroll-area.d.ts +8 -5
  116. package/dist/components/scroll-area.js +19 -20
  117. package/dist/components/segmented-control.d.ts +52 -8
  118. package/dist/components/segmented-control.js +67 -37
  119. package/dist/components/select.d.ts +59 -12
  120. package/dist/components/select.js +97 -47
  121. package/dist/components/sidebar.d.ts +22 -3
  122. package/dist/components/sidebar.js +21 -11
  123. package/dist/components/skeleton.d.ts +5 -2
  124. package/dist/components/skeleton.js +5 -5
  125. package/dist/components/slider.d.ts +27 -5
  126. package/dist/components/slider.js +30 -18
  127. package/dist/components/spinner.d.ts +6 -2
  128. package/dist/components/spinner.js +4 -4
  129. package/dist/components/stat.d.ts +21 -4
  130. package/dist/components/stat.js +8 -4
  131. package/dist/components/status-dot.d.ts +4 -1
  132. package/dist/components/status-dot.js +4 -4
  133. package/dist/components/stepper.d.ts +5 -1
  134. package/dist/components/stepper.js +3 -3
  135. package/dist/components/switch.d.ts +24 -5
  136. package/dist/components/switch.js +38 -20
  137. package/dist/components/table.d.ts +51 -2
  138. package/dist/components/table.js +158 -9
  139. package/dist/components/tabs.d.ts +49 -17
  140. package/dist/components/tabs.js +86 -55
  141. package/dist/components/tag.d.ts +17 -7
  142. package/dist/components/tag.js +19 -21
  143. package/dist/components/tags-input.d.ts +33 -4
  144. package/dist/components/tags-input.js +41 -31
  145. package/dist/components/textarea.d.ts +61 -5
  146. package/dist/components/textarea.js +59 -22
  147. package/dist/components/toast.d.ts +89 -15
  148. package/dist/components/toast.js +106 -31
  149. package/dist/components/toggle-group.d.ts +30 -3
  150. package/dist/components/toggle-group.js +44 -17
  151. package/dist/components/toggle.d.ts +25 -4
  152. package/dist/components/toggle.js +29 -19
  153. package/dist/components/tooltip.d.ts +31 -12
  154. package/dist/components/tooltip.js +63 -29
  155. package/dist/components.json +1518 -0
  156. package/dist/custom-elements.json +31817 -0
  157. package/dist/dev/index.d.ts +40 -0
  158. package/dist/dev/rules.d.ts +46 -0
  159. package/dist/dev/table.generated.d.ts +8 -0
  160. package/dist/dev/types.d.ts +113 -0
  161. package/dist/dev.js +3364 -0
  162. package/dist/disclosure.d.ts +30 -0
  163. package/dist/dismiss.d.ts +20 -0
  164. package/dist/form-control.d.ts +92 -0
  165. package/dist/index.d.ts +5 -4
  166. package/dist/index.js +24 -24
  167. package/dist/keyboard-activation.d.ts +31 -0
  168. package/dist/keyboard.d.ts +32 -0
  169. package/dist/modal.d.ts +44 -0
  170. package/dist/overlay.d.ts +249 -0
  171. package/dist/parts.d.ts +171 -0
  172. package/dist/projection.d.ts +370 -0
  173. package/dist/types/elements.d.ts +648 -0
  174. package/dist/types/react.d.ts +163 -0
  175. package/dist/types/solid.d.ts +164 -0
  176. package/dist/types/solid2.d.ts +161 -0
  177. package/dist/types/svelte.d.ts +154 -0
  178. package/dist/types/vue.d.ts +156 -0
  179. package/dist/vscode.html-custom-data.json +6004 -0
  180. package/dist/web-types.json +8365 -0
  181. package/package.json +113 -25
  182. package/dist/base.d.ts.map +0 -1
  183. package/dist/components/accordion.d.ts.map +0 -1
  184. package/dist/components/action-input.d.ts.map +0 -1
  185. package/dist/components/alert.d.ts.map +0 -1
  186. package/dist/components/avatar.d.ts.map +0 -1
  187. package/dist/components/badge.d.ts.map +0 -1
  188. package/dist/components/banner.d.ts.map +0 -1
  189. package/dist/components/bar-chart.d.ts.map +0 -1
  190. package/dist/components/breadcrumbs.d.ts.map +0 -1
  191. package/dist/components/button.d.ts.map +0 -1
  192. package/dist/components/calendar.d.ts.map +0 -1
  193. package/dist/components/card.d.ts.map +0 -1
  194. package/dist/components/carousel.d.ts.map +0 -1
  195. package/dist/components/charts/scale.d.ts.map +0 -1
  196. package/dist/components/charts/shape.d.ts.map +0 -1
  197. package/dist/components/checkbox-group.d.ts.map +0 -1
  198. package/dist/components/checkbox.d.ts.map +0 -1
  199. package/dist/components/collapsible.d.ts.map +0 -1
  200. package/dist/components/color-picker.d.ts.map +0 -1
  201. package/dist/components/combobox.d.ts.map +0 -1
  202. package/dist/components/compose-input.d.ts.map +0 -1
  203. package/dist/components/dialog.d.ts.map +0 -1
  204. package/dist/components/divider.d.ts.map +0 -1
  205. package/dist/components/donut-chart.d.ts.map +0 -1
  206. package/dist/components/drawer.d.ts.map +0 -1
  207. package/dist/components/dropdown-menu.d.ts.map +0 -1
  208. package/dist/components/editable.d.ts.map +0 -1
  209. package/dist/components/error-fallback.d.ts.map +0 -1
  210. package/dist/components/field.d.ts.map +0 -1
  211. package/dist/components/file-upload.d.ts.map +0 -1
  212. package/dist/components/gauge.d.ts.map +0 -1
  213. package/dist/components/hamburger.d.ts.map +0 -1
  214. package/dist/components/hover-card.d.ts.map +0 -1
  215. package/dist/components/indicator.d.ts.map +0 -1
  216. package/dist/components/input.d.ts.map +0 -1
  217. package/dist/components/line-chart.d.ts.map +0 -1
  218. package/dist/components/list.d.ts.map +0 -1
  219. package/dist/components/menu.d.ts.map +0 -1
  220. package/dist/components/multiselect.d.ts.map +0 -1
  221. package/dist/components/nav-bar.d.ts.map +0 -1
  222. package/dist/components/nav-menu.d.ts.map +0 -1
  223. package/dist/components/number-input.d.ts.map +0 -1
  224. package/dist/components/pagination.d.ts.map +0 -1
  225. package/dist/components/panel.d.ts.map +0 -1
  226. package/dist/components/pin-input.d.ts.map +0 -1
  227. package/dist/components/popover.d.ts.map +0 -1
  228. package/dist/components/progress.d.ts.map +0 -1
  229. package/dist/components/radio-group.d.ts.map +0 -1
  230. package/dist/components/radio.d.ts.map +0 -1
  231. package/dist/components/scroll-area.d.ts.map +0 -1
  232. package/dist/components/segmented-control.d.ts.map +0 -1
  233. package/dist/components/select.d.ts.map +0 -1
  234. package/dist/components/sidebar.d.ts.map +0 -1
  235. package/dist/components/skeleton.d.ts.map +0 -1
  236. package/dist/components/slider.d.ts.map +0 -1
  237. package/dist/components/spinner.d.ts.map +0 -1
  238. package/dist/components/stat.d.ts.map +0 -1
  239. package/dist/components/status-dot.d.ts.map +0 -1
  240. package/dist/components/stepper.d.ts.map +0 -1
  241. package/dist/components/switch.d.ts.map +0 -1
  242. package/dist/components/table.d.ts.map +0 -1
  243. package/dist/components/tabs.d.ts.map +0 -1
  244. package/dist/components/tag.d.ts.map +0 -1
  245. package/dist/components/tags-input.d.ts.map +0 -1
  246. package/dist/components/textarea.d.ts.map +0 -1
  247. package/dist/components/toast.d.ts.map +0 -1
  248. package/dist/components/toggle-group.d.ts.map +0 -1
  249. package/dist/components/toggle.d.ts.map +0 -1
  250. package/dist/components/tooltip.d.ts.map +0 -1
  251. package/dist/index.d.ts.map +0 -1
  252. /package/dist/chunks/{scale-BFZNL3Ss.js → scale-_ccSuoYg.js} +0 -0
@@ -1,20 +1,21 @@
1
- import { VoidElement as e } from "../base.js";
2
- import { t } from "../chunks/decorate-DKuCkHK4.js";
3
- import { html as n, nothing as r } from "lit";
4
- import { property as i } from "lit/decorators.js";
1
+ import { t as e } from "../chunks/base-CMruMbxC.js";
2
+ import { t } from "../chunks/decorate-CaYbmmmm.js";
3
+ import { t as n } from "../chunks/form-control-C0vH6gii.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/file-upload.ts
6
- var a = class extends e {
7
+ var o = class extends n(e) {
7
8
  constructor(...e) {
8
9
  super(...e), this.accept = "", this.multiple = !1, this.disabled = !1, this.maxSize = 0, this.error = "", this._files = [], this._onDropzoneClick = () => {
9
- this.disabled || this._input?.click();
10
+ this.formDisabled || this._input?.click();
10
11
  }, this._onDropzoneKeydown = (e) => {
11
- this.disabled || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._input?.click());
12
+ this.formDisabled || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._input?.click());
12
13
  }, this._onDragOver = (e) => {
13
- this.disabled || (e.preventDefault(), this.setAttribute("dragging", ""));
14
+ this.disabled || (e.preventDefault(), this.setHostAttribute("dragging", ""));
14
15
  }, this._onDragLeave = () => {
15
- this.removeAttribute("dragging");
16
+ this.setHostAttribute("dragging", null);
16
17
  }, this._onDrop = (e) => {
17
- if (e.preventDefault(), this.removeAttribute("dragging"), this.disabled) return;
18
+ if (e.preventDefault(), this.setHostAttribute("dragging", null), this.formDisabled) return;
18
19
  let t = Array.from(e.dataTransfer?.files ?? []);
19
20
  this._addFiles(t);
20
21
  }, this._onInputChange = (e) => {
@@ -22,24 +23,37 @@ var a = class extends e {
22
23
  this._addFiles(n), t.value = "";
23
24
  };
24
25
  }
26
+ static {
27
+ this.labelTarget = ".void-file-upload-dropzone";
28
+ }
29
+ formSubmission() {
30
+ return this._files;
31
+ }
32
+ formSnapshot() {
33
+ return [...this._files];
34
+ }
35
+ formRestore(e) {
36
+ this._files = Array.isArray(e) ? [...e] : [], this.requestUpdate();
37
+ }
38
+ formStateRestoreCallback() {}
25
39
  get _input() {
26
40
  return this.querySelector("input[type=\"file\"]");
27
41
  }
28
42
  render() {
29
- return n`
43
+ return r`
30
44
  <input
31
45
  type="file"
32
46
  class="void-file-upload-input"
33
- accept=${this.accept || r}
47
+ accept=${this.accept || i}
34
48
  ?multiple=${this.multiple}
35
49
  ?disabled=${this.disabled}
36
50
  @change=${this._onInputChange}
37
51
  />
38
52
  <div
39
53
  class="void-file-upload-dropzone"
40
- tabindex=${this.disabled ? "-1" : "0"}
54
+ tabindex=${this.formDisabled ? "-1" : "0"}
41
55
  role="button"
42
- aria-disabled=${this.disabled ? "true" : "false"}
56
+ aria-disabled=${this.formDisabled ? "true" : i}
43
57
  @click=${this._onDropzoneClick}
44
58
  @keydown=${this._onDropzoneKeydown}
45
59
  @dragover=${this._onDragOver}
@@ -50,9 +64,9 @@ var a = class extends e {
50
64
  Drop files here or <span class="void-file-upload-browse">browse</span>
51
65
  </span>
52
66
  </div>
53
- ${this._files.length > 0 ? n`
67
+ ${this._files.length > 0 ? r`
54
68
  <div class="void-file-upload-files">
55
- ${this._files.map((e, t) => n`
69
+ ${this._files.map((e, t) => r`
56
70
  <div class="void-file-upload-file">
57
71
  <span class="void-file-upload-filename">${e.name}</span>
58
72
  <button
@@ -65,8 +79,8 @@ var a = class extends e {
65
79
  </div>
66
80
  `)}
67
81
  </div>
68
- ` : r}
69
- ${this.error ? n`<span class="void-file-upload-error">${this.error}</span>` : r}
82
+ ` : i}
83
+ ${this.error ? r`<span class="void-file-upload-error">${this.error}</span>` : i}
70
84
  `;
71
85
  }
72
86
  _addFiles(e) {
@@ -74,26 +88,35 @@ var a = class extends e {
74
88
  t.length !== 0 && (this._files = this.multiple ? [...this._files, ...t] : t, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
75
89
  bubbles: !0,
76
90
  composed: !0,
77
- detail: { files: [...this._files] }
91
+ detail: {
92
+ value: [...this._files],
93
+ files: [...this._files]
94
+ }
78
95
  })));
79
96
  }
80
97
  _removeFile(e) {
81
98
  this._files = this._files.filter((t, n) => n !== e), this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
82
99
  bubbles: !0,
83
100
  composed: !0,
84
- detail: { files: [...this._files] }
101
+ detail: {
102
+ value: [...this._files],
103
+ files: [...this._files]
104
+ }
85
105
  }));
86
106
  }
87
107
  };
88
- t([i({ type: String })], a.prototype, "accept", void 0), t([i({
108
+ t([a({ type: String })], o.prototype, "accept", void 0), t([a({
89
109
  type: Boolean,
90
110
  reflect: !0
91
- })], a.prototype, "multiple", void 0), t([i({
111
+ })], o.prototype, "multiple", void 0), t([a({
92
112
  type: Boolean,
93
113
  reflect: !0
94
- })], a.prototype, "disabled", void 0), t([i({ type: Number })], a.prototype, "maxSize", void 0), t([i({
114
+ })], o.prototype, "disabled", void 0), t([a({
115
+ type: Number,
116
+ attribute: "max-size"
117
+ })], o.prototype, "maxSize", void 0), t([a({
95
118
  type: String,
96
119
  reflect: !0
97
- })], a.prototype, "error", void 0), customElements.get("void-file-upload") || customElements.define("void-file-upload", a);
120
+ })], o.prototype, "error", void 0), customElements.get("void-file-upload") || customElements.define("void-file-upload", o);
98
121
  //#endregion
99
- export { a as VoidFileUpload };
122
+ export { o as VoidFileUpload };
@@ -1,4 +1,4 @@
1
- import { LitElement } from 'lit';
1
+ import { VoidElement } from '../base.js';
2
2
  export interface GaugeZone {
3
3
  from: number;
4
4
  to: number;
@@ -13,17 +13,40 @@ export interface GaugeData {
13
13
  value?: number;
14
14
  segments?: GaugeSegment[];
15
15
  }
16
- export declare class VoidGauge extends LitElement {
17
- createRenderRoot(): this;
16
+ /**
17
+ * Radial gauge for a single value within a range (capacity, score, load) or for a few segments that share
18
+ * it, drawn in SVG as a full, semi or three-quarter arc with optional tick marks and colour zones. Set
19
+ * `value` between `min` and `max`, or give it `data.segments`; it has no children. The gauge is an image to
20
+ * assistive technology, so set `aria-label` and state the figure in the surrounding text.
21
+ */
22
+ export declare class VoidGauge extends VoidElement {
23
+ /**
24
+ * Text shown with the value, such as `%` or `MB/s`. Centered under the number, or right after it with
25
+ * `unit-inline`.
26
+ */
18
27
  unit: string;
28
+ /**
29
+ * The reading, between `min` and `max`, for a single-value gauge. For a gauge split into segments set
30
+ * `data.segments` instead.
31
+ */
19
32
  value: number;
33
+ /** Value at the start of the arc. Defaults to 0. */
20
34
  min: number;
35
+ /** Value at the end of the arc. Defaults to 100. */
21
36
  max: number;
37
+ /** Width of the gauge in pixels. Defaults to 220; the height follows from `circular`. */
22
38
  size: number;
39
+ /** Width of the arc stroke in pixels. Defaults to 14. */
23
40
  thickness: number;
41
+ /** How much of a circle the arc covers: `triple` (270 degrees, default), `semi` (180) or `full` (360). */
24
42
  circular: 'full' | 'semi' | 'triple';
43
+ /**
44
+ * How the arc is drawn: `filled` (default, solid), `outline` (tinted with a border) or `wireframe`
45
+ * (thin lines only).
46
+ */
25
47
  variant: 'filled' | 'outline' | 'wireframe';
26
- showValue: boolean;
48
+ /** Leave the reading out of the centre (it is printed by default). */
49
+ hideValue: boolean;
27
50
  /** When true, render the unit right next to the value (e.g. "75%").
28
51
  When false (default), render it on the line below. Short units like
29
52
  % or ° look better inline; longer multi-char units often look
@@ -43,22 +66,37 @@ export declare class VoidGauge extends LitElement {
43
66
  /** When true (default), force a major tick at `min` (the gauge start
44
67
  position). Independent of `tick-major` — useful when min isn't a
45
68
  multiple of the major interval but you still want an endpoint
46
- marker. Set `tick-min="false"` to disable. */
47
- tickMin: boolean;
69
+ marker. Add `hide-tick-min` to leave it out. */
70
+ hideTickMin: boolean;
48
71
  /** When true (default), force a major tick at `max` (the gauge end
49
72
  position). Useful when max doesn't naturally fall on a major-interval
50
73
  boundary (e.g. max=100 with tick-major=30) but you still want the
51
74
  endpoint marked. If max naturally falls on a step, this upgrades the
52
- classification to major. Set `tick-max="false"` to disable. */
53
- tickMax: boolean;
75
+ classification to major. Add `hide-tick-max` to leave it out. */
76
+ hideTickMax: boolean;
77
+ /**
78
+ * Order of segments around the arc: `value` (default, largest first) or `manual` (the order of
79
+ * `data.segments`).
80
+ */
54
81
  segmentsSort: 'value' | 'manual';
55
82
  /** Visible gap between segments. `false`/`0` = seamless. `true` = 1% of the
56
83
  filled arc consumed by gaps. Number = explicit percent. Higher % = clearer
57
84
  segmentation but more arc sacrificed; the precision-vs-clarity tradeoff. */
58
85
  gaps: boolean | number;
86
+ /**
87
+ * Accessible name of the gauge, such as `Disk usage`. The gauge is an image to assistive technology,
88
+ * so set it and put the figure in the text around it.
89
+ */
59
90
  ariaLabel: string;
91
+ /** Colour bands over the value range. Assign an array of `{ from, to, color }`;
92
+ the fill takes the colour of the zone containing the value. Property only. */
60
93
  zones: GaugeZone[];
61
94
  private _data;
95
+ /**
96
+ * Segmented data: `{ segments: [{ name, value, color? }] }` splits the arc between named parts; the
97
+ * optional `value` is the headline reading. Property only: assign a new object to update the gauge and
98
+ * animate to it. For a single reading, set the `value` attribute instead.
99
+ */
62
100
  get data(): GaugeData;
63
101
  set data(next: GaugeData);
64
102
  private _phase;
@@ -74,6 +112,8 @@ export declare class VoidGauge extends LitElement {
74
112
  private _animStart;
75
113
  private _animDuration;
76
114
  private _rafHandle;
115
+ private _hasAnimated;
116
+ protected willUpdate(changed: Map<PropertyKey, unknown>): void;
77
117
  private _refreshTargets;
78
118
  private _resolveTotal;
79
119
  connectedCallback(): void;
@@ -99,4 +139,3 @@ declare global {
99
139
  'void-gauge': VoidGauge;
100
140
  }
101
141
  }
102
- //# sourceMappingURL=gauge.d.ts.map
@@ -1,5 +1,6 @@
1
- import { t as e } from "../chunks/decorate-DKuCkHK4.js";
2
- import { LitElement as t, html as n, nothing as r, svg as i } from "lit";
1
+ import { t as e } from "../chunks/base-CMruMbxC.js";
2
+ import { t } from "../chunks/decorate-CaYbmmmm.js";
3
+ import { html as n, nothing as r, svg as i } from "lit";
3
4
  import { property as a, state as o } from "lit/decorators.js";
4
5
  //#region src/components/gauge.ts
5
6
  function s(e) {
@@ -37,9 +38,9 @@ function p(e) {
37
38
  totalSweep: 3 * t / 2
38
39
  };
39
40
  }
40
- var m = class extends t {
41
+ var m = class extends e {
41
42
  constructor(...e) {
42
- super(...e), this.unit = "", this.value = 0, this.min = 0, this.max = 100, this.size = 220, this.thickness = 14, this.circular = "triple", this.variant = "filled", this.showValue = !0, this.unitInline = !1, this.tickMajor = 0, this.tickMinor = 0, this.tickMin = !0, this.tickMax = !0, this.segmentsSort = "value", this.gaps = !1, this.ariaLabel = "", this.zones = [], this._data = {}, this._phase = "pre", this._hoverSegment = null, this._hoverX = 0, this._hoverY = 0, this._displayValue = 0, this._displayValueFrom = 0, this._targetValue = 0, this._displaySegments = /* @__PURE__ */ new Map(), this._segmentsFrom = /* @__PURE__ */ new Map(), this._targetSegments = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._onMouseMove = (e) => {
43
+ super(...e), this.unit = "", this.value = 0, this.min = 0, this.max = 100, this.size = 220, this.thickness = 14, this.circular = "triple", this.variant = "filled", this.hideValue = !1, this.unitInline = !1, this.tickMajor = 0, this.tickMinor = 0, this.hideTickMin = !1, this.hideTickMax = !1, this.segmentsSort = "value", this.gaps = !1, this.ariaLabel = "", this.zones = [], this._data = {}, this._phase = "pre", this._hoverSegment = null, this._hoverX = 0, this._hoverY = 0, this._displayValue = 0, this._displayValueFrom = 0, this._targetValue = 0, this._displaySegments = /* @__PURE__ */ new Map(), this._segmentsFrom = /* @__PURE__ */ new Map(), this._targetSegments = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._hasAnimated = !1, this._onMouseMove = (e) => {
43
44
  let t = this.querySelector("svg");
44
45
  if (!t) return;
45
46
  let n = this._data.segments;
@@ -66,14 +67,14 @@ var m = class extends t {
66
67
  this._hoverSegment !== null && (this._hoverSegment = null);
67
68
  return;
68
69
  }
69
- let x = this.segmentsSort === "value" ? [...n].sort((e, t) => t.value - e.value) : n, S = [...this._displaySegments.values()].reduce((e, t) => e + t, 0) || this._displayValue || 1, C = h;
70
+ let x = this.segmentsSort === "value" ? [...n].sort((e, t) => t.value - e.value) : n, S = [...this._displaySegments.values()].reduce((e, t) => e + t, 0) || this._displayValue || 1, C = b - h, w = h;
70
71
  for (let e = 0; e < x.length; e++) {
71
- let t = x[e], r = n.indexOf(t), i = (this._displaySegments.get(r) ?? 0) / S * g;
72
- if (v >= C && v < C + i) {
72
+ let t = x[e], r = n.indexOf(t), i = (this._displaySegments.get(r) ?? 0) / S * C;
73
+ if (v >= w && v < w + i) {
73
74
  this._hoverSegment !== r && (this._hoverSegment = r), this._hoverX = a, this._hoverY = o;
74
75
  return;
75
76
  }
76
- C += i;
77
+ w += i;
77
78
  }
78
79
  this._hoverSegment !== null && (this._hoverSegment = null);
79
80
  }, this._onMouseLeave = () => {
@@ -88,9 +89,6 @@ var m = class extends t {
88
89
  this.requestUpdate(), n < 1 ? this._rafHandle = requestAnimationFrame(this._tick) : this._phase = "idle";
89
90
  };
90
91
  }
91
- createRenderRoot() {
92
- return this;
93
- }
94
92
  get data() {
95
93
  return this._data;
96
94
  }
@@ -104,6 +102,9 @@ var m = class extends t {
104
102
  this._startAnimation(a, n, !0);
105
103
  });
106
104
  }
105
+ willUpdate(e) {
106
+ super.willUpdate?.(e), (e.has("value") || e.has("min") || e.has("max")) && (this._refreshTargets(), this._hasAnimated && this.isConnected && this._startAnimation(new Map(this._displaySegments), this._displayValue, !0));
107
+ }
107
108
  _refreshTargets() {
108
109
  let e = this._data.segments ?? [];
109
110
  this._targetSegments.clear();
@@ -116,7 +117,7 @@ var m = class extends t {
116
117
  return e && e.length > 0 ? e.reduce((e, t) => e + t.value, 0) : this.value;
117
118
  }
118
119
  connectedCallback() {
119
- super.connectedCallback(), this.setAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
120
+ super.connectedCallback(), this.setHostAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
120
121
  let e = /* @__PURE__ */ new Map(), t = this._data.segments ?? [];
121
122
  for (let n = 0; n < t.length; n++) e.set(n, 0);
122
123
  this._startAnimation(e, 0, !1);
@@ -128,7 +129,7 @@ var m = class extends t {
128
129
  _startAnimation(e, t, n) {
129
130
  cancelAnimationFrame(this._rafHandle);
130
131
  let r = getComputedStyle(this), i = r.getPropertyValue("--void-anim-scale").trim(), a = i === "" ? 1 : parseFloat(i), o = parseFloat(r.getPropertyValue("--void-duration-chart-enter")) || 700;
131
- if (this._animDuration = o * a, this._segmentsFrom = e, this._displayValueFrom = n ? t : 0, this._animStart = performance.now(), this._animDuration <= 0) {
132
+ if (this._animDuration = o * a, this._segmentsFrom = e, this._displayValueFrom = n ? t : 0, this._animStart = performance.now(), this._hasAnimated = !0, this._animDuration <= 0) {
132
133
  this._displayValue = this._targetValue, this._displaySegments = new Map(this._targetSegments), this._phase = "idle", this.requestUpdate();
133
134
  return;
134
135
  }
@@ -145,7 +146,8 @@ var m = class extends t {
145
146
  if (this.zones.length === 0) return "var(--void-color-accent)";
146
147
  let e = this._resolveTotal();
147
148
  for (let t of this.zones) if (e >= t.from && e <= t.to) return t.color;
148
- return this.zones[this.zones.length - 1].color;
149
+ let t = this.zones.reduce((e, t) => t.from < e.from ? t : e);
150
+ return e < t.from ? t.color : this.zones[this.zones.length - 1].color;
149
151
  }
150
152
  _hasSegments() {
151
153
  return (this._data.segments?.length ?? 0) > 0;
@@ -174,7 +176,7 @@ var m = class extends t {
174
176
  for (let r of this.zones) s.push(i`
175
177
  <path
176
178
  class="void-gauge-zone"
177
- style="--zone-color: ${r.color}; stroke-width: ${o};"
179
+ style="--zone-color: ${r.color}; --gauge-stroke-width: ${o};"
178
180
  d=${l(e, t, n, this._angleAt(r.from), this._angleAt(r.to))}
179
181
  ></path>
180
182
  `);
@@ -186,40 +188,40 @@ var m = class extends t {
186
188
  let h = this.zones[this.zones.length - 1];
187
189
  return h && Math.abs(h.to - this.max) < 1e-6 && p.push(i`<path class="void-gauge-zone-cap" d=${u(this._angleAt(h.to), 0)} style="--zone-color: ${h.color};"></path>`), i`<g class="void-gauge-zones">${s}${p}</g>`;
188
190
  }
189
- _renderSegments(e, t, n, a, o, s, c) {
191
+ _renderSegments(e, t, n, a, o, s) {
190
192
  if (!this._hasSegments()) return r;
191
- let d = this._data.segments, f = this.segmentsSort === "value" ? [...d].sort((e, t) => t.value - e.value) : d, p = c - a, m = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * p, h = f.length, g = (h > 1 ? m / (h - 1) : 0) / 2, _ = [], v = a, y = null, b = null, x = null, S = null;
192
- for (let r = 0; r < f.length; r++) {
193
- let a = f[r], p = d.indexOf(a), m = this._displaySegments.get(p) ?? 0;
194
- if (m <= 0 || s <= 0) {
195
- v += 0;
193
+ let c = this._data.segments, d = this.segmentsSort === "value" ? [...c].sort((e, t) => t.value - e.value) : c, f = s - a, p = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * f, m = d.length, h = (m > 1 ? p / (m - 1) : 0) / 2, g = [], _ = a, v = null, y = null, b = null, x = null;
194
+ for (let r = 0; r < d.length; r++) {
195
+ let a = d[r], p = c.indexOf(a), S = this._displaySegments.get(p) ?? 0;
196
+ if (S <= 0 || o <= 0) {
197
+ _ += 0;
196
198
  continue;
197
199
  }
198
- let C = m / s * o, w = Math.min(v + C, c), T = r > 0 ? v + g : v, E = r < h - 1 ? w - g : w;
200
+ let C = S / o * f, w = Math.min(_ + C, s), T = r > 0 ? _ + h : _, E = r < m - 1 ? w - h : w;
199
201
  if (E > T + .001) {
200
202
  let r = a.color ?? "var(--void-color-accent)", o = this.variant === "outline" ? u(e, t, n, this.thickness, T, E) : l(e, t, n, T, E);
201
- _.push(i`
203
+ g.push(i`
202
204
  <path
203
205
  class="void-gauge-segment"
204
206
  d=${o}
205
- style="--segment-color: ${r}; stroke-width: ${this.thickness};"
207
+ style="--segment-color: ${r}; --gauge-stroke-width: ${this.thickness};"
206
208
  data-segment-index=${p}
207
209
  ></path>
208
- `), y === null && (y = r, b = T), x = r, S = E;
210
+ `), v === null && (v = r, y = T), b = r, x = E;
209
211
  }
210
- v += C;
212
+ _ += C;
211
213
  }
212
- if (_.length === 0) return r;
213
- let C = this.thickness / 2, w = [];
214
- if (b !== null && y !== null) {
215
- let r = e + n * Math.cos(b), a = t + n * Math.sin(b);
216
- w.push(i`<circle class="void-gauge-segment-cap" cx=${r} cy=${a} r=${C} style="--segment-color: ${y};"></circle>`);
214
+ if (g.length === 0) return r;
215
+ let S = this.thickness / 2, C = [];
216
+ if (y !== null && v !== null) {
217
+ let r = e + n * Math.cos(y), a = t + n * Math.sin(y);
218
+ C.push(i`<circle class="void-gauge-segment-cap" cx=${r} cy=${a} r=${S} style="--segment-color: ${v};"></circle>`);
217
219
  }
218
- if (S !== null && x !== null) {
219
- let r = e + n * Math.cos(S), a = t + n * Math.sin(S);
220
- w.push(i`<circle class="void-gauge-segment-cap" cx=${r} cy=${a} r=${C} style="--segment-color: ${x};"></circle>`);
220
+ if (x !== null && b !== null) {
221
+ let r = e + n * Math.cos(x), a = t + n * Math.sin(x);
222
+ C.push(i`<circle class="void-gauge-segment-cap" cx=${r} cy=${a} r=${S} style="--segment-color: ${b};"></circle>`);
221
223
  }
222
- return i`<g class="void-gauge-segments">${w}${_}</g>`;
224
+ return i`<g class="void-gauge-segments">${C}${g}</g>`;
223
225
  }
224
226
  _renderCenter(e, t) {
225
227
  let n = this._displayValue, a = c(n), o = this.circular === "semi" ? t * .7 : t, s = o + 20;
@@ -257,7 +259,7 @@ var m = class extends t {
257
259
  if (!this._hasTicks() || this.max - this.min <= 0) return r;
258
260
  let a = Math.max(0, n - this.thickness / 2), o = Math.max(0, a - 3), s = Math.max(0, o - 5), c = Math.max(0, o - 10), l = [], u = this.tickMinor > 0 ? this.tickMinor : this.tickMajor;
259
261
  if (u <= 0) return r;
260
- this.tickMin && l.push({
262
+ this.hideTickMin || l.push({
261
263
  v: this.min,
262
264
  major: !0
263
265
  });
@@ -270,11 +272,11 @@ var m = class extends t {
270
272
  });
271
273
  }
272
274
  let f = (this.max - this.min) / u, p = Math.abs(f - Math.round(f)) < d;
273
- if (this.tickMax || p) {
275
+ if (!this.hideTickMax || p) {
274
276
  let e = this.tickMajor > 0 && Math.abs((this.max - this.min) / this.tickMajor - Math.round((this.max - this.min) / this.tickMajor)) < 1e-6;
275
277
  l.push({
276
278
  v: this.max,
277
- major: this.tickMax || e
279
+ major: !this.hideTickMax || e
278
280
  });
279
281
  }
280
282
  return l.length === 0 ? r : i`<g class="void-gauge-ticks">${l.map(({ v: n, major: r }) => {
@@ -283,7 +285,7 @@ var m = class extends t {
283
285
  })}</g>`;
284
286
  }
285
287
  render() {
286
- let { startAngle: e, endAngle: t, totalSweep: a } = p(this.circular), o = this.size / 2, s = this.size / 2, c = Math.max(8, this.thickness / 2), d = this.size / 2 - c, f = this._viewBoxHeight(), m = this._resolveTotal(), h = Math.max(this.min, Math.min(this.max, this._displayValue)), g = this.max - this.min === 0 ? 0 : (h - this.min) / (this.max - this.min), _ = e + Math.max(0, Math.min(1, g)) * a, v = this._resolveFillColor(), y = _ > e + .001;
288
+ let { startAngle: e, endAngle: t, totalSweep: a } = p(this.circular), o = this.size / 2, s = this.size / 2, c = Math.max(8, this.thickness / 2), d = this.size / 2 - c, f = this._viewBoxHeight(), m = [...this._displaySegments.values()].reduce((e, t) => e + t, 0), h = Math.max(this.min, Math.min(this.max, this._displayValue)), g = this.max - this.min === 0 ? 0 : (h - this.min) / (this.max - this.min), _ = e + Math.max(0, Math.min(1, g)) * a, v = this._resolveFillColor(), y = _ > e + .001;
287
289
  return n`
288
290
  <svg
289
291
  viewBox="0 0 ${this.size} ${f}"
@@ -297,7 +299,7 @@ var m = class extends t {
297
299
  matching the unfilled portion of the gauge). -->
298
300
  <path
299
301
  class="void-gauge-track"
300
- style="stroke-width: ${this.thickness};"
302
+ style="--gauge-stroke-width: ${this.thickness};"
301
303
  d=${l(o, s, d, e, t)}
302
304
  ></path>
303
305
 
@@ -315,19 +317,19 @@ var m = class extends t {
315
317
  ${y && !this._hasSegments() ? i`
316
318
  <path
317
319
  class="void-gauge-value"
318
- style="--value-color: ${v}; stroke-width: ${this.thickness};"
320
+ style="--value-color: ${v}; --gauge-stroke-width: ${this.thickness};"
319
321
  d=${this.variant === "outline" ? u(o, s, d, this.thickness, e, _) : l(o, s, d, e, _)}
320
322
  ></path>
321
323
  ` : r}
322
324
 
323
325
  <!-- Segment overlays -->
324
- ${this._renderSegments(o, s, d, e, a, m, _)}
326
+ ${this._renderSegments(o, s, d, e, m, _)}
325
327
 
326
328
  <!-- Tick marks (outside the band) -->
327
329
  ${this._renderTicks(o, s, d)}
328
330
 
329
331
  <!-- Center label -->
330
- ${this.showValue ? this._renderCenter(o, s) : r}
332
+ ${this.hideValue ? r : this._renderCenter(o, s)}
331
333
 
332
334
  <!-- Hover tooltip -->
333
335
  ${this._hoverSegment !== null && this._data.segments && this._hoverSegment < this._data.segments.length ? this._renderHoverTooltip(this._data.segments, this._hoverSegment) : r}
@@ -358,32 +360,32 @@ var m = class extends t {
358
360
  `;
359
361
  }
360
362
  };
361
- e([a()], m.prototype, "unit", void 0), e([a({ type: Number })], m.prototype, "value", void 0), e([a({ type: Number })], m.prototype, "min", void 0), e([a({ type: Number })], m.prototype, "max", void 0), e([a({
363
+ t([a()], m.prototype, "unit", void 0), t([a({ type: Number })], m.prototype, "value", void 0), t([a({ type: Number })], m.prototype, "min", void 0), t([a({ type: Number })], m.prototype, "max", void 0), t([a({
362
364
  type: Number,
363
365
  reflect: !0
364
- })], m.prototype, "size", void 0), e([a({ type: Number })], m.prototype, "thickness", void 0), e([a({ reflect: !0 })], m.prototype, "circular", void 0), e([a({ reflect: !0 })], m.prototype, "variant", void 0), e([a({
366
+ })], m.prototype, "size", void 0), t([a({ type: Number })], m.prototype, "thickness", void 0), t([a({ reflect: !0 })], m.prototype, "circular", void 0), t([a({ reflect: !0 })], m.prototype, "variant", void 0), t([a({
365
367
  type: Boolean,
366
- attribute: "show-value",
368
+ attribute: "hide-value",
367
369
  reflect: !0
368
- })], m.prototype, "showValue", void 0), e([a({
370
+ })], m.prototype, "hideValue", void 0), t([a({
369
371
  type: Boolean,
370
372
  attribute: "unit-inline",
371
373
  reflect: !0
372
- })], m.prototype, "unitInline", void 0), e([a({
374
+ })], m.prototype, "unitInline", void 0), t([a({
373
375
  type: Number,
374
376
  attribute: "tick-major"
375
- })], m.prototype, "tickMajor", void 0), e([a({
377
+ })], m.prototype, "tickMajor", void 0), t([a({
376
378
  type: Number,
377
379
  attribute: "tick-minor"
378
- })], m.prototype, "tickMinor", void 0), e([a({
380
+ })], m.prototype, "tickMinor", void 0), t([a({
379
381
  type: Boolean,
380
- attribute: "tick-min",
382
+ attribute: "hide-tick-min",
381
383
  reflect: !0
382
- })], m.prototype, "tickMin", void 0), e([a({
384
+ })], m.prototype, "hideTickMin", void 0), t([a({
383
385
  type: Boolean,
384
- attribute: "tick-max",
386
+ attribute: "hide-tick-max",
385
387
  reflect: !0
386
- })], m.prototype, "tickMax", void 0), e([a({ attribute: "segments-sort" })], m.prototype, "segmentsSort", void 0), e([a({ converter: {
388
+ })], m.prototype, "hideTickMax", void 0), t([a({ attribute: "segments-sort" })], m.prototype, "segmentsSort", void 0), t([a({ converter: {
387
389
  fromAttribute(e) {
388
390
  if (e === null || e === "" || e === "true") return !0;
389
391
  if (e === "false") return !1;
@@ -393,6 +395,6 @@ e([a()], m.prototype, "unit", void 0), e([a({ type: Number })], m.prototype, "va
393
395
  toAttribute(e) {
394
396
  return e === !0 ? "" : e === !1 ? "false" : String(e);
395
397
  }
396
- } })], m.prototype, "gaps", void 0), e([a({ attribute: "aria-label" })], m.prototype, "ariaLabel", void 0), e([o()], m.prototype, "_phase", void 0), e([o()], m.prototype, "_hoverSegment", void 0), e([o()], m.prototype, "_hoverX", void 0), e([o()], m.prototype, "_hoverY", void 0), customElements.get("void-gauge") || customElements.define("void-gauge", m);
398
+ } })], m.prototype, "gaps", void 0), t([a({ attribute: "aria-label" })], m.prototype, "ariaLabel", void 0), t([a({ attribute: !1 })], m.prototype, "zones", void 0), t([o()], m.prototype, "_phase", void 0), t([o()], m.prototype, "_hoverSegment", void 0), t([o()], m.prototype, "_hoverX", void 0), t([o()], m.prototype, "_hoverY", void 0), customElements.get("void-gauge") || customElements.define("void-gauge", m);
397
399
  //#endregion
398
400
  export { m as VoidGauge };
@@ -1,13 +1,29 @@
1
1
  import { VoidElement } from '../base.js';
2
- /** Animated open/close toggle for mobile navigation menus and collapsible sidebars. */
2
+ import { KeyboardActivation } from '../keyboard-activation.js';
3
+ /**
4
+ * Animated open/close toggle for mobile navigation menus and collapsible sidebars.
5
+ *
6
+ * @fires {CustomEvent<{ reason: 'trigger' }>} void-open - The user opened it (click, Enter or Space). Does not bubble.
7
+ * @fires {CustomEvent<{ reason: 'trigger' }>} void-close - The user closed it. Does not bubble.
8
+ */
3
9
  export declare class VoidHamburger extends VoidElement {
4
- active: boolean;
10
+ /** Enter and Space fire a real `click`, as on a native button. */
11
+ protected readonly _activation: KeyboardActivation;
12
+ /**
13
+ * Whether the menu it controls is open: draws the lines as a close cross and sets `aria-expanded`. It
14
+ * flips on every click and Enter or Space, firing `void-open` or `void-close`; set it yourself when the
15
+ * menu closes some other way.
16
+ */
17
+ open: boolean;
18
+ /** Size step: `sm`, `md` (default) or `lg`. */
5
19
  size: 'sm' | 'md' | 'lg';
20
+ private _unwatch;
21
+ /** Inside a `<fieldset disabled>` it ignores clicks and keys and leaves the tab order, as a native button does. */
22
+ private _syncDisabled;
6
23
  connectedCallback(): void;
7
24
  disconnectedCallback(): void;
8
25
  updated(changed: Map<string, unknown>): void;
9
26
  private _handleClick;
10
- private _handleKeydown;
11
27
  render(): import('lit').TemplateResult<1>;
12
28
  }
13
29
  declare global {
@@ -15,4 +31,3 @@ declare global {
15
31
  'void-hamburger': VoidHamburger;
16
32
  }
17
33
  }
18
- //# sourceMappingURL=hamburger.d.ts.map
@@ -1,31 +1,40 @@
1
- import { VoidElement as e } from "../base.js";
2
- import { t } from "../chunks/decorate-DKuCkHK4.js";
3
- import { html as n } from "lit";
4
- import { property as r } from "lit/decorators.js";
1
+ import { t as e } from "../chunks/base-CMruMbxC.js";
2
+ import { t } from "../chunks/decorate-CaYbmmmm.js";
3
+ import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
+ import { i as r, r as i } from "../chunks/form-control-C0vH6gii.js";
5
+ import { html as a } from "lit";
6
+ import { property as o } from "lit/decorators.js";
5
7
  //#region src/components/hamburger.ts
6
- var i = class extends e {
8
+ var s = class extends e {
7
9
  constructor(...e) {
8
- super(...e), this.active = !1, this.size = "md", this._handleClick = () => {
9
- this.active = !this.active, this.dispatchEvent(new CustomEvent("void-toggle", {
10
- bubbles: !0,
11
- composed: !0,
12
- detail: { active: this.active }
10
+ super(...e), this._activation = new n(this, { disabled: () => i(this) }), this.open = !1, this.size = "md", this._unwatch = null, this._handleClick = () => {
11
+ if (i(this)) return;
12
+ this.open = !this.open;
13
+ let e = { reason: "trigger" };
14
+ this.open ? this.dispatchEvent(new CustomEvent("void-open", {
15
+ bubbles: !1,
16
+ detail: e
17
+ })) : this.dispatchEvent(new CustomEvent("void-close", {
18
+ bubbles: !1,
19
+ detail: e
13
20
  }));
14
- }, this._handleKeydown = (e) => {
15
- (e.key === " " || e.key === "Enter") && (e.preventDefault(), this._handleClick());
16
21
  };
17
22
  }
23
+ _syncDisabled() {
24
+ let e = i(this);
25
+ this.setHostAttribute("aria-disabled", e ? "true" : null), this.setHostAttribute("tabindex", e ? "-1" : "0");
26
+ }
18
27
  connectedCallback() {
19
- super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("tabindex", "0"), this.setAttribute("aria-expanded", String(this.active)), this.setAttribute("aria-label", this.active ? "Close menu" : "Menu"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
28
+ super.connectedCallback(), this.setHostAttribute("role", "button"), this._syncDisabled(), this._unwatch = r(this, () => this._syncDisabled()), this.setHostAttribute("aria-expanded", String(this.open)), this.setHostAttribute("aria-label", this.open ? "Close menu" : "Menu"), this.addEventListener("click", this._handleClick);
20
29
  }
21
30
  disconnectedCallback() {
22
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
31
+ super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this._unwatch?.(), this._unwatch = null;
23
32
  }
24
33
  updated(e) {
25
- e.has("active") && (this.setAttribute("aria-expanded", String(this.active)), this.setAttribute("aria-label", this.active ? "Close menu" : "Menu"));
34
+ e.has("open") && (this.setHostAttribute("aria-expanded", String(this.open)), this.setHostAttribute("aria-label", this.open ? "Close menu" : "Menu"));
26
35
  }
27
36
  render() {
28
- return n`
37
+ return a`
29
38
  <span class="void-hamburger-lines">
30
39
  <span class="void-hamburger-line"></span>
31
40
  <span class="void-hamburger-line"></span>
@@ -34,12 +43,12 @@ var i = class extends e {
34
43
  `;
35
44
  }
36
45
  };
37
- t([r({
46
+ t([o({
38
47
  type: Boolean,
39
48
  reflect: !0
40
- })], i.prototype, "active", void 0), t([r({
49
+ })], s.prototype, "open", void 0), t([o({
41
50
  type: String,
42
51
  reflect: !0
43
- })], i.prototype, "size", void 0), customElements.get("void-hamburger") || customElements.define("void-hamburger", i);
52
+ })], s.prototype, "size", void 0), customElements.get("void-hamburger") || customElements.define("void-hamburger", s);
44
53
  //#endregion
45
- export { i as VoidHamburger };
54
+ export { s as VoidHamburger };