@editora/ui-core 0.1.19 → 0.1.21

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 (313) hide show
  1. package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
  2. package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
  3. package/dist/accordion.cjs.js +3 -3
  4. package/dist/accordion.esm.js +39 -62
  5. package/dist/alert-dialog.cjs.js +19 -19
  6. package/dist/alert-dialog.esm.js +69 -87
  7. package/dist/alert.cjs.js +1 -1
  8. package/dist/alert.esm.js +4 -7
  9. package/dist/anchor.cjs.js +2 -2
  10. package/dist/anchor.esm.js +3 -3
  11. package/dist/animated-beam.cjs.js +83 -83
  12. package/dist/animated-beam.esm.js +250 -277
  13. package/dist/animated-list.cjs.js +4 -4
  14. package/dist/animated-list.esm.js +47 -61
  15. package/dist/animated-text.cjs.js +2 -2
  16. package/dist/animated-text.esm.js +13 -24
  17. package/dist/app-header.cjs.js +3 -3
  18. package/dist/app-header.esm.js +11 -13
  19. package/dist/aspect-ratio.cjs.js +1 -1
  20. package/dist/aspect-ratio.esm.js +4 -7
  21. package/dist/avatar.cjs.js +1 -1
  22. package/dist/avatar.esm.js +7 -13
  23. package/dist/badge.cjs.js +1 -1
  24. package/dist/badge.esm.js +4 -7
  25. package/dist/block-controls.cjs.js +2 -2
  26. package/dist/block-controls.esm.js +19 -35
  27. package/dist/box.cjs.js +1 -1
  28. package/dist/box.esm.js +8 -15
  29. package/dist/breadcrumb.cjs.js +2 -2
  30. package/dist/breadcrumb.esm.js +20 -37
  31. package/dist/button.cjs.js +1 -521
  32. package/dist/button.esm.js +2 -671
  33. package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
  34. package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
  35. package/dist/calendar.cjs.js +1 -1
  36. package/dist/calendar.esm.js +8 -9
  37. package/dist/card.cjs.js +4 -4
  38. package/dist/card.esm.js +13 -19
  39. package/dist/chart.cjs.js +64 -64
  40. package/dist/chart.esm.js +223 -254
  41. package/dist/checkbox.cjs.js +1 -1
  42. package/dist/checkbox.esm.js +2 -3
  43. package/dist/collapsible.cjs.js +1 -1
  44. package/dist/collapsible.esm.js +5 -9
  45. package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
  46. package/dist/collection.cjs.js +1 -1
  47. package/dist/collection.esm.js +30 -29
  48. package/dist/color-picker.cjs.js +10 -10
  49. package/dist/color-picker.esm.js +190 -253
  50. package/dist/combobox.cjs.js +13 -13
  51. package/dist/combobox.esm.js +93 -126
  52. package/dist/command-palette.cjs.js +3 -3
  53. package/dist/command-palette.esm.js +19 -30
  54. package/dist/command.cjs.js +4 -4
  55. package/dist/command.esm.js +41 -53
  56. package/dist/components/ui-collection.d.ts.map +1 -1
  57. package/dist/components/ui-multi-select.d.ts.map +1 -1
  58. package/dist/components/ui-orbiter.d.ts.map +1 -1
  59. package/dist/components/ui-portal.d.ts.map +1 -1
  60. package/dist/components/ui-positioner.d.ts.map +1 -1
  61. package/dist/components/ui-skeleton.d.ts.map +1 -1
  62. package/dist/components/ui-sortable.d.ts +8 -0
  63. package/dist/components/ui-sortable.d.ts.map +1 -1
  64. package/dist/components/ui-split-button.d.ts +1 -0
  65. package/dist/components/ui-split-button.d.ts.map +1 -1
  66. package/dist/components/ui-tabs.d.ts.map +1 -1
  67. package/dist/components/ui-textarea.d.ts.map +1 -1
  68. package/dist/components/ui-time-picker.d.ts.map +1 -1
  69. package/dist/container.cjs.js +2 -2
  70. package/dist/container.esm.js +2 -3
  71. package/dist/context-menu.cjs.js +8 -8
  72. package/dist/context-menu.esm.js +157 -219
  73. package/dist/control-group.cjs.js +1 -1
  74. package/dist/control-group.esm.js +2 -3
  75. package/dist/data-table.cjs.js +4 -4
  76. package/dist/data-table.esm.js +299 -381
  77. package/dist/date-field.cjs.js +3 -3
  78. package/dist/date-field.esm.js +68 -80
  79. package/dist/date-picker.cjs.js +9 -9
  80. package/dist/date-picker.esm.js +69 -97
  81. package/dist/date-range-picker.cjs.js +3 -3
  82. package/dist/date-range-picker.esm.js +32 -56
  83. package/dist/date-range-time-picker.cjs.js +9 -9
  84. package/dist/date-range-time-picker.esm.js +111 -140
  85. package/dist/date-time-picker.cjs.js +7 -7
  86. package/dist/date-time-picker.esm.js +115 -147
  87. package/dist/date-time-utils-Dmost5Ee.js +1 -0
  88. package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
  89. package/dist/description.cjs.js +1 -1
  90. package/dist/description.esm.js +3 -5
  91. package/dist/dialog.cjs.js +12 -12
  92. package/dist/dialog.esm.js +44 -63
  93. package/dist/direction-provider.cjs.js +1 -1
  94. package/dist/direction-provider.esm.js +2 -3
  95. package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
  96. package/dist/dismissable-layer-DNfrKA20.js +1 -0
  97. package/dist/dismissable-layer.cjs.js +2 -2
  98. package/dist/dismissable-layer.esm.js +4 -6
  99. package/dist/dock.cjs.js +5 -5
  100. package/dist/dock.esm.js +134 -155
  101. package/dist/drawer.cjs.js +2 -2
  102. package/dist/drawer.esm.js +18 -35
  103. package/dist/dropdown.cjs.js +2 -2
  104. package/dist/dropdown.esm.js +119 -149
  105. package/dist/dropzone.cjs.js +1 -1
  106. package/dist/dropzone.esm.js +0 -1
  107. package/dist/empty-state.cjs.js +1 -1
  108. package/dist/empty-state.esm.js +1 -1
  109. package/dist/field-error.cjs.js +1 -1
  110. package/dist/field-error.esm.js +3 -5
  111. package/dist/field.cjs.js +5 -5
  112. package/dist/field.esm.js +27 -34
  113. package/dist/fieldset.cjs.js +4 -4
  114. package/dist/fieldset.esm.js +19 -24
  115. package/dist/file-upload.cjs.js +4 -4
  116. package/dist/file-upload.esm.js +69 -93
  117. package/dist/flex.cjs.js +1 -1
  118. package/dist/flex.esm.js +5 -9
  119. package/dist/floating-toolbar.cjs.js +4 -4
  120. package/dist/floating-toolbar.esm.js +60 -85
  121. package/dist/focus-scope-Bwug2gDv.js +1 -0
  122. package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
  123. package/dist/focus-scope.cjs.js +2 -2
  124. package/dist/focus-scope.esm.js +15 -20
  125. package/dist/form.cjs.js +2 -2
  126. package/dist/form.esm.js +26 -53
  127. package/dist/gantt.cjs.js +43 -43
  128. package/dist/gantt.esm.js +295 -322
  129. package/dist/grid.cjs.js +1 -1
  130. package/dist/grid.esm.js +5 -9
  131. package/dist/hover-card.cjs.js +4 -4
  132. package/dist/hover-card.esm.js +22 -28
  133. package/dist/icon-cloud.cjs.js +7 -7
  134. package/dist/icon-cloud.esm.js +48 -62
  135. package/dist/icon.cjs.js +1 -1
  136. package/dist/icon.esm.js +2 -4
  137. package/dist/index.cjs.js +1 -1
  138. package/dist/index.esm.js +378 -390
  139. package/dist/inline-edit.cjs.js +11 -11
  140. package/dist/inline-edit.esm.js +32 -36
  141. package/dist/input.cjs.js +17 -17
  142. package/dist/input.esm.js +50 -63
  143. package/dist/label.cjs.js +2 -2
  144. package/dist/label.esm.js +8 -17
  145. package/dist/layout.cjs.js +2 -2
  146. package/dist/layout.esm.js +20 -26
  147. package/dist/listbox-B6QgECax.js +46 -0
  148. package/dist/listbox-DJamVeFj.mjs +200 -0
  149. package/dist/listbox.cjs.js +1 -1
  150. package/dist/listbox.esm.js +2 -4
  151. package/dist/marquee.cjs.js +5 -5
  152. package/dist/marquee.esm.js +33 -50
  153. package/dist/masonry-grid.cjs.js +1 -1
  154. package/dist/masonry-grid.esm.js +5 -9
  155. package/dist/menu.cjs.js +3 -3
  156. package/dist/menu.esm.js +106 -126
  157. package/dist/menubar.cjs.js +5 -5
  158. package/dist/menubar.esm.js +118 -164
  159. package/dist/meter.cjs.js +2 -2
  160. package/dist/meter.esm.js +4 -4
  161. package/dist/multi-select.cjs.js +5 -5
  162. package/dist/multi-select.esm.js +125 -137
  163. package/dist/navigation-menu.cjs.js +4 -4
  164. package/dist/navigation-menu.esm.js +44 -55
  165. package/dist/number-field.cjs.js +2 -2
  166. package/dist/number-field.esm.js +73 -98
  167. package/dist/number-ticker.cjs.js +3 -3
  168. package/dist/number-ticker.esm.js +22 -43
  169. package/dist/odometer.cjs.js +1 -1
  170. package/dist/odometer.esm.js +5 -9
  171. package/dist/orbiter.cjs.js +13 -13
  172. package/dist/orbiter.esm.js +79 -90
  173. package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
  174. package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
  175. package/dist/pagination.cjs.js +2 -2
  176. package/dist/pagination.esm.js +14 -18
  177. package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
  178. package/dist/panel-group-CaD0_KQf.js +36 -0
  179. package/dist/panel-group.cjs.js +1 -1
  180. package/dist/panel-group.esm.js +2 -5
  181. package/dist/panel.cjs.js +4 -4
  182. package/dist/panel.esm.js +8 -10
  183. package/dist/password-field.cjs.js +9 -9
  184. package/dist/password-field.esm.js +62 -82
  185. package/dist/pin-input.cjs.js +3 -3
  186. package/dist/pin-input.esm.js +33 -39
  187. package/dist/placement-grid.cjs.js +4 -4
  188. package/dist/placement-grid.esm.js +108 -131
  189. package/dist/plugin-panel.cjs.js +7 -7
  190. package/dist/plugin-panel.esm.js +13 -15
  191. package/dist/popover.cjs.js +2 -2
  192. package/dist/popover.esm.js +21 -31
  193. package/dist/portal-DgpQ3Jo1.js +1 -0
  194. package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
  195. package/dist/portal.cjs.js +3 -3
  196. package/dist/portal.esm.js +20 -28
  197. package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
  198. package/dist/positioner-D_fqyx_j.js +1 -0
  199. package/dist/positioner.cjs.js +2 -2
  200. package/dist/positioner.esm.js +22 -28
  201. package/dist/presence.cjs.js +1 -1
  202. package/dist/presence.esm.js +7 -13
  203. package/dist/primitives/auto-scroll.d.ts +9 -0
  204. package/dist/primitives/auto-scroll.d.ts.map +1 -0
  205. package/dist/primitives/selector.d.ts +4 -0
  206. package/dist/primitives/selector.d.ts.map +1 -0
  207. package/dist/progress.cjs.js +1 -1
  208. package/dist/progress.esm.js +5 -9
  209. package/dist/quick-actions.cjs.js +6 -6
  210. package/dist/quick-actions.esm.js +52 -62
  211. package/dist/radio-group.cjs.js +13 -13
  212. package/dist/radio-group.esm.js +39 -51
  213. package/dist/radio.cjs.js +1 -1
  214. package/dist/radio.esm.js +5 -9
  215. package/dist/rating.cjs.js +1 -1
  216. package/dist/rating.esm.js +12 -23
  217. package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
  218. package/dist/roving-focus-group.cjs.js +1 -1
  219. package/dist/roving-focus-group.esm.js +3 -5
  220. package/dist/runtime-CTaOSmBj.js +1 -0
  221. package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
  222. package/dist/runtime.cjs.js +1 -1
  223. package/dist/runtime.esm.js +6 -6
  224. package/dist/scroll-area.cjs.js +3 -3
  225. package/dist/scroll-area.esm.js +38 -46
  226. package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
  227. package/dist/section.cjs.js +1 -1
  228. package/dist/section.esm.js +1 -1
  229. package/dist/select.cjs.js +7 -7
  230. package/dist/select.esm.js +67 -97
  231. package/dist/selection-popup.cjs.js +1 -1
  232. package/dist/selection-popup.esm.js +8 -15
  233. package/dist/selector-BvAh35ve.js +1 -0
  234. package/dist/selector-WI8pD7YO.mjs +18 -0
  235. package/dist/separator.cjs.js +1 -1
  236. package/dist/separator.esm.js +1 -1
  237. package/dist/sidebar.cjs.js +18 -18
  238. package/dist/sidebar.esm.js +117 -139
  239. package/dist/skeleton.cjs.js +11 -11
  240. package/dist/skeleton.esm.js +27 -24
  241. package/dist/slider.cjs.js +1 -1
  242. package/dist/slider.esm.js +6 -11
  243. package/dist/slot.cjs.js +4 -4
  244. package/dist/slot.esm.js +16 -19
  245. package/dist/sortable.cjs.js +79 -65
  246. package/dist/sortable.esm.js +714 -734
  247. package/dist/spinning-text.cjs.js +12 -12
  248. package/dist/spinning-text.esm.js +80 -92
  249. package/dist/split-button.cjs.js +4 -4
  250. package/dist/split-button.esm.js +77 -62
  251. package/dist/splitter.cjs.js +1 -1
  252. package/dist/splitter.esm.js +1 -1
  253. package/dist/stepper.cjs.js +8 -8
  254. package/dist/stepper.esm.js +32 -52
  255. package/dist/switch.cjs.js +7 -7
  256. package/dist/switch.esm.js +23 -31
  257. package/dist/table.cjs.js +2 -2
  258. package/dist/table.esm.js +46 -56
  259. package/dist/tabs.cjs.js +8 -8
  260. package/dist/tabs.esm.js +89 -109
  261. package/dist/tags-input.cjs.js +4 -4
  262. package/dist/tags-input.esm.js +45 -62
  263. package/dist/textarea.cjs.js +10 -10
  264. package/dist/textarea.esm.js +49 -52
  265. package/dist/time-field.cjs.js +4 -4
  266. package/dist/time-field.esm.js +70 -84
  267. package/dist/time-picker.cjs.js +22 -22
  268. package/dist/time-picker.esm.js +88 -110
  269. package/dist/timeline.cjs.js +1 -1
  270. package/dist/timeline.esm.js +3 -5
  271. package/dist/toast.cjs.js +2 -2
  272. package/dist/toast.esm.js +33 -47
  273. package/dist/toggle-group.cjs.js +6 -6
  274. package/dist/toggle-group.esm.js +85 -105
  275. package/dist/toggle.cjs.js +1 -1
  276. package/dist/toggle.esm.js +3 -5
  277. package/dist/toolbar.cjs.js +1 -1
  278. package/dist/toolbar.esm.js +13 -24
  279. package/dist/tooltip.cjs.js +2 -2
  280. package/dist/tooltip.esm.js +31 -42
  281. package/dist/transfer-list.cjs.js +31 -31
  282. package/dist/transfer-list.esm.js +114 -127
  283. package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
  284. package/dist/tree-Dx_kv_ih.js +39 -0
  285. package/dist/tree-item.cjs.js +2 -2
  286. package/dist/tree-item.esm.js +2 -3
  287. package/dist/tree.cjs.js +1 -1
  288. package/dist/tree.esm.js +2 -5
  289. package/dist/ui-button-Q0GNNWKC.mjs +665 -0
  290. package/dist/ui-button-rXQOS9QJ.js +521 -0
  291. package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
  292. package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
  293. package/dist/visually-hidden.cjs.js +1 -1
  294. package/dist/visually-hidden.esm.js +1 -1
  295. package/dist/wizard.cjs.js +14 -14
  296. package/dist/wizard.esm.js +85 -105
  297. package/package.json +2 -2
  298. package/dist/date-time-utils-66480de4.js +0 -1
  299. package/dist/date-time-utils-a2c7af25.mjs +0 -307
  300. package/dist/dismissable-layer-193e3bed.js +0 -1
  301. package/dist/focus-scope-2b12b4e7.js +0 -1
  302. package/dist/listbox-308789a0.mjs +0 -210
  303. package/dist/listbox-ef2f708e.js +0 -46
  304. package/dist/panel-group-40254cdd.js +0 -36
  305. package/dist/portal-c69756c0.js +0 -1
  306. package/dist/positioner-33529bb8.js +0 -1
  307. package/dist/runtime-3f13807b.js +0 -1
  308. package/dist/tree-0a7a8d05.js +0 -39
  309. /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
  310. /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
  311. /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
  312. /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
  313. /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
@@ -1,6 +1,5 @@
1
- import { E as I } from "./ElementBase-909688f3.mjs";
2
- import { O as m } from "./overlayManager-5bbd4dc3.mjs";
3
- import "./scroll-lock-31da444f.mjs";
1
+ import { E as I } from "./ElementBase-YlTLMsGk.mjs";
2
+ import { O as m } from "./overlayManager-BJjU1VA8.mjs";
4
3
  function F(i) {
5
4
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => i()) : window.setTimeout(i, 16);
6
5
  }
@@ -536,8 +535,7 @@ const E = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
536
535
  }
537
536
  `;
538
537
  function w(i, e) {
539
- if (i == null)
540
- return e;
538
+ if (i == null) return e;
541
539
  const t = i.trim().toLowerCase();
542
540
  return t !== "false" && t !== "0" && t !== "off";
543
541
  }
@@ -548,9 +546,8 @@ function C(i, e) {
548
546
  return i === "top" || i === "bottom" || i === "left" || i === "right" ? i : i === "start" ? e === "rtl" ? "right" : "left" : i === "end" ? e === "rtl" ? "left" : "right" : "left";
549
547
  }
550
548
  function A(i, e) {
551
- var r;
552
549
  const t = i.querySelector(`[slot="${e}"]`);
553
- return t ? ((r = t.textContent) == null ? void 0 : r.trim().length) !== 0 || t.children.length > 0 : !1;
550
+ return t ? t.textContent?.trim().length !== 0 || t.children.length > 0 : !1;
554
551
  }
555
552
  function L() {
556
553
  return typeof window < "u" && typeof document < "u";
@@ -700,16 +697,13 @@ class T extends I {
700
697
  return this.state === "loading" && this.lockWhileLoading;
701
698
  }
702
699
  _isNodeInsideDrawer(e) {
703
- if (!e)
704
- return !1;
700
+ if (!e) return !1;
705
701
  const t = this._getPanel();
706
702
  return t && t.contains(e) ? !0 : this.contains(e);
707
703
  }
708
704
  _isFocusable(e) {
709
- if (!e || !e.isConnected || e.disabled || e.matches('[inert], [aria-hidden="true"]') || e.closest('[inert], [aria-hidden="true"]'))
710
- return !1;
711
- if (!L())
712
- return !0;
705
+ if (!e || !e.isConnected || e.disabled || e.matches('[inert], [aria-hidden="true"]') || e.closest('[inert], [aria-hidden="true"]')) return !1;
706
+ if (!L()) return !0;
713
707
  const t = window.getComputedStyle(e);
714
708
  return t.display !== "none" && t.visibility !== "hidden";
715
709
  }
@@ -747,8 +741,7 @@ class T extends I {
747
741
  }
748
742
  _syncLiveUi() {
749
743
  const e = this.hasAttribute("open"), t = this._getOverlay(), r = this._getPanel(), s = this._getHeader(), a = this.root.querySelector(".close-btn");
750
- if (t && t.setAttribute("aria-hidden", e ? "false" : "true"), !r)
751
- return;
744
+ if (t && t.setAttribute("aria-hidden", e ? "false" : "true"), !r) return;
752
745
  const o = this._resolvedSide();
753
746
  r.classList.remove("side-left", "side-right", "side-top", "side-bottom"), r.classList.add(`side-${o}`);
754
747
  const n = this.state === "loading";
@@ -763,11 +756,9 @@ class T extends I {
763
756
  k ? r.setAttribute("aria-label", k) : r.removeAttribute("aria-label"), c ? r.setAttribute("aria-labelledby", c) : r.removeAttribute("aria-labelledby"), d.length ? r.setAttribute("aria-describedby", d.join(" ")) : r.removeAttribute("aria-describedby");
764
757
  }
765
758
  _focusInitial() {
766
- if (!this._isOpen)
767
- return;
759
+ if (!this._isOpen) return;
768
760
  const e = this._getPanel();
769
- if (!e)
770
- return;
761
+ if (!e) return;
771
762
  const t = this.getAttribute("initial-focus") || "";
772
763
  if (t) {
773
764
  const o = this.querySelector(t) || e.querySelector(t);
@@ -795,8 +786,7 @@ class T extends I {
795
786
  }
796
787
  }
797
788
  _ensureFocusTrap() {
798
- if (!this._isOpen || !this._isTopMost())
799
- return;
789
+ if (!this._isOpen || !this._isTopMost()) return;
800
790
  const e = document.activeElement;
801
791
  this._isNodeInsideDrawer(e) || this._focusInitial();
802
792
  }
@@ -807,10 +797,8 @@ class T extends I {
807
797
  }
808
798
  }
809
799
  _canRestoreFocus(e) {
810
- if (!e || !e.isConnected || e.disabled)
811
- return !1;
812
- if (!L())
813
- return !0;
800
+ if (!e || !e.isConnected || e.disabled) return !1;
801
+ if (!L()) return !0;
814
802
  const t = window.getComputedStyle(e);
815
803
  return t.display !== "none" && t.visibility !== "hidden";
816
804
  }
@@ -860,8 +848,7 @@ class T extends I {
860
848
  this._restoreFocusEl = null, this._closeReason = "programmatic", this._scheduleRestoreFocus(r);
861
849
  }
862
850
  _requestClose(e) {
863
- if (!this._isOpen || this._isInteractionLocked())
864
- return;
851
+ if (!this._isOpen || this._isInteractionLocked()) return;
865
852
  const t = new CustomEvent("request-close", {
866
853
  detail: { reason: e },
867
854
  bubbles: !0,
@@ -879,8 +866,7 @@ class T extends I {
879
866
  }
880
867
  _onRootClick(e) {
881
868
  const t = e.target;
882
- if (!t || !this._isOpen)
883
- return;
869
+ if (!t || !this._isOpen) return;
884
870
  if (t.closest(".close-btn")) {
885
871
  this._requestClose("button");
886
872
  return;
@@ -889,8 +875,7 @@ class T extends I {
889
875
  }
890
876
  _handleTab(e) {
891
877
  const t = this._getPanel();
892
- if (!t)
893
- return;
878
+ if (!t) return;
894
879
  const r = this._collectFocusable();
895
880
  if (!r.length) {
896
881
  e.preventDefault(), t.focus();
@@ -920,8 +905,7 @@ class T extends I {
920
905
  _onDocumentKeyDown(e) {
921
906
  if (!(!this._isOpen || !this._isTopMost())) {
922
907
  if (e.key === "Escape") {
923
- if (!this.dismissible || !this.closeOnEsc || this._isInteractionLocked())
924
- return;
908
+ if (!this.dismissible || !this.closeOnEsc || this._isInteractionLocked()) return;
925
909
  e.preventDefault(), e.stopPropagation(), this._requestClose("escape");
926
910
  return;
927
911
  }
@@ -929,8 +913,7 @@ class T extends I {
929
913
  }
930
914
  }
931
915
  _onDocumentFocusIn(e) {
932
- if (!this._isOpen || !this._isTopMost())
933
- return;
916
+ if (!this._isOpen || !this._isTopMost()) return;
934
917
  const t = e.target, r = this._getPanel(), s = typeof e.composedPath == "function" ? e.composedPath() : [];
935
918
  t && this._isNodeInsideDrawer(t) || s.includes(this) || r && s.includes(r) || this._scheduleFocusInitial();
936
919
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("./ElementBase-1b301e7f.js"),y=require("./menu-item-styles-83ad1e22.js"),l=['[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]',".item","[data-menu-item]"].join(", "),k=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("./ElementBase-EV6mVBUV.js"),y=require("./menu-item-styles-CbNUEwP2.js"),l=['[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]',".item","[data-menu-item]"].join(", "),k=`
2
2
  :host {
3
3
  --ui-dropdown-bg: var(
4
4
  --ui-dropdown-menu-bg,
@@ -488,7 +488,7 @@
488
488
  color: HighlightText;
489
489
  }
490
490
  }
491
- `;function A(i){return i==="top"||i==="left"||i==="right"?i:"bottom"}function S(i){const e=(i||"").trim().toLowerCase();return e==="sm"||e==="1"||e==="compact"?"sm":e==="lg"||e==="3"||e==="comfortable"?"lg":"md"}function C(i){const e=(i||"").trim().toLowerCase();return!e||e==="default"?null:e==="none"?"0px":e==="sm"?"8px":e==="md"?"12px":e==="lg"||e==="large"?"16px":e==="full"||e==="pill"?"999px":e==="square"?"6px":e==="soft"||e==="rounded"?"14px":/^\d+(\.\d+)?$/.test(e)?`${e}px`:/^\d+(\.\d+)?(px|rem|em|%)$/.test(e)?e:i}function h(i,e){return i.getAttribute(e)||""}function f(i,e){if(i==null)return e;const r=i.trim().toLowerCase();return r!=="false"&&r!=="0"&&r!=="off"}function p(){return typeof window<"u"&&typeof document<"u"}function b(i){return i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"||i.disabled===!0}function E(i){return(i.getAttribute("aria-label")||i.textContent||"").trim()}function g(i){if(i)try{i.focus({preventScroll:!0})}catch{i.focus()}}function I(i,e){const r=i.offsetTop,t=r+i.offsetHeight,o=e.scrollTop,a=o+e.clientHeight;if(r<o){e.scrollTop=r;return}t>a&&(e.scrollTop=Math.max(0,t-e.clientHeight))}function T(i){return w(i)}function w(i){if(i.nodeType===Node.TEXT_NODE)return document.createTextNode(i.textContent||"");if(!(i instanceof HTMLElement))return i.cloneNode(!1);const e=i.tagName==="UI-BOX",r=document.createElement(e?"div":i.tagName.toLowerCase());return Array.from(i.attributes).forEach(t=>{t.name!=="slot"&&r.setAttribute(t.name,t.value)}),Array.from(i.childNodes).forEach(t=>{r.appendChild(w(t))}),r}function M(i,e,r){for(let t=e+r;t>=0&&t<i.length;t+=r)if(!b(i[t]))return t;return-1}function O(i,e,r){if(!e)return null;const t=i.filter(a=>!b(a));if(!t.length)return null;const o=r?t.indexOf(r):-1;for(let a=1;a<=t.length;a+=1){const n=t[(o+a+t.length)%t.length];if(E(n).toLowerCase().startsWith(e))return n}return null}const P=new Set(["variant","density","shape","elevation","tone","size","radius"]),D=new Set(["aria-label","aria-labelledby","aria-describedby"]),F=["--ui-dropdown-bg","--ui-dropdown-color","--ui-dropdown-muted","--ui-dropdown-border-color","--ui-dropdown-border","--ui-dropdown-shadow","--ui-dropdown-radius","--ui-dropdown-padding","--ui-dropdown-min-width","--ui-dropdown-gap","--ui-dropdown-ring","--ui-dropdown-backdrop","--ui-dropdown-item-radius","--ui-dropdown-item-font-weight","--ui-dropdown-item-hover-bg","--ui-dropdown-item-active-bg","--ui-dropdown-item-checked-bg","--ui-dropdown-item-active-color","--ui-dropdown-duration","--ui-dropdown-easing"];class _ extends x.ElementBase{constructor(){super(),this._isOpen=!1,this._panelEl=null,this._portalEl=null,this._restoreFocusEl=null,this._typeaheadBuffer="",this._typeaheadTimer=null,this._placement="bottom",this._openListenersBound=!1,this._openFrame=0,this._checkboxState=new Map,this._radioState=new Map,this._menuId=`ui-dropdown-menu-${Math.random().toString(36).slice(2,10)}`,this._triggerId=`ui-dropdown-trigger-${Math.random().toString(36).slice(2,10)}`,this._onHostClick=this._onHostClick.bind(this),this._onHostKeyDown=this._onHostKeyDown.bind(this),this._onDocumentPointerDown=this._onDocumentPointerDown.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["open","disabled","placement","variant","size","density","radius","shape","elevation","tone","close-on-select","close-on-scroll","typeahead","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onHostClick),this.addEventListener("keydown",this._onHostKeyDown),this.root.addEventListener("slotchange",this._onSlotChange),this._syncOpenState(),this._syncTriggerA11y()}disconnectedCallback(){this.removeEventListener("click",this._onHostClick),this.removeEventListener("keydown",this._onHostKeyDown),this.root.removeEventListener("slotchange",this._onSlotChange),this._teardownOpenListeners(),this._openFrame&&cancelAnimationFrame(this._openFrame),super.disconnectedCallback()}attributeChangedCallback(e,r,t){if(r!==t){if(e==="open"){this._syncOpenState();return}if(!(e==="close-on-select"||e==="close-on-scroll"||e==="typeahead")){if(e==="disabled"){this.hasAttribute("disabled")&&this._isOpen&&this.close("disabled"),this._syncTriggerA11y();return}if(this._isOpen&&(e==="placement"||P.has(e))){this._syncMenuPresentation(),this._schedulePanelSync();return}this._isOpen&&D.has(e)&&this._syncMenuA11y()}}}open(){this.hasAttribute("disabled")||this.hasAttribute("open")||this.setAttribute("open","")}close(e="programmatic"){!this.hasAttribute("open")&&!this._isOpen||this._close(e)}closeDropdown(e="programmatic"){if(!(!this.hasAttribute("open")&&!this._isOpen)){if(e==="programmatic"){this.close(e);return}this._requestClose(e)}}toggle(){if(this._isOpen){this._requestClose("trigger");return}this.open()}get closeOnSelect(){return f(this.getAttribute("close-on-select"),!0)}set closeOnSelect(e){this.setAttribute("close-on-select",e?"true":"false")}get closeOnScroll(){return f(this.getAttribute("close-on-scroll"),!0)}set closeOnScroll(e){this.setAttribute("close-on-scroll",e?"true":"false")}get typeahead(){return f(this.getAttribute("typeahead"),!0)}set typeahead(e){this.setAttribute("typeahead",e?"true":"false")}_getTrigger(){return this.querySelector('[slot="trigger"]')}_getContentSource(){return this.querySelector('[slot="content"]')}_getMenu(){return this._portalEl}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.getAttribute("aria-hidden")==="true")return!1;if(!p())return!0;const r=window.getComputedStyle(e);return r.display!=="none"&&r.visibility!=="hidden"}_currentFocusedItem(){const e=this.root.activeElement||document.activeElement;return e instanceof HTMLElement?e.closest(l):null}_queryItems(e=!0){const r=this._getMenu();if(!r)return[];const t=Array.from(r.querySelectorAll(l));return e?t:t.filter(o=>!b(o))}_requestClose(e){if(!this._isOpen)return;const r=new CustomEvent("request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r);const t=new CustomEvent("ui-request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t),!(r.defaultPrevented||t.defaultPrevented)&&this.close(e)}_close(e,r={}){if(this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=0,this._isOpen=!1,this._teardownOpenListeners(),this.hasAttribute("open")&&this.removeAttribute("open"),this._syncControlState(),this._syncTriggerA11y(),this._clearActiveItem(),this._clearMenuContent(),this._resetTypeahead(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:e}})),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:e}})),r.restoreFocus!==!1){const t=this._getTrigger();t&&this._isFocusable(t)?g(t):this._restoreFocusEl&&this._isFocusable(this._restoreFocusEl)&&g(this._restoreFocusEl)}this._restoreFocusEl=null}_syncOpenState(){const e=this.hasAttribute("open")&&!this.hasAttribute("disabled");if(e===this._isOpen){this._syncControlState(),this._syncTriggerA11y(),e&&(this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync());return}if(e){this._isOpen=!0,this._restoreFocusEl=document.activeElement,this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._syncControlState(),this._syncTriggerA11y(),this._attachOpenListeners(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0}})),this._schedulePanelSync("first");return}this._close("programmatic",{restoreFocus:!1})}_attachOpenListeners(){this._openListenersBound||(document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!0)}_teardownOpenListeners(){this._openListenersBound&&(document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!1)}_syncTriggerA11y(){const e=this._getTrigger();if(e){if(e.id||(e.id=this._triggerId),e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded",this._isOpen?"true":"false"),this._isOpen?e.setAttribute("aria-controls",this._menuId):e.removeAttribute("aria-controls"),this.hasAttribute("disabled")){e.setAttribute("aria-disabled","true"),e.setAttribute("tabindex","-1");return}e.getAttribute("aria-disabled")==="true"&&e.removeAttribute("aria-disabled"),e.getAttribute("tabindex")==="-1"&&e.removeAttribute("tabindex")}}_renderMenuContent(){const e=this._getMenu();if(!e)return;e.replaceChildren();const r=this._getContentSource();if(r&&e.appendChild(T(r)),!e.querySelector(l)){const t=document.createElement("div");t.className="empty-state",t.textContent="No items",e.appendChild(t)}this._syncMenuItemSemantics()}_syncMenuItemSemantics(){this._queryItems(!0).forEach((e,r)=>{e.getAttribute("role")||e.setAttribute("role","menuitem"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.dataset.sourceIndex=String(r),e.hasAttribute("disabled")&&e.getAttribute("aria-disabled")!=="true"&&e.setAttribute("aria-disabled","true");const t=e.getAttribute("role");(t==="menuitemcheckbox"||t==="menuitemradio")&&!e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false"),this._applyStoredItemState(e,r)})}_clearMenuContent(){const e=this._getMenu();e&&e.replaceChildren()}_applyStoredItemState(e,r){const t=e.getAttribute("role");if(t==="menuitemcheckbox"){if(!this._checkboxState.has(r))return;const n=this._checkboxState.get(r)===!0;e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked");return}if(t!=="menuitemradio")return;const o=e.getAttribute("data-group")||e.getAttribute("name")||"__default__";if(!this._radioState.has(o))return;const a=this._radioState.get(o)===r;e.setAttribute("aria-checked",a?"true":"false"),e.setAttribute("data-state",a?"checked":"unchecked")}_syncMenuPresentation(){const e=this._getMenu();if(!e)return;const r=p()?window.getComputedStyle(this):null;r&&F.forEach(c=>{const m=r.getPropertyValue(c).trim();m?e.style.setProperty(c,m):e.style.removeProperty(c)});const t=h(this,"variant"),o=S(this.getAttribute("size")||this.getAttribute("density")),a=h(this,"density"),n=h(this,"shape"),u=h(this,"elevation"),s=h(this,"tone"),d=C(this.getAttribute("radius")||n||null);if(t&&t!=="default"?e.setAttribute("data-variant",t):e.removeAttribute("data-variant"),o!=="md"?e.setAttribute("data-size",o):e.removeAttribute("data-size"),a&&a!=="default"?e.setAttribute("data-density",a):e.removeAttribute("data-density"),n&&n!=="default"?e.setAttribute("data-shape",n):e.removeAttribute("data-shape"),u&&u!=="default"?e.setAttribute("data-elevation",u):e.removeAttribute("data-elevation"),s&&s!=="default"&&s!=="brand"?e.setAttribute("data-tone",s):e.removeAttribute("data-tone"),d){e.style.setProperty("--ui-dropdown-radius",d),e.style.setProperty("--ui-dropdown-item-radius",d==="999px"?"999px":`max(0px, calc(${d} - 2px))`);return}e.style.removeProperty("--ui-dropdown-radius"),e.style.removeProperty("--ui-dropdown-item-radius")}_syncMenuA11y(){const e=this._getMenu();if(!e)return;const r=this._getTrigger(),t=this.getAttribute("aria-label")||"",o=this.getAttribute("aria-labelledby")||"",a=this.getAttribute("aria-describedby")||"",n=o||(!t&&(r!=null&&r.id)?r.id:"");t?e.setAttribute("aria-label",t):e.removeAttribute("aria-label"),n?e.setAttribute("aria-labelledby",n):e.removeAttribute("aria-labelledby"),a?e.setAttribute("aria-describedby",a):e.removeAttribute("aria-describedby")}_syncControlState(){const e=this._panelEl,r=this._getMenu();!e||!r||(e.hidden=!this._isOpen,e.setAttribute("data-placement",this._placement))}_schedulePanelSync(e){this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=requestAnimationFrame(()=>{this._openFrame=0,this._syncPanelState(),e==="first"&&this._focusFirstItem(),e==="last"&&this._focusLastItem()})}_syncPanelState(){const e=this._panelEl;!e||!this._isOpen||(this._placement=this._resolvePlacement(),e.setAttribute("data-placement",this._placement),this.style.setProperty("--ui-dropdown-available-width",`${Math.max(0,Math.floor(this._availableWidth(this._placement)))}px`),this.style.setProperty("--ui-dropdown-available-height",`${Math.max(0,Math.floor(this._availableHeight(this._placement)))}px`))}_availableWidth(e){const r=this._getTrigger();if(!r||!p())return 380;const t=r.getBoundingClientRect(),o=window.innerWidth||document.documentElement.clientWidth||0;return e==="left"?t.left-12:e==="right"?o-t.right-12:o-t.left-12}_availableHeight(e){const r=this._getTrigger();if(!r||!p())return 440;const t=r.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight||0;return e==="top"?t.top-12:o-t.bottom-12}_resolvePlacement(){const e=A(this.getAttribute("placement")),r=this._getTrigger(),t=this._getMenu();if(!r||!t||!p())return e;const o=r.getBoundingClientRect(),a=window.innerWidth||document.documentElement.clientWidth||0,n=window.innerHeight||document.documentElement.clientHeight||0,u=Math.max(0,n-o.bottom-12),s=Math.max(0,o.top-12),d=Math.max(0,a-o.right-12),c=Math.max(0,o.left-12),m=Math.min(Math.max(t.scrollHeight,t.offsetHeight)+4,320),v=Math.min(Math.max(t.scrollWidth,t.offsetWidth)+4,360);return e==="top"?s>=m||s>u?"top":"bottom":e==="left"?c>=v||c>d?"left":"right":e==="right"?d>=v||d>=c?"right":"left":u>=m||u>=s?"bottom":"top"}_clearActiveItem(){this._queryItems(!0).forEach(e=>e.removeAttribute("data-active"))}_setActiveItem(e,r={}){if(this._clearActiveItem(),!!e&&(e.setAttribute("data-active","true"),r.focus&&g(e),r.scroll)){const t=this._getMenu();t&&I(e,t)}}_focusFirstItem(){const e=this._queryItems(!1);this._setActiveItem(e[0]||null,{focus:!0,scroll:!0})}_focusLastItem(){const e=this._queryItems(!1);this._setActiveItem(e[e.length-1]||null,{focus:!0,scroll:!0})}_moveFocus(e){const r=this._queryItems(!0);if(!r.length)return;const t=this._currentFocusedItem()||this._queryItems(!0).find(n=>n.getAttribute("data-active")==="true")||null,o=t?r.indexOf(t):e>0?-1:r.length,a=M(r,o,e);if(a>=0){this._setActiveItem(r[a],{focus:!0,scroll:!0});return}e>0?this._focusFirstItem():this._focusLastItem()}_resetTypeahead(){this._typeaheadBuffer="",this._typeaheadTimer!=null&&(window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null)}_isTypeaheadKey(e){return e.ctrlKey||e.metaKey||e.altKey?!1:e.key.length===1&&/\S/.test(e.key)}_handleTypeahead(e){if(!this.typeahead||!this._isTypeaheadKey(e))return!1;const r=e.key.toLowerCase();this._typeaheadBuffer=`${this._typeaheadBuffer}${r}`.slice(0,24),this._typeaheadTimer!=null&&window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=window.setTimeout(()=>this._resetTypeahead(),460);const t=O(this._queryItems(!0),this._typeaheadBuffer,this._currentFocusedItem());return t?(this._setActiveItem(t,{focus:!0,scroll:!0}),e.preventDefault(),!0):!1}_querySourceItems(){const e=this._getContentSource();return e?Array.from(e.querySelectorAll(l)):[]}_applySelectionBehavior(e){const r=e.getAttribute("role"),t=Number(e.dataset.sourceIndex||"-1");if(r==="menuitemcheckbox"){const n=e.getAttribute("aria-checked")!=="true";e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked"),t>=0&&this._checkboxState.set(t,n);return}if(r!=="menuitemradio")return;const a=e.getAttribute("data-group")||e.getAttribute("name")||""||"__default__";t>=0&&this._radioState.set(a,t),this._queryItems(!0).filter(n=>n.getAttribute("role")==="menuitemradio").forEach(n=>{const u=n.getAttribute("data-group")||n.getAttribute("name")||"";if(a&&(u||"__default__")!==a)return;const s=n===e;n.setAttribute("aria-checked",s?"true":"false"),n.setAttribute("data-state",s?"checked":"unchecked")})}_findMenuItemFromEvent(e){const r=typeof e.composedPath=="function"?e.composedPath():[];for(const o of r)if(o instanceof HTMLElement&&o.matches(l))return o;const t=e.target;return t instanceof HTMLElement?t.closest(l):null}_isEventInsideTrigger(e){const r=this._getTrigger();return r?(typeof e.composedPath=="function"?e.composedPath():[]).includes(r):!1}_emitSelect(e){var t;const r={value:e.getAttribute("data-value")||e.getAttribute("value")||void 0,label:e.getAttribute("aria-label")||((t=e.textContent)==null?void 0:t.trim())||void 0,checked:e.getAttribute("aria-checked")==="true",item:e};this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:r}))}_onHostClick(e){var t;if(this.hasAttribute("disabled"))return;const r=this._isOpen?this._findMenuItemFromEvent(e):null;if(r&&((t=this._getMenu())!=null&&t.contains(r))&&!b(r)){this._applySelectionBehavior(r),this._setActiveItem(r,{focus:!0,scroll:!0}),this._emitSelect(r),this.closeOnSelect&&this._requestClose("select");return}if(this._isEventInsideTrigger(e)){if(e.preventDefault(),this._isOpen){this._requestClose("trigger");return}this.open()}}_onHostKeyDown(e){var r;if(!this._isOpen){if(!this._isEventInsideTrigger(e)||!["ArrowDown","ArrowUp","Enter"," "].includes(e.key))return;e.preventDefault(),this.open(),this._schedulePanelSync(e.key==="ArrowUp"?"last":"first");return}if(!this._handleTypeahead(e)){if(e.key==="Escape"){e.preventDefault(),this._requestClose("escape");return}if(e.key==="ArrowDown"){e.preventDefault(),this._moveFocus(1);return}if(e.key==="ArrowUp"){e.preventDefault(),this._moveFocus(-1);return}if(e.key==="Home"){e.preventDefault(),this._focusFirstItem();return}if(e.key==="End"){e.preventDefault(),this._focusLastItem();return}if(e.key==="Tab"){this._requestClose("tab");return}if(e.key==="Enter"||e.key===" "){const t=this._currentFocusedItem();if(!t||!((r=this._getMenu())!=null&&r.contains(t))||b(t))return;e.preventDefault(),t.click()}}}_onDocumentPointerDown(e){!this._isOpen||(typeof e.composedPath=="function"?e.composedPath():[]).includes(this)||this._requestClose("outside")}_onSlotChange(){this._syncTriggerA11y(),this._isOpen&&(this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync())}render(){this.setContent(`
491
+ `;function A(i){return i==="top"||i==="left"||i==="right"?i:"bottom"}function S(i){const e=(i||"").trim().toLowerCase();return e==="sm"||e==="1"||e==="compact"?"sm":e==="lg"||e==="3"||e==="comfortable"?"lg":"md"}function C(i){const e=(i||"").trim().toLowerCase();return!e||e==="default"?null:e==="none"?"0px":e==="sm"?"8px":e==="md"?"12px":e==="lg"||e==="large"?"16px":e==="full"||e==="pill"?"999px":e==="square"?"6px":e==="soft"||e==="rounded"?"14px":/^\d+(\.\d+)?$/.test(e)?`${e}px`:/^\d+(\.\d+)?(px|rem|em|%)$/.test(e)?e:i}function h(i,e){return i.getAttribute(e)||""}function f(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function p(){return typeof window<"u"&&typeof document<"u"}function b(i){return i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"||i.disabled===!0}function E(i){return(i.getAttribute("aria-label")||i.textContent||"").trim()}function g(i){if(i)try{i.focus({preventScroll:!0})}catch{i.focus()}}function I(i,e){const t=i.offsetTop,r=t+i.offsetHeight,o=e.scrollTop,a=o+e.clientHeight;if(t<o){e.scrollTop=t;return}r>a&&(e.scrollTop=Math.max(0,r-e.clientHeight))}function T(i){return w(i)}function w(i){if(i.nodeType===Node.TEXT_NODE)return document.createTextNode(i.textContent||"");if(!(i instanceof HTMLElement))return i.cloneNode(!1);const e=i.tagName==="UI-BOX",t=document.createElement(e?"div":i.tagName.toLowerCase());return Array.from(i.attributes).forEach(r=>{r.name!=="slot"&&t.setAttribute(r.name,r.value)}),Array.from(i.childNodes).forEach(r=>{t.appendChild(w(r))}),t}function M(i,e,t){for(let r=e+t;r>=0&&r<i.length;r+=t)if(!b(i[r]))return r;return-1}function O(i,e,t){if(!e)return null;const r=i.filter(a=>!b(a));if(!r.length)return null;const o=t?r.indexOf(t):-1;for(let a=1;a<=r.length;a+=1){const n=r[(o+a+r.length)%r.length];if(E(n).toLowerCase().startsWith(e))return n}return null}const P=new Set(["variant","density","shape","elevation","tone","size","radius"]),D=new Set(["aria-label","aria-labelledby","aria-describedby"]),F=["--ui-dropdown-bg","--ui-dropdown-color","--ui-dropdown-muted","--ui-dropdown-border-color","--ui-dropdown-border","--ui-dropdown-shadow","--ui-dropdown-radius","--ui-dropdown-padding","--ui-dropdown-min-width","--ui-dropdown-gap","--ui-dropdown-ring","--ui-dropdown-backdrop","--ui-dropdown-item-radius","--ui-dropdown-item-font-weight","--ui-dropdown-item-hover-bg","--ui-dropdown-item-active-bg","--ui-dropdown-item-checked-bg","--ui-dropdown-item-active-color","--ui-dropdown-duration","--ui-dropdown-easing"];class _ extends x.ElementBase{constructor(){super(),this._isOpen=!1,this._panelEl=null,this._portalEl=null,this._restoreFocusEl=null,this._typeaheadBuffer="",this._typeaheadTimer=null,this._placement="bottom",this._openListenersBound=!1,this._openFrame=0,this._checkboxState=new Map,this._radioState=new Map,this._menuId=`ui-dropdown-menu-${Math.random().toString(36).slice(2,10)}`,this._triggerId=`ui-dropdown-trigger-${Math.random().toString(36).slice(2,10)}`,this._onHostClick=this._onHostClick.bind(this),this._onHostKeyDown=this._onHostKeyDown.bind(this),this._onDocumentPointerDown=this._onDocumentPointerDown.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["open","disabled","placement","variant","size","density","radius","shape","elevation","tone","close-on-select","close-on-scroll","typeahead","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onHostClick),this.addEventListener("keydown",this._onHostKeyDown),this.root.addEventListener("slotchange",this._onSlotChange),this._syncOpenState(),this._syncTriggerA11y()}disconnectedCallback(){this.removeEventListener("click",this._onHostClick),this.removeEventListener("keydown",this._onHostKeyDown),this.root.removeEventListener("slotchange",this._onSlotChange),this._teardownOpenListeners(),this._openFrame&&cancelAnimationFrame(this._openFrame),super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if(!(e==="close-on-select"||e==="close-on-scroll"||e==="typeahead")){if(e==="disabled"){this.hasAttribute("disabled")&&this._isOpen&&this.close("disabled"),this._syncTriggerA11y();return}if(this._isOpen&&(e==="placement"||P.has(e))){this._syncMenuPresentation(),this._schedulePanelSync();return}this._isOpen&&D.has(e)&&this._syncMenuA11y()}}}open(){this.hasAttribute("disabled")||this.hasAttribute("open")||this.setAttribute("open","")}close(e="programmatic"){!this.hasAttribute("open")&&!this._isOpen||this._close(e)}closeDropdown(e="programmatic"){if(!(!this.hasAttribute("open")&&!this._isOpen)){if(e==="programmatic"){this.close(e);return}this._requestClose(e)}}toggle(){if(this._isOpen){this._requestClose("trigger");return}this.open()}get closeOnSelect(){return f(this.getAttribute("close-on-select"),!0)}set closeOnSelect(e){this.setAttribute("close-on-select",e?"true":"false")}get closeOnScroll(){return f(this.getAttribute("close-on-scroll"),!0)}set closeOnScroll(e){this.setAttribute("close-on-scroll",e?"true":"false")}get typeahead(){return f(this.getAttribute("typeahead"),!0)}set typeahead(e){this.setAttribute("typeahead",e?"true":"false")}_getTrigger(){return this.querySelector('[slot="trigger"]')}_getContentSource(){return this.querySelector('[slot="content"]')}_getMenu(){return this._portalEl}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.getAttribute("aria-hidden")==="true")return!1;if(!p())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_currentFocusedItem(){const e=this.root.activeElement||document.activeElement;return e instanceof HTMLElement?e.closest(l):null}_queryItems(e=!0){const t=this._getMenu();if(!t)return[];const r=Array.from(t.querySelectorAll(l));return e?r:r.filter(o=>!b(o))}_requestClose(e){if(!this._isOpen)return;const t=new CustomEvent("request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t);const r=new CustomEvent("ui-request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r),!(t.defaultPrevented||r.defaultPrevented)&&this.close(e)}_close(e,t={}){if(this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=0,this._isOpen=!1,this._teardownOpenListeners(),this.hasAttribute("open")&&this.removeAttribute("open"),this._syncControlState(),this._syncTriggerA11y(),this._clearActiveItem(),this._clearMenuContent(),this._resetTypeahead(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:e}})),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:e}})),t.restoreFocus!==!1){const r=this._getTrigger();r&&this._isFocusable(r)?g(r):this._restoreFocusEl&&this._isFocusable(this._restoreFocusEl)&&g(this._restoreFocusEl)}this._restoreFocusEl=null}_syncOpenState(){const e=this.hasAttribute("open")&&!this.hasAttribute("disabled");if(e===this._isOpen){this._syncControlState(),this._syncTriggerA11y(),e&&(this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync());return}if(e){this._isOpen=!0,this._restoreFocusEl=document.activeElement,this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._syncControlState(),this._syncTriggerA11y(),this._attachOpenListeners(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0}})),this._schedulePanelSync("first");return}this._close("programmatic",{restoreFocus:!1})}_attachOpenListeners(){this._openListenersBound||(document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!0)}_teardownOpenListeners(){this._openListenersBound&&(document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!1)}_syncTriggerA11y(){const e=this._getTrigger();if(e){if(e.id||(e.id=this._triggerId),e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded",this._isOpen?"true":"false"),this._isOpen?e.setAttribute("aria-controls",this._menuId):e.removeAttribute("aria-controls"),this.hasAttribute("disabled")){e.setAttribute("aria-disabled","true"),e.setAttribute("tabindex","-1");return}e.getAttribute("aria-disabled")==="true"&&e.removeAttribute("aria-disabled"),e.getAttribute("tabindex")==="-1"&&e.removeAttribute("tabindex")}}_renderMenuContent(){const e=this._getMenu();if(!e)return;e.replaceChildren();const t=this._getContentSource();if(t&&e.appendChild(T(t)),!e.querySelector(l)){const r=document.createElement("div");r.className="empty-state",r.textContent="No items",e.appendChild(r)}this._syncMenuItemSemantics()}_syncMenuItemSemantics(){this._queryItems(!0).forEach((e,t)=>{e.getAttribute("role")||e.setAttribute("role","menuitem"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.dataset.sourceIndex=String(t),e.hasAttribute("disabled")&&e.getAttribute("aria-disabled")!=="true"&&e.setAttribute("aria-disabled","true");const r=e.getAttribute("role");(r==="menuitemcheckbox"||r==="menuitemradio")&&!e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false"),this._applyStoredItemState(e,t)})}_clearMenuContent(){const e=this._getMenu();e&&e.replaceChildren()}_applyStoredItemState(e,t){const r=e.getAttribute("role");if(r==="menuitemcheckbox"){if(!this._checkboxState.has(t))return;const n=this._checkboxState.get(t)===!0;e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked");return}if(r!=="menuitemradio")return;const o=e.getAttribute("data-group")||e.getAttribute("name")||"__default__";if(!this._radioState.has(o))return;const a=this._radioState.get(o)===t;e.setAttribute("aria-checked",a?"true":"false"),e.setAttribute("data-state",a?"checked":"unchecked")}_syncMenuPresentation(){const e=this._getMenu();if(!e)return;const t=p()?window.getComputedStyle(this):null;t&&F.forEach(c=>{const m=t.getPropertyValue(c).trim();m?e.style.setProperty(c,m):e.style.removeProperty(c)});const r=h(this,"variant"),o=S(this.getAttribute("size")||this.getAttribute("density")),a=h(this,"density"),n=h(this,"shape"),u=h(this,"elevation"),s=h(this,"tone"),d=C(this.getAttribute("radius")||n||null);if(r&&r!=="default"?e.setAttribute("data-variant",r):e.removeAttribute("data-variant"),o!=="md"?e.setAttribute("data-size",o):e.removeAttribute("data-size"),a&&a!=="default"?e.setAttribute("data-density",a):e.removeAttribute("data-density"),n&&n!=="default"?e.setAttribute("data-shape",n):e.removeAttribute("data-shape"),u&&u!=="default"?e.setAttribute("data-elevation",u):e.removeAttribute("data-elevation"),s&&s!=="default"&&s!=="brand"?e.setAttribute("data-tone",s):e.removeAttribute("data-tone"),d){e.style.setProperty("--ui-dropdown-radius",d),e.style.setProperty("--ui-dropdown-item-radius",d==="999px"?"999px":`max(0px, calc(${d} - 2px))`);return}e.style.removeProperty("--ui-dropdown-radius"),e.style.removeProperty("--ui-dropdown-item-radius")}_syncMenuA11y(){const e=this._getMenu();if(!e)return;const t=this._getTrigger(),r=this.getAttribute("aria-label")||"",o=this.getAttribute("aria-labelledby")||"",a=this.getAttribute("aria-describedby")||"",n=o||(!r&&t?.id?t.id:"");r?e.setAttribute("aria-label",r):e.removeAttribute("aria-label"),n?e.setAttribute("aria-labelledby",n):e.removeAttribute("aria-labelledby"),a?e.setAttribute("aria-describedby",a):e.removeAttribute("aria-describedby")}_syncControlState(){const e=this._panelEl,t=this._getMenu();!e||!t||(e.hidden=!this._isOpen,e.setAttribute("data-placement",this._placement))}_schedulePanelSync(e){this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=requestAnimationFrame(()=>{this._openFrame=0,this._syncPanelState(),e==="first"&&this._focusFirstItem(),e==="last"&&this._focusLastItem()})}_syncPanelState(){const e=this._panelEl;!e||!this._isOpen||(this._placement=this._resolvePlacement(),e.setAttribute("data-placement",this._placement),this.style.setProperty("--ui-dropdown-available-width",`${Math.max(0,Math.floor(this._availableWidth(this._placement)))}px`),this.style.setProperty("--ui-dropdown-available-height",`${Math.max(0,Math.floor(this._availableHeight(this._placement)))}px`))}_availableWidth(e){const t=this._getTrigger();if(!t||!p())return 380;const r=t.getBoundingClientRect(),o=window.innerWidth||document.documentElement.clientWidth||0;return e==="left"?r.left-12:e==="right"?o-r.right-12:o-r.left-12}_availableHeight(e){const t=this._getTrigger();if(!t||!p())return 440;const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight||0;return e==="top"?r.top-12:o-r.bottom-12}_resolvePlacement(){const e=A(this.getAttribute("placement")),t=this._getTrigger(),r=this._getMenu();if(!t||!r||!p())return e;const o=t.getBoundingClientRect(),a=window.innerWidth||document.documentElement.clientWidth||0,n=window.innerHeight||document.documentElement.clientHeight||0,u=Math.max(0,n-o.bottom-12),s=Math.max(0,o.top-12),d=Math.max(0,a-o.right-12),c=Math.max(0,o.left-12),m=Math.min(Math.max(r.scrollHeight,r.offsetHeight)+4,320),v=Math.min(Math.max(r.scrollWidth,r.offsetWidth)+4,360);return e==="top"?s>=m||s>u?"top":"bottom":e==="left"?c>=v||c>d?"left":"right":e==="right"?d>=v||d>=c?"right":"left":u>=m||u>=s?"bottom":"top"}_clearActiveItem(){this._queryItems(!0).forEach(e=>e.removeAttribute("data-active"))}_setActiveItem(e,t={}){if(this._clearActiveItem(),!!e&&(e.setAttribute("data-active","true"),t.focus&&g(e),t.scroll)){const r=this._getMenu();r&&I(e,r)}}_focusFirstItem(){const e=this._queryItems(!1);this._setActiveItem(e[0]||null,{focus:!0,scroll:!0})}_focusLastItem(){const e=this._queryItems(!1);this._setActiveItem(e[e.length-1]||null,{focus:!0,scroll:!0})}_moveFocus(e){const t=this._queryItems(!0);if(!t.length)return;const r=this._currentFocusedItem()||this._queryItems(!0).find(n=>n.getAttribute("data-active")==="true")||null,o=r?t.indexOf(r):e>0?-1:t.length,a=M(t,o,e);if(a>=0){this._setActiveItem(t[a],{focus:!0,scroll:!0});return}e>0?this._focusFirstItem():this._focusLastItem()}_resetTypeahead(){this._typeaheadBuffer="",this._typeaheadTimer!=null&&(window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null)}_isTypeaheadKey(e){return e.ctrlKey||e.metaKey||e.altKey?!1:e.key.length===1&&/\S/.test(e.key)}_handleTypeahead(e){if(!this.typeahead||!this._isTypeaheadKey(e))return!1;const t=e.key.toLowerCase();this._typeaheadBuffer=`${this._typeaheadBuffer}${t}`.slice(0,24),this._typeaheadTimer!=null&&window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=window.setTimeout(()=>this._resetTypeahead(),460);const r=O(this._queryItems(!0),this._typeaheadBuffer,this._currentFocusedItem());return r?(this._setActiveItem(r,{focus:!0,scroll:!0}),e.preventDefault(),!0):!1}_querySourceItems(){const e=this._getContentSource();return e?Array.from(e.querySelectorAll(l)):[]}_applySelectionBehavior(e){const t=e.getAttribute("role"),r=Number(e.dataset.sourceIndex||"-1");if(t==="menuitemcheckbox"){const n=e.getAttribute("aria-checked")!=="true";e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked"),r>=0&&this._checkboxState.set(r,n);return}if(t!=="menuitemradio")return;const a=e.getAttribute("data-group")||e.getAttribute("name")||""||"__default__";r>=0&&this._radioState.set(a,r),this._queryItems(!0).filter(n=>n.getAttribute("role")==="menuitemradio").forEach(n=>{if((n.getAttribute("data-group")||n.getAttribute("name")||""||"__default__")!==a)return;const s=n===e;n.setAttribute("aria-checked",s?"true":"false"),n.setAttribute("data-state",s?"checked":"unchecked")})}_findMenuItemFromEvent(e){const t=typeof e.composedPath=="function"?e.composedPath():[];for(const o of t)if(o instanceof HTMLElement&&o.matches(l))return o;const r=e.target;return r instanceof HTMLElement?r.closest(l):null}_isEventInsideTrigger(e){const t=this._getTrigger();return t?(typeof e.composedPath=="function"?e.composedPath():[]).includes(t):!1}_emitSelect(e){const t={value:e.getAttribute("data-value")||e.getAttribute("value")||void 0,label:e.getAttribute("aria-label")||e.textContent?.trim()||void 0,checked:e.getAttribute("aria-checked")==="true",item:e};this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:t}))}_onHostClick(e){if(this.hasAttribute("disabled"))return;const t=this._isOpen?this._findMenuItemFromEvent(e):null;if(t&&this._getMenu()?.contains(t)&&!b(t)){this._applySelectionBehavior(t),this._setActiveItem(t,{focus:!0,scroll:!0}),this._emitSelect(t),this.closeOnSelect&&this._requestClose("select");return}if(this._isEventInsideTrigger(e)){if(e.preventDefault(),this._isOpen){this._requestClose("trigger");return}this.open()}}_onHostKeyDown(e){if(!this._isOpen){if(!this._isEventInsideTrigger(e)||!["ArrowDown","ArrowUp","Enter"," "].includes(e.key))return;e.preventDefault(),this.open(),this._schedulePanelSync(e.key==="ArrowUp"?"last":"first");return}if(!this._handleTypeahead(e)){if(e.key==="Escape"){e.preventDefault(),this._requestClose("escape");return}if(e.key==="ArrowDown"){e.preventDefault(),this._moveFocus(1);return}if(e.key==="ArrowUp"){e.preventDefault(),this._moveFocus(-1);return}if(e.key==="Home"){e.preventDefault(),this._focusFirstItem();return}if(e.key==="End"){e.preventDefault(),this._focusLastItem();return}if(e.key==="Tab"){this._requestClose("tab");return}if(e.key==="Enter"||e.key===" "){const t=this._currentFocusedItem();if(!t||!this._getMenu()?.contains(t)||b(t))return;e.preventDefault(),t.click()}}}_onDocumentPointerDown(e){!this._isOpen||(typeof e.composedPath=="function"?e.composedPath():[]).includes(this)||this._requestClose("outside")}_onSlotChange(){this._syncTriggerA11y(),this._isOpen&&(this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync())}render(){this.setContent(`
492
492
  <style>${k}</style>
493
493
  <div class="root" part="root">
494
494
  <div class="trigger" part="trigger">