@voidable/ui 0.6.1 → 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 (250) 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/disclosure-Bj_49GcC.js +23 -0
  12. package/dist/chunks/dismiss-Drsy_dE5.js +37 -0
  13. package/dist/chunks/form-control-C0vH6gii.js +300 -0
  14. package/dist/chunks/keyboard-MQpfTX5I.js +46 -0
  15. package/dist/chunks/keyboard-activation-CV0m4hkn.js +29 -0
  16. package/dist/chunks/modal-D_YVy2vg.js +71 -0
  17. package/dist/chunks/overlay-BywGMcDW.js +467 -0
  18. package/dist/chunks/parts-D30c8OoG.js +229 -0
  19. package/dist/chunks/{shape-FJvZa8FW.js → shape-C_LW7EjG.js} +12 -4
  20. package/dist/components/accordion.d.ts +38 -10
  21. package/dist/components/accordion.js +51 -53
  22. package/dist/components/action-input.d.ts +64 -6
  23. package/dist/components/action-input.js +84 -41
  24. package/dist/components/alert.d.ts +24 -10
  25. package/dist/components/alert.js +26 -27
  26. package/dist/components/avatar.d.ts +8 -2
  27. package/dist/components/avatar.js +3 -3
  28. package/dist/components/badge.d.ts +8 -3
  29. package/dist/components/badge.js +2 -2
  30. package/dist/components/banner.d.ts +21 -10
  31. package/dist/components/banner.js +27 -27
  32. package/dist/components/bar-chart.d.ts +30 -6
  33. package/dist/components/bar-chart.js +29 -39
  34. package/dist/components/breadcrumbs.d.ts +19 -6
  35. package/dist/components/breadcrumbs.js +16 -22
  36. package/dist/components/button.d.ts +64 -10
  37. package/dist/components/button.js +70 -26
  38. package/dist/components/calendar.d.ts +65 -10
  39. package/dist/components/calendar.js +157 -106
  40. package/dist/components/card.d.ts +14 -9
  41. package/dist/components/card.js +8 -22
  42. package/dist/components/carousel.d.ts +65 -14
  43. package/dist/components/carousel.js +84 -93
  44. package/dist/components/charts/scale.d.ts +0 -1
  45. package/dist/components/charts/shape.d.ts +0 -1
  46. package/dist/components/checkbox-group.d.ts +38 -5
  47. package/dist/components/checkbox-group.js +61 -20
  48. package/dist/components/checkbox.d.ts +53 -7
  49. package/dist/components/checkbox.js +66 -29
  50. package/dist/components/collapsible.d.ts +29 -9
  51. package/dist/components/collapsible.js +42 -44
  52. package/dist/components/color-picker.d.ts +20 -4
  53. package/dist/components/color-picker.js +35 -29
  54. package/dist/components/combobox.d.ts +84 -10
  55. package/dist/components/combobox.js +142 -45
  56. package/dist/components/compose-input.d.ts +8 -1
  57. package/dist/components/compose-input.js +9 -3
  58. package/dist/components/dialog.d.ts +24 -20
  59. package/dist/components/dialog.js +8 -57
  60. package/dist/components/divider.d.ts +8 -1
  61. package/dist/components/divider.js +3 -3
  62. package/dist/components/donut-chart.d.ts +28 -5
  63. package/dist/components/donut-chart.js +55 -54
  64. package/dist/components/drawer.d.ts +19 -18
  65. package/dist/components/drawer.js +9 -53
  66. package/dist/components/dropdown-menu.d.ts +62 -7
  67. package/dist/components/dropdown-menu.js +124 -33
  68. package/dist/components/editable.d.ts +37 -3
  69. package/dist/components/editable.js +45 -24
  70. package/dist/components/error-fallback.d.ts +36 -5
  71. package/dist/components/error-fallback.js +73 -23
  72. package/dist/components/field.d.ts +38 -4
  73. package/dist/components/field.js +63 -21
  74. package/dist/components/file-upload.d.ts +23 -2
  75. package/dist/components/file-upload.js +47 -24
  76. package/dist/components/gauge.d.ts +48 -9
  77. package/dist/components/gauge.js +57 -55
  78. package/dist/components/hamburger.d.ts +19 -4
  79. package/dist/components/hamburger.js +28 -19
  80. package/dist/components/hover-card.d.ts +40 -14
  81. package/dist/components/hover-card.js +76 -59
  82. package/dist/components/indicator.d.ts +18 -7
  83. package/dist/components/indicator.js +16 -18
  84. package/dist/components/input.d.ts +70 -5
  85. package/dist/components/input.js +83 -20
  86. package/dist/components/line-chart.d.ts +27 -5
  87. package/dist/components/line-chart.js +19 -21
  88. package/dist/components/list.d.ts +10 -1
  89. package/dist/components/list.js +3 -3
  90. package/dist/components/menu.d.ts +67 -21
  91. package/dist/components/menu.js +116 -115
  92. package/dist/components/multiselect.d.ts +108 -13
  93. package/dist/components/multiselect.js +207 -70
  94. package/dist/components/nav-bar.d.ts +12 -7
  95. package/dist/components/nav-bar.js +11 -21
  96. package/dist/components/nav-menu.d.ts +52 -12
  97. package/dist/components/nav-menu.js +68 -70
  98. package/dist/components/number-input.d.ts +76 -8
  99. package/dist/components/number-input.js +117 -51
  100. package/dist/components/pagination.d.ts +19 -1
  101. package/dist/components/pagination.js +68 -7
  102. package/dist/components/panel.d.ts +16 -8
  103. package/dist/components/panel.js +20 -20
  104. package/dist/components/pin-input.d.ts +41 -4
  105. package/dist/components/pin-input.js +45 -27
  106. package/dist/components/popover.d.ts +29 -11
  107. package/dist/components/popover.js +47 -35
  108. package/dist/components/progress.d.ts +7 -3
  109. package/dist/components/progress.js +3 -3
  110. package/dist/components/radio-group.d.ts +30 -5
  111. package/dist/components/radio-group.js +56 -19
  112. package/dist/components/radio.d.ts +47 -7
  113. package/dist/components/radio.js +68 -29
  114. package/dist/components/scroll-area.d.ts +8 -5
  115. package/dist/components/scroll-area.js +19 -20
  116. package/dist/components/segmented-control.d.ts +52 -8
  117. package/dist/components/segmented-control.js +66 -36
  118. package/dist/components/select.d.ts +59 -12
  119. package/dist/components/select.js +96 -46
  120. package/dist/components/sidebar.d.ts +22 -3
  121. package/dist/components/sidebar.js +20 -10
  122. package/dist/components/skeleton.d.ts +5 -2
  123. package/dist/components/skeleton.js +4 -4
  124. package/dist/components/slider.d.ts +27 -5
  125. package/dist/components/slider.js +29 -17
  126. package/dist/components/spinner.d.ts +6 -2
  127. package/dist/components/spinner.js +3 -3
  128. package/dist/components/stat.d.ts +21 -4
  129. package/dist/components/stat.js +7 -3
  130. package/dist/components/status-dot.d.ts +4 -1
  131. package/dist/components/status-dot.js +3 -3
  132. package/dist/components/stepper.d.ts +5 -1
  133. package/dist/components/stepper.js +2 -2
  134. package/dist/components/switch.d.ts +24 -5
  135. package/dist/components/switch.js +37 -19
  136. package/dist/components/table.d.ts +51 -2
  137. package/dist/components/table.js +157 -8
  138. package/dist/components/tabs.d.ts +49 -17
  139. package/dist/components/tabs.js +85 -54
  140. package/dist/components/tag.d.ts +17 -7
  141. package/dist/components/tag.js +19 -21
  142. package/dist/components/tags-input.d.ts +33 -4
  143. package/dist/components/tags-input.js +40 -30
  144. package/dist/components/textarea.d.ts +61 -5
  145. package/dist/components/textarea.js +58 -21
  146. package/dist/components/toast.d.ts +89 -15
  147. package/dist/components/toast.js +105 -30
  148. package/dist/components/toggle-group.d.ts +30 -3
  149. package/dist/components/toggle-group.js +43 -16
  150. package/dist/components/toggle.d.ts +25 -4
  151. package/dist/components/toggle.js +28 -18
  152. package/dist/components/tooltip.d.ts +31 -12
  153. package/dist/components/tooltip.js +62 -28
  154. package/dist/components.json +1518 -0
  155. package/dist/custom-elements.json +31817 -0
  156. package/dist/dev/index.d.ts +40 -0
  157. package/dist/dev/rules.d.ts +46 -0
  158. package/dist/dev/table.generated.d.ts +8 -0
  159. package/dist/dev/types.d.ts +113 -0
  160. package/dist/dev.js +3364 -0
  161. package/dist/disclosure.d.ts +30 -0
  162. package/dist/dismiss.d.ts +20 -0
  163. package/dist/form-control.d.ts +92 -0
  164. package/dist/index.d.ts +5 -4
  165. package/dist/index.js +24 -24
  166. package/dist/keyboard-activation.d.ts +31 -0
  167. package/dist/keyboard.d.ts +32 -0
  168. package/dist/modal.d.ts +44 -0
  169. package/dist/overlay.d.ts +249 -0
  170. package/dist/parts.d.ts +171 -0
  171. package/dist/projection.d.ts +370 -0
  172. package/dist/types/elements.d.ts +648 -0
  173. package/dist/types/react.d.ts +163 -0
  174. package/dist/types/solid.d.ts +164 -0
  175. package/dist/types/solid2.d.ts +161 -0
  176. package/dist/types/svelte.d.ts +154 -0
  177. package/dist/types/vue.d.ts +156 -0
  178. package/dist/vscode.html-custom-data.json +6004 -0
  179. package/dist/web-types.json +8365 -0
  180. package/package.json +113 -21
  181. package/dist/base.d.ts.map +0 -1
  182. package/dist/components/accordion.d.ts.map +0 -1
  183. package/dist/components/action-input.d.ts.map +0 -1
  184. package/dist/components/alert.d.ts.map +0 -1
  185. package/dist/components/avatar.d.ts.map +0 -1
  186. package/dist/components/badge.d.ts.map +0 -1
  187. package/dist/components/banner.d.ts.map +0 -1
  188. package/dist/components/bar-chart.d.ts.map +0 -1
  189. package/dist/components/breadcrumbs.d.ts.map +0 -1
  190. package/dist/components/button.d.ts.map +0 -1
  191. package/dist/components/calendar.d.ts.map +0 -1
  192. package/dist/components/card.d.ts.map +0 -1
  193. package/dist/components/carousel.d.ts.map +0 -1
  194. package/dist/components/charts/scale.d.ts.map +0 -1
  195. package/dist/components/charts/shape.d.ts.map +0 -1
  196. package/dist/components/checkbox-group.d.ts.map +0 -1
  197. package/dist/components/checkbox.d.ts.map +0 -1
  198. package/dist/components/collapsible.d.ts.map +0 -1
  199. package/dist/components/color-picker.d.ts.map +0 -1
  200. package/dist/components/combobox.d.ts.map +0 -1
  201. package/dist/components/compose-input.d.ts.map +0 -1
  202. package/dist/components/dialog.d.ts.map +0 -1
  203. package/dist/components/divider.d.ts.map +0 -1
  204. package/dist/components/donut-chart.d.ts.map +0 -1
  205. package/dist/components/drawer.d.ts.map +0 -1
  206. package/dist/components/dropdown-menu.d.ts.map +0 -1
  207. package/dist/components/editable.d.ts.map +0 -1
  208. package/dist/components/error-fallback.d.ts.map +0 -1
  209. package/dist/components/field.d.ts.map +0 -1
  210. package/dist/components/file-upload.d.ts.map +0 -1
  211. package/dist/components/gauge.d.ts.map +0 -1
  212. package/dist/components/hamburger.d.ts.map +0 -1
  213. package/dist/components/hover-card.d.ts.map +0 -1
  214. package/dist/components/indicator.d.ts.map +0 -1
  215. package/dist/components/input.d.ts.map +0 -1
  216. package/dist/components/line-chart.d.ts.map +0 -1
  217. package/dist/components/list.d.ts.map +0 -1
  218. package/dist/components/menu.d.ts.map +0 -1
  219. package/dist/components/multiselect.d.ts.map +0 -1
  220. package/dist/components/nav-bar.d.ts.map +0 -1
  221. package/dist/components/nav-menu.d.ts.map +0 -1
  222. package/dist/components/number-input.d.ts.map +0 -1
  223. package/dist/components/pagination.d.ts.map +0 -1
  224. package/dist/components/panel.d.ts.map +0 -1
  225. package/dist/components/pin-input.d.ts.map +0 -1
  226. package/dist/components/popover.d.ts.map +0 -1
  227. package/dist/components/progress.d.ts.map +0 -1
  228. package/dist/components/radio-group.d.ts.map +0 -1
  229. package/dist/components/radio.d.ts.map +0 -1
  230. package/dist/components/scroll-area.d.ts.map +0 -1
  231. package/dist/components/segmented-control.d.ts.map +0 -1
  232. package/dist/components/select.d.ts.map +0 -1
  233. package/dist/components/sidebar.d.ts.map +0 -1
  234. package/dist/components/skeleton.d.ts.map +0 -1
  235. package/dist/components/slider.d.ts.map +0 -1
  236. package/dist/components/spinner.d.ts.map +0 -1
  237. package/dist/components/stat.d.ts.map +0 -1
  238. package/dist/components/status-dot.d.ts.map +0 -1
  239. package/dist/components/stepper.d.ts.map +0 -1
  240. package/dist/components/switch.d.ts.map +0 -1
  241. package/dist/components/table.d.ts.map +0 -1
  242. package/dist/components/tabs.d.ts.map +0 -1
  243. package/dist/components/tag.d.ts.map +0 -1
  244. package/dist/components/tags-input.d.ts.map +0 -1
  245. package/dist/components/textarea.d.ts.map +0 -1
  246. package/dist/components/toast.d.ts.map +0 -1
  247. package/dist/components/toggle-group.d.ts.map +0 -1
  248. package/dist/components/toggle.d.ts.map +0 -1
  249. package/dist/components/tooltip.d.ts.map +0 -1
  250. package/dist/index.d.ts.map +0 -1
@@ -1,47 +1,51 @@
1
- import { t as e } from "../chunks/decorate-CaYbmmmm.js";
2
- import { t } from "../chunks/shape-FJvZa8FW.js";
3
- import { LitElement as n, html as r, nothing as i, svg as a } from "lit";
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/shape-C_LW7EjG.js";
4
+ import { html as r, nothing as i, svg as a } from "lit";
4
5
  import { property as o, state as s } from "lit/decorators.js";
5
6
  //#region src/components/donut-chart.ts
6
7
  function c(e) {
7
- return 1 - (1 - e) ** 3;
8
+ return Number.isFinite(e) ? e : 0;
8
9
  }
9
10
  function l(e) {
10
- return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
11
+ return 1 - (1 - e) ** 3;
11
12
  }
12
13
  function u(e) {
13
14
  return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
14
15
  }
15
- var d = class extends n {
16
+ function d(e) {
17
+ return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
18
+ }
19
+ var f = class extends e {
16
20
  constructor(...e) {
17
- super(...e), this.size = 220, this.inner = .6, this.gaps = !1, this.variant = "filled", this.showValues = !1, this.showTotal = !1, this.ariaLabel = "", this._data = { segments: [] }, this._phase = "pre", this._hoverSegment = null, this._hoverX = 0, this._hoverY = 0, this._progress = 0, this._progressFrom = 0, this._displayValues = /* @__PURE__ */ new Map(), this._targetValues = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._displayTotal = 0, this._displayTotalFrom = 0, this._targetTotal = 0, this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._onMouseMove = (e) => {
21
+ super(...e), this.size = 220, this.inner = .6, this.gaps = !1, this.variant = "filled", this.showValue = !1, this.showTotal = !1, this.ariaLabel = "", this._data = { segments: [] }, this._phase = "pre", this._hoverSegment = null, this._hoverX = 0, this._hoverY = 0, this._progress = 0, this._progressFrom = 0, this._displayValues = /* @__PURE__ */ new Map(), this._targetValues = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._displayTotal = 0, this._displayTotalFrom = 0, this._targetTotal = 0, this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._onMouseMove = (e) => {
18
22
  let t = this.querySelector("svg");
19
23
  if (!t) return;
20
24
  let n = this._data.segments;
21
25
  if (n.length === 0 || this._displayTotal <= 0) return;
22
26
  let r = t.getBoundingClientRect();
23
27
  if (r.width === 0) return;
24
- let i = (e.clientX - r.left) / r.width * this.size, a = (e.clientY - r.top) / r.height * this.size, o = this.size / 2, s = this.size / 2, c = i - o, l = a - s, u = Math.sqrt(c * c + l * l), d = this.size / 2 - 4;
25
- if (u < d * this.inner || u > d) {
28
+ let i = (e.clientX - r.left) / r.width * this.size, a = (e.clientY - r.top) / r.height * this.size, o = this.size / 2, s = this.size / 2, l = i - o, u = a - s, d = Math.sqrt(l * l + u * u), f = this.size / 2 - 4;
29
+ if (d < f * this.inner || d > f) {
26
30
  this._hoverSegment !== null && (this._hoverSegment = null);
27
31
  return;
28
32
  }
29
- let f = Math.atan2(l, c) - -Math.PI / 2;
30
- f < 0 && (f += 2 * Math.PI);
31
- let p = 2 * Math.PI, m = 0;
33
+ let p = Math.atan2(u, l) - -Math.PI / 2;
34
+ p < 0 && (p += 2 * Math.PI);
35
+ let m = 2 * Math.PI, h = 0;
32
36
  for (let e = 0; e < n.length; e++) {
33
- let t = n[e].value / this._targetTotal * p;
34
- if (f >= m && f < m + t) {
37
+ let t = c(n[e].value) / this._targetTotal * m;
38
+ if (p >= h && p < h + t) {
35
39
  this._hoverSegment !== e && (this._hoverSegment = e), this._hoverX = i, this._hoverY = a;
36
40
  return;
37
41
  }
38
- m += t;
42
+ h += t;
39
43
  }
40
44
  this._hoverSegment !== null && (this._hoverSegment = null);
41
45
  }, this._onMouseLeave = () => {
42
46
  this._hoverSegment = null;
43
47
  }, this._tick = (e) => {
44
- let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = c(n);
48
+ let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = l(n);
45
49
  this._progress = this._progressFrom + (1 - this._progressFrom) * r;
46
50
  for (let [e, t] of this._targetValues) {
47
51
  let n = this._animFrom.get(e) ?? 0;
@@ -50,9 +54,6 @@ var d = class extends n {
50
54
  this._displayTotal = this._displayTotalFrom + (this._targetTotal - this._displayTotalFrom) * r, this.requestUpdate(), n < 1 ? this._rafHandle = requestAnimationFrame(this._tick) : this._phase = "idle";
51
55
  };
52
56
  }
53
- createRenderRoot() {
54
- return this;
55
- }
56
57
  get data() {
57
58
  return this._data;
58
59
  }
@@ -68,11 +69,11 @@ var d = class extends n {
68
69
  _refreshTargets() {
69
70
  this._targetValues.clear();
70
71
  let e = this._data.segments;
71
- for (let t = 0; t < e.length; t++) this._targetValues.set(t, e[t].value);
72
- this._targetTotal = e.reduce((e, t) => e + t.value, 0);
72
+ for (let t = 0; t < e.length; t++) this._targetValues.set(t, c(e[t].value));
73
+ this._targetTotal = e.reduce((e, t) => e + c(t.value), 0);
73
74
  }
74
75
  connectedCallback() {
75
- super.connectedCallback(), this.setAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
76
+ super.connectedCallback(), this.setHostAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
76
77
  this._startAnimation(/* @__PURE__ */ new Map(), 0, 0, !0);
77
78
  }), this.addEventListener("mousemove", this._onMouseMove), this.addEventListener("mouseleave", this._onMouseLeave);
78
79
  }
@@ -89,23 +90,23 @@ var d = class extends n {
89
90
  this._phase = "animating", this._rafHandle = requestAnimationFrame(this._tick);
90
91
  }
91
92
  render() {
92
- let { segments: e } = this._data, n = e.reduce((e, t) => e + t.value, 0);
93
- if (e.length === 0 || n === 0) return r`<svg viewBox="0 0 ${this.size} ${this.size}" role="img" aria-label=${this.ariaLabel || "Donut chart"}></svg>`;
94
- let o = this.size / 2, s = this.size / 2, c = this.size / 2 - 4, d = c * this.inner, f = Math.max(this._displayTotal, .001), p = 2 * Math.PI, m = -Math.PI / 2 + this._progress * p, h = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * p, g = (e.length > 0 ? h / e.length : 0) / 2, _ = [], v = -Math.PI / 2;
95
- for (let n = 0; n < e.length; n++) {
96
- let r = e[n], i = this._displayValues.get(n) ?? 0, l = v, u = l + i / f * p, h = Math.min(u, m);
97
- if (h > l + .001) {
98
- let e = r.color ?? `var(--void-chart-series-${n % 6 + 1})`, i = l + g, u = Math.max(i + .001, h - g);
99
- _.push(a`
93
+ let { segments: e } = this._data, t = e.reduce((e, t) => e + c(t.value), 0);
94
+ if (e.length === 0 || t === 0) return r`<svg viewBox="0 0 ${this.size} ${this.size}" role="img" aria-label=${this.ariaLabel || "Donut chart"}></svg>`;
95
+ let o = this.size / 2, s = this.size / 2, l = this.size / 2 - 4, f = l * this.inner, p = Math.max(this._displayTotal, .001), m = 2 * Math.PI, h = -Math.PI / 2 + this._progress * m, g = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * m, _ = e.filter((e, t) => (this._displayValues.get(t) ?? 0) > 0).length, v = (_ > 1 ? g / e.length : 0) / 2, y = [], b = -Math.PI / 2;
96
+ for (let t = 0; t < e.length; t++) {
97
+ let r = e[t], i = this._displayValues.get(t) ?? 0, c = b, u = c + i / p * m, d = Math.min(u, h);
98
+ if (d > c + .001) {
99
+ let e = r.color ?? `var(--void-chart-series-${t % 6 + 1})`, i = c + v, u = _ === 1 && d >= c + m - 1e-9 ? i + m : Math.max(i + .001, d - v);
100
+ y.push(a`
100
101
  <path
101
102
  class="void-donut-chart-segment"
102
- d=${t(o, s, c, i, u, d)}
103
+ d=${n(o, s, l, i, u, f)}
103
104
  style="--segment-color: ${e}"
104
- data-segment-index=${n}
105
+ data-segment-index=${t}
105
106
  ></path>
106
107
  `);
107
108
  }
108
- v = u;
109
+ b = u;
109
110
  }
110
111
  return r`
111
112
  <svg
@@ -114,21 +115,21 @@ var d = class extends n {
114
115
  aria-label=${this.ariaLabel || "Donut chart"}
115
116
  data-phase=${this._phase}
116
117
  >
117
- ${_}
118
+ ${y}
118
119
  ${this.showTotal ? a`
119
120
  <g class="void-donut-chart-total">
120
- <text x=${o} y=${s} text-anchor="middle" dy="0.32em">${l(this._displayTotal)}</text>
121
+ <text x=${o} y=${s} text-anchor="middle" dy="0.32em">${u(this._displayTotal)}</text>
121
122
  </g>
122
123
  ` : i}
123
- ${this.showValues ? a`
124
+ ${this.showValue ? a`
124
125
  <g class="void-donut-chart-labels">
125
126
  ${e.map((e, t) => {
126
127
  let n = this._displayValues.get(t) ?? 0;
127
128
  if (n < .001) return i;
128
129
  let r = -Math.PI / 2;
129
- for (let e = 0; e < t; e++) r += (this._displayValues.get(e) ?? 0) / f * p;
130
- let l = r + n / f * p / 2, m = (c + d) / 2;
131
- return a`<text x=${o + m * Math.cos(l)} y=${s + m * Math.sin(l)} text-anchor="middle" dy="0.32em">${u(n)}</text>`;
130
+ for (let e = 0; e < t; e++) r += (this._displayValues.get(e) ?? 0) / p * m;
131
+ let c = r + n / p * m / 2, u = (l + f) / 2;
132
+ return a`<text x=${o + u * Math.cos(c)} y=${s + u * Math.sin(c)} text-anchor="middle" dy="0.32em">${d(n)}</text>`;
132
133
  })}
133
134
  </g>
134
135
  ` : i}
@@ -138,33 +139,33 @@ var d = class extends n {
138
139
  `;
139
140
  }
140
141
  _renderHoverTooltip(e, t) {
141
- let n = e[t], r = this._displayValues.get(t) ?? n.value, i = [...this._displayValues.values()].reduce((e, t) => e + t, 0) || this._targetTotal || 1, o = Math.round(r / i * 100), s = this.size / 2, c = this._hoverX < s ? this.size - 140 - 8 : 8, l = this._hoverY - 44 / 2;
142
- return l < 8 && (l = 8), l + 44 > this.size - 8 && (l = this.size - 44 - 8), a`
142
+ let n = e[t], r = this._displayValues.get(t) ?? c(n.value), i = [...this._displayValues.values()].reduce((e, t) => e + t, 0) || this._targetTotal || 1, o = Math.round(r / i * 100), s = this.size / 2, l = this._hoverX < s ? this.size - 140 - 8 : 8, u = this._hoverY - 44 / 2;
143
+ return u < 8 && (u = 8), u + 44 > this.size - 8 && (u = this.size - 44 - 8), a`
143
144
  <g class="void-donut-chart-hover" pointer-events="none">
144
145
  <rect
145
146
  class="void-donut-chart-tooltip-bg"
146
- x=${c} y=${l}
147
+ x=${l} y=${u}
147
148
  width=${140} height=${44}
148
149
  rx="6" ry="6"
149
150
  ></rect>
150
151
  <text
151
152
  class="void-donut-chart-tooltip-name"
152
- x=${c + 8}
153
- y=${l + 8 + 10}
153
+ x=${l + 8}
154
+ y=${u + 8 + 10}
154
155
  >${n.name}</text>
155
156
  <text
156
157
  class="void-donut-chart-tooltip-value"
157
- x=${c + 8}
158
- y=${l + 8 + 14 + 10}
159
- >${u(r)} <tspan class="void-donut-chart-tooltip-pct">(${o}%)</tspan></text>
158
+ x=${l + 8}
159
+ y=${u + 8 + 14 + 10}
160
+ >${d(r)} <tspan class="void-donut-chart-tooltip-pct">(${o}%)</tspan></text>
160
161
  </g>
161
162
  `;
162
163
  }
163
164
  };
164
- e([o({
165
+ t([o({
165
166
  type: Number,
166
167
  reflect: !0
167
- })], d.prototype, "size", void 0), e([o({ type: Number })], d.prototype, "inner", void 0), e([o({ converter: {
168
+ })], f.prototype, "size", void 0), t([o({ type: Number })], f.prototype, "inner", void 0), t([o({ converter: {
168
169
  fromAttribute(e) {
169
170
  if (e === null || e === "" || e === "true") return !0;
170
171
  if (e === "false") return !1;
@@ -174,14 +175,14 @@ e([o({
174
175
  toAttribute(e) {
175
176
  return e === !0 ? "" : e === !1 ? "false" : String(e);
176
177
  }
177
- } })], d.prototype, "gaps", void 0), e([o({ reflect: !0 })], d.prototype, "variant", void 0), e([o({
178
+ } })], f.prototype, "gaps", void 0), t([o({ reflect: !0 })], f.prototype, "variant", void 0), t([o({
178
179
  type: Boolean,
179
- attribute: "show-values",
180
+ attribute: "show-value",
180
181
  reflect: !0
181
- })], d.prototype, "showValues", void 0), e([o({
182
+ })], f.prototype, "showValue", void 0), t([o({
182
183
  type: Boolean,
183
184
  attribute: "show-total",
184
185
  reflect: !0
185
- })], d.prototype, "showTotal", void 0), e([o({ attribute: "aria-label" })], d.prototype, "ariaLabel", void 0), e([s()], d.prototype, "_phase", void 0), e([s()], d.prototype, "_hoverSegment", void 0), e([s()], d.prototype, "_hoverX", void 0), e([s()], d.prototype, "_hoverY", void 0), customElements.get("void-donut-chart") || customElements.define("void-donut-chart", d);
186
+ })], f.prototype, "showTotal", void 0), t([o({ attribute: "aria-label" })], f.prototype, "ariaLabel", void 0), t([s()], f.prototype, "_phase", void 0), t([s()], f.prototype, "_hoverSegment", void 0), t([s()], f.prototype, "_hoverX", void 0), t([s()], f.prototype, "_hoverY", void 0), customElements.get("void-donut-chart") || customElements.define("void-donut-chart", f);
186
187
  //#endregion
187
- export { d as VoidDonutChart };
188
+ export { f as VoidDonutChart };
@@ -1,26 +1,27 @@
1
- import { nothing } from 'lit';
2
- import { VoidElement } from '../base.js';
3
- /** Slide-out overlay panel for filters, detail views, and navigation menus; opens from any screen edge. */
4
- export declare class VoidDrawer extends VoidElement {
5
- open: boolean;
1
+ import { VoidModal } from '../modal.js';
2
+ /**
3
+ * Slide-out overlay panel for filters, detail views, and navigation menus; opens from any screen edge.
4
+ *
5
+ * A modal like `<void-dialog>`, with the same parts: `<void-drawer-title>` (required: it names the drawer), then
6
+ * optionally `<void-drawer-description>`, `<void-drawer-body>` and `<void-drawer-actions>`. The parts are the final
7
+ * DOM; the native `<dialog>` opened with `showModal()` (top layer, inert page, counted scroll lock) is internal to
8
+ * the drawer. Focus moves in on open and returns on close.
9
+ *
10
+ * @attr {string} aria-label - Accessible name when there is no `<void-drawer-title>` (prefer the title).
11
+ * @csspart surface - The native `<dialog>` that holds the parts (style its `::backdrop` through it).
12
+ * @csspart close - The close button.
13
+ * @fires {CustomEvent<{ reason: 'api' }>} void-open - The drawer opened.
14
+ * @fires {CustomEvent<{ reason: 'escape' | 'outside' | 'close-button' | 'form' | 'parent' | 'api' }>} void-close - The
15
+ * drawer is closing. Cancelable when the user caused it (`escape`, `outside`, `close-button`).
16
+ */
17
+ export declare class VoidDrawer extends VoidModal {
18
+ /** Screen edge the drawer slides in from: `right` (default), `left`, `top` or `bottom`. */
6
19
  side: 'left' | 'right' | 'top' | 'bottom';
20
+ /** Width of a side drawer, or height of a top or bottom one: `sm`, `md` (default) or `lg`. */
7
21
  size: 'sm' | 'md' | 'lg';
8
- heading: string;
9
- closable: boolean;
10
- private _userContent;
11
- private _didSetup;
12
- connectedCallback(): void;
13
- disconnectedCallback(): void;
14
- protected updated(changed: Map<string, unknown>): void;
15
- private _handleKeydown;
16
- private _handleBackdropClick;
17
- private _handleBackdropKeydown;
18
- private _close;
19
- render(): typeof nothing | import('lit').TemplateResult<1>;
20
22
  }
21
23
  declare global {
22
24
  interface HTMLElementTagNameMap {
23
25
  'void-drawer': VoidDrawer;
24
26
  }
25
27
  }
26
- //# sourceMappingURL=drawer.d.ts.map
@@ -1,62 +1,18 @@
1
- import { VoidElement as e } from "../base.js";
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";
1
+ import { t as e } from "../chunks/decorate-CaYbmmmm.js";
2
+ import { t } from "../chunks/modal-D_YVy2vg.js";
3
+ import { property as n } from "lit/decorators.js";
5
4
  //#region src/components/drawer.ts
6
- var a = class extends e {
5
+ var r = class extends t {
7
6
  constructor(...e) {
8
- super(...e), this.open = !1, this.side = "right", this.size = "md", this.heading = "", this.closable = !0, this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
9
- e.key === "Escape" && this.open && this.closable && this._close();
10
- }, this._handleBackdropClick = () => {
11
- this.closable && this._close();
12
- }, this._handleBackdropKeydown = (e) => {
13
- e.key === "Escape" && this.closable && this._close();
14
- };
15
- }
16
- connectedCallback() {
17
- super.connectedCallback(), this.setAttribute("role", "dialog"), this.setAttribute("aria-modal", "true"), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.addEventListener("keydown", this._handleKeydown);
18
- }
19
- disconnectedCallback() {
20
- super.disconnectedCallback(), this.removeEventListener("keydown", this._handleKeydown);
21
- }
22
- updated(e) {
23
- if (super.updated(e), e.has("heading") && this.heading ? this.setAttribute("aria-label", this.heading) : e.has("heading") && !this.heading && this.removeAttribute("aria-label"), !this._didSetup) {
24
- this._didSetup = !0;
25
- let e = this.querySelector(".void-drawer-body");
26
- if (e) for (let t of this._userContent) e.appendChild(t);
27
- }
28
- }
29
- _close() {
30
- this.open = !1, this.dispatchEvent(new CustomEvent("void-close", {
31
- bubbles: !0,
32
- composed: !0
33
- }));
34
- }
35
- render() {
36
- return this.open ? n`
37
- <div class="void-drawer-backdrop" @click="${this._handleBackdropClick}" @keydown="${this._handleBackdropKeydown}"></div>
38
- <div class="void-drawer-panel">
39
- <div class="void-drawer-header">
40
- ${this.heading ? n`<span class="void-drawer-heading">${this.heading}</span>` : r}
41
- ${this.closable ? n`<button type="button" class="void-drawer-close" aria-label="Close" @click="${this._close}">&times;</button>` : r}
42
- </div>
43
- <div class="void-drawer-body"></div>
44
- </div>
45
- ` : r;
7
+ super(...e), this.side = "right", this.size = "md";
46
8
  }
47
9
  };
48
- t([i({
49
- type: Boolean,
50
- reflect: !0
51
- })], a.prototype, "open", void 0), t([i({
10
+ e([n({
52
11
  type: String,
53
12
  reflect: !0
54
- })], a.prototype, "side", void 0), t([i({
13
+ })], r.prototype, "side", void 0), e([n({
55
14
  type: String,
56
15
  reflect: !0
57
- })], a.prototype, "size", void 0), t([i({ type: String })], a.prototype, "heading", void 0), t([i({
58
- type: Boolean,
59
- reflect: !0
60
- })], a.prototype, "closable", void 0), customElements.get("void-drawer") || customElements.define("void-drawer", a);
16
+ })], r.prototype, "size", void 0), customElements.get("void-drawer") || customElements.define("void-drawer", r);
61
17
  //#endregion
62
- export { a as VoidDrawer };
18
+ export { r as VoidDrawer };
@@ -1,24 +1,80 @@
1
1
  import { VoidElement } from '../base.js';
2
- /** Trigger-anchored action menu for table row actions, toolbar overflow menus, and context menus. */
2
+ import { KeyboardActivation } from '../keyboard-activation.js';
3
+ import { OverlayController } from '../overlay.js';
4
+ import { PartsController } from '../parts.js';
5
+ /**
6
+ * Trigger-anchored action menu for table row actions, toolbar overflow menus, and context menus.
7
+ *
8
+ * Two parts: `<void-dropdown-menu-trigger>` around the control that opens the menu (one element: a
9
+ * `<void-button>`, a `<button>`), and `<void-dropdown-menu-content>` holding the `<void-dropdown-menu-item>`s
10
+ * (and `<void-dropdown-menu-separator>`s between groups). The parts are the final DOM.
11
+ *
12
+ * Follows the WAI-ARIA menu button pattern: the trigger gets `aria-haspopup="menu"`, `aria-expanded` and
13
+ * `aria-controls`; the panel is a `role="menu"` of `menuitem`s that take focus one at a time. Keyboard on the
14
+ * trigger: Enter, Space and ArrowDown open the menu and focus the first item, ArrowUp opens it and focuses the
15
+ * last item. In the menu: ArrowDown and ArrowUp move between items (wrapping, skipping disabled ones), Home
16
+ * and End jump to the first and last, typing characters jumps to the next item starting with them, Enter or
17
+ * Space activate the item. Choosing an item closes the menu and returns focus to the trigger (add `keep-open`
18
+ * to an item, for example a checkbox-style toggle, to keep it open); Escape closes it and returns focus to the
19
+ * trigger; Tab or a press outside closes it. The panel is shown in the top layer and placed with CSS anchor
20
+ * positioning, flipping at viewport edges.
21
+ *
22
+ * @fires {CustomEvent<{ reason: 'trigger' | 'keyboard' | 'api' }>} void-open - The menu opened.
23
+ * @fires {CustomEvent<{ reason: 'trigger' | 'select' | 'escape' | 'outside' | 'blur' | 'parent' | 'api' }>} void-close -
24
+ * The menu is closing. Cancelable when the user caused it (every reason but `parent` and `api`).
25
+ */
3
26
  export declare class VoidDropdownMenu extends VoidElement {
27
+ /** Whether the menu is open. A click on the trigger toggles it; choosing an item, Escape, Tab or a press outside closes it. */
4
28
  open: boolean;
5
- position: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
6
- private _triggerEl;
7
- private _panel;
29
+ /** Side of the trigger the menu opens on; it flips to the opposite side when there is no room. */
30
+ side: 'top' | 'bottom' | 'left' | 'right';
31
+ /** Alignment with the trigger along that side. */
32
+ align: 'start' | 'center' | 'end';
33
+ protected readonly _parts: PartsController;
34
+ /** Which item receives focus when the menu opens from the keyboard. */
35
+ private _focusLast;
36
+ private readonly _typeahead;
37
+ protected readonly _overlay: OverlayController;
38
+ /** The control inside the trigger part (gets the menu-button ARIA). */
39
+ private get _triggerEl();
40
+ private _content;
41
+ /** Enabled items of this menu (not of a menu nested inside it). */
42
+ private _items;
43
+ /** The content is a `role="menu"` in the top layer, named by the trigger's control; separators are separators. */
44
+ private _wire;
8
45
  connectedCallback(): void;
9
46
  disconnectedCallback(): void;
47
+ /** Opens the menu and focuses its first or last item (or moves there when it is already open). */
48
+ private _openAndFocus;
10
49
  private _handleTriggerClick;
11
- private _handleOutsideClick;
50
+ private _handleSelect;
51
+ /**
52
+ * Keys on the trigger and inside the menu; the host's own listener, so nothing outside the menu is affected.
53
+ * Escape is handled by the shared overlay stack (it closes only the topmost overlay).
54
+ */
12
55
  private _handleKeydown;
13
56
  }
57
+ /**
58
+ * An item of a `<void-dropdown-menu>`, inside its `<void-dropdown-menu-content>`. Choosing it (click, Enter or
59
+ * Space) dispatches `void-select` and closes the menu, unless it has `keep-open`.
60
+ *
61
+ * @fires {CustomEvent<{ item: VoidDropdownMenuItem; value: string }>} void-select - The item was chosen.
62
+ */
14
63
  export declare class VoidDropdownMenuItem extends VoidElement {
64
+ /** What the item stands for, passed as `detail.value` of `void-select` (empty when not set). */
65
+ value: string;
66
+ /** Enter and Space fire a real `click`, as on a native button. */
67
+ protected readonly _activation: KeyboardActivation;
68
+ /** Dim the item, skip it in keyboard navigation and stop it firing `void-select`. */
15
69
  disabled: boolean;
70
+ /** Draw the item in the error colour, for an action that deletes or cannot be undone. */
16
71
  destructive: boolean;
72
+ /** Keep the menu open when this item is chosen (checkbox-style or repeatable items). */
73
+ keepOpen: boolean;
17
74
  connectedCallback(): void;
18
75
  disconnectedCallback(): void;
19
76
  updated(changed: Map<string, unknown>): void;
20
77
  private _handleClick;
21
- private _handleKeydown;
22
78
  }
23
79
  declare global {
24
80
  interface HTMLElementTagNameMap {
@@ -26,4 +82,3 @@ declare global {
26
82
  'void-dropdown-menu-item': VoidDropdownMenuItem;
27
83
  }
28
84
  }
29
- //# sourceMappingURL=dropdown-menu.d.ts.map
@@ -1,43 +1,126 @@
1
- import { VoidElement as e } from "../base.js";
1
+ import { t as e } from "../chunks/base-CMruMbxC.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { property as n } from "lit/decorators.js";
3
+ import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
+ import { i as r, n as i } from "../chunks/parts-D30c8OoG.js";
5
+ import { i as a, r as o, t as s } from "../chunks/keyboard-MQpfTX5I.js";
6
+ import { t as c } from "../chunks/overlay-BywGMcDW.js";
7
+ import { property as l } from "lit/decorators.js";
4
8
  //#region src/components/dropdown-menu.ts
5
- var r = class extends e {
9
+ var u = class extends e {
6
10
  constructor(...e) {
7
- super(...e), this.open = !1, this.position = "bottom-start", this._triggerEl = null, this._panel = null, this._handleTriggerClick = () => {
8
- this.open = !this.open;
9
- }, this._handleOutsideClick = (e) => {
10
- this.open && !this.contains(e.target) && (this.open = !1);
11
+ super(...e), this.open = !1, this.side = "bottom", this.align = "start", this._parts = new i(this, {
12
+ tags: [
13
+ "void-dropdown-menu-trigger",
14
+ "void-dropdown-menu-content",
15
+ "void-dropdown-menu-item",
16
+ "void-dropdown-menu-separator"
17
+ ],
18
+ onChange: () => {
19
+ this._wire(), this.requestUpdate();
20
+ }
21
+ }), this._focusLast = !1, this._typeahead = new s(), this._overlay = new c(this, {
22
+ kind: "menu",
23
+ surface: () => this._content(),
24
+ isOpen: () => this.open,
25
+ setOpen: (e) => {
26
+ this.open = e;
27
+ },
28
+ trigger: () => this._triggerEl,
29
+ haspopup: "menu",
30
+ anchor: () => this,
31
+ hostStyle: (e, t) => this.setHostStyle(e, t),
32
+ placement: () => ({
33
+ side: this.side,
34
+ align: this.align
35
+ }),
36
+ attr: (e, t, n) => this._parts.set(e, t, n),
37
+ style: (e, t, n) => this._parts.style(e, t, n),
38
+ initialFocus: (e) => {
39
+ let t = this._focusLast;
40
+ if (this._focusLast = !1, e === "api") return !1;
41
+ let n = this._items();
42
+ return (t ? n[n.length - 1] : n[0]) ?? null;
43
+ }
44
+ }), this._handleTriggerClick = (e) => {
45
+ let t = this._parts.one("void-dropdown-menu-trigger");
46
+ t && t.contains(e.target) && this._overlay.toggle("trigger");
47
+ }, this._handleSelect = (e) => {
48
+ let t = e.target;
49
+ !(t instanceof f) || !this._parts.owns(t) || t.keepOpen || this._overlay.requestClose("select");
11
50
  }, this._handleKeydown = (e) => {
12
- if (e.key === "Escape" && this.open && (this.open = !1, this._triggerEl?.focus()), this.open && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
13
- e.preventDefault();
14
- let t = Array.from(this.querySelectorAll("void-dropdown-menu-item:not([disabled])"));
15
- if (!t.length) return;
16
- let n = t.indexOf(document.activeElement);
17
- e.key === "ArrowDown" ? (t[n + 1] ?? t[0]).focus() : (t[n - 1] ?? t[t.length - 1]).focus();
51
+ if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.isComposing) return;
52
+ let t = e.target, n = this._triggerEl;
53
+ if (n && this._parts.one("void-dropdown-menu-trigger")?.contains(t)) {
54
+ e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), this._openAndFocus(e.key === "ArrowDown" ? "first" : "last")) : (e.key === "Enter" || e.key === " ") && !d(n, t) && (e.preventDefault(), this.open ? this._overlay.requestClose("trigger") : this._openAndFocus("first"));
55
+ return;
18
56
  }
57
+ let r = this._content(), i = t.closest("void-dropdown-menu-item");
58
+ if (!this.open || !r?.contains(t) || !i) return;
59
+ let s = this._items(), c = s.indexOf(i), l = s.map(() => !1), u;
60
+ if (e.key === "ArrowDown") u = s[a(l, c, 1)];
61
+ else if (e.key === "ArrowUp") u = s[a(l, c, -1)];
62
+ else if (e.key === "Home") u = s[0];
63
+ else if (e.key === "End") u = s[s.length - 1];
64
+ else if (e.key === "Tab") {
65
+ this._overlay.requestClose("blur");
66
+ return;
67
+ } else if (o(e) && e.key !== " ") {
68
+ let t = this._typeahead.match(e.key, s.map((e) => e.textContent ?? ""), l, c);
69
+ t >= 0 && (e.preventDefault(), s[t].focus());
70
+ return;
71
+ } else return;
72
+ e.preventDefault(), u?.focus();
19
73
  };
20
74
  }
75
+ get _triggerEl() {
76
+ return r(this._parts.one("void-dropdown-menu-trigger"));
77
+ }
78
+ _content() {
79
+ return this._parts.one("void-dropdown-menu-content");
80
+ }
81
+ _items() {
82
+ return this._parts.all("void-dropdown-menu-item").filter((e) => !e.hasAttribute("disabled"));
83
+ }
84
+ _wire() {
85
+ let e = this._content();
86
+ if (!e) return;
87
+ let t = this._triggerEl;
88
+ this._parts.set(e, "popover", "manual"), this._parts.set(e, "role", "menu"), this._parts.id(e, "void-dropdown-menu-content"), this._parts.set(e, "aria-labelledby", t ? this._parts.id(t, "void-dropdown-menu-trigger") : null);
89
+ for (let e of this._parts.all("void-dropdown-menu-separator")) this._parts.provide(e, "role", "separator");
90
+ }
21
91
  connectedCallback() {
22
- super.connectedCallback(), this._triggerEl = this.children[0] ?? null, this._panel = document.createElement("div"), this._panel.className = "void-dropdown-menu-panel", this._panel.setAttribute("role", "menu");
23
- let e = Array.from(this.childNodes);
24
- for (let t of e) t !== this._triggerEl && this._panel.appendChild(t);
25
- this.appendChild(this._panel), this._triggerEl?.addEventListener("click", this._handleTriggerClick), document.addEventListener("mousedown", this._handleOutsideClick), document.addEventListener("keydown", this._handleKeydown);
92
+ super.connectedCallback(), this.addEventListener("click", this._handleTriggerClick), this.addEventListener("keydown", this._handleKeydown), this.addEventListener("void-select", this._handleSelect);
26
93
  }
27
94
  disconnectedCallback() {
28
- super.disconnectedCallback(), this._triggerEl?.removeEventListener("click", this._handleTriggerClick), document.removeEventListener("mousedown", this._handleOutsideClick), document.removeEventListener("keydown", this._handleKeydown);
95
+ super.disconnectedCallback(), this.removeEventListener("click", this._handleTriggerClick), this.removeEventListener("keydown", this._handleKeydown), this.removeEventListener("void-select", this._handleSelect), this._typeahead.reset();
96
+ }
97
+ _openAndFocus(e) {
98
+ if (this.open) {
99
+ let t = this._items();
100
+ (e === "first" ? t[0] : t[t.length - 1])?.focus();
101
+ return;
102
+ }
103
+ this._focusLast = e === "last", this._overlay.requestOpen("keyboard");
29
104
  }
30
105
  };
31
- t([n({
106
+ t([l({
32
107
  type: Boolean,
33
108
  reflect: !0
34
- })], r.prototype, "open", void 0), t([n({
109
+ })], u.prototype, "open", void 0), t([l({
110
+ type: String,
111
+ reflect: !0
112
+ })], u.prototype, "side", void 0), t([l({
35
113
  type: String,
36
114
  reflect: !0
37
- })], r.prototype, "position", void 0), customElements.get("void-dropdown-menu") || customElements.define("void-dropdown-menu", r);
38
- var i = class extends e {
115
+ })], u.prototype, "align", void 0);
116
+ function d(e, t) {
117
+ let n = t.closest("button, a[href], input, summary");
118
+ return !!n && e.contains(n);
119
+ }
120
+ customElements.get("void-dropdown-menu") || customElements.define("void-dropdown-menu", u);
121
+ var f = class extends e {
39
122
  constructor(...e) {
40
- super(...e), this.disabled = !1, this.destructive = !1, this._handleClick = (e) => {
123
+ super(...e), this.value = "", this._activation = new n(this, { disabled: () => this.disabled }), this.disabled = !1, this.destructive = !1, this.keepOpen = !1, this._handleClick = (e) => {
41
124
  if (this.disabled) {
42
125
  e.stopImmediatePropagation();
43
126
  return;
@@ -45,28 +128,36 @@ var i = class extends e {
45
128
  this.dispatchEvent(new CustomEvent("void-select", {
46
129
  bubbles: !0,
47
130
  composed: !0,
48
- detail: { item: this }
131
+ detail: {
132
+ item: this,
133
+ value: this.value
134
+ }
49
135
  }));
50
- }, this._handleKeydown = (e) => {
51
- (e.key === "Enter" || e.key === " ") && !this.disabled && (e.preventDefault(), this._handleClick(e));
52
136
  };
53
137
  }
54
138
  connectedCallback() {
55
- super.connectedCallback(), this.setAttribute("role", "menuitem"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
139
+ super.connectedCallback(), this.setHostAttribute("role", "menuitem"), this.setHostAttribute("tabindex", "-1"), this.addEventListener("click", this._handleClick);
56
140
  }
57
141
  disconnectedCallback() {
58
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
142
+ super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
59
143
  }
60
144
  updated(e) {
61
- e.has("disabled") && (this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-disabled", String(this.disabled)));
145
+ e.has("disabled") && this.setHostAttribute("aria-disabled", this.disabled ? "true" : null);
62
146
  }
63
147
  };
64
- t([n({
148
+ t([l({
149
+ type: String,
150
+ reflect: !0
151
+ })], f.prototype, "value", void 0), t([l({
65
152
  type: Boolean,
66
153
  reflect: !0
67
- })], i.prototype, "disabled", void 0), t([n({
154
+ })], f.prototype, "disabled", void 0), t([l({
68
155
  type: Boolean,
69
156
  reflect: !0
70
- })], i.prototype, "destructive", void 0), customElements.get("void-dropdown-menu-item") || customElements.define("void-dropdown-menu-item", i);
157
+ })], f.prototype, "destructive", void 0), t([l({
158
+ type: Boolean,
159
+ reflect: !0,
160
+ attribute: "keep-open"
161
+ })], f.prototype, "keepOpen", void 0), customElements.get("void-dropdown-menu-item") || customElements.define("void-dropdown-menu-item", f);
71
162
  //#endregion
72
- export { r as VoidDropdownMenu, i as VoidDropdownMenuItem };
163
+ export { u as VoidDropdownMenu, f as VoidDropdownMenuItem };