@editora/ui-core 0.1.20 → 0.1.22

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 (290) hide show
  1. package/dist/accordion.cjs.js +3 -3
  2. package/dist/accordion.esm.js +3 -3
  3. package/dist/alert-dialog.cjs.js +32 -32
  4. package/dist/alert-dialog.esm.js +95 -75
  5. package/dist/alert.cjs.js +6 -6
  6. package/dist/alert.esm.js +6 -6
  7. package/dist/animated-list.cjs.js +4 -4
  8. package/dist/animated-list.esm.js +4 -4
  9. package/dist/animated-text.cjs.js +4 -4
  10. package/dist/animated-text.esm.js +4 -4
  11. package/dist/app-header.cjs.js +3 -3
  12. package/dist/app-header.esm.js +3 -3
  13. package/dist/aspect-ratio.cjs.js +3 -3
  14. package/dist/aspect-ratio.esm.js +3 -3
  15. package/dist/avatar.cjs.js +14 -14
  16. package/dist/avatar.esm.js +31 -29
  17. package/dist/badge.cjs.js +4 -4
  18. package/dist/badge.esm.js +4 -4
  19. package/dist/block-controls.cjs.js +4 -4
  20. package/dist/block-controls.esm.js +4 -4
  21. package/dist/box.cjs.js +2 -2
  22. package/dist/box.esm.js +2 -2
  23. package/dist/breadcrumb.cjs.js +5 -5
  24. package/dist/breadcrumb.esm.js +5 -5
  25. package/dist/button.cjs.js +1 -1
  26. package/dist/button.esm.js +1 -1
  27. package/dist/{calendar-DLY4acgn.mjs → calendar-DbxYRdlv.mjs} +227 -183
  28. package/dist/{calendar-Dkof-FTK.js → calendar-Qa-cFOp3.js} +74 -35
  29. package/dist/calendar.cjs.js +1 -1
  30. package/dist/calendar.esm.js +1 -1
  31. package/dist/card.cjs.js +8 -8
  32. package/dist/card.esm.js +63 -20
  33. package/dist/chart.cjs.js +4 -4
  34. package/dist/chart.esm.js +6 -6
  35. package/dist/checkbox.cjs.js +2 -2
  36. package/dist/checkbox.esm.js +2 -2
  37. package/dist/collapsible.cjs.js +7 -7
  38. package/dist/collapsible.esm.js +7 -7
  39. package/dist/collection.cjs.js +1 -1
  40. package/dist/collection.esm.js +27 -23
  41. package/dist/color-picker.cjs.js +34 -14
  42. package/dist/color-picker.esm.js +89 -67
  43. package/dist/combobox.cjs.js +29 -27
  44. package/dist/combobox.esm.js +51 -45
  45. package/dist/command.cjs.js +2 -2
  46. package/dist/command.esm.js +2 -2
  47. package/dist/components/ui-alert-dialog.d.ts +1 -0
  48. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  49. package/dist/components/ui-avatar.d.ts +1 -0
  50. package/dist/components/ui-avatar.d.ts.map +1 -1
  51. package/dist/components/ui-button.d.ts +1 -0
  52. package/dist/components/ui-button.d.ts.map +1 -1
  53. package/dist/components/ui-calendar.d.ts.map +1 -1
  54. package/dist/components/ui-card.d.ts +3 -0
  55. package/dist/components/ui-card.d.ts.map +1 -1
  56. package/dist/components/ui-checkbox.d.ts.map +1 -1
  57. package/dist/components/ui-collection.d.ts.map +1 -1
  58. package/dist/components/ui-color-picker.d.ts.map +1 -1
  59. package/dist/components/ui-combobox.d.ts.map +1 -1
  60. package/dist/components/ui-data-table.d.ts.map +1 -1
  61. package/dist/components/ui-date-field.d.ts.map +1 -1
  62. package/dist/components/ui-date-picker.d.ts.map +1 -1
  63. package/dist/components/ui-date-range-picker.d.ts.map +1 -1
  64. package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
  65. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  66. package/dist/components/ui-dock.d.ts +1 -0
  67. package/dist/components/ui-dock.d.ts.map +1 -1
  68. package/dist/components/ui-drawer.d.ts.map +1 -1
  69. package/dist/components/ui-dropdown.d.ts.map +1 -1
  70. package/dist/components/ui-field.d.ts.map +1 -1
  71. package/dist/components/ui-file-upload.d.ts.map +1 -1
  72. package/dist/components/ui-gantt.d.ts.map +1 -1
  73. package/dist/components/ui-input.d.ts.map +1 -1
  74. package/dist/components/ui-menu.d.ts.map +1 -1
  75. package/dist/components/ui-multi-select.d.ts.map +1 -1
  76. package/dist/components/ui-number-field.d.ts.map +1 -1
  77. package/dist/components/ui-password-field.d.ts.map +1 -1
  78. package/dist/components/ui-pin-input.d.ts +1 -0
  79. package/dist/components/ui-pin-input.d.ts.map +1 -1
  80. package/dist/components/ui-placement-grid.d.ts.map +1 -1
  81. package/dist/components/ui-portal.d.ts.map +1 -1
  82. package/dist/components/ui-positioner.d.ts.map +1 -1
  83. package/dist/components/ui-progress.d.ts.map +1 -1
  84. package/dist/components/ui-radio.d.ts.map +1 -1
  85. package/dist/components/ui-rating.d.ts +1 -0
  86. package/dist/components/ui-rating.d.ts.map +1 -1
  87. package/dist/components/ui-select.d.ts.map +1 -1
  88. package/dist/components/ui-sortable.d.ts +8 -0
  89. package/dist/components/ui-sortable.d.ts.map +1 -1
  90. package/dist/components/ui-switch.d.ts.map +1 -1
  91. package/dist/components/ui-table.d.ts.map +1 -1
  92. package/dist/components/ui-tabs.d.ts +1 -0
  93. package/dist/components/ui-tabs.d.ts.map +1 -1
  94. package/dist/components/ui-tags-input.d.ts +1 -0
  95. package/dist/components/ui-tags-input.d.ts.map +1 -1
  96. package/dist/components/ui-textarea.d.ts.map +1 -1
  97. package/dist/components/ui-time-field.d.ts.map +1 -1
  98. package/dist/components/ui-toggle-group.d.ts.map +1 -1
  99. package/dist/components/ui-toggle.d.ts.map +1 -1
  100. package/dist/components/ui-tree.d.ts.map +1 -1
  101. package/dist/components/ui-wizard.d.ts.map +1 -1
  102. package/dist/context-menu.cjs.js +3 -3
  103. package/dist/context-menu.esm.js +4 -4
  104. package/dist/control-name-BmoI1m3a.js +1 -0
  105. package/dist/control-name-Bpj7F34X.mjs +48 -0
  106. package/dist/data-table.cjs.js +5 -2
  107. package/dist/data-table.esm.js +145 -142
  108. package/dist/date-field.cjs.js +5 -5
  109. package/dist/date-field.esm.js +34 -31
  110. package/dist/date-picker.cjs.js +16 -16
  111. package/dist/date-picker.esm.js +48 -44
  112. package/dist/date-range-picker.cjs.js +5 -5
  113. package/dist/date-range-picker.esm.js +120 -118
  114. package/dist/date-range-time-picker.cjs.js +22 -22
  115. package/dist/date-range-time-picker.esm.js +88 -84
  116. package/dist/date-time-picker.cjs.js +26 -26
  117. package/dist/date-time-picker.esm.js +105 -101
  118. package/dist/{date-time-utils-Dmost5Ee.js → date-time-utils-BzfTpeU-.js} +1 -1
  119. package/dist/{date-time-utils-y1N2gvG2.mjs → date-time-utils-Cps2aSu2.mjs} +1 -1
  120. package/dist/description.cjs.js +3 -3
  121. package/dist/description.esm.js +3 -3
  122. package/dist/dialog.cjs.js +2 -2
  123. package/dist/dialog.esm.js +2 -2
  124. package/dist/dock.cjs.js +12 -12
  125. package/dist/dock.esm.js +72 -74
  126. package/dist/drawer.cjs.js +19 -19
  127. package/dist/drawer.esm.js +58 -58
  128. package/dist/dropdown.cjs.js +13 -13
  129. package/dist/dropdown.esm.js +49 -48
  130. package/dist/empty-state.cjs.js +3 -3
  131. package/dist/empty-state.esm.js +3 -3
  132. package/dist/field-error.cjs.js +1 -1
  133. package/dist/field-error.esm.js +1 -1
  134. package/dist/field.cjs.js +12 -12
  135. package/dist/field.esm.js +84 -75
  136. package/dist/fieldset.cjs.js +4 -4
  137. package/dist/fieldset.esm.js +4 -4
  138. package/dist/file-upload.cjs.js +3 -3
  139. package/dist/file-upload.esm.js +5 -3
  140. package/dist/floating-toolbar.cjs.js +8 -8
  141. package/dist/floating-toolbar.esm.js +9 -9
  142. package/dist/form.cjs.js +11 -11
  143. package/dist/form.esm.js +11 -11
  144. package/dist/gantt.cjs.js +43 -32
  145. package/dist/gantt.esm.js +99 -88
  146. package/dist/icon-cloud.cjs.js +3 -3
  147. package/dist/icon-cloud.esm.js +3 -3
  148. package/dist/icon.cjs.js +1 -1
  149. package/dist/icon.esm.js +1 -1
  150. package/dist/index.cjs.js +1 -1
  151. package/dist/index.esm.js +121 -118
  152. package/dist/inline-edit.cjs.js +1 -1
  153. package/dist/inline-edit.esm.js +1 -1
  154. package/dist/input.cjs.js +14 -14
  155. package/dist/input.esm.js +39 -32
  156. package/dist/label.cjs.js +3 -3
  157. package/dist/label.esm.js +3 -3
  158. package/dist/{listbox-B6QgECax.js → listbox-CTpRpuF7.js} +1 -1
  159. package/dist/{listbox-DJamVeFj.mjs → listbox-hMVOhKHC.mjs} +1 -1
  160. package/dist/listbox.cjs.js +1 -1
  161. package/dist/listbox.esm.js +1 -1
  162. package/dist/marquee.cjs.js +3 -3
  163. package/dist/marquee.esm.js +3 -3
  164. package/dist/{menu-item-styles-CbNUEwP2.js → menu-item-styles-B4onAr4C.js} +3 -3
  165. package/dist/{menu-item-styles-CZiPwPwl.mjs → menu-item-styles-IGSFLAHu.mjs} +3 -3
  166. package/dist/menu.cjs.js +7 -7
  167. package/dist/menu.esm.js +29 -28
  168. package/dist/menubar.cjs.js +1 -1
  169. package/dist/menubar.esm.js +2 -2
  170. package/dist/meter.cjs.js +1 -1
  171. package/dist/meter.esm.js +1 -1
  172. package/dist/multi-select.cjs.js +18 -18
  173. package/dist/multi-select.esm.js +82 -66
  174. package/dist/navigation-menu.cjs.js +1 -1
  175. package/dist/navigation-menu.esm.js +1 -1
  176. package/dist/number-field.cjs.js +11 -13
  177. package/dist/number-field.esm.js +29 -27
  178. package/dist/number-ticker.cjs.js +4 -4
  179. package/dist/number-ticker.esm.js +4 -4
  180. package/dist/odometer.cjs.js +2 -2
  181. package/dist/odometer.esm.js +2 -2
  182. package/dist/orbiter.cjs.js +3 -3
  183. package/dist/orbiter.esm.js +3 -3
  184. package/dist/pagination.cjs.js +1 -1
  185. package/dist/pagination.esm.js +1 -1
  186. package/dist/password-field.cjs.js +23 -23
  187. package/dist/password-field.esm.js +48 -47
  188. package/dist/pin-input.cjs.js +8 -6
  189. package/dist/pin-input.esm.js +21 -15
  190. package/dist/placement-grid.cjs.js +4 -4
  191. package/dist/placement-grid.esm.js +58 -58
  192. package/dist/plugin-panel.cjs.js +1 -1
  193. package/dist/plugin-panel.esm.js +1 -1
  194. package/dist/popover.cjs.js +5 -5
  195. package/dist/popover.esm.js +4 -4
  196. package/dist/portal.cjs.js +3 -3
  197. package/dist/portal.esm.js +11 -10
  198. package/dist/positioner.cjs.js +2 -2
  199. package/dist/positioner.esm.js +15 -14
  200. package/dist/primitives/auto-scroll.d.ts +9 -0
  201. package/dist/primitives/auto-scroll.d.ts.map +1 -0
  202. package/dist/primitives/control-name.d.ts +30 -0
  203. package/dist/primitives/control-name.d.ts.map +1 -0
  204. package/dist/primitives/selector.d.ts +4 -0
  205. package/dist/primitives/selector.d.ts.map +1 -0
  206. package/dist/primitives/trigger.d.ts +2 -0
  207. package/dist/primitives/trigger.d.ts.map +1 -0
  208. package/dist/progress.cjs.js +4 -4
  209. package/dist/progress.esm.js +20 -18
  210. package/dist/quick-actions.cjs.js +3 -3
  211. package/dist/quick-actions.esm.js +3 -3
  212. package/dist/radio-group.cjs.js +1 -1
  213. package/dist/radio-group.esm.js +1 -1
  214. package/dist/radio.cjs.js +2 -2
  215. package/dist/radio.esm.js +2 -2
  216. package/dist/rating.cjs.js +17 -16
  217. package/dist/rating.esm.js +91 -92
  218. package/dist/{runtime-D1gFh1fS.mjs → runtime-CFnK53iC.mjs} +133 -94
  219. package/dist/runtime-DwE-tizc.js +1 -0
  220. package/dist/runtime.cjs.js +1 -1
  221. package/dist/runtime.d.ts +1 -1
  222. package/dist/runtime.d.ts.map +1 -1
  223. package/dist/runtime.esm.js +29 -26
  224. package/dist/select.cjs.js +20 -19
  225. package/dist/select.esm.js +36 -32
  226. package/dist/selection-popup.cjs.js +2 -2
  227. package/dist/selection-popup.esm.js +2 -2
  228. package/dist/selector-BvAh35ve.js +1 -0
  229. package/dist/selector-WI8pD7YO.mjs +18 -0
  230. package/dist/separator.cjs.js +7 -7
  231. package/dist/separator.esm.js +7 -7
  232. package/dist/sidebar.cjs.js +7 -7
  233. package/dist/sidebar.esm.js +7 -7
  234. package/dist/skeleton.cjs.js +7 -7
  235. package/dist/skeleton.esm.js +7 -7
  236. package/dist/slider.cjs.js +3 -3
  237. package/dist/slider.esm.js +3 -3
  238. package/dist/slot.cjs.js +3 -3
  239. package/dist/slot.esm.js +3 -3
  240. package/dist/sortable.cjs.js +61 -48
  241. package/dist/sortable.esm.js +636 -554
  242. package/dist/spinning-text.cjs.js +3 -3
  243. package/dist/spinning-text.esm.js +3 -3
  244. package/dist/split-button.cjs.js +1 -1
  245. package/dist/split-button.esm.js +1 -1
  246. package/dist/stepper.cjs.js +1 -1
  247. package/dist/stepper.esm.js +1 -1
  248. package/dist/switch.cjs.js +10 -12
  249. package/dist/switch.esm.js +10 -12
  250. package/dist/table.cjs.js +9 -6
  251. package/dist/table.esm.js +46 -43
  252. package/dist/tabs.cjs.js +22 -23
  253. package/dist/tabs.esm.js +116 -112
  254. package/dist/tags-input.cjs.js +9 -9
  255. package/dist/tags-input.esm.js +32 -25
  256. package/dist/textarea.cjs.js +13 -13
  257. package/dist/textarea.esm.js +46 -31
  258. package/dist/theme.d.ts +18 -0
  259. package/dist/theme.d.ts.map +1 -1
  260. package/dist/time-field.cjs.js +5 -5
  261. package/dist/time-field.esm.js +21 -18
  262. package/dist/time-picker.cjs.js +4 -4
  263. package/dist/time-picker.esm.js +5 -5
  264. package/dist/timeline.cjs.js +2 -2
  265. package/dist/timeline.esm.js +4 -4
  266. package/dist/toast.cjs.js +6 -6
  267. package/dist/toast.esm.js +13 -13
  268. package/dist/toggle-group.cjs.js +5 -6
  269. package/dist/toggle-group.esm.js +63 -60
  270. package/dist/toggle.cjs.js +18 -18
  271. package/dist/toggle.esm.js +32 -31
  272. package/dist/tooltip.cjs.js +4 -4
  273. package/dist/tooltip.esm.js +4 -4
  274. package/dist/transfer-list.cjs.js +32 -32
  275. package/dist/transfer-list.esm.js +57 -57
  276. package/dist/tree-7qbVnpGp.js +39 -0
  277. package/dist/{tree-B3kE8ESs.mjs → tree-Deoft-kO.mjs} +34 -33
  278. package/dist/tree.cjs.js +1 -1
  279. package/dist/tree.esm.js +1 -1
  280. package/dist/trigger-BjnxLCeQ.mjs +9 -0
  281. package/dist/trigger-DkPsKxsP.js +1 -0
  282. package/dist/{ui-button-rXQOS9QJ.js → ui-button-BInsgSbr.js} +27 -26
  283. package/dist/{ui-button-Q0GNNWKC.mjs → ui-button-rfiuUnUD.mjs} +65 -48
  284. package/dist/{ui-icon-YI6lyuqU.mjs → ui-icon-BSi_GtqO.mjs} +2 -2
  285. package/dist/{ui-icon-BzVNC_lr.js → ui-icon-Bvt9oIIR.js} +5 -5
  286. package/dist/wizard.cjs.js +12 -13
  287. package/dist/wizard.esm.js +17 -15
  288. package/package.json +1 -1
  289. package/dist/runtime-CTaOSmBj.js +0 -1
  290. package/dist/tree-Dx_kv_ih.js +0 -39
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O=require("./ElementBase-EV6mVBUV.js"),m=require("./overlayManager-CSy3fJmJ.js");function F(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>i()):window.setTimeout(i,16)}function _(i){if(i){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(i);return}window.clearTimeout(i)}}const E='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',S=new Set(["side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","role","aria-label","aria-labelledby","aria-describedby","initial-focus"]),T=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-EV6mVBUV.js"),v=require("./overlayManager-CSy3fJmJ.js");function k(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>i()):window.setTimeout(i,16)}function F(i){if(i){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(i);return}window.clearTimeout(i)}}const L='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',D=new Set(["side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","role","aria-label","aria-labelledby","aria-describedby","initial-focus"]),$=`
2
2
  :host {
3
3
  position: fixed;
4
4
  inset: 0;
@@ -15,7 +15,7 @@
15
15
  color-mix(in srgb, var(--ui-color-surface-elevated, #f8fafc) 20%, var(--ui-color-surface, #ffffff)) 100%
16
16
  );
17
17
  --ui-drawer-color: var(--ui-color-text, #0f172a);
18
- --ui-drawer-muted: var(--ui-color-muted, #64748b);
18
+ --ui-drawer-muted: var(--ui-color-muted, #526175);
19
19
  --ui-drawer-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 74%, transparent);
20
20
  --ui-drawer-border: 1px solid var(--ui-drawer-border-color);
21
21
  --ui-drawer-shadow: none;
@@ -370,13 +370,13 @@
370
370
  }
371
371
 
372
372
  :host([tone='success']) {
373
- --ui-drawer-focus-ring: var(--ui-color-success, #16a34a);
374
- --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-success, #16a34a) 12%, transparent);
373
+ --ui-drawer-focus-ring: var(--ui-color-success, #15803d);
374
+ --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-success, #15803d) 12%, transparent);
375
375
  }
376
376
 
377
377
  :host([tone='warning']) {
378
- --ui-drawer-focus-ring: var(--ui-color-warning, #d97706);
379
- --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-warning, #d97706) 16%, transparent);
378
+ --ui-drawer-focus-ring: var(--ui-color-warning, #b45309);
379
+ --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-warning, #b45309) 16%, transparent);
380
380
  }
381
381
 
382
382
  :host([state='error']) .panel {
@@ -384,7 +384,7 @@
384
384
  }
385
385
 
386
386
  :host([state='success']) .panel {
387
- border-color: color-mix(in srgb, var(--ui-color-success, #16a34a) 40%, var(--ui-drawer-border-color));
387
+ border-color: color-mix(in srgb, var(--ui-color-success, #15803d) 40%, var(--ui-drawer-border-color));
388
388
  }
389
389
 
390
390
  :host([state='loading']) .body {
@@ -498,25 +498,25 @@
498
498
  display: none;
499
499
  }
500
500
  }
501
- `;function w(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function v(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function C(i,e){return i==="top"||i==="bottom"||i==="left"||i==="right"?i:i==="start"?e==="rtl"?"right":"left":i==="end"?e==="rtl"?"left":"right":"left"}function A(i,e){const t=i.querySelector(`[slot="${e}"]`);return t?t.textContent?.trim().length!==0||t.children.length>0:!1}function L(){return typeof window<"u"&&typeof document<"u"}class I extends O.ElementBase{constructor(){super(),this._uid=Math.random().toString(36).slice(2,10),this._isOpen=!1,this._restoreFocusEl=null,this._globalListenersBound=!1,this._closeReason="programmatic",this._focusInitialFrame=0,this._focusTrapFrame=0,this._restoreFocusFrame=0,this._onRootClick=this._onRootClick.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this),this._onDocumentFocusIn=this._onDocumentFocusIn.bind(this)}static get observedAttributes(){return["open","side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","title","description","aria-label","aria-labelledby","aria-describedby","initial-focus"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources(),this._restoreFocusEl=null,this._isOpen=!1,super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if(S.has(e)){this._syncLiveUi(),this._isOpen&&(e==="initial-focus"||e==="dismissible"||e==="show-close")&&this._scheduleEnsureFocusTrap();return}this.isConnected&&this.requestRender()}}open(){this.setAttribute("open","")}close(e="programmatic"){this._closeReason=e,this.removeAttribute("open")}closeDrawer(e="programmatic"){if(this.hasAttribute("open")){if(e==="programmatic"){this.close("programmatic");return}this._requestClose(e)}}toggle(){this.hasAttribute("open")?this.close("programmatic"):this.open()}get dismissible(){const e=this.getAttribute("dismissible");return e==null?!1:w(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return w(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return w(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return w(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?w(this.getAttribute("show-close"),!0):this.dismissible}set showClose(e){this.setAttribute("show-close",String(e))}get state(){const e=this.getAttribute("state");return e==="loading"||e==="error"||e==="success"?e:"idle"}set state(e){if(e==="idle"){this.removeAttribute("state");return}this.setAttribute("state",e)}get inset(){return this.hasAttribute("inset")}set inset(e){e?this.setAttribute("inset",""):this.removeAttribute("inset")}_getPanel(){return this.root.querySelector(".panel")}_getOverlay(){return this.root.querySelector(".overlay")}_getHeader(){return this.root.querySelector(".header")}_titleId(){return`ui-drawer-title-${this._uid}`}_descriptionId(){return`ui-drawer-description-${this._uid}`}_bodyId(){return`ui-drawer-body-${this._uid}`}_resolvedSide(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr";return C(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=m.OverlayManager.top();return e?e===this:!0}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_isNodeInsideDrawer(e){if(!e)return!1;const t=this._getPanel();return t&&t.contains(e)?!0:this.contains(e)}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.matches('[inert], [aria-hidden="true"]')||e.closest('[inert], [aria-hidden="true"]'))return!1;if(!L())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_collectFocusable(){const e=this._getPanel(),t=[],r=s=>{this._isFocusable(s)&&(t.includes(s)||t.push(s))};return this.querySelectorAll(E).forEach(r),e&&e.querySelectorAll(E).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(_(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(_(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(_(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=F(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=F(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&_(this._restoreFocusFrame),this._restoreFocusFrame=F(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(e)&&e.focus({preventScroll:!0})}catch{try{this._canRestoreFocus(e)&&e.focus()}catch{}}}))}_syncLiveUi(){const e=this.hasAttribute("open"),t=this._getOverlay(),r=this._getPanel(),s=this._getHeader(),a=this.root.querySelector(".close-btn");if(t&&t.setAttribute("aria-hidden",e?"false":"true"),!r)return;const o=this._resolvedSide();r.classList.remove("side-left","side-right","side-top","side-bottom"),r.classList.add(`side-${o}`);const n=this.state==="loading";n?r.setAttribute("aria-busy","true"):r.removeAttribute("aria-busy");const y=this.getAttribute("role")||"dialog";r.setAttribute("role",y);const u=(this.getAttribute("title")||"").trim(),h=(this.getAttribute("description")||"").trim(),b=A(this,"header"),p=this.showClose,x=p||b||!!u||!!h;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!p,a.disabled=n&&this.lockWhileLoading);const f=this.getAttribute("aria-label")||"",g=this.getAttribute("aria-labelledby")||"",l=this.getAttribute("aria-describedby")||"",c=g||(!f&&(b||u)?this._titleId():""),d=[];l?d.push(l):(h&&d.push(this._descriptionId()),d.push(this._bodyId()));const k=f||(c?"":"Drawer");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")}_focusInitial(){if(!this._isOpen)return;const e=this._getPanel();if(!e)return;const t=this.getAttribute("initial-focus")||"";if(t){const o=this.querySelector(t)||e.querySelector(t);if(o&&this._isFocusable(o))try{o.focus({preventScroll:!0});return}catch{try{o.focus();return}catch{}}}const r=this._collectFocusable(),a=r.find(o=>o.hasAttribute("autofocus"))||r[0]||e;a===e&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","-1");try{a.focus({preventScroll:!0})}catch{try{a.focus()}catch{}}}_ensureFocusTrap(){if(!this._isOpen||!this._isTopMost())return;const e=document.activeElement;this._isNodeInsideDrawer(e)||this._focusInitial()}_releaseOpenResources(){try{m.OverlayManager.unregister(this),m.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!L())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_syncOpenState(){const e=this.hasAttribute("open");if(this._syncLiveUi(),e===this._isOpen){e?(this._bindGlobalListeners(),this._scheduleEnsureFocusTrap()):(this._unbindGlobalListeners(),this._cancelScheduledFocusWork());return}if(this._isOpen=e,e){this._cancelScheduledFocusWork(),this._bindGlobalListeners(),this._restoreFocusEl=document.activeElement||null,this._closeReason="programmatic";try{m.OverlayManager.register(this),m.OverlayManager.acquireLock()}catch{}this._scheduleFocusInitial(),this._scheduleEnsureFocusTrap(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0,reason:"programmatic"}}));return}this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources();const t=this._closeReason;this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:t}}));const r=this._restoreFocusEl;this._restoreFocusEl=null,this._closeReason="programmatic",this._scheduleRestoreFocus(r)}_requestClose(e){if(!this._isOpen||this._isInteractionLocked())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)}_onRootClick(e){const t=e.target;if(!t||!this._isOpen)return;if(t.closest(".close-btn")){this._requestClose("button");return}t.closest(".overlay")&&(!this.dismissible||!this.closeOnOverlay||this._isTopMost()&&this._requestClose("overlay"))}_handleTab(e){const t=this._getPanel();if(!t)return;const r=this._collectFocusable();if(!r.length){e.preventDefault(),t.focus();return}const s=r[0],a=r[r.length-1],o=document.activeElement,n=!!o&&this._isNodeInsideDrawer(o);if(e.shiftKey){if(!n||o===s){e.preventDefault();try{a.focus({preventScroll:!0})}catch{a.focus()}}return}if(!n||o===a){e.preventDefault();try{s.focus({preventScroll:!0})}catch{s.focus()}}}_onDocumentKeyDown(e){if(!(!this._isOpen||!this._isTopMost())){if(e.key==="Escape"){if(!this.dismissible||!this.closeOnEsc||this._isInteractionLocked())return;e.preventDefault(),e.stopPropagation(),this._requestClose("escape");return}e.key==="Tab"&&this._handleTab(e)}}_onDocumentFocusIn(e){if(!this._isOpen||!this._isTopMost())return;const t=e.target,r=this._getPanel(),s=typeof e.composedPath=="function"?e.composedPath():[];t&&this._isNodeInsideDrawer(t)||s.includes(this)||r&&s.includes(r)||this._scheduleFocusInitial()}render(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr",t=C(this.getAttribute("side"),e==="rtl"?"rtl":"ltr"),r=this.showClose,s=A(this,"header"),a=A(this,"footer"),o=(this.getAttribute("title")||"").trim(),n=(this.getAttribute("description")||"").trim(),y=r||s||!!o||!!n,u=`ui-drawer-title-${this._uid}`,h=`ui-drawer-description-${this._uid}`,b=`ui-drawer-body-${this._uid}`,p=this.getAttribute("aria-label")||"",x=this.getAttribute("aria-labelledby")||"",f=this.getAttribute("aria-describedby")||"",g=x||(!p&&(s||o)?u:""),l=[];f?l.push(f):(n&&l.push(h),l.push(b));const c=p||(g?"":"Drawer"),d=this.state==="loading";this.setContent(`
502
- <style>${T}</style>
501
+ `;function _(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function y(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function S(i,e){return i==="top"||i==="bottom"||i==="left"||i==="right"?i:i==="start"?e==="rtl"?"right":"left":i==="end"?e==="rtl"?"left":"right":"left"}function C(i,e){const t=i.querySelector(`[slot="${e}"]`);return t?t.textContent?.trim().length!==0||t.children.length>0:!1}function I(){return typeof window<"u"&&typeof document<"u"}class O extends T.ElementBase{constructor(){super(),this._uid=Math.random().toString(36).slice(2,10),this._isOpen=!1,this._restoreFocusEl=null,this._globalListenersBound=!1,this._closeReason="programmatic",this._focusInitialFrame=0,this._focusTrapFrame=0,this._restoreFocusFrame=0,this._onRootClick=this._onRootClick.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this),this._onDocumentFocusIn=this._onDocumentFocusIn.bind(this)}static get observedAttributes(){return["open","side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","title","description","aria-label","aria-labelledby","aria-describedby","initial-focus"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources(),this._restoreFocusEl=null,this._isOpen=!1,super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if(D.has(e)){this._syncLiveUi(),this._isOpen&&(e==="initial-focus"||e==="dismissible"||e==="show-close")&&this._scheduleEnsureFocusTrap();return}this.isConnected&&this.requestRender()}}open(){this.setAttribute("open","")}close(e="programmatic"){this._closeReason=e,this.removeAttribute("open")}closeDrawer(e="programmatic"){if(this.hasAttribute("open")){if(e==="programmatic"){this.close("programmatic");return}this._requestClose(e)}}toggle(){this.hasAttribute("open")?this.close("programmatic"):this.open()}get dismissible(){const e=this.getAttribute("dismissible");return e==null?!1:_(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return _(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return _(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return _(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?_(this.getAttribute("show-close"),!0):this.dismissible}set showClose(e){this.setAttribute("show-close",String(e))}get state(){const e=this.getAttribute("state");return e==="loading"||e==="error"||e==="success"?e:"idle"}set state(e){if(e==="idle"){this.removeAttribute("state");return}this.setAttribute("state",e)}get inset(){return this.hasAttribute("inset")}set inset(e){e?this.setAttribute("inset",""):this.removeAttribute("inset")}_getPanel(){return this.root.querySelector(".panel")}_getOverlay(){return this.root.querySelector(".overlay")}_getHeader(){return this.root.querySelector(".header")}_titleId(){return`ui-drawer-title-${this._uid}`}_descriptionId(){return`ui-drawer-description-${this._uid}`}_bodyId(){return`ui-drawer-body-${this._uid}`}_resolvedSide(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr";return S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=v.OverlayManager.top();return e?e===this:!0}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_isNodeInsideDrawer(e){if(!e)return!1;const t=this._getPanel();return t&&t.contains(e)?!0:this.contains(e)}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.matches('[inert], [aria-hidden="true"]')||e.closest('[inert], [aria-hidden="true"]'))return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_collectFocusable(){const e=this._getPanel(),t=[],r=s=>{this._isFocusable(s)&&(t.includes(s)||t.push(s))};return this.querySelectorAll(L).forEach(r),e&&e.querySelectorAll(L).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(F(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(F(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(F(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=k(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=k(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&F(this._restoreFocusFrame),this._restoreFocusFrame=k(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(e)&&e.focus({preventScroll:!0})}catch{try{this._canRestoreFocus(e)&&e.focus()}catch{}}}))}_syncLiveUi(){const e=this.hasAttribute("open"),t=this._getOverlay(),r=this._getPanel(),s=this._getHeader(),a=this.root.querySelector(".close-btn");if(t&&t.setAttribute("aria-hidden",e?"false":"true"),!r)return;const o=this._resolvedSide();r.classList.remove("side-left","side-right","side-top","side-bottom"),r.classList.add(`side-${o}`);const n=this.state==="loading";n?r.setAttribute("aria-busy","true"):r.removeAttribute("aria-busy");const A=this.getAttribute("role")||"dialog";r.setAttribute("role",A);const u=(this.getAttribute("title")||"").trim(),g=(this.getAttribute("description")||"").trim(),c=C(this,"header"),h=this.showClose,x=h||c||!!u||!!g;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!h,a.disabled=n&&this.lockWhileLoading);const b=this.getAttribute("aria-label")||"",m=this.getAttribute("aria-labelledby")||"",w=this.getAttribute("aria-describedby")||"",p=c?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",l=!b&&!m&&!!p,f=m||(!b&&!l&&(c||u)?this._titleId():""),d=[];w?d.push(w):(g&&d.push(this._descriptionId()),d.push(this._bodyId()));const E=b||(l?p:f?"":"Drawer");E?r.setAttribute("aria-label",E):r.removeAttribute("aria-label"),f?r.setAttribute("aria-labelledby",f):r.removeAttribute("aria-labelledby"),d.length?r.setAttribute("aria-describedby",d.join(" ")):r.removeAttribute("aria-describedby")}_focusInitial(){if(!this._isOpen)return;const e=this._getPanel();if(!e)return;const t=this.getAttribute("initial-focus")||"";if(t){const o=this.querySelector(t)||e.querySelector(t);if(o&&this._isFocusable(o))try{o.focus({preventScroll:!0});return}catch{try{o.focus();return}catch{}}}const r=this._collectFocusable(),a=r.find(o=>o.hasAttribute("autofocus"))||r[0]||e;a===e&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","-1");try{a.focus({preventScroll:!0})}catch{try{a.focus()}catch{}}}_ensureFocusTrap(){if(!this._isOpen||!this._isTopMost())return;const e=document.activeElement;this._isNodeInsideDrawer(e)||this._focusInitial()}_releaseOpenResources(){try{v.OverlayManager.unregister(this),v.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_syncOpenState(){const e=this.hasAttribute("open");if(this._syncLiveUi(),e===this._isOpen){e?(this._bindGlobalListeners(),this._scheduleEnsureFocusTrap()):(this._unbindGlobalListeners(),this._cancelScheduledFocusWork());return}if(this._isOpen=e,e){this._cancelScheduledFocusWork(),this._bindGlobalListeners(),this._restoreFocusEl=document.activeElement||null,this._closeReason="programmatic";try{v.OverlayManager.register(this),v.OverlayManager.acquireLock()}catch{}this._scheduleFocusInitial(),this._scheduleEnsureFocusTrap(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0,reason:"programmatic"}}));return}this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources();const t=this._closeReason;this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:t}}));const r=this._restoreFocusEl;this._restoreFocusEl=null,this._closeReason="programmatic",this._scheduleRestoreFocus(r)}_requestClose(e){if(!this._isOpen||this._isInteractionLocked())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)}_onRootClick(e){const t=e.target;if(!t||!this._isOpen)return;if(t.closest(".close-btn")){this._requestClose("button");return}t.closest(".overlay")&&(!this.dismissible||!this.closeOnOverlay||this._isTopMost()&&this._requestClose("overlay"))}_handleTab(e){const t=this._getPanel();if(!t)return;const r=this._collectFocusable();if(!r.length){e.preventDefault(),t.focus();return}const s=r[0],a=r[r.length-1],o=document.activeElement,n=!!o&&this._isNodeInsideDrawer(o);if(e.shiftKey){if(!n||o===s){e.preventDefault();try{a.focus({preventScroll:!0})}catch{a.focus()}}return}if(!n||o===a){e.preventDefault();try{s.focus({preventScroll:!0})}catch{s.focus()}}}_onDocumentKeyDown(e){if(!(!this._isOpen||!this._isTopMost())){if(e.key==="Escape"){if(!this.dismissible||!this.closeOnEsc||this._isInteractionLocked())return;e.preventDefault(),e.stopPropagation(),this._requestClose("escape");return}e.key==="Tab"&&this._handleTab(e)}}_onDocumentFocusIn(e){if(!this._isOpen||!this._isTopMost())return;const t=e.target,r=this._getPanel(),s=typeof e.composedPath=="function"?e.composedPath():[];t&&this._isNodeInsideDrawer(t)||s.includes(this)||r&&s.includes(r)||this._scheduleFocusInitial()}render(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr",t=S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr"),r=this.showClose,s=C(this,"header"),a=C(this,"footer"),o=(this.getAttribute("title")||"").trim(),n=(this.getAttribute("description")||"").trim(),A=r||s||!!o||!!n,u=`ui-drawer-title-${this._uid}`,g=`ui-drawer-description-${this._uid}`,c=`ui-drawer-body-${this._uid}`,h=this.getAttribute("aria-label")||"",x=this.getAttribute("aria-labelledby")||"",b=this.getAttribute("aria-describedby")||"",m=s?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",w=!h&&!x&&!!m,p=x||(!h&&!w&&(s||o)?u:""),l=[];b?l.push(b):(n&&l.push(g),l.push(c));const f=h||(w?m:p?"":"Drawer"),d=this.state==="loading";this.setContent(`
502
+ <style>${$}</style>
503
503
  <div class="overlay" part="overlay" aria-hidden="true"></div>
504
- <aside
504
+ <div
505
505
  class="panel side-${t}"
506
506
  part="panel"
507
507
  role="dialog"
508
508
  aria-modal="true"
509
- ${c?`aria-label="${v(c)}"`:""}
510
- ${g?`aria-labelledby="${v(g)}"`:""}
511
- ${l.length?`aria-describedby="${v(l.join(" "))}"`:""}
509
+ ${f?`aria-label="${y(f)}"`:""}
510
+ ${p?`aria-labelledby="${y(p)}"`:""}
511
+ ${l.length?`aria-describedby="${y(l.join(" "))}"`:""}
512
512
  ${d?'aria-busy="true"':""}
513
513
  tabindex="-1"
514
514
  >
515
- <header class="header ${y?"":"empty"}" part="header">
515
+ <header class="header ${A?"":"empty"}" part="header">
516
516
  <div class="header-main">
517
517
  ${s?`<slot name="header" id="${u}"></slot>`:""}
518
- ${!s&&o?`<h2 class="title" id="${u}">${v(o)}</h2>`:""}
519
- ${n?`<p class="subtitle" id="${h}">${v(n)}</p>`:""}
518
+ ${!s&&o?`<h2 class="title" id="${u}">${y(o)}</h2>`:""}
519
+ ${n?`<p class="subtitle" id="${g}">${y(n)}</p>`:""}
520
520
  </div>
521
521
  <button
522
522
  type="button"
@@ -532,7 +532,7 @@
532
532
  </svg>
533
533
  </button>
534
534
  </header>
535
- <div class="body" part="body" id="${b}"><slot></slot></div>
535
+ <div class="body" part="body" id="${c}"><slot></slot></div>
536
536
  <footer class="footer ${a?"":"empty"}" part="footer"><slot name="footer"></slot></footer>
537
- </aside>
538
- `),this._syncLiveUi(),this._isOpen&&this._scheduleEnsureFocusTrap()}_bindGlobalListeners(){this._globalListenersBound||(document.addEventListener("keydown",this._onDocumentKeyDown,!0),document.addEventListener("focusin",this._onDocumentFocusIn,!0),this._globalListenersBound=!0)}_unbindGlobalListeners(){this._globalListenersBound&&(document.removeEventListener("keydown",this._onDocumentKeyDown,!0),document.removeEventListener("focusin",this._onDocumentFocusIn,!0),this._globalListenersBound=!1)}}typeof customElements<"u"&&!customElements.get("ui-drawer")&&customElements.define("ui-drawer",I);exports.UIDrawer=I;
537
+ </div>
538
+ `),this._syncLiveUi(),this._isOpen&&this._scheduleEnsureFocusTrap()}_bindGlobalListeners(){this._globalListenersBound||(document.addEventListener("keydown",this._onDocumentKeyDown,!0),document.addEventListener("focusin",this._onDocumentFocusIn,!0),this._globalListenersBound=!0)}_unbindGlobalListeners(){this._globalListenersBound&&(document.removeEventListener("keydown",this._onDocumentKeyDown,!0),document.removeEventListener("focusin",this._onDocumentFocusIn,!0),this._globalListenersBound=!1)}}typeof customElements<"u"&&!customElements.get("ui-drawer")&&customElements.define("ui-drawer",O);exports.UIDrawer=O;
@@ -1,9 +1,9 @@
1
- import { E as I } from "./ElementBase-YlTLMsGk.mjs";
2
- import { O as m } from "./overlayManager-BJjU1VA8.mjs";
3
- function F(i) {
1
+ import { E as O } from "./ElementBase-YlTLMsGk.mjs";
2
+ import { O as v } from "./overlayManager-BJjU1VA8.mjs";
3
+ function k(i) {
4
4
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => i()) : window.setTimeout(i, 16);
5
5
  }
6
- function _(i) {
6
+ function F(i) {
7
7
  if (i) {
8
8
  if (typeof cancelAnimationFrame == "function") {
9
9
  cancelAnimationFrame(i);
@@ -12,7 +12,7 @@ function _(i) {
12
12
  window.clearTimeout(i);
13
13
  }
14
14
  }
15
- const E = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', S = /* @__PURE__ */ new Set([
15
+ const L = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', T = /* @__PURE__ */ new Set([
16
16
  "side",
17
17
  "dismissible",
18
18
  "headless",
@@ -33,7 +33,7 @@ const E = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
33
33
  "aria-labelledby",
34
34
  "aria-describedby",
35
35
  "initial-focus"
36
- ]), O = `
36
+ ]), D = `
37
37
  :host {
38
38
  position: fixed;
39
39
  inset: 0;
@@ -50,7 +50,7 @@ const E = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
50
50
  color-mix(in srgb, var(--ui-color-surface-elevated, #f8fafc) 20%, var(--ui-color-surface, #ffffff)) 100%
51
51
  );
52
52
  --ui-drawer-color: var(--ui-color-text, #0f172a);
53
- --ui-drawer-muted: var(--ui-color-muted, #64748b);
53
+ --ui-drawer-muted: var(--ui-color-muted, #526175);
54
54
  --ui-drawer-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 74%, transparent);
55
55
  --ui-drawer-border: 1px solid var(--ui-drawer-border-color);
56
56
  --ui-drawer-shadow: none;
@@ -405,13 +405,13 @@ const E = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
405
405
  }
406
406
 
407
407
  :host([tone='success']) {
408
- --ui-drawer-focus-ring: var(--ui-color-success, #16a34a);
409
- --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-success, #16a34a) 12%, transparent);
408
+ --ui-drawer-focus-ring: var(--ui-color-success, #15803d);
409
+ --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-success, #15803d) 12%, transparent);
410
410
  }
411
411
 
412
412
  :host([tone='warning']) {
413
- --ui-drawer-focus-ring: var(--ui-color-warning, #d97706);
414
- --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-warning, #d97706) 16%, transparent);
413
+ --ui-drawer-focus-ring: var(--ui-color-warning, #b45309);
414
+ --ui-drawer-control-bg-hover: color-mix(in srgb, var(--ui-color-warning, #b45309) 16%, transparent);
415
415
  }
416
416
 
417
417
  :host([state='error']) .panel {
@@ -419,7 +419,7 @@ const E = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
419
419
  }
420
420
 
421
421
  :host([state='success']) .panel {
422
- border-color: color-mix(in srgb, var(--ui-color-success, #16a34a) 40%, var(--ui-drawer-border-color));
422
+ border-color: color-mix(in srgb, var(--ui-color-success, #15803d) 40%, var(--ui-drawer-border-color));
423
423
  }
424
424
 
425
425
  :host([state='loading']) .body {
@@ -534,25 +534,25 @@ const E = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
534
534
  }
535
535
  }
536
536
  `;
537
- function w(i, e) {
537
+ function _(i, e) {
538
538
  if (i == null) return e;
539
539
  const t = i.trim().toLowerCase();
540
540
  return t !== "false" && t !== "0" && t !== "off";
541
541
  }
542
- function v(i) {
542
+ function y(i) {
543
543
  return i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
544
544
  }
545
- function C(i, e) {
545
+ function I(i, e) {
546
546
  return i === "top" || i === "bottom" || i === "left" || i === "right" ? i : i === "start" ? e === "rtl" ? "right" : "left" : i === "end" ? e === "rtl" ? "left" : "right" : "left";
547
547
  }
548
- function A(i, e) {
548
+ function C(i, e) {
549
549
  const t = i.querySelector(`[slot="${e}"]`);
550
550
  return t ? t.textContent?.trim().length !== 0 || t.children.length > 0 : !1;
551
551
  }
552
- function L() {
552
+ function S() {
553
553
  return typeof window < "u" && typeof document < "u";
554
554
  }
555
- class T extends I {
555
+ class $ extends O {
556
556
  constructor() {
557
557
  super(), this._uid = Math.random().toString(36).slice(2, 10), this._isOpen = !1, this._restoreFocusEl = null, this._globalListenersBound = !1, this._closeReason = "programmatic", this._focusInitialFrame = 0, this._focusTrapFrame = 0, this._restoreFocusFrame = 0, this._onRootClick = this._onRootClick.bind(this), this._onDocumentKeyDown = this._onDocumentKeyDown.bind(this), this._onDocumentFocusIn = this._onDocumentFocusIn.bind(this);
558
558
  }
@@ -594,7 +594,7 @@ class T extends I {
594
594
  this._syncOpenState();
595
595
  return;
596
596
  }
597
- if (S.has(e)) {
597
+ if (T.has(e)) {
598
598
  this._syncLiveUi(), this._isOpen && (e === "initial-focus" || e === "dismissible" || e === "show-close") && this._scheduleEnsureFocusTrap();
599
599
  return;
600
600
  }
@@ -621,31 +621,31 @@ class T extends I {
621
621
  }
622
622
  get dismissible() {
623
623
  const e = this.getAttribute("dismissible");
624
- return e == null ? !1 : w(e, !0);
624
+ return e == null ? !1 : _(e, !0);
625
625
  }
626
626
  set dismissible(e) {
627
627
  e ? this.setAttribute("dismissible", "") : this.removeAttribute("dismissible");
628
628
  }
629
629
  get closeOnOverlay() {
630
- return w(this.getAttribute("close-on-overlay"), !0);
630
+ return _(this.getAttribute("close-on-overlay"), !0);
631
631
  }
632
632
  set closeOnOverlay(e) {
633
633
  this.setAttribute("close-on-overlay", String(e));
634
634
  }
635
635
  get closeOnEsc() {
636
- return w(this.getAttribute("close-on-esc"), !0);
636
+ return _(this.getAttribute("close-on-esc"), !0);
637
637
  }
638
638
  set closeOnEsc(e) {
639
639
  this.setAttribute("close-on-esc", String(e));
640
640
  }
641
641
  get lockWhileLoading() {
642
- return w(this.getAttribute("lock-while-loading"), !0);
642
+ return _(this.getAttribute("lock-while-loading"), !0);
643
643
  }
644
644
  set lockWhileLoading(e) {
645
645
  this.setAttribute("lock-while-loading", String(e));
646
646
  }
647
647
  get showClose() {
648
- return this.hasAttribute("show-close") ? w(this.getAttribute("show-close"), !0) : this.dismissible;
648
+ return this.hasAttribute("show-close") ? _(this.getAttribute("show-close"), !0) : this.dismissible;
649
649
  }
650
650
  set showClose(e) {
651
651
  this.setAttribute("show-close", String(e));
@@ -687,10 +687,10 @@ class T extends I {
687
687
  }
688
688
  _resolvedSide() {
689
689
  const e = this.getAttribute("dir") || document.documentElement.getAttribute("dir") || "ltr";
690
- return C(this.getAttribute("side"), e === "rtl" ? "rtl" : "ltr");
690
+ return I(this.getAttribute("side"), e === "rtl" ? "rtl" : "ltr");
691
691
  }
692
692
  _isTopMost() {
693
- const e = m.top();
693
+ const e = v.top();
694
694
  return e ? e === this : !0;
695
695
  }
696
696
  _isInteractionLocked() {
@@ -703,7 +703,7 @@ class T extends I {
703
703
  }
704
704
  _isFocusable(e) {
705
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;
706
+ if (!S()) return !0;
707
707
  const t = window.getComputedStyle(e);
708
708
  return t.display !== "none" && t.visibility !== "hidden";
709
709
  }
@@ -711,23 +711,23 @@ class T extends I {
711
711
  const e = this._getPanel(), t = [], r = (s) => {
712
712
  this._isFocusable(s) && (t.includes(s) || t.push(s));
713
713
  };
714
- return this.querySelectorAll(E).forEach(r), e && e.querySelectorAll(E).forEach(r), t;
714
+ return this.querySelectorAll(L).forEach(r), e && e.querySelectorAll(L).forEach(r), t;
715
715
  }
716
716
  _cancelScheduledFocusWork() {
717
- this._focusInitialFrame && (_(this._focusInitialFrame), this._focusInitialFrame = 0), this._focusTrapFrame && (_(this._focusTrapFrame), this._focusTrapFrame = 0), this._restoreFocusFrame && (_(this._restoreFocusFrame), this._restoreFocusFrame = 0);
717
+ this._focusInitialFrame && (F(this._focusInitialFrame), this._focusInitialFrame = 0), this._focusTrapFrame && (F(this._focusTrapFrame), this._focusTrapFrame = 0), this._restoreFocusFrame && (F(this._restoreFocusFrame), this._restoreFocusFrame = 0);
718
718
  }
719
719
  _scheduleFocusInitial() {
720
- this._isOpen && (this._focusInitialFrame || (this._focusInitialFrame = F(() => {
720
+ this._isOpen && (this._focusInitialFrame || (this._focusInitialFrame = k(() => {
721
721
  this._focusInitialFrame = 0, this._focusInitial();
722
722
  })));
723
723
  }
724
724
  _scheduleEnsureFocusTrap() {
725
- this._isOpen && (this._focusTrapFrame || (this._focusTrapFrame = F(() => {
725
+ this._isOpen && (this._focusTrapFrame || (this._focusTrapFrame = k(() => {
726
726
  this._focusTrapFrame = 0, this._ensureFocusTrap();
727
727
  })));
728
728
  }
729
729
  _scheduleRestoreFocus(e) {
730
- !e || !this._canRestoreFocus(e) || (this._restoreFocusFrame && _(this._restoreFocusFrame), this._restoreFocusFrame = F(() => {
730
+ !e || !this._canRestoreFocus(e) || (this._restoreFocusFrame && F(this._restoreFocusFrame), this._restoreFocusFrame = k(() => {
731
731
  this._restoreFocusFrame = 0;
732
732
  try {
733
733
  this._canRestoreFocus(e) && e.focus({ preventScroll: !0 });
@@ -746,14 +746,14 @@ class T extends I {
746
746
  r.classList.remove("side-left", "side-right", "side-top", "side-bottom"), r.classList.add(`side-${o}`);
747
747
  const n = this.state === "loading";
748
748
  n ? r.setAttribute("aria-busy", "true") : r.removeAttribute("aria-busy");
749
- const y = this.getAttribute("role") || "dialog";
750
- r.setAttribute("role", y);
751
- const u = (this.getAttribute("title") || "").trim(), h = (this.getAttribute("description") || "").trim(), p = A(this, "header"), b = this.showClose, x = b || p || !!u || !!h;
752
- s && s.classList.toggle("empty", !x), a && (a.hidden = !b, a.disabled = n && this.lockWhileLoading);
753
- const f = this.getAttribute("aria-label") || "", g = this.getAttribute("aria-labelledby") || "", l = this.getAttribute("aria-describedby") || "", c = g || (!f && (p || u) ? this._titleId() : ""), d = [];
754
- l ? d.push(l) : (h && d.push(this._descriptionId()), d.push(this._bodyId()));
755
- const k = f || (c ? "" : "Drawer");
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");
749
+ const A = this.getAttribute("role") || "dialog";
750
+ r.setAttribute("role", A);
751
+ const u = (this.getAttribute("title") || "").trim(), g = (this.getAttribute("description") || "").trim(), c = C(this, "header"), h = this.showClose, x = h || c || !!u || !!g;
752
+ s && s.classList.toggle("empty", !x), a && (a.hidden = !h, a.disabled = n && this.lockWhileLoading);
753
+ const p = this.getAttribute("aria-label") || "", m = this.getAttribute("aria-labelledby") || "", w = this.getAttribute("aria-describedby") || "", b = c ? (this.querySelector('[slot="header"]')?.textContent || "").replace(/\s+/g, " ").trim() : "", l = !p && !m && !!b, f = m || (!p && !l && (c || u) ? this._titleId() : ""), d = [];
754
+ w ? d.push(w) : (g && d.push(this._descriptionId()), d.push(this._bodyId()));
755
+ const E = p || (l ? b : f ? "" : "Drawer");
756
+ E ? r.setAttribute("aria-label", E) : r.removeAttribute("aria-label"), f ? r.setAttribute("aria-labelledby", f) : r.removeAttribute("aria-labelledby"), d.length ? r.setAttribute("aria-describedby", d.join(" ")) : r.removeAttribute("aria-describedby");
757
757
  }
758
758
  _focusInitial() {
759
759
  if (!this._isOpen) return;
@@ -792,13 +792,13 @@ class T extends I {
792
792
  }
793
793
  _releaseOpenResources() {
794
794
  try {
795
- m.unregister(this), m.releaseLock();
795
+ v.unregister(this), v.releaseLock();
796
796
  } catch {
797
797
  }
798
798
  }
799
799
  _canRestoreFocus(e) {
800
800
  if (!e || !e.isConnected || e.disabled) return !1;
801
- if (!L()) return !0;
801
+ if (!S()) return !0;
802
802
  const t = window.getComputedStyle(e);
803
803
  return t.display !== "none" && t.visibility !== "hidden";
804
804
  }
@@ -811,7 +811,7 @@ class T extends I {
811
811
  if (this._isOpen = e, e) {
812
812
  this._cancelScheduledFocusWork(), this._bindGlobalListeners(), this._restoreFocusEl = document.activeElement || null, this._closeReason = "programmatic";
813
813
  try {
814
- m.register(this), m.acquireLock();
814
+ v.register(this), v.acquireLock();
815
815
  } catch {
816
816
  }
817
817
  this._scheduleFocusInitial(), this._scheduleEnsureFocusTrap(), this.dispatchEvent(new CustomEvent("open", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("show", { bubbles: !0, composed: !0 })), this.dispatchEvent(
@@ -918,28 +918,28 @@ class T extends I {
918
918
  t && this._isNodeInsideDrawer(t) || s.includes(this) || r && s.includes(r) || this._scheduleFocusInitial();
919
919
  }
920
920
  render() {
921
- const e = this.getAttribute("dir") || document.documentElement.getAttribute("dir") || "ltr", t = C(this.getAttribute("side"), e === "rtl" ? "rtl" : "ltr"), r = this.showClose, s = A(this, "header"), a = A(this, "footer"), o = (this.getAttribute("title") || "").trim(), n = (this.getAttribute("description") || "").trim(), y = r || s || !!o || !!n, u = `ui-drawer-title-${this._uid}`, h = `ui-drawer-description-${this._uid}`, p = `ui-drawer-body-${this._uid}`, b = this.getAttribute("aria-label") || "", x = this.getAttribute("aria-labelledby") || "", f = this.getAttribute("aria-describedby") || "", g = x || (!b && (s || o) ? u : ""), l = [];
922
- f ? l.push(f) : (n && l.push(h), l.push(p));
923
- const c = b || (g ? "" : "Drawer"), d = this.state === "loading";
921
+ const e = this.getAttribute("dir") || document.documentElement.getAttribute("dir") || "ltr", t = I(this.getAttribute("side"), e === "rtl" ? "rtl" : "ltr"), r = this.showClose, s = C(this, "header"), a = C(this, "footer"), o = (this.getAttribute("title") || "").trim(), n = (this.getAttribute("description") || "").trim(), A = r || s || !!o || !!n, u = `ui-drawer-title-${this._uid}`, g = `ui-drawer-description-${this._uid}`, c = `ui-drawer-body-${this._uid}`, h = this.getAttribute("aria-label") || "", x = this.getAttribute("aria-labelledby") || "", p = this.getAttribute("aria-describedby") || "", m = s ? (this.querySelector('[slot="header"]')?.textContent || "").replace(/\s+/g, " ").trim() : "", w = !h && !x && !!m, b = x || (!h && !w && (s || o) ? u : ""), l = [];
922
+ p ? l.push(p) : (n && l.push(g), l.push(c));
923
+ const f = h || (w ? m : b ? "" : "Drawer"), d = this.state === "loading";
924
924
  this.setContent(`
925
- <style>${O}</style>
925
+ <style>${D}</style>
926
926
  <div class="overlay" part="overlay" aria-hidden="true"></div>
927
- <aside
927
+ <div
928
928
  class="panel side-${t}"
929
929
  part="panel"
930
930
  role="dialog"
931
931
  aria-modal="true"
932
- ${c ? `aria-label="${v(c)}"` : ""}
933
- ${g ? `aria-labelledby="${v(g)}"` : ""}
934
- ${l.length ? `aria-describedby="${v(l.join(" "))}"` : ""}
932
+ ${f ? `aria-label="${y(f)}"` : ""}
933
+ ${b ? `aria-labelledby="${y(b)}"` : ""}
934
+ ${l.length ? `aria-describedby="${y(l.join(" "))}"` : ""}
935
935
  ${d ? 'aria-busy="true"' : ""}
936
936
  tabindex="-1"
937
937
  >
938
- <header class="header ${y ? "" : "empty"}" part="header">
938
+ <header class="header ${A ? "" : "empty"}" part="header">
939
939
  <div class="header-main">
940
940
  ${s ? `<slot name="header" id="${u}"></slot>` : ""}
941
- ${!s && o ? `<h2 class="title" id="${u}">${v(o)}</h2>` : ""}
942
- ${n ? `<p class="subtitle" id="${h}">${v(n)}</p>` : ""}
941
+ ${!s && o ? `<h2 class="title" id="${u}">${y(o)}</h2>` : ""}
942
+ ${n ? `<p class="subtitle" id="${g}">${y(n)}</p>` : ""}
943
943
  </div>
944
944
  <button
945
945
  type="button"
@@ -955,9 +955,9 @@ class T extends I {
955
955
  </svg>
956
956
  </button>
957
957
  </header>
958
- <div class="body" part="body" id="${p}"><slot></slot></div>
958
+ <div class="body" part="body" id="${c}"><slot></slot></div>
959
959
  <footer class="footer ${a ? "" : "empty"}" part="footer"><slot name="footer"></slot></footer>
960
- </aside>
960
+ </div>
961
961
  `), this._syncLiveUi(), this._isOpen && this._scheduleEnsureFocusTrap();
962
962
  }
963
963
  _bindGlobalListeners() {
@@ -967,7 +967,7 @@ class T extends I {
967
967
  this._globalListenersBound && (document.removeEventListener("keydown", this._onDocumentKeyDown, !0), document.removeEventListener("focusin", this._onDocumentFocusIn, !0), this._globalListenersBound = !1);
968
968
  }
969
969
  }
970
- typeof customElements < "u" && !customElements.get("ui-drawer") && customElements.define("ui-drawer", T);
970
+ typeof customElements < "u" && !customElements.get("ui-drawer") && customElements.define("ui-drawer", $);
971
971
  export {
972
- T as UIDrawer
972
+ $ as UIDrawer
973
973
  };
@@ -1,4 +1,4 @@
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=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("./ElementBase-EV6mVBUV.js"),y=require("./trigger-DkPsKxsP.js"),k=require("./menu-item-styles-B4onAr4C.js"),l=['[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]',".item","[data-menu-item]"].join(", "),A=`
2
2
  :host {
3
3
  --ui-dropdown-bg: var(
4
4
  --ui-dropdown-menu-bg,
@@ -243,7 +243,7 @@
243
243
  }
244
244
 
245
245
  .menu[data-tone='neutral'] {
246
- --ui-dropdown-ring: color-mix(in srgb, var(--ui-color-muted, #64748b) 60%, var(--ui-dropdown-color));
246
+ --ui-dropdown-ring: color-mix(in srgb, var(--ui-color-muted, #526175) 60%, var(--ui-dropdown-color));
247
247
  }
248
248
 
249
249
  .menu[data-tone='danger'] {
@@ -254,20 +254,20 @@
254
254
  }
255
255
 
256
256
  .menu[data-tone='success'] {
257
- --ui-dropdown-ring: var(--ui-color-success, #16a34a);
258
- --ui-dropdown-item-hover-bg: color-mix(in srgb, var(--ui-color-success, #16a34a) 12%, transparent);
259
- --ui-dropdown-item-active-bg: color-mix(in srgb, var(--ui-color-success, #16a34a) 18%, transparent);
260
- --ui-dropdown-item-checked-bg: color-mix(in srgb, var(--ui-color-success, #16a34a) 16%, transparent);
257
+ --ui-dropdown-ring: var(--ui-color-success, #15803d);
258
+ --ui-dropdown-item-hover-bg: color-mix(in srgb, var(--ui-color-success, #15803d) 12%, transparent);
259
+ --ui-dropdown-item-active-bg: color-mix(in srgb, var(--ui-color-success, #15803d) 18%, transparent);
260
+ --ui-dropdown-item-checked-bg: color-mix(in srgb, var(--ui-color-success, #15803d) 16%, transparent);
261
261
  }
262
262
 
263
263
  .menu[data-tone='warning'] {
264
- --ui-dropdown-ring: var(--ui-color-warning, #d97706);
265
- --ui-dropdown-item-hover-bg: color-mix(in srgb, var(--ui-color-warning, #d97706) 15%, transparent);
266
- --ui-dropdown-item-active-bg: color-mix(in srgb, var(--ui-color-warning, #d97706) 20%, transparent);
267
- --ui-dropdown-item-checked-bg: color-mix(in srgb, var(--ui-color-warning, #d97706) 17%, transparent);
264
+ --ui-dropdown-ring: var(--ui-color-warning, #b45309);
265
+ --ui-dropdown-item-hover-bg: color-mix(in srgb, var(--ui-color-warning, #b45309) 15%, transparent);
266
+ --ui-dropdown-item-active-bg: color-mix(in srgb, var(--ui-color-warning, #b45309) 20%, transparent);
267
+ --ui-dropdown-item-checked-bg: color-mix(in srgb, var(--ui-color-warning, #b45309) 17%, transparent);
268
268
  }
269
269
 
270
- ${y.createSharedMenuItemCss({scopes:[".menu"],prefix:"--ui-dropdown",shortcutSelectors:[".shortcut",".meta"],activeStateSelectors:['.item[data-active="true"]','[role="menuitem"][data-active="true"]','[role="menuitemcheckbox"][data-active="true"]','[role="menuitemradio"][data-active="true"]','[data-menu-item][data-active="true"]']})}
270
+ ${k.createSharedMenuItemCss({scopes:[".menu"],prefix:"--ui-dropdown",shortcutSelectors:[".shortcut",".meta"],activeStateSelectors:['.item[data-active="true"]','[role="menuitem"][data-active="true"]','[role="menuitemcheckbox"][data-active="true"]','[role="menuitemradio"][data-active="true"]','[data-menu-item][data-active="true"]']})}
271
271
 
272
272
  .menu [role='menuitem'],
273
273
  .menu [role='menuitemcheckbox'],
@@ -488,8 +488,8 @@
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 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
- <style>${k}</style>
491
+ `;function S(i){return i==="top"||i==="left"||i==="right"?i:"bottom"}function C(i){const e=(i||"").trim().toLowerCase();return e==="sm"||e==="1"||e==="compact"?"sm":e==="lg"||e==="3"||e==="comfortable"?"lg":"md"}function E(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 p(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 h(){return typeof window<"u"&&typeof document<"u"}function b(i){return i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"||i.disabled===!0}function I(i){return(i.getAttribute("aria-label")||i.textContent||"").trim()}function g(i){if(i)try{i.focus({preventScroll:!0})}catch{i.focus()}}function T(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 M(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 O(i,e,t){for(let r=e+t;r>=0&&r<i.length;r+=t)if(!b(i[r]))return r;return-1}function P(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(I(n).toLowerCase().startsWith(e))return n}return null}const D=new Set(["variant","density","shape","elevation","tone","size","radius"]),F=new Set(["aria-label","aria-labelledby","aria-describedby"]),L=["--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"||D.has(e))){this._syncMenuPresentation(),this._schedulePanelSync();return}this._isOpen&&F.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(!h())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)return;const t=y.resolveTriggerControl(e);if(t.id||(t.id=this._triggerId),t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded",this._isOpen?"true":"false"),this._isOpen?t.setAttribute("aria-controls",this._menuId):t.removeAttribute("aria-controls"),this.hasAttribute("disabled")){t.setAttribute("aria-disabled","true"),t.setAttribute("tabindex","-1");return}t.getAttribute("aria-disabled")==="true"&&t.removeAttribute("aria-disabled"),t.getAttribute("tabindex")==="-1"&&t.removeAttribute("tabindex")}_renderMenuContent(){const e=this._getMenu();if(!e)return;e.replaceChildren();const t=this._getContentSource();if(t&&e.appendChild(M(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=h()?window.getComputedStyle(this):null;t&&L.forEach(c=>{const m=t.getPropertyValue(c).trim();m?e.style.setProperty(c,m):e.style.removeProperty(c)});const r=p(this,"variant"),o=C(this.getAttribute("size")||this.getAttribute("density")),a=p(this,"density"),n=p(this,"shape"),u=p(this,"elevation"),s=p(this,"tone"),d=E(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||!h())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||!h())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=S(this.getAttribute("placement")),t=this._getTrigger(),r=this._getMenu();if(!t||!r||!h())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&&T(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=O(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=P(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
+ <style>${A}</style>
493
493
  <div class="root" part="root">
494
494
  <div class="trigger" part="trigger">
495
495
  <slot name="trigger"></slot>