@editora/ui-core 0.1.21 → 0.1.23

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 (348) hide show
  1. package/README.md +292 -221
  2. package/dist/{ElementBase-YlTLMsGk.mjs → ElementBase-BeZT54Hj.mjs} +3 -2
  3. package/dist/ElementBase-DxbvhLJs.js +1 -0
  4. package/dist/ElementBase.d.ts +2 -1
  5. package/dist/ElementBase.d.ts.map +1 -1
  6. package/dist/__tests__/setup.d.ts +0 -2
  7. package/dist/__tests__/setup.d.ts.map +1 -1
  8. package/dist/accordion.cjs.js +4 -4
  9. package/dist/accordion.esm.js +4 -4
  10. package/dist/alert-dialog.cjs.js +32 -32
  11. package/dist/alert-dialog.esm.js +95 -75
  12. package/dist/alert.cjs.js +7 -7
  13. package/dist/alert.esm.js +7 -7
  14. package/dist/anchor.cjs.js +3 -3
  15. package/dist/anchor.esm.js +6 -5
  16. package/dist/animated-beam.cjs.js +1 -1
  17. package/dist/animated-beam.esm.js +1 -1
  18. package/dist/animated-list.cjs.js +5 -5
  19. package/dist/animated-list.esm.js +5 -5
  20. package/dist/animated-text.cjs.js +5 -5
  21. package/dist/animated-text.esm.js +5 -5
  22. package/dist/app-header.cjs.js +4 -4
  23. package/dist/app-header.esm.js +4 -4
  24. package/dist/aspect-ratio.cjs.js +4 -4
  25. package/dist/aspect-ratio.esm.js +4 -4
  26. package/dist/avatar.cjs.js +14 -14
  27. package/dist/avatar.esm.js +31 -29
  28. package/dist/badge.cjs.js +5 -5
  29. package/dist/badge.esm.js +5 -5
  30. package/dist/block-controls.cjs.js +5 -5
  31. package/dist/block-controls.esm.js +5 -5
  32. package/dist/box.cjs.js +3 -3
  33. package/dist/box.esm.js +3 -3
  34. package/dist/breadcrumb.cjs.js +6 -6
  35. package/dist/breadcrumb.esm.js +6 -6
  36. package/dist/button.cjs.js +1 -1
  37. package/dist/button.esm.js +1 -1
  38. package/dist/{calendar-DLY4acgn.mjs → calendar-B3PUKHQm.mjs} +227 -183
  39. package/dist/{calendar-Dkof-FTK.js → calendar-D-mXMgqc.js} +74 -35
  40. package/dist/calendar.cjs.js +1 -1
  41. package/dist/calendar.esm.js +1 -1
  42. package/dist/card.cjs.js +8 -8
  43. package/dist/card.esm.js +63 -20
  44. package/dist/chart.cjs.js +5 -5
  45. package/dist/chart.esm.js +7 -7
  46. package/dist/checkbox.cjs.js +3 -3
  47. package/dist/checkbox.esm.js +3 -3
  48. package/dist/collapsible.cjs.js +8 -8
  49. package/dist/collapsible.esm.js +8 -8
  50. package/dist/collection.cjs.js +1 -1
  51. package/dist/collection.esm.js +9 -8
  52. package/dist/color-picker.cjs.js +30 -10
  53. package/dist/color-picker.esm.js +84 -62
  54. package/dist/combobox.cjs.js +29 -27
  55. package/dist/combobox.esm.js +51 -45
  56. package/dist/command-palette.cjs.js +1 -1
  57. package/dist/command-palette.esm.js +1 -1
  58. package/dist/command.cjs.js +2 -2
  59. package/dist/command.esm.js +3 -3
  60. package/dist/components/ui-alert-dialog.d.ts +1 -0
  61. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  62. package/dist/components/ui-anchor.d.ts +2 -1
  63. package/dist/components/ui-anchor.d.ts.map +1 -1
  64. package/dist/components/ui-avatar.d.ts +1 -0
  65. package/dist/components/ui-avatar.d.ts.map +1 -1
  66. package/dist/components/ui-button.d.ts +1 -0
  67. package/dist/components/ui-button.d.ts.map +1 -1
  68. package/dist/components/ui-calendar.d.ts.map +1 -1
  69. package/dist/components/ui-card.d.ts +3 -0
  70. package/dist/components/ui-card.d.ts.map +1 -1
  71. package/dist/components/ui-checkbox.d.ts.map +1 -1
  72. package/dist/components/ui-collection.d.ts +2 -1
  73. package/dist/components/ui-collection.d.ts.map +1 -1
  74. package/dist/components/ui-color-picker.d.ts.map +1 -1
  75. package/dist/components/ui-combobox.d.ts.map +1 -1
  76. package/dist/components/ui-data-table.d.ts.map +1 -1
  77. package/dist/components/ui-date-field.d.ts.map +1 -1
  78. package/dist/components/ui-date-picker.d.ts.map +1 -1
  79. package/dist/components/ui-date-range-picker.d.ts.map +1 -1
  80. package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
  81. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  82. package/dist/components/ui-dock.d.ts +1 -0
  83. package/dist/components/ui-dock.d.ts.map +1 -1
  84. package/dist/components/ui-drawer.d.ts.map +1 -1
  85. package/dist/components/ui-dropdown.d.ts.map +1 -1
  86. package/dist/components/ui-field.d.ts.map +1 -1
  87. package/dist/components/ui-file-upload.d.ts.map +1 -1
  88. package/dist/components/ui-form.d.ts +1 -0
  89. package/dist/components/ui-form.d.ts.map +1 -1
  90. package/dist/components/ui-gantt.d.ts.map +1 -1
  91. package/dist/components/ui-input.d.ts.map +1 -1
  92. package/dist/components/ui-menu.d.ts.map +1 -1
  93. package/dist/components/ui-multi-select.d.ts.map +1 -1
  94. package/dist/components/ui-number-field.d.ts.map +1 -1
  95. package/dist/components/ui-password-field.d.ts.map +1 -1
  96. package/dist/components/ui-pin-input.d.ts +1 -0
  97. package/dist/components/ui-pin-input.d.ts.map +1 -1
  98. package/dist/components/ui-placement-grid.d.ts.map +1 -1
  99. package/dist/components/ui-progress.d.ts.map +1 -1
  100. package/dist/components/ui-radio.d.ts.map +1 -1
  101. package/dist/components/ui-rating.d.ts +1 -0
  102. package/dist/components/ui-rating.d.ts.map +1 -1
  103. package/dist/components/ui-roving-focus-group.d.ts +2 -1
  104. package/dist/components/ui-roving-focus-group.d.ts.map +1 -1
  105. package/dist/components/ui-select.d.ts.map +1 -1
  106. package/dist/components/ui-sortable.d.ts.map +1 -1
  107. package/dist/components/ui-switch.d.ts.map +1 -1
  108. package/dist/components/ui-table.d.ts.map +1 -1
  109. package/dist/components/ui-tabs.d.ts +1 -0
  110. package/dist/components/ui-tabs.d.ts.map +1 -1
  111. package/dist/components/ui-tags-input.d.ts +1 -0
  112. package/dist/components/ui-tags-input.d.ts.map +1 -1
  113. package/dist/components/ui-textarea.d.ts.map +1 -1
  114. package/dist/components/ui-time-field.d.ts.map +1 -1
  115. package/dist/components/ui-toggle-group.d.ts.map +1 -1
  116. package/dist/components/ui-toggle.d.ts.map +1 -1
  117. package/dist/components/ui-tree.d.ts.map +1 -1
  118. package/dist/components/ui-wizard.d.ts.map +1 -1
  119. package/dist/container.cjs.js +1 -1
  120. package/dist/container.esm.js +1 -1
  121. package/dist/context-menu.cjs.js +3 -3
  122. package/dist/context-menu.esm.js +5 -5
  123. package/dist/control-group.cjs.js +1 -1
  124. package/dist/control-group.esm.js +1 -1
  125. package/dist/control-name-BmoI1m3a.js +1 -0
  126. package/dist/control-name-Bpj7F34X.mjs +48 -0
  127. package/dist/data-table.cjs.js +6 -3
  128. package/dist/data-table.esm.js +146 -143
  129. package/dist/date-field.cjs.js +5 -5
  130. package/dist/date-field.esm.js +34 -31
  131. package/dist/date-picker.cjs.js +16 -16
  132. package/dist/date-picker.esm.js +49 -45
  133. package/dist/date-range-picker.cjs.js +5 -5
  134. package/dist/date-range-picker.esm.js +120 -118
  135. package/dist/date-range-time-picker.cjs.js +22 -22
  136. package/dist/date-range-time-picker.esm.js +89 -85
  137. package/dist/date-time-picker.cjs.js +23 -23
  138. package/dist/date-time-picker.esm.js +103 -99
  139. package/dist/{date-time-utils-y1N2gvG2.mjs → date-time-utils-BTlxnz5j.mjs} +1 -1
  140. package/dist/{date-time-utils-Dmost5Ee.js → date-time-utils-y3AvNvGe.js} +1 -1
  141. package/dist/description.cjs.js +4 -4
  142. package/dist/description.esm.js +4 -4
  143. package/dist/dialog.cjs.js +3 -3
  144. package/dist/dialog.esm.js +3 -3
  145. package/dist/direction-provider.cjs.js +1 -1
  146. package/dist/direction-provider.esm.js +1 -1
  147. package/dist/dismissable-layer.cjs.js +1 -1
  148. package/dist/dismissable-layer.esm.js +1 -1
  149. package/dist/dock.cjs.js +12 -12
  150. package/dist/dock.esm.js +73 -75
  151. package/dist/domElement-DazSZBjV.js +1 -0
  152. package/dist/domElement-ZlSGVP0l.mjs +5 -0
  153. package/dist/domElement.d.ts +2 -0
  154. package/dist/domElement.d.ts.map +1 -0
  155. package/dist/drawer.cjs.js +19 -19
  156. package/dist/drawer.esm.js +58 -58
  157. package/dist/dropdown.cjs.js +13 -13
  158. package/dist/dropdown.esm.js +50 -49
  159. package/dist/empty-state.cjs.js +4 -4
  160. package/dist/empty-state.esm.js +4 -4
  161. package/dist/field-error.cjs.js +2 -2
  162. package/dist/field-error.esm.js +2 -2
  163. package/dist/field.cjs.js +12 -12
  164. package/dist/field.esm.js +84 -75
  165. package/dist/fieldset.cjs.js +5 -5
  166. package/dist/fieldset.esm.js +5 -5
  167. package/dist/file-upload.cjs.js +4 -4
  168. package/dist/file-upload.esm.js +6 -4
  169. package/dist/flex.cjs.js +1 -1
  170. package/dist/flex.esm.js +1 -1
  171. package/dist/floating-toolbar.cjs.js +8 -8
  172. package/dist/floating-toolbar.esm.js +10 -10
  173. package/dist/focus-scope.cjs.js +1 -1
  174. package/dist/focus-scope.esm.js +1 -1
  175. package/dist/form.cjs.js +13 -13
  176. package/dist/form.esm.js +23 -13
  177. package/dist/gantt.cjs.js +43 -32
  178. package/dist/gantt.esm.js +100 -89
  179. package/dist/grid.cjs.js +1 -1
  180. package/dist/grid.esm.js +1 -1
  181. package/dist/hover-card.cjs.js +1 -1
  182. package/dist/hover-card.esm.js +1 -1
  183. package/dist/icon-cloud.cjs.js +4 -4
  184. package/dist/icon-cloud.esm.js +4 -4
  185. package/dist/icon.cjs.js +1 -1
  186. package/dist/icon.esm.js +1 -1
  187. package/dist/index.cjs.js +1 -1
  188. package/dist/index.esm.js +121 -118
  189. package/dist/inline-edit.cjs.js +2 -2
  190. package/dist/inline-edit.esm.js +2 -2
  191. package/dist/input.cjs.js +14 -14
  192. package/dist/input.esm.js +40 -33
  193. package/dist/label.cjs.js +4 -4
  194. package/dist/label.esm.js +4 -4
  195. package/dist/layout.cjs.js +1 -1
  196. package/dist/layout.esm.js +1 -1
  197. package/dist/{listbox-B6QgECax.js → listbox-CTpRpuF7.js} +1 -1
  198. package/dist/{listbox-DJamVeFj.mjs → listbox-hMVOhKHC.mjs} +1 -1
  199. package/dist/listbox.cjs.js +1 -1
  200. package/dist/listbox.esm.js +1 -1
  201. package/dist/marquee.cjs.js +4 -4
  202. package/dist/marquee.esm.js +4 -4
  203. package/dist/masonry-grid.cjs.js +1 -1
  204. package/dist/masonry-grid.esm.js +1 -1
  205. package/dist/{menu-item-styles-CbNUEwP2.js → menu-item-styles-B4onAr4C.js} +3 -3
  206. package/dist/{menu-item-styles-CZiPwPwl.mjs → menu-item-styles-IGSFLAHu.mjs} +3 -3
  207. package/dist/menu.cjs.js +7 -7
  208. package/dist/menu.esm.js +30 -29
  209. package/dist/menubar.cjs.js +1 -1
  210. package/dist/menubar.esm.js +3 -3
  211. package/dist/meter.cjs.js +2 -2
  212. package/dist/meter.esm.js +2 -2
  213. package/dist/multi-select.cjs.js +17 -17
  214. package/dist/multi-select.esm.js +52 -44
  215. package/dist/navigation-menu.cjs.js +2 -2
  216. package/dist/navigation-menu.esm.js +2 -2
  217. package/dist/number-field.cjs.js +11 -13
  218. package/dist/number-field.esm.js +30 -28
  219. package/dist/number-ticker.cjs.js +5 -5
  220. package/dist/number-ticker.esm.js +5 -5
  221. package/dist/odometer.cjs.js +3 -3
  222. package/dist/odometer.esm.js +3 -3
  223. package/dist/orbiter.cjs.js +4 -4
  224. package/dist/orbiter.esm.js +4 -4
  225. package/dist/pagination.cjs.js +2 -2
  226. package/dist/pagination.esm.js +2 -2
  227. package/dist/{panel-group-CaD0_KQf.js → panel-group-BVHJEdfx.js} +1 -1
  228. package/dist/{panel-group-8sVNnGxg.mjs → panel-group-BxO_eNW6.mjs} +1 -1
  229. package/dist/panel-group.cjs.js +1 -1
  230. package/dist/panel-group.esm.js +1 -1
  231. package/dist/panel.cjs.js +1 -1
  232. package/dist/panel.esm.js +1 -1
  233. package/dist/password-field.cjs.js +23 -23
  234. package/dist/password-field.esm.js +48 -47
  235. package/dist/pin-input.cjs.js +8 -6
  236. package/dist/pin-input.esm.js +21 -15
  237. package/dist/placement-grid.cjs.js +4 -4
  238. package/dist/placement-grid.esm.js +58 -58
  239. package/dist/plugin-panel.cjs.js +2 -2
  240. package/dist/plugin-panel.esm.js +2 -2
  241. package/dist/popover.cjs.js +6 -6
  242. package/dist/popover.esm.js +5 -5
  243. package/dist/portal.cjs.js +1 -1
  244. package/dist/portal.esm.js +1 -1
  245. package/dist/positioner.cjs.js +1 -1
  246. package/dist/positioner.esm.js +1 -1
  247. package/dist/presence.cjs.js +1 -1
  248. package/dist/presence.esm.js +1 -1
  249. package/dist/primitives/control-name.d.ts +30 -0
  250. package/dist/primitives/control-name.d.ts.map +1 -0
  251. package/dist/primitives/trigger.d.ts +2 -0
  252. package/dist/primitives/trigger.d.ts.map +1 -0
  253. package/dist/progress.cjs.js +4 -4
  254. package/dist/progress.esm.js +20 -18
  255. package/dist/quick-actions.cjs.js +4 -4
  256. package/dist/quick-actions.esm.js +4 -4
  257. package/dist/radio-group.cjs.js +2 -2
  258. package/dist/radio-group.esm.js +2 -2
  259. package/dist/radio.cjs.js +3 -3
  260. package/dist/radio.esm.js +3 -3
  261. package/dist/rating.cjs.js +18 -17
  262. package/dist/rating.esm.js +91 -92
  263. package/dist/roving-focus-group.cjs.js +1 -1
  264. package/dist/roving-focus-group.esm.js +11 -10
  265. package/dist/{runtime-D1gFh1fS.mjs → runtime-CFnK53iC.mjs} +133 -94
  266. package/dist/runtime-DwE-tizc.js +1 -0
  267. package/dist/runtime.cjs.js +1 -1
  268. package/dist/runtime.d.ts +1 -1
  269. package/dist/runtime.d.ts.map +1 -1
  270. package/dist/runtime.esm.js +29 -26
  271. package/dist/scroll-area.cjs.js +1 -1
  272. package/dist/scroll-area.esm.js +1 -1
  273. package/dist/section.cjs.js +1 -1
  274. package/dist/section.esm.js +1 -1
  275. package/dist/select.cjs.js +20 -19
  276. package/dist/select.esm.js +37 -33
  277. package/dist/selection-popup.cjs.js +3 -3
  278. package/dist/selection-popup.esm.js +3 -3
  279. package/dist/separator.cjs.js +8 -8
  280. package/dist/separator.esm.js +8 -8
  281. package/dist/sidebar.cjs.js +9 -9
  282. package/dist/sidebar.esm.js +16 -16
  283. package/dist/skeleton.cjs.js +8 -8
  284. package/dist/skeleton.esm.js +8 -8
  285. package/dist/slider.cjs.js +4 -4
  286. package/dist/slider.esm.js +4 -4
  287. package/dist/slot.cjs.js +4 -4
  288. package/dist/slot.esm.js +4 -4
  289. package/dist/sortable.cjs.js +43 -44
  290. package/dist/sortable.esm.js +100 -101
  291. package/dist/spinning-text.cjs.js +4 -4
  292. package/dist/spinning-text.esm.js +4 -4
  293. package/dist/split-button.cjs.js +1 -1
  294. package/dist/split-button.esm.js +2 -2
  295. package/dist/splitter.cjs.js +1 -1
  296. package/dist/splitter.esm.js +1 -1
  297. package/dist/stepper.cjs.js +2 -2
  298. package/dist/stepper.esm.js +2 -2
  299. package/dist/switch.cjs.js +11 -13
  300. package/dist/switch.esm.js +11 -13
  301. package/dist/table.cjs.js +10 -7
  302. package/dist/table.esm.js +47 -44
  303. package/dist/tabs.cjs.js +21 -22
  304. package/dist/tabs.esm.js +71 -67
  305. package/dist/tags-input.cjs.js +9 -9
  306. package/dist/tags-input.esm.js +32 -25
  307. package/dist/textarea.cjs.js +10 -10
  308. package/dist/textarea.esm.js +30 -21
  309. package/dist/theme.d.ts +18 -0
  310. package/dist/theme.d.ts.map +1 -1
  311. package/dist/time-field.cjs.js +5 -5
  312. package/dist/time-field.esm.js +21 -18
  313. package/dist/time-picker.cjs.js +4 -4
  314. package/dist/time-picker.esm.js +6 -6
  315. package/dist/timeline.cjs.js +3 -3
  316. package/dist/timeline.esm.js +5 -5
  317. package/dist/toast.cjs.js +7 -7
  318. package/dist/toast.esm.js +14 -14
  319. package/dist/toggle-group.cjs.js +6 -7
  320. package/dist/toggle-group.esm.js +64 -61
  321. package/dist/toggle.cjs.js +18 -18
  322. package/dist/toggle.esm.js +32 -31
  323. package/dist/toolbar.cjs.js +1 -1
  324. package/dist/toolbar.esm.js +1 -1
  325. package/dist/tooltip.cjs.js +5 -5
  326. package/dist/tooltip.esm.js +5 -5
  327. package/dist/transfer-list.cjs.js +4 -4
  328. package/dist/transfer-list.esm.js +4 -4
  329. package/dist/{tree-B3kE8ESs.mjs → tree-B_oQput6.mjs} +35 -34
  330. package/dist/tree-SivHxcAy.js +39 -0
  331. package/dist/tree-item.cjs.js +1 -1
  332. package/dist/tree-item.esm.js +1 -1
  333. package/dist/tree.cjs.js +1 -1
  334. package/dist/tree.esm.js +1 -1
  335. package/dist/trigger-BjnxLCeQ.mjs +9 -0
  336. package/dist/trigger-DkPsKxsP.js +1 -0
  337. package/dist/{ui-button-rXQOS9QJ.js → ui-button-BPrzJScZ.js} +29 -28
  338. package/dist/{ui-button-Q0GNNWKC.mjs → ui-button-Co8Sid6t.mjs} +70 -49
  339. package/dist/{ui-icon-BzVNC_lr.js → ui-icon-D3avtxX_.js} +5 -5
  340. package/dist/{ui-icon-YI6lyuqU.mjs → ui-icon-DLhB08Fo.mjs} +3 -3
  341. package/dist/visually-hidden.cjs.js +1 -1
  342. package/dist/visually-hidden.esm.js +1 -1
  343. package/dist/wizard.cjs.js +12 -13
  344. package/dist/wizard.esm.js +18 -16
  345. package/package.json +2 -2
  346. package/dist/ElementBase-EV6mVBUV.js +0 -1
  347. package/dist/runtime-CTaOSmBj.js +0 -1
  348. package/dist/tree-Dx_kv_ih.js +0 -39
@@ -1,9 +1,9 @@
1
- import { E as q } from "./ElementBase-YlTLMsGk.mjs";
2
- import { r as O, e as F, l as U, i as A, s as N, c as V } from "./date-time-utils-y1N2gvG2.mjs";
1
+ import { E as q } from "./ElementBase-BeZT54Hj.mjs";
2
+ import { r as O, e as F, l as U, i as A, s as N, c as V } from "./date-time-utils-BTlxnz5j.mjs";
3
3
  function g(s, t, e) {
4
4
  return Math.max(t, Math.min(e, s));
5
5
  }
6
- function _(s, t = 3) {
6
+ function m(s, t = 3) {
7
7
  const e = 10 ** t;
8
8
  return Math.round(s * e) / e;
9
9
  }
@@ -20,7 +20,7 @@ function D(s) {
20
20
  const e = Number(t);
21
21
  return Number.isFinite(e) ? g(e, 0, 1) : null;
22
22
  }
23
- function P(s) {
23
+ function C(s) {
24
24
  const t = s.trim();
25
25
  if (!t) return null;
26
26
  if (t.endsWith("%")) {
@@ -98,7 +98,7 @@ function G(s) {
98
98
  if (!t) return null;
99
99
  const e = T(t[1]);
100
100
  if (!e || e.channels.length < 3) return null;
101
- const r = P(e.channels[0]), i = P(e.channels[1]), a = P(e.channels[2]);
101
+ const r = C(e.channels[0]), i = C(e.channels[1]), a = C(e.channels[2]);
102
102
  if (r == null || i == null || a == null) return null;
103
103
  const n = e.alpha != null ? D(e.alpha) : 1;
104
104
  return n == null ? null : b({ r, g: i, b: a, a: n });
@@ -118,7 +118,7 @@ function b(s) {
118
118
  r: S(s.r),
119
119
  g: S(s.g),
120
120
  b: S(s.b),
121
- a: _(g(s.a, 0, 1), 4)
121
+ a: m(g(s.a, 0, 1), 4)
122
122
  };
123
123
  }
124
124
  function f(s) {
@@ -131,21 +131,21 @@ function Y(s, t = !1) {
131
131
  }
132
132
  function j(s, t = !0) {
133
133
  const e = b(s);
134
- return !t || e.a >= 1 ? `rgb(${e.r} ${e.g} ${e.b})` : `rgb(${e.r} ${e.g} ${e.b} / ${_(e.a, 3)})`;
134
+ return !t || e.a >= 1 ? `rgb(${e.r} ${e.g} ${e.b})` : `rgb(${e.r} ${e.g} ${e.b} / ${m(e.a, 3)})`;
135
135
  }
136
136
  function J(s, t = !0) {
137
- const e = Math.round(y(s.h)), r = Math.round(g(s.s, 0, 100)), i = Math.round(g(s.l, 0, 100)), a = _(g(s.a, 0, 1), 3);
137
+ const e = Math.round(y(s.h)), r = Math.round(g(s.s, 0, 100)), i = Math.round(g(s.l, 0, 100)), a = m(g(s.a, 0, 1), 3);
138
138
  return !t || a >= 1 ? `hsl(${e} ${r}% ${i}%)` : `hsl(${e} ${r}% ${i}% / ${a})`;
139
139
  }
140
140
  function z(s) {
141
141
  const t = b(s), e = t.r / 255, r = t.g / 255, i = t.b / 255, a = Math.max(e, r, i), n = Math.min(e, r, i), o = a - n;
142
142
  let l = 0;
143
143
  o !== 0 && (a === e ? l = (r - i) / o % 6 : a === r ? l = (i - e) / o + 2 : l = (e - r) / o + 4, l *= 60, l < 0 && (l += 360));
144
- const c = a === 0 ? 0 : o / a * 100, d = a * 100;
144
+ const c = a === 0 ? 0 : o / a * 100, p = a * 100;
145
145
  return {
146
- h: _(l, 3),
147
- s: _(c, 3),
148
- v: _(d, 3),
146
+ h: m(l, 3),
147
+ s: m(c, 3),
148
+ v: m(p, 3),
149
149
  a: t.a
150
150
  };
151
151
  }
@@ -159,13 +159,13 @@ function Q(s) {
159
159
  a: s.a
160
160
  });
161
161
  }
162
- function I(s) {
162
+ function M(s) {
163
163
  const t = b(s), e = t.r / 255, r = t.g / 255, i = t.b / 255, a = Math.max(e, r, i), n = Math.min(e, r, i), o = a - n, l = (a + n) / 2;
164
- let c = 0, d = 0;
165
- return o !== 0 && (d = o / (1 - Math.abs(2 * l - 1)), a === e ? c = (r - i) / o % 6 : a === r ? c = (i - e) / o + 2 : c = (e - r) / o + 4, c *= 60, c < 0 && (c += 360)), {
166
- h: _(c, 3),
167
- s: _(d * 100, 3),
168
- l: _(l * 100, 3),
164
+ let c = 0, p = 0;
165
+ return o !== 0 && (p = o / (1 - Math.abs(2 * l - 1)), a === e ? c = (r - i) / o % 6 : a === r ? c = (i - e) / o + 2 : c = (e - r) / o + 4, c *= 60, c < 0 && (c += 360)), {
166
+ h: m(c, 3),
167
+ s: m(p * 100, 3),
168
+ l: m(l * 100, 3),
169
169
  a: t.a
170
170
  };
171
171
  }
@@ -179,16 +179,16 @@ function $(s) {
179
179
  a: s.a
180
180
  });
181
181
  }
182
- function m(s, t) {
182
+ function _(s, t) {
183
183
  return Y(s, t).toUpperCase();
184
184
  }
185
185
  function w(s, t) {
186
186
  return j(s, t);
187
187
  }
188
188
  function Z(s, t) {
189
- return J(I(s), t);
189
+ return J(M(s), t);
190
190
  }
191
- const C = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
191
+ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
192
192
  <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
193
193
  <path d="m5.6 7.6 4.4 4.6 4.4-4.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
194
194
  </svg>
@@ -197,10 +197,10 @@ const C = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
197
197
  --ui-cp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
198
198
  --ui-cp-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 74%, transparent);
199
199
  --ui-cp-text: var(--ui-color-text, #0f172a);
200
- --ui-cp-muted: var(--ui-color-muted, #64748b);
200
+ --ui-cp-muted: var(--ui-color-muted, #526175);
201
201
  --ui-cp-accent: var(--ui-color-primary, #2563eb);
202
- --ui-cp-success: var(--ui-color-success, #16a34a);
203
- --ui-cp-warning: var(--ui-color-warning, #d97706);
202
+ --ui-cp-success: var(--ui-color-success, #15803d);
203
+ --ui-cp-warning: var(--ui-color-warning, #b45309);
204
204
  --ui-cp-danger: var(--ui-color-danger, #dc2626);
205
205
  --ui-cp-radius: 14px;
206
206
  --ui-cp-shadow: none;
@@ -509,11 +509,15 @@ const C = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
509
509
  }
510
510
 
511
511
  .sv:focus-visible,
512
- .slider:focus-visible {
512
+ .slider:focus-visible::after {
513
513
  outline: 2px solid color-mix(in srgb, var(--ui-cp-accent) 64%, transparent);
514
514
  outline-offset: 1px;
515
515
  }
516
516
 
517
+ .slider:focus-visible {
518
+ outline: none;
519
+ }
520
+
517
521
  .thumb {
518
522
  position: absolute;
519
523
  inline-size: 12px;
@@ -528,19 +532,35 @@ const C = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
528
532
  transform: translate3d(0, 0, 0);
529
533
  }
530
534
 
535
+ /* The track is 12px, but the element is 24px tall (WCAG 2.5.8): the padding is the extra hit area,
536
+ the track is painted in the content box and the ring is drawn by ::after over just the track. */
531
537
  .slider {
532
538
  position: relative;
539
+ box-sizing: content-box;
533
540
  block-size: 12px;
541
+ padding-block: 6px;
534
542
  border-radius: 999px;
535
- border: 1px solid color-mix(in srgb, var(--ui-cp-border) 82%, transparent);
543
+ background-clip: content-box;
544
+ background-origin: content-box;
536
545
  cursor: pointer;
537
546
  touch-action: none;
538
547
  overflow: visible;
548
+ }
549
+
550
+ .slider::after {
551
+ content: "";
552
+ position: absolute;
553
+ inset-inline: 0;
554
+ inset-block: 6px;
555
+ box-sizing: border-box;
556
+ border-radius: 999px;
557
+ border: 1px solid color-mix(in srgb, var(--ui-cp-border) 82%, transparent);
539
558
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-cp-border) 40%, transparent);
559
+ pointer-events: none;
540
560
  }
541
561
 
542
562
  .slider.hue {
543
- background: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
563
+ background-image: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
544
564
  }
545
565
 
546
566
  .slider.alpha {
@@ -888,7 +908,7 @@ function k(s) {
888
908
  }
889
909
  class rt extends q {
890
910
  constructor() {
891
- super(), this._syncing = !1, this._initialized = !1, this._rgba = b(f(C) || { r: 37, g: 99, b: 235, a: 1 }), this._hsva = z(this._rgba), this._format = "hex", this._open = !1, this._error = "", this._presets = [], this._recentColors = [], this._panelCache = /* @__PURE__ */ new WeakMap(), this._overlay = null, this._overlayRoot = null, this._releaseScrollLock = null, this._restoreFocusEl = null, this._isSheetOpen = !1, this._dragTarget = null, this._dragPointerId = -1, this._dragRect = null, this._dragX = 0, this._dragY = 0, this._dragRaf = 0, this._dragChanged = !1, this._dragSource = "drag", this._renderingSwatches = !1, this._scheduleOverlayPosition = O(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onPanelClick(t, "root"), this._onRootInputBound = (t) => this._onPanelInput(t, "root"), this._onRootChangeBound = (t) => this._onPanelChange(t, "root"), this._onRootKeyDownBound = (t) => this._onPanelKeyDown(t, "root"), this._onRootPointerDownBound = (t) => this._onPanelPointerDown(t, "root"), this._onRootPointerMoveBound = (t) => this._onPanelPointerMove(t), this._onRootPointerUpBound = (t) => this._onPanelPointerUp(t), this._onRootPointerCancelBound = (t) => this._onPanelPointerCancel(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._scheduleOverlayPosition.run(), this._onWindowScrollBound = (t) => {
911
+ super(), this._syncing = !1, this._initialized = !1, this._rgba = b(f(I) || { r: 37, g: 99, b: 235, a: 1 }), this._hsva = z(this._rgba), this._format = "hex", this._open = !1, this._error = "", this._presets = [], this._recentColors = [], this._panelCache = /* @__PURE__ */ new WeakMap(), this._overlay = null, this._overlayRoot = null, this._releaseScrollLock = null, this._restoreFocusEl = null, this._isSheetOpen = !1, this._dragTarget = null, this._dragPointerId = -1, this._dragRect = null, this._dragX = 0, this._dragY = 0, this._dragRaf = 0, this._dragChanged = !1, this._dragSource = "drag", this._renderingSwatches = !1, this._scheduleOverlayPosition = O(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onPanelClick(t, "root"), this._onRootInputBound = (t) => this._onPanelInput(t, "root"), this._onRootChangeBound = (t) => this._onPanelChange(t, "root"), this._onRootKeyDownBound = (t) => this._onPanelKeyDown(t, "root"), this._onRootPointerDownBound = (t) => this._onPanelPointerDown(t, "root"), this._onRootPointerMoveBound = (t) => this._onPanelPointerMove(t), this._onRootPointerUpBound = (t) => this._onPanelPointerUp(t), this._onRootPointerCancelBound = (t) => this._onPanelPointerCancel(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._scheduleOverlayPosition.run(), this._onWindowScrollBound = (t) => {
892
912
  F(t, [this._overlay]) || this._scheduleOverlayPosition.run();
893
913
  }, this._applyValueAttribute(!1), this._applyFormatAttribute(), this._open = this.hasAttribute("open"), this._parsePresetsAttribute();
894
914
  }
@@ -984,7 +1004,7 @@ class rt extends q {
984
1004
  getColor() {
985
1005
  const t = b(this._rgba);
986
1006
  return {
987
- hex: m(t, this._alphaEnabled()),
1007
+ hex: _(t, this._alphaEnabled()),
988
1008
  rgba: t,
989
1009
  hsva: { ...this._hsva }
990
1010
  };
@@ -1198,7 +1218,7 @@ class rt extends q {
1198
1218
  _applyValueAttribute(t) {
1199
1219
  const e = this.getAttribute("value");
1200
1220
  if (!e) {
1201
- this._applyRgba(f(C) || this._rgba, !1);
1221
+ this._applyRgba(f(I) || this._rgba, !1);
1202
1222
  return;
1203
1223
  }
1204
1224
  const r = f(e);
@@ -1225,7 +1245,7 @@ class rt extends q {
1225
1245
  if (typeof i != "string") continue;
1226
1246
  const a = f(i);
1227
1247
  if (!a) continue;
1228
- const n = m(this._normalizeByAlpha(a), this._alphaEnabled());
1248
+ const n = _(this._normalizeByAlpha(a), this._alphaEnabled());
1229
1249
  r.includes(n) || r.push(n);
1230
1250
  }
1231
1251
  this._presets = r;
@@ -1244,7 +1264,7 @@ class rt extends q {
1244
1264
  if (!t) return;
1245
1265
  const e = JSON.parse(t);
1246
1266
  if (!Array.isArray(e)) return;
1247
- this._recentColors = e.filter((r) => typeof r == "string").map((r) => f(r)).filter((r) => !!r).map((r) => m(this._normalizeByAlpha(r), this._alphaEnabled())).slice(0, this._maxRecent());
1267
+ this._recentColors = e.filter((r) => typeof r == "string").map((r) => f(r)).filter((r) => !!r).map((r) => _(this._normalizeByAlpha(r), this._alphaEnabled())).slice(0, this._maxRecent());
1248
1268
  } catch {
1249
1269
  this._recentColors = [];
1250
1270
  }
@@ -1269,17 +1289,17 @@ class rt extends q {
1269
1289
  };
1270
1290
  }
1271
1291
  _serializeValue(t = this._format) {
1272
- return t === "rgb" ? w(this._rgba, this._alphaEnabled()) : t === "hsl" ? Z(this._rgba, this._alphaEnabled()) : m(this._rgba, this._alphaEnabled());
1292
+ return t === "rgb" ? w(this._rgba, this._alphaEnabled()) : t === "hsl" ? Z(this._rgba, this._alphaEnabled()) : _(this._rgba, this._alphaEnabled());
1273
1293
  }
1274
1294
  _currentHex() {
1275
- return m(this._rgba, this._alphaEnabled());
1295
+ return _(this._rgba, this._alphaEnabled());
1276
1296
  }
1277
1297
  _eventDetail(t) {
1278
1298
  return {
1279
1299
  value: this._serializeValue(),
1280
1300
  hex: this._currentHex(),
1281
1301
  rgba: { ...this._rgba },
1282
- hsla: I(this._rgba),
1302
+ hsla: M(this._rgba),
1283
1303
  source: t
1284
1304
  };
1285
1305
  }
@@ -1459,18 +1479,18 @@ class rt extends q {
1459
1479
  return this._isPopoverMode() && this._open && this._overlayRoot ? this._overlayRoot.querySelector('[data-cp-panel="overlay"]') : this.root.querySelector('[data-cp-panel="inline"]');
1460
1480
  }
1461
1481
  _updateUI(t, e = !1) {
1462
- const r = this.root.querySelector('[data-role="trigger-wrap"]'), i = this.root.querySelector(".trigger"), a = this.root.querySelector('[data-role="trigger-value"]'), n = this.root.querySelector('[data-role="trigger-preview"]'), o = this.root.querySelector('[data-role="inline-panel"]'), l = this._isPopoverMode(), c = this._state(), d = this._tone(), v = c === "loading", h = this._isDisabled(), x = this._isReadonly(), M = this._serializeValue() || this._placeholder();
1463
- r && (r.hidden = !l), i && (i.disabled = h || v, i.dataset.state = c, i.dataset.tone = d, i.setAttribute("aria-expanded", l && this._open ? "true" : "false"), this._applyAria(i)), a && (a.textContent = M), n && (n.style.background = w(this._rgba, !0)), o && (o.hidden = l), this._forEachPanel((p) => this._updatePanel(p, { skipSwatches: t, disabled: h, readonly: x, loading: v, state: c, tone: d, modePopover: l, liveOnly: e }));
1482
+ const r = this.root.querySelector('[data-role="trigger-wrap"]'), i = this.root.querySelector(".trigger"), a = this.root.querySelector('[data-role="trigger-value"]'), n = this.root.querySelector('[data-role="trigger-preview"]'), o = this.root.querySelector('[data-role="inline-panel"]'), l = this._isPopoverMode(), c = this._state(), p = this._tone(), v = c === "loading", h = this._isDisabled(), x = this._isReadonly(), R = this._serializeValue() || this._placeholder();
1483
+ r && (r.hidden = !l), i && (i.disabled = h || v, i.dataset.state = c, i.dataset.tone = p, i.setAttribute("aria-expanded", l && this._open ? "true" : "false"), this._applyAria(i, R)), a && (a.textContent = R), n && (n.style.background = w(this._rgba, !0)), o && (o.hidden = l), this._forEachPanel((d) => this._updatePanel(d, { skipSwatches: t, disabled: h, readonly: x, loading: v, state: c, tone: p, modePopover: l, liveOnly: e }));
1464
1484
  }
1465
1485
  _updatePanel(t, e) {
1466
- const r = this._rgba, i = I(r), a = this._hsva, n = `hsl(${Math.round(a.h)} 100% 50%)`, o = t.panel.getAttribute("data-cp-panel") === "overlay", l = !!this._error || e.state === "error", c = e.disabled || e.readonly || e.loading;
1486
+ const r = this._rgba, i = M(r), a = this._hsva, n = `hsl(${Math.round(a.h)} 100% 50%)`, o = t.panel.getAttribute("data-cp-panel") === "overlay", l = !!this._error || e.state === "error", c = e.disabled || e.readonly || e.loading;
1467
1487
  if (this._applyAria(t.panel), t.panel.dataset.state = l ? "error" : e.state, t.panel.dataset.tone = e.tone, t.panel.setAttribute("aria-busy", e.loading ? "true" : "false"), o && e.modePopover ? (t.panel.setAttribute("role", "dialog"), t.panel.setAttribute("aria-modal", "true"), t.panel.tabIndex = -1) : (t.panel.removeAttribute("role"), t.panel.removeAttribute("aria-modal"), t.panel.removeAttribute("tabindex")), t.label && (t.label.textContent = this._labelText()), t.valueText && (t.valueText.textContent = this._serializeValue()), t.preview && (t.preview.style.background = w(r, !0)), t.status) {
1468
- let p = "";
1469
- l ? p = "Error" : e.state === "loading" ? p = "Syncing" : e.state === "success" && (p = "Saved"), t.status.hidden = !p, t.status.textContent = p, t.status.dataset.tone = e.tone;
1488
+ let d = "";
1489
+ l ? d = "Error" : e.state === "loading" ? d = "Syncing" : e.state === "success" && (d = "Saved"), t.status.hidden = !d, t.status.textContent = d, t.status.dataset.tone = e.tone;
1470
1490
  }
1471
1491
  if (t.sv && (t.sv.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${n})`, t.sv.setAttribute("aria-valuetext", `Saturation ${Math.round(a.s)}%, Value ${Math.round(a.v)}%`), t.sv.setAttribute("aria-disabled", c ? "true" : "false"), t.sv.tabIndex = c ? -1 : 0), t.svThumb) {
1472
- const p = u(a.s, 1, 99), R = u(100 - a.v, 1, 99);
1473
- t.svThumb.style.left = `${p}%`, t.svThumb.style.top = `${R}%`;
1492
+ const d = u(a.s, 1, 99), P = u(100 - a.v, 1, 99);
1493
+ t.svThumb.style.left = `${d}%`, t.svThumb.style.top = `${P}%`;
1474
1494
  }
1475
1495
  t.hue && (t.hue.setAttribute("aria-valuemin", "0"), t.hue.setAttribute("aria-valuemax", "360"), t.hue.setAttribute("aria-valuenow", String(Math.round(a.h))), t.hue.setAttribute("aria-disabled", c ? "true" : "false"), t.hue.tabIndex = c ? -1 : 0), t.hueThumb && (t.hueThumb.style.left = `${u(a.h / 360 * 100, 1, 99)}%`), t.alphaRow && (t.alphaRow.hidden = !this._alphaEnabled()), t.alpha && (t.alpha.setAttribute("aria-valuemin", "0"), t.alpha.setAttribute("aria-valuemax", "100"), t.alpha.setAttribute("aria-valuenow", String(Math.round(a.a * 100))), t.alpha.setAttribute("aria-disabled", c || !this._alphaEnabled() ? "true" : "false"), t.alpha.tabIndex = c ? -1 : 0, t.alpha.style.backgroundImage = `
1476
1496
  linear-gradient(45deg, var(--ui-cp-checker-a) 25%, transparent 25%),
@@ -1479,20 +1499,20 @@ class rt extends q {
1479
1499
  linear-gradient(-45deg, transparent 75%, var(--ui-cp-checker-a) 75%),
1480
1500
  linear-gradient(to right, rgba(${r.r}, ${r.g}, ${r.b}, 0), rgba(${r.r}, ${r.g}, ${r.b}, 1))
1481
1501
  `), t.alphaThumb && (t.alphaThumb.style.left = `${u(a.a * 100, 1, 99)}%`);
1482
- const d = t.panel.getRootNode(), v = d instanceof ShadowRoot ? d.activeElement : t.panel.ownerDocument.activeElement, h = v && t.panel.contains(v) ? v.getAttribute("data-input") : null;
1483
- if (t.inputHex && h !== "hex" && (t.inputHex.value = m(r, this._alphaEnabled())), t.inputR && h !== "r" && (t.inputR.value = String(r.r)), t.inputG && h !== "g" && (t.inputG.value = String(r.g)), t.inputB && h !== "b" && (t.inputB.value = String(r.b)), t.inputA1 && h !== "a1" && (t.inputA1.value = this._alphaEnabled() ? String(Number(r.a.toFixed(3))) : "1"), t.inputH && h !== "h" && (t.inputH.value = String(Math.round(i.h))), t.inputS && h !== "s" && (t.inputS.value = String(Math.round(i.s))), t.inputL && h !== "l" && (t.inputL.value = String(Math.round(i.l))), t.inputA2 && h !== "a2" && (t.inputA2.value = this._alphaEnabled() ? String(Number(r.a.toFixed(3))) : "1"), e.liveOnly) return;
1502
+ const p = t.panel.getRootNode(), v = p instanceof ShadowRoot ? p.activeElement : t.panel.ownerDocument.activeElement, h = v && t.panel.contains(v) ? v.getAttribute("data-input") : null;
1503
+ if (t.inputHex && h !== "hex" && (t.inputHex.value = _(r, this._alphaEnabled())), t.inputR && h !== "r" && (t.inputR.value = String(r.r)), t.inputG && h !== "g" && (t.inputG.value = String(r.g)), t.inputB && h !== "b" && (t.inputB.value = String(r.b)), t.inputA1 && h !== "a1" && (t.inputA1.value = this._alphaEnabled() ? String(Number(r.a.toFixed(3))) : "1"), t.inputH && h !== "h" && (t.inputH.value = String(Math.round(i.h))), t.inputS && h !== "s" && (t.inputS.value = String(Math.round(i.s))), t.inputL && h !== "l" && (t.inputL.value = String(Math.round(i.l))), t.inputA2 && h !== "a2" && (t.inputA2.value = this._alphaEnabled() ? String(Number(r.a.toFixed(3))) : "1"), e.liveOnly) return;
1484
1504
  if (t.tabHex && (t.tabHex.dataset.active = String(this._format === "hex")), t.tabRgb && (t.tabRgb.dataset.active = String(this._format === "rgb")), t.tabHsl && (t.tabHsl.dataset.active = String(this._format === "hsl")), t.groupHex && (t.groupHex.hidden = this._format !== "hex"), t.groupRgb && (t.groupRgb.hidden = this._format !== "rgb"), t.groupHsl && (t.groupHsl.hidden = this._format !== "hsl"), t.inputA1 && (t.inputA1.disabled = !this._alphaEnabled() || c), t.inputA2 && (t.inputA2.disabled = !this._alphaEnabled() || c), t.error) {
1485
- const p = this._error || (e.state === "error" ? "Unable to validate current color value." : "");
1486
- t.error.hidden = !p, t.error.textContent = p;
1505
+ const d = this._error || (e.state === "error" ? "Unable to validate current color value." : "");
1506
+ t.error.hidden = !d, t.error.textContent = d;
1487
1507
  }
1488
1508
  const x = c;
1489
1509
  if (t.copyHex && (t.copyHex.disabled = e.disabled || e.loading), t.copyRgb && (t.copyRgb.disabled = e.disabled || e.loading), t.eyedropper) {
1490
- const p = typeof window < "u" && typeof window.EyeDropper == "function";
1491
- t.eyedropper.hidden = !p, t.eyedropper.disabled = x || !p;
1510
+ const d = typeof window < "u" && typeof window.EyeDropper == "function";
1511
+ t.eyedropper.hidden = !d, t.eyedropper.disabled = x || !d;
1492
1512
  }
1493
- if (t.clear && (t.clear.disabled = x), t.apply && (t.apply.hidden = !e.modePopover, t.apply.disabled = x), t.panel.querySelectorAll(".input").forEach((p) => {
1494
- const R = p;
1495
- R.disabled = x;
1513
+ if (t.clear && (t.clear.disabled = x), t.apply && (t.apply.hidden = !e.modePopover, t.apply.disabled = x), t.panel.querySelectorAll(".input").forEach((d) => {
1514
+ const P = d;
1515
+ P.disabled = x;
1496
1516
  }), !e.skipSwatches && !this._renderingSwatches) {
1497
1517
  this._renderingSwatches = !0;
1498
1518
  try {
@@ -1507,12 +1527,12 @@ class rt extends q {
1507
1527
  t.presets && (t.presets.innerHTML = this._presets.map((r) => {
1508
1528
  const i = f(r);
1509
1529
  if (!i) return "";
1510
- const a = m(this._normalizeByAlpha(i), this._alphaEnabled()), n = a.toLowerCase() === e ? ' data-selected="true"' : "";
1530
+ const a = _(this._normalizeByAlpha(i), this._alphaEnabled()), n = a.toLowerCase() === e ? ' data-selected="true"' : "";
1511
1531
  return `<button type="button" class="swatch" part="swatch" data-action="preset" data-color="${k(a)}"${n} title="${k(a)}" style="background:${k(w(i, !0))}"></button>`;
1512
1532
  }).join("")), t.recentTitle && (t.recentTitle.hidden = !this._recentEnabled() || this._recentColors.length === 0), t.recent && (t.recent.hidden = !this._recentEnabled() || this._recentColors.length === 0, t.recent.innerHTML = this._recentColors.map((r) => {
1513
1533
  const i = f(r);
1514
1534
  if (!i) return "";
1515
- const a = m(this._normalizeByAlpha(i), this._alphaEnabled()), n = a.toLowerCase() === e ? ' data-selected="true"' : "";
1535
+ const a = _(this._normalizeByAlpha(i), this._alphaEnabled()), n = a.toLowerCase() === e ? ' data-selected="true"' : "";
1516
1536
  return `<button type="button" class="swatch" part="swatch recent" data-action="recent" data-color="${k(a)}"${n} title="${k(a)}" style="background:${k(w(i, !0))}"></button>`;
1517
1537
  }).join(""));
1518
1538
  }
@@ -1552,7 +1572,7 @@ class rt extends q {
1552
1572
  }
1553
1573
  if (a === "clear") {
1554
1574
  if (this._isReadonly()) return;
1555
- const n = f(C);
1575
+ const n = f(I);
1556
1576
  n && (this._applyRgba(n, !1), this._error = "", this._syncValueAttribute(), this._emitInput("text"), this._emitChange("text"), this._pushRecent(this._currentHex()), this._updateUI(!1));
1557
1577
  return;
1558
1578
  }
@@ -1629,12 +1649,12 @@ class rt extends q {
1629
1649
  if (!t) return null;
1630
1650
  const e = this._panelRefs(t);
1631
1651
  if (this._format === "hex") {
1632
- const l = e.inputHex?.value || "", c = l.trim().startsWith("#") ? l.trim() : `#${l.trim()}`, d = f(c);
1633
- return d ? this._normalizeByAlpha(d) : null;
1652
+ const l = e.inputHex?.value || "", c = l.trim().startsWith("#") ? l.trim() : `#${l.trim()}`, p = f(c);
1653
+ return p ? this._normalizeByAlpha(p) : null;
1634
1654
  }
1635
1655
  if (this._format === "rgb") {
1636
- const l = Number(e.inputR?.value ?? ""), c = Number(e.inputG?.value ?? ""), d = Number(e.inputB?.value ?? ""), v = this._alphaEnabled() ? Number(e.inputA1?.value ?? "") : 1;
1637
- return [l, c, d, v].every((h) => Number.isFinite(h)) ? this._normalizeByAlpha({ r: l, g: c, b: d, a: v }) : null;
1656
+ const l = Number(e.inputR?.value ?? ""), c = Number(e.inputG?.value ?? ""), p = Number(e.inputB?.value ?? ""), v = this._alphaEnabled() ? Number(e.inputA1?.value ?? "") : 1;
1657
+ return [l, c, p, v].every((h) => Number.isFinite(h)) ? this._normalizeByAlpha({ r: l, g: c, b: p, a: v }) : null;
1638
1658
  }
1639
1659
  const r = Number(e.inputH?.value ?? ""), i = Number(e.inputS?.value ?? ""), a = Number(e.inputL?.value ?? ""), n = this._alphaEnabled() ? Number(e.inputA2?.value ?? "") : 1;
1640
1660
  if (![r, i, a, n].every((l) => Number.isFinite(l))) return null;
@@ -1744,12 +1764,14 @@ class rt extends q {
1744
1764
  else
1745
1765
  this.dispatchEvent(new CustomEvent("toast", { detail: { message: r }, bubbles: !0, composed: !0 }));
1746
1766
  }
1747
- _applyAria(t) {
1748
- const e = this.getAttribute("aria-labelledby"), r = this.getAttribute("aria-describedby"), i = this.getAttribute("aria-label");
1749
- e ? t.setAttribute("aria-labelledby", e) : t.removeAttribute("aria-labelledby"), r ? t.setAttribute("aria-describedby", r) : t.removeAttribute("aria-describedby"), i ? t.setAttribute("aria-label", i) : e || t.setAttribute("aria-label", "Color picker");
1767
+ _applyAria(t, e = "") {
1768
+ const r = this.getAttribute("aria-labelledby"), i = this.getAttribute("aria-describedby"), a = this.getAttribute("aria-label"), n = this.getRootNode(), o = r ? r.split(/\s+/).map((p) => n.getElementById?.(p)?.textContent?.trim() || "").filter(Boolean).join(" ") : "";
1769
+ t.removeAttribute("aria-labelledby"), i ? t.setAttribute("aria-describedby", i) : t.removeAttribute("aria-describedby");
1770
+ const l = o || a || "Color picker", c = e && !l.includes(e) ? `${l}, ${e}` : l;
1771
+ t.setAttribute("aria-label", c);
1750
1772
  }
1751
1773
  }
1752
- customElements.get("ui-color-picker") || customElements.define("ui-color-picker", rt);
1774
+ typeof customElements < "u" && !customElements.get("ui-color-picker") && customElements.define("ui-color-picker", rt);
1753
1775
  export {
1754
1776
  rt as UIColorPicker
1755
1777
  };
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("./ElementBase-EV6mVBUV.js"),h=require("./collection-qv8A8rq4.js"),k=require("./dismissable-layer-DNfrKA20.js"),L=require("./listbox-B6QgECax.js"),F=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./ElementBase-DxbvhLJs.js"),F=require("./control-name-BmoI1m3a.js"),h=require("./collection-qv8A8rq4.js"),$=require("./dismissable-layer-DNfrKA20.js"),E=require("./listbox-CTpRpuF7.js"),D=`
2
2
  <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
3
3
  <path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
4
4
  </svg>
5
- `,$=`
5
+ `,I=`
6
6
  <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
7
7
  <path d="m5.6 7.6 4.4 4.6 4.4-4.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
8
8
  </svg>
9
- `,E=`
9
+ `,B=`
10
10
  :host {
11
11
  --ui-combobox-width: var(--ui-width, 100%);
12
12
  --ui-combobox-min-width: 248px;
@@ -15,7 +15,7 @@
15
15
  --ui-combobox-radius: var(--ui-radius, 12px);
16
16
  --ui-combobox-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
17
17
  --ui-combobox-text: var(--ui-color-text, #0f172a);
18
- --ui-combobox-muted: var(--ui-color-muted, #64748b);
18
+ --ui-combobox-muted: var(--ui-color-muted, #526175);
19
19
  --ui-combobox-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 78%, transparent);
20
20
  --ui-combobox-border: 1px solid var(--ui-combobox-border-color);
21
21
  --ui-combobox-shadow: none;
@@ -29,8 +29,8 @@
29
29
  --ui-combobox-option-hover: color-mix(in srgb, var(--ui-color-primary, #2563eb) 11%, transparent);
30
30
  --ui-combobox-option-active: color-mix(in srgb, var(--ui-color-primary, #2563eb) 18%, transparent);
31
31
  --ui-combobox-error: var(--ui-color-danger, #dc2626);
32
- --ui-combobox-success: var(--ui-color-success, #16a34a);
33
- --ui-combobox-warning: var(--ui-color-warning, #d97706);
32
+ --ui-combobox-success: var(--ui-color-success, #15803d);
33
+ --ui-combobox-warning: var(--ui-color-warning, #b45309);
34
34
  --ui-combobox-duration: 150ms;
35
35
  --ui-combobox-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
36
36
 
@@ -65,7 +65,8 @@
65
65
  .root {
66
66
  position: relative;
67
67
  width: var(--ui-combobox-width);
68
- min-width: var(--ui-combobox-min-width);
68
+ /* The host already clamps its minimum to its container; the control inside has to as well. */
69
+ min-width: min(100%, var(--ui-combobox-min-width));
69
70
  max-width: 100%;
70
71
  }
71
72
 
@@ -467,7 +468,7 @@
467
468
  color: HighlightText;
468
469
  }
469
470
  }
470
- `;function a(d){return d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function _(d){if(d==null)return!1;const t=String(d).toLowerCase();return t!=="false"&&t!=="0"}class A extends C.ElementBase{constructor(){super(),this._input=null,this._control=null,this._panel=null,this._clearBtn=null,this._toggleBtn=null,this._options=[],this._filtered=[],this._highlightedIndex=-1,this._query="",this._debounceTimer=null,this._observer=null,this._uid=Math.random().toString(36).slice(2,8),this._formUnregister=null,this._isFocused=!1,this._suppressValueSync=!1,this._globalListenersBound=!1,this._dismissableLayer=null,this._nextOpenSource="attribute",this._optionsRefreshFrame=0,this._autofocusFrame=0,this._listStructureFingerprint="",this._panelPointerDown=!1,this._onInput=this._onInput.bind(this),this._onNativeChange=this._onNativeChange.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClearClick=this._onClearClick.bind(this),this._onToggleClick=this._onToggleClick.bind(this),this._onPanelPointerDown=this._onPanelPointerDown.bind(this),this._onPanelClick=this._onPanelClick.bind(this)}static get observedAttributes(){return["value","placeholder","disabled","clearable","debounce","maxlength","readonly","autofocus","name","required","validation","state","state-text","size","variant","radius","label","description","open","headless","empty-text","no-filter","allow-custom"]}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>{this._scheduleOptionsRefresh()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","data-combobox-option"]}),this._attachFormRegistration()}disconnectedCallback(){this._unbindGlobalListeners(),this._detachDomListeners(),this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._observer&&(this._observer.disconnect(),this._observer=null),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),this._optionsRefreshFrame&&(cancelAnimationFrame(this._optionsRefreshFrame),this._optionsRefreshFrame=0),this._autofocusFrame&&(cancelAnimationFrame(this._autofocusFrame),this._autofocusFrame=0),this._formUnregister&&(this._formUnregister(),this._formUnregister=null),super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e!==i){if(t==="value"){this._suppressValueSync||this._syncInputFromValue(),this._updateClearButton(),this._renderList();return}if(t==="open"){this._applyOpenState(),e!==i&&this._emitOpenState(i!=null,e!=null,this._nextOpenSource),this._nextOpenSource="attribute";return}if(t==="disabled"){this._isDisabled()&&this.open&&this._setOpen(!1,"attribute"),this.isConnected&&this.requestRender();return}if(t==="state"){this.isConnected&&this.requestRender();return}if(t==="state-text"){this._renderList();return}this.isConnected&&this.requestRender()}}get value(){return this.getAttribute("value")||""}set value(t){const e=t||"";e!==this.value&&this.setAttribute("value",e)}get open(){return this.hasAttribute("open")}set open(t){this._setOpen(t,"api")}_isDisabled(){return _(this.getAttribute("disabled"))}_isReadonly(){return this.hasAttribute("readonly")}_state(){const t=(this.getAttribute("state")||"idle").trim().toLowerCase();return t==="loading"||t==="error"||t==="success"?t:"idle"}_isLoading(){return this._state()==="loading"}_stateText(){const t=this.getAttribute("state-text");if(t)return t;const e=this._state();return e==="loading"?"Syncing results":e==="error"?"Unable to load results":e==="success"?"Results up to date":""}_emitOpenState(t,e,i){const r={open:t,previousOpen:e,source:i};this.dispatchEvent(new CustomEvent(t?"open":"close",{detail:r,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(t?"ui-open":"ui-close",{detail:r,bubbles:!0,composed:!0}))}_attachFormRegistration(){try{const r=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),s=this.getAttribute("name");r&&typeof r.registerField=="function"&&s&&(this._formUnregister=r.registerField(s,{name:s,getValue:()=>this.value,setValue:o=>{this.value=o},validate:async()=>{const o=this._isCurrentValueValid();return{valid:o,message:o?void 0:"Please select a value from the list."}},setError:o=>{o?(this.setAttribute("validation","error"),this.setAttribute("data-error",o)):(this.removeAttribute("validation"),this.removeAttribute("data-error"))}}))}catch{}}_isCurrentValueValid(){const t=this.hasAttribute("required"),e=this.value;return!t&&!e?!0:t&&!e?!1:this.hasAttribute("allow-custom")?!0:this._options.some(i=>i.value===e)}_readOptions(){const t=Array.from(this.querySelectorAll("option,[data-combobox-option]")),e=new Set;return t.map((i,r)=>{const s=i.tagName.toLowerCase()==="option",o=i,n=s?o.value||o.textContent||"":i.getAttribute("value")||i.getAttribute("data-value")||i.textContent||"",l=s?(o.label||o.textContent||o.value||"").trim():(i.getAttribute("label")||i.textContent||n).trim(),b=(i.getAttribute("description")||i.getAttribute("data-description")||"").trim(),u=s?o.disabled:_(i.getAttribute("disabled")),c=n.trim();if(!c&&!l)return null;const p=`${c}::${l}`;return e.has(p)?null:(e.add(p),{value:c,label:l,description:b,disabled:u,sourceIndex:r})}).filter(i=>!!i)}_findOptionByValue(t){return this._options.find(e=>e.value===t)||null}_findExactOptionByQuery(t){const e=h.normalizeCollectionText(t);return e&&this._options.find(i=>!i.disabled&&(h.normalizeCollectionText(i.label)===e||h.normalizeCollectionText(i.value)===e))||null}_rebuildFiltered(t){const e=h.normalizeCollectionText(this._query),i=this.hasAttribute("no-filter"),r=this._filtered[this._highlightedIndex];if(this._filtered=this._options.filter(o=>i||!e?!0:h.normalizeCollectionText(o.label).includes(e)||h.normalizeCollectionText(o.value).includes(e)),t?.preserveHighlight&&r){const o=this._filtered.findIndex(n=>n.sourceIndex===r.sourceIndex);if(o>=0&&!this._filtered[o].disabled){this._highlightedIndex=o;return}}const s=this._findOptionByValue(this.value);if(s){const o=this._filtered.findIndex(n=>n.sourceIndex===s.sourceIndex);if(o>=0&&!this._filtered[o].disabled){this._highlightedIndex=o;return}}this._highlightedIndex=L.resolveListboxActiveIndex(this._filtered,{getDisabled:o=>o.disabled})}_renderList(){if(!this._panel)return;const t=this._renderStateRow(),e=this.getAttribute("empty-text")||"No matches found",i=[t,e,this._filtered.length===0?"empty":"options",...this._filtered.map(o=>[o.sourceIndex,o.value,o.label,o.description,o.disabled?"1":"0"].join(""))].join("");if(i===this._listStructureFingerprint&&this._syncRenderedListState())return;if(this._filtered.length===0){this._panel.innerHTML=`${t}<div class="empty" part="empty">${a(e)}</div>`,this._listStructureFingerprint=i,this._panel.refresh(),this._panel.clearActive(),this._syncActiveDescendant();return}const r=this.value,s=this._filtered.map((o,n)=>{const l=o.value===r,b=n===this._highlightedIndex,u=o.disabled;return`
471
+ `;function n(d){return d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function _(d){if(d==null)return!1;const t=String(d).toLowerCase();return t!=="false"&&t!=="0"}class k extends L.ElementBase{constructor(){super(),this._input=null,this._control=null,this._panel=null,this._clearBtn=null,this._toggleBtn=null,this._options=[],this._filtered=[],this._highlightedIndex=-1,this._query="",this._debounceTimer=null,this._observer=null,this._uid=Math.random().toString(36).slice(2,8),this._formUnregister=null,this._isFocused=!1,this._suppressValueSync=!1,this._globalListenersBound=!1,this._dismissableLayer=null,this._nextOpenSource="attribute",this._optionsRefreshFrame=0,this._autofocusFrame=0,this._listStructureFingerprint="",this._panelPointerDown=!1,this._onInput=this._onInput.bind(this),this._onNativeChange=this._onNativeChange.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClearClick=this._onClearClick.bind(this),this._onToggleClick=this._onToggleClick.bind(this),this._onPanelPointerDown=this._onPanelPointerDown.bind(this),this._onPanelClick=this._onPanelClick.bind(this)}static get observedAttributes(){return["aria-label","aria-description","aria-describedby","value","placeholder","disabled","clearable","debounce","maxlength","readonly","autofocus","name","required","validation","state","state-text","size","variant","radius","label","description","open","headless","empty-text","no-filter","allow-custom"]}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>{this._scheduleOptionsRefresh()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","data-combobox-option"]}),this._attachFormRegistration()}disconnectedCallback(){this._unbindGlobalListeners(),this._detachDomListeners(),this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._observer&&(this._observer.disconnect(),this._observer=null),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),this._optionsRefreshFrame&&(cancelAnimationFrame(this._optionsRefreshFrame),this._optionsRefreshFrame=0),this._autofocusFrame&&(cancelAnimationFrame(this._autofocusFrame),this._autofocusFrame=0),this._formUnregister&&(this._formUnregister(),this._formUnregister=null),super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e!==i){if(t==="value"){this._suppressValueSync||this._syncInputFromValue(),this._updateClearButton(),this._renderList();return}if(t==="open"){this._applyOpenState(),e!==i&&this._emitOpenState(i!=null,e!=null,this._nextOpenSource),this._nextOpenSource="attribute";return}if(t==="disabled"){this._isDisabled()&&this.open&&this._setOpen(!1,"attribute"),this.isConnected&&this.requestRender();return}if(t==="state"){this.isConnected&&this.requestRender();return}if(t==="state-text"){this._renderList();return}this.isConnected&&this.requestRender()}}get value(){return this.getAttribute("value")||""}set value(t){const e=t||"";e!==this.value&&this.setAttribute("value",e)}get open(){return this.hasAttribute("open")}set open(t){this._setOpen(t,"api")}_isDisabled(){return _(this.getAttribute("disabled"))}_isReadonly(){return this.hasAttribute("readonly")}_state(){const t=(this.getAttribute("state")||"idle").trim().toLowerCase();return t==="loading"||t==="error"||t==="success"?t:"idle"}_isLoading(){return this._state()==="loading"}_stateText(){const t=this.getAttribute("state-text");if(t)return t;const e=this._state();return e==="loading"?"Syncing results":e==="error"?"Unable to load results":e==="success"?"Results up to date":""}_emitOpenState(t,e,i){const r={open:t,previousOpen:e,source:i};this.dispatchEvent(new CustomEvent(t?"open":"close",{detail:r,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(t?"ui-open":"ui-close",{detail:r,bubbles:!0,composed:!0}))}_attachFormRegistration(){try{const r=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),s=this.getAttribute("name");r&&typeof r.registerField=="function"&&s&&(this._formUnregister=r.registerField(s,{name:s,getValue:()=>this.value,setValue:o=>{this.value=o},validate:async()=>{const o=this._isCurrentValueValid();return{valid:o,message:o?void 0:"Please select a value from the list."}},setError:o=>{o?(this.setAttribute("validation","error"),this.setAttribute("data-error",o)):(this.removeAttribute("validation"),this.removeAttribute("data-error"))}}))}catch{}}_isCurrentValueValid(){const t=this.hasAttribute("required"),e=this.value;return!t&&!e?!0:t&&!e?!1:this.hasAttribute("allow-custom")?!0:this._options.some(i=>i.value===e)}_readOptions(){const t=Array.from(this.querySelectorAll("option,[data-combobox-option]")),e=new Set;return t.map((i,r)=>{const s=i.tagName.toLowerCase()==="option",o=i,a=s?o.value||o.textContent||"":i.getAttribute("value")||i.getAttribute("data-value")||i.textContent||"",l=s?(o.label||o.textContent||o.value||"").trim():(i.getAttribute("label")||i.textContent||a).trim(),b=(i.getAttribute("description")||i.getAttribute("data-description")||"").trim(),u=s?o.disabled:_(i.getAttribute("disabled")),c=a.trim();if(!c&&!l)return null;const p=`${c}::${l}`;return e.has(p)?null:(e.add(p),{value:c,label:l,description:b,disabled:u,sourceIndex:r})}).filter(i=>!!i)}_findOptionByValue(t){return this._options.find(e=>e.value===t)||null}_findExactOptionByQuery(t){const e=h.normalizeCollectionText(t);return e&&this._options.find(i=>!i.disabled&&(h.normalizeCollectionText(i.label)===e||h.normalizeCollectionText(i.value)===e))||null}_rebuildFiltered(t){const e=h.normalizeCollectionText(this._query),i=this.hasAttribute("no-filter"),r=this._filtered[this._highlightedIndex];if(this._filtered=this._options.filter(o=>i||!e?!0:h.normalizeCollectionText(o.label).includes(e)||h.normalizeCollectionText(o.value).includes(e)),t?.preserveHighlight&&r){const o=this._filtered.findIndex(a=>a.sourceIndex===r.sourceIndex);if(o>=0&&!this._filtered[o].disabled){this._highlightedIndex=o;return}}const s=this._findOptionByValue(this.value);if(s){const o=this._filtered.findIndex(a=>a.sourceIndex===s.sourceIndex);if(o>=0&&!this._filtered[o].disabled){this._highlightedIndex=o;return}}this._highlightedIndex=E.resolveListboxActiveIndex(this._filtered,{getDisabled:o=>o.disabled})}_renderList(){if(!this._panel)return;const t=this._renderStateRow(),e=this.getAttribute("empty-text")||"No matches found",i=[t,e,this._filtered.length===0?"empty":"options",...this._filtered.map(o=>[o.sourceIndex,o.value,o.label,o.description,o.disabled?"1":"0"].join(""))].join("");if(i===this._listStructureFingerprint&&this._syncRenderedListState())return;if(this._filtered.length===0){this._panel.innerHTML=`${t}<div class="empty" part="empty">${n(e)}</div>`,this._listStructureFingerprint=i,this._panel.refresh(),this._panel.clearActive(),this._syncActiveDescendant();return}const r=this.value,s=this._filtered.map((o,a)=>{const l=o.value===r,b=a===this._highlightedIndex,u=o.disabled;return`
471
472
  <button
472
473
  type="button"
473
474
  id="${`${this._uid}-option-${o.sourceIndex}`}"
@@ -475,27 +476,27 @@
475
476
  role="option"
476
477
  aria-selected="${l?"true":"false"}"
477
478
  aria-disabled="${u?"true":"false"}"
478
- data-option-index="${n}"
479
+ data-option-index="${a}"
479
480
  data-highlighted="${b?"true":"false"}"
480
481
  data-selected="${l?"true":"false"}"
481
482
  ${u?"disabled":""}>
482
483
  <span class="option-text">
483
- <span class="option-label">${a(o.label)}</span>
484
- ${o.description?`<span class="option-description">${a(o.description)}</span>`:""}
484
+ <span class="option-label">${n(o.label)}</span>
485
+ ${o.description?`<span class="option-description">${n(o.description)}</span>`:""}
485
486
  </span>
486
487
  <span class="option-check" aria-hidden="true">✓</span>
487
488
  </button>
488
- `}).join("");this._panel.innerHTML=`${t}${s}`,this._listStructureFingerprint=i,this._panel.refresh(),this._syncActiveDescendant(),this._scrollHighlightedIntoView()}_syncRenderedListState(){if(!this._panel)return!1;if(this._filtered.length===0)return this._panel.querySelector(".empty")?(this._panel.clearActive(),this._syncActiveDescendant(),!0):!1;const t=Array.from(this._panel.querySelectorAll(".option[data-option-index]"));if(t.length!==this._filtered.length)return!1;const e=this.value;return t.forEach((i,r)=>{const s=this._filtered[r];if(!s)return;const o=s.value===e,n=r===this._highlightedIndex;i.setAttribute("aria-selected",o?"true":"false"),i.setAttribute("aria-disabled",s.disabled?"true":"false"),i.setAttribute("data-highlighted",n?"true":"false"),i.setAttribute("data-selected",o?"true":"false"),i.disabled=s.disabled}),this._syncActiveDescendant(),this._scrollHighlightedIntoView(),!0}_renderStateRow(){const t=this._state(),e=this._stateText();return e?`<div class="status-row" part="status" data-state="${a(t)}" aria-live="polite">${a(e)}</div>`:""}_syncInputFromValue(){if(!this._input||this._isFocused&&this.open)return;const t=this._findOptionByValue(this.value);t?(this._query=t.label,this._input.value=t.label):(this._query=this.value,this._input.value=this.value),this._rebuildFiltered({preserveHighlight:!1}),this._renderList()}_syncActiveDescendant(){if(!this._input)return;const t=this._panel?.querySelector(`[data-option-index="${this._highlightedIndex}"]`);if(t&&this._panel){this._panel.setActiveItem(t,{focus:!1,owner:this._input,scroll:!1});return}this._panel?.clearActive(),this._input.removeAttribute("aria-activedescendant")}_scrollHighlightedIntoView(){if(!this._panel||this._highlightedIndex<0)return;const t=this._panel.querySelector(`[data-option-index="${this._highlightedIndex}"]`);this._panel.setActiveItem(t,{focus:!1,owner:this._input,scroll:!0})}_updateClearButton(){if(!this._clearBtn)return;this.hasAttribute("clearable")&&!this._isDisabled()&&!this._isReadonly()&&!this._isLoading()&&(this._query.length>0||this.value.length>0)?this._clearBtn.removeAttribute("hidden"):this._clearBtn.setAttribute("hidden","")}_applyOpenState(){if(!this._panel||!this._input||!this._toggleBtn)return;const t=this.open,e=this._isLoading();t?(this._bindGlobalListeners(),this._panel.setAttribute("data-open","true"),this._panel.removeAttribute("hidden"),this._panel.setAttribute("aria-hidden","false"),this._input.setAttribute("aria-expanded","true"),this._toggleBtn.setAttribute("data-open","true"),this._rebuildFiltered({preserveHighlight:!0}),this._renderList(),this._syncDismissableLayer()):(this._unbindGlobalListeners(),this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._panel.setAttribute("hidden",""),this._panel.removeAttribute("data-open"),this._panel.setAttribute("aria-hidden","true"),this._input.setAttribute("aria-expanded","false"),this._toggleBtn.setAttribute("data-open","false")),this._toggleBtn.disabled=this._isDisabled(),this._clearBtn&&(this._clearBtn.disabled=this._isDisabled()||this._isReadonly()),this._input.setAttribute("aria-busy",e?"true":"false"),this._panel.setAttribute("aria-busy",e?"true":"false")}_bindGlobalListeners(){this._globalListenersBound||(this._globalListenersBound=!0)}_unbindGlobalListeners(){this._globalListenersBound&&(this._globalListenersBound=!1)}_syncDismissableLayer(){!this.open||!this._panel||(this._dismissableLayer?.destroy(),this._dismissableLayer=k.createDismissableLayer({node:this._panel,trigger:this._control,closeOnEscape:!1,closeOnPointerOutside:!0,onDismiss:t=>{t==="outside-pointer"&&(this.hasAttribute("allow-custom")?this._commitCustomValue():this._syncInputFromValue(),this._closePanel("outside"))}}))}_setOpen(t,e="api"){t!==this.open&&(t&&this._isDisabled()||(this._nextOpenSource=e,t?this.setAttribute("open",""):this.removeAttribute("open")))}_openPanel(t="api"){this._setOpen(!0,t)}_closePanel(t="api"){this._setOpen(!1,t)}_commitSelection(t){if(this._isDisabled()||this._isReadonly()||t.disabled)return;const e=this.value;this._suppressValueSync=!0,this.value=t.value,this._suppressValueSync=!1,this._input&&(this._input.value=t.label),this._query=t.label,this._rebuildFiltered({preserveHighlight:!1}),this._renderList(),this._updateClearButton(),this._closePanel("selection"),e!==t.value&&this.dispatchEvent(new CustomEvent("change",{detail:{value:t.value,label:t.label},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("select",{detail:{value:t.value,label:t.label},bubbles:!0,composed:!0}))}_commitCustomValue(){if(this._isDisabled()||this._isReadonly()||!this.hasAttribute("allow-custom"))return;const t=this._query.trim(),e=this.value;this._suppressValueSync=!0,this.value=t,this._suppressValueSync=!1,this._updateClearButton(),e!==t&&this.dispatchEvent(new CustomEvent("change",{detail:{value:t,label:t,custom:!0},bubbles:!0,composed:!0}))}_moveHighlight(t){if(this._filtered.length===0)return;const e=this._panel?.querySelector(`[data-option-index="${this._highlightedIndex}"]`),i=this._panel?.move(t>0?1:-1,{current:e,focus:!1,owner:this._input,scroll:!0})||null;if(!i)return;const r=Number(i.getAttribute("data-option-index")||"-1");r<0||(this._highlightedIndex=r,this._renderList())}render(){const t=this.hasAttribute("headless"),e=this.getAttribute("disabled"),i=_(e),r=this._isReadonly(),s=this._state(),o=s==="loading",n=this.getAttribute("placeholder")||"Search...",l=this.getAttribute("maxlength"),b=this.hasAttribute("required"),u=this.getAttribute("label")||"",c=this.getAttribute("description")||"",x=this.getAttribute("data-error")||""||(s==="error"?this._stateText()||"Unable to load options.":""),m=this.getAttribute("validation")==="error"||s==="error"||!!x,f=!!(u||this.querySelector('[slot="label"]')),g=!!(c||this.querySelector('[slot="description"]')),v=`${this._uid}-error`,y=[g?`${this._uid}-description`:"",m?v:""].filter(Boolean).join(" ");if(this._options=this._readOptions(),!this._query){const w=this._findOptionByValue(this.value);this._query=w?w.label:this.value}this._rebuildFiltered({preserveHighlight:!1}),this.setContent(`
489
- ${t?"":`<style>${E}</style>`}
490
- ${f||g?`
489
+ `}).join("");this._panel.innerHTML=`${t}${s}`,this._listStructureFingerprint=i,this._panel.refresh(),this._syncActiveDescendant(),this._scrollHighlightedIntoView()}_syncRenderedListState(){if(!this._panel)return!1;if(this._filtered.length===0)return this._panel.querySelector(".empty")?(this._panel.clearActive(),this._syncActiveDescendant(),!0):!1;const t=Array.from(this._panel.querySelectorAll(".option[data-option-index]"));if(t.length!==this._filtered.length)return!1;const e=this.value;return t.forEach((i,r)=>{const s=this._filtered[r];if(!s)return;const o=s.value===e,a=r===this._highlightedIndex;i.setAttribute("aria-selected",o?"true":"false"),i.setAttribute("aria-disabled",s.disabled?"true":"false"),i.setAttribute("data-highlighted",a?"true":"false"),i.setAttribute("data-selected",o?"true":"false"),i.disabled=s.disabled}),this._syncActiveDescendant(),this._scrollHighlightedIntoView(),!0}_renderStateRow(){const t=this._state(),e=this._stateText();return e?`<div class="status-row" part="status" data-state="${n(t)}" aria-live="polite">${n(e)}</div>`:""}_syncInputFromValue(){if(!this._input||this._isFocused&&this.open)return;const t=this._findOptionByValue(this.value);t?(this._query=t.label,this._input.value=t.label):(this._query=this.value,this._input.value=this.value),this._rebuildFiltered({preserveHighlight:!1}),this._renderList()}_syncActiveDescendant(){if(!this._input)return;const t=this._panel?.querySelector(`[data-option-index="${this._highlightedIndex}"]`);if(t&&this._panel){this._panel.setActiveItem(t,{focus:!1,owner:this._input,scroll:!1});return}this._panel?.clearActive(),this._input.removeAttribute("aria-activedescendant")}_scrollHighlightedIntoView(){if(!this._panel||this._highlightedIndex<0)return;const t=this._panel.querySelector(`[data-option-index="${this._highlightedIndex}"]`);this._panel.setActiveItem(t,{focus:!1,owner:this._input,scroll:!0})}_updateClearButton(){if(!this._clearBtn)return;this.hasAttribute("clearable")&&!this._isDisabled()&&!this._isReadonly()&&!this._isLoading()&&(this._query.length>0||this.value.length>0)?this._clearBtn.removeAttribute("hidden"):this._clearBtn.setAttribute("hidden","")}_applyOpenState(){if(!this._panel||!this._input||!this._toggleBtn)return;const t=this.open,e=this._isLoading();t?(this._bindGlobalListeners(),this._panel.setAttribute("data-open","true"),this._panel.removeAttribute("hidden"),this._panel.setAttribute("aria-hidden","false"),this._input.setAttribute("aria-expanded","true"),this._toggleBtn.setAttribute("data-open","true"),this._rebuildFiltered({preserveHighlight:!0}),this._renderList(),this._syncDismissableLayer()):(this._unbindGlobalListeners(),this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._panel.setAttribute("hidden",""),this._panel.removeAttribute("data-open"),this._panel.setAttribute("aria-hidden","true"),this._input.setAttribute("aria-expanded","false"),this._toggleBtn.setAttribute("data-open","false")),this._toggleBtn.disabled=this._isDisabled(),this._clearBtn&&(this._clearBtn.disabled=this._isDisabled()||this._isReadonly()),this._input.setAttribute("aria-busy",e?"true":"false"),this._panel.setAttribute("aria-busy",e?"true":"false")}_bindGlobalListeners(){this._globalListenersBound||(this._globalListenersBound=!0)}_unbindGlobalListeners(){this._globalListenersBound&&(this._globalListenersBound=!1)}_syncDismissableLayer(){!this.open||!this._panel||(this._dismissableLayer?.destroy(),this._dismissableLayer=$.createDismissableLayer({node:this._panel,trigger:this._control,closeOnEscape:!1,closeOnPointerOutside:!0,onDismiss:t=>{t==="outside-pointer"&&(this.hasAttribute("allow-custom")?this._commitCustomValue():this._syncInputFromValue(),this._closePanel("outside"))}}))}_setOpen(t,e="api"){t!==this.open&&(t&&this._isDisabled()||(this._nextOpenSource=e,t?this.setAttribute("open",""):this.removeAttribute("open")))}_openPanel(t="api"){this._setOpen(!0,t)}_closePanel(t="api"){this._setOpen(!1,t)}_commitSelection(t){if(this._isDisabled()||this._isReadonly()||t.disabled)return;const e=this.value;this._suppressValueSync=!0,this.value=t.value,this._suppressValueSync=!1,this._input&&(this._input.value=t.label),this._query=t.label,this._rebuildFiltered({preserveHighlight:!1}),this._renderList(),this._updateClearButton(),this._closePanel("selection"),e!==t.value&&this.dispatchEvent(new CustomEvent("change",{detail:{value:t.value,label:t.label},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("select",{detail:{value:t.value,label:t.label},bubbles:!0,composed:!0}))}_commitCustomValue(){if(this._isDisabled()||this._isReadonly()||!this.hasAttribute("allow-custom"))return;const t=this._query.trim(),e=this.value;this._suppressValueSync=!0,this.value=t,this._suppressValueSync=!1,this._updateClearButton(),e!==t&&this.dispatchEvent(new CustomEvent("change",{detail:{value:t,label:t,custom:!0},bubbles:!0,composed:!0}))}_moveHighlight(t){if(this._filtered.length===0)return;const e=this._panel?.querySelector(`[data-option-index="${this._highlightedIndex}"]`),i=this._panel?.move(t>0?1:-1,{current:e,focus:!1,owner:this._input,scroll:!0})||null;if(!i)return;const r=Number(i.getAttribute("data-option-index")||"-1");r<0||(this._highlightedIndex=r,this._renderList())}render(){const t=this.hasAttribute("headless"),e=this.getAttribute("disabled"),i=_(e),r=this._isReadonly(),s=this._state(),o=s==="loading",a=this.getAttribute("placeholder")||"Search...",l=this.getAttribute("maxlength"),b=this.hasAttribute("required"),u=this.getAttribute("label")||"",c=this.getAttribute("description")||"",x=this.getAttribute("data-error")||""||(s==="error"?this._stateText()||"Unable to load options.":""),m=this.getAttribute("validation")==="error"||s==="error"||!!x,f=!!(u||this.querySelector('[slot="label"]')),g=(this.getAttribute("aria-label")||"").trim(),v=!!(c||this.querySelector('[slot="description"]')),y=`${this._uid}-error`,w=F.externalDescriptionMarkup(this,this._uid),A=[v?`${this._uid}-description`:"",m?y:"",w.id].filter(Boolean).join(" ");if(this._options=this._readOptions(),!this._query){const C=this._findOptionByValue(this.value);this._query=C?C.label:this.value}this._rebuildFiltered({preserveHighlight:!1}),this.setContent(`
490
+ ${t?"":`<style>${B}</style>`}
491
+ ${f||v?`
491
492
  <div class="label-row">
492
- <label class="label" part="label" id="${this._uid}-label"><slot name="label">${a(u)}</slot></label>
493
- <div class="description" part="description" id="${this._uid}-description"><slot name="description">${a(c)}</slot></div>
493
+ <label class="label" part="label" id="${this._uid}-label"><slot name="label">${n(u)}</slot></label>
494
+ <div class="description" part="description" id="${this._uid}-description"><slot name="description">${n(c)}</slot></div>
494
495
  </div>
495
496
  `:""}
496
497
 
497
498
  <div class="root" part="root">
498
- <div class="control" part="control" data-focused="${this._isFocused?"true":"false"}" data-state="${a(s)}">
499
+ <div class="control" part="control" data-focused="${this._isFocused?"true":"false"}" data-state="${n(s)}">
499
500
  <input
500
501
  id="${this._uid}-input"
501
502
  part="input"
@@ -504,22 +505,23 @@
504
505
  aria-autocomplete="list"
505
506
  aria-expanded="${this.open?"true":"false"}"
506
507
  aria-controls="${this._uid}-listbox"
507
- ${f?`aria-labelledby="${this._uid}-label"`:""}
508
- ${y?`aria-describedby="${y}"`:""}
508
+ ${f?`aria-labelledby="${this._uid}-label"`:g?`aria-label="${n(g)}"`:""}
509
+ ${A?`aria-describedby="${A}"`:""}
509
510
  ${m?'aria-invalid="true"':""}
510
511
  aria-busy="${o?"true":"false"}"
511
- value="${a(this._query)}"
512
- placeholder="${a(n)}"
512
+ value="${n(this._query)}"
513
+ placeholder="${n(a)}"
513
514
  ${i?"disabled":""}
514
515
  ${r?"readonly":""}
515
516
  ${b?"required":""}
516
- ${l?`maxlength="${a(l)}"`:""}
517
+ ${l?`maxlength="${n(l)}"`:""}
517
518
  />
518
- <button type="button" part="clear" class="icon-btn clear-btn" aria-label="Clear value" hidden ${r?"disabled":""}>${F}</button>
519
- <button type="button" part="toggle" class="icon-btn toggle-btn" data-open="${this.open?"true":"false"}" aria-label="Toggle options">${$}</button>
519
+ <button type="button" part="clear" class="icon-btn clear-btn" aria-label="Clear value" hidden ${r?"disabled":""}>${D}</button>
520
+ <button type="button" part="toggle" class="icon-btn toggle-btn" data-open="${this.open?"true":"false"}" aria-label="Toggle options">${I}</button>
520
521
  </div>
521
- <ui-listbox class="panel" id="${this._uid}-listbox" part="panel" role="listbox" item-selector=".option[data-option-index]" item-role="option" active-attribute="data-highlighted" aria-busy="${o?"true":"false"}" data-state="${a(s)}" ${this.open?'data-open="true" aria-hidden="false"':'hidden aria-hidden="true"'}></ui-listbox>
522
+ <ui-listbox class="panel" id="${this._uid}-listbox" part="panel" role="listbox" item-selector=".option[data-option-index]" item-role="option" active-attribute="data-highlighted" aria-busy="${o?"true":"false"}" data-state="${n(s)}" ${this.open?'data-open="true" aria-hidden="false"':'hidden aria-hidden="true"'}></ui-listbox>
522
523
  </div>
523
524
  <slot hidden></slot>
524
- <div class="error" part="error" id="${v}" ${m?"":"hidden"}>${a(x)}</div>
525
- `),this._detachDomListeners(),this._input=this.root.querySelector("input"),this._control=this.root.querySelector(".control"),this._panel=this.root.querySelector("ui-listbox.panel"),this._clearBtn=this.root.querySelector(".clear-btn"),this._toggleBtn=this.root.querySelector(".toggle-btn"),this._listStructureFingerprint="",this._renderList(),this._updateClearButton(),this._applyOpenState(),this._input&&(this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onNativeChange),this._input.addEventListener("focus",this._onFocusIn),this._input.addEventListener("blur",this._onFocusOut),this._input.addEventListener("keydown",this._onKeyDown),this.hasAttribute("autofocus")&&(this._autofocusFrame&&cancelAnimationFrame(this._autofocusFrame),this._autofocusFrame=requestAnimationFrame(()=>{this._autofocusFrame=0;try{this._input?.focus()}catch{}}))),this._clearBtn&&this._clearBtn.addEventListener("click",this._onClearClick),this._toggleBtn&&this._toggleBtn.addEventListener("click",this._onToggleClick),this._panel&&(this._panel.addEventListener("pointerdown",this._onPanelPointerDown),this._panel.addEventListener("click",this._onPanelClick))}_detachDomListeners(){this._input&&(this._input.removeEventListener("input",this._onInput),this._input.removeEventListener("change",this._onNativeChange),this._input.removeEventListener("focus",this._onFocusIn),this._input.removeEventListener("blur",this._onFocusOut),this._input.removeEventListener("keydown",this._onKeyDown)),this._clearBtn&&this._clearBtn.removeEventListener("click",this._onClearClick),this._toggleBtn&&this._toggleBtn.removeEventListener("click",this._onToggleClick),this._panel&&(this._panel.removeEventListener("pointerdown",this._onPanelPointerDown),this._panel.removeEventListener("click",this._onPanelClick))}_onInput(t){if(!this._input||this._isDisabled()||this._isReadonly())return;const e=t.target.value;this._query=e,this._openPanel("keyboard"),this._rebuildFiltered({preserveHighlight:!1}),this._renderList(),this._updateClearButton(),this.dispatchEvent(new CustomEvent("input",{detail:{query:e,value:this.value},bubbles:!0,composed:!0}));const i=Number(this.getAttribute("debounce")||0);this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),i>0?this._debounceTimer=setTimeout(()=>{this.dispatchEvent(new CustomEvent("debounced-input",{detail:{query:e,value:this.value},bubbles:!0,composed:!0}))},i):this.dispatchEvent(new CustomEvent("debounced-input",{detail:{query:e,value:this.value},bubbles:!0,composed:!0}))}_onNativeChange(){this._isDisabled()||this._isReadonly()||this.hasAttribute("allow-custom")&&this._commitCustomValue()}_onFocusIn(){this._isFocused=!0,this._control&&this._control.setAttribute("data-focused","true"),this._isReadonly()||this._openPanel("keyboard")}_onFocusOut(){this._isFocused=!1,this._control&&this._control.setAttribute("data-focused","false"),queueMicrotask(()=>{if(this._panelPointerDown){this._panelPointerDown=!1;return}this.root.activeElement||this.open&&(this.hasAttribute("allow-custom")?this._commitCustomValue():this._syncInputFromValue(),this._closePanel("outside"))})}_refreshOptionsFromDom(){this._options=this._readOptions();const t=this._isFocused&&this.open;if(!t){const e=this._findOptionByValue(this.value),i=e?e.label:this.value;this._query=i,this._input&&(this._input.value=i)}this._rebuildFiltered({preserveHighlight:t}),this._renderList(),this._updateClearButton()}_scheduleOptionsRefresh(){this._optionsRefreshFrame||(this._optionsRefreshFrame=requestAnimationFrame(()=>{this._optionsRefreshFrame=0,this.isConnected&&this._refreshOptionsFromDom()}))}_onKeyDown(t){if(!this._isDisabled()&&this._input){if(t.key==="Home"&&this.open){t.preventDefault();const e=this._panel?.focusBoundary("first",{focus:!1,owner:this._input,scroll:!0})||null;this._highlightedIndex=Number(e?.getAttribute("data-option-index")||"-1"),this._renderList();return}if(t.key==="End"&&this.open){t.preventDefault();const e=this._panel?.focusBoundary("last",{focus:!1,owner:this._input,scroll:!0})||null;this._highlightedIndex=Number(e?.getAttribute("data-option-index")||"-1"),this._renderList();return}if(t.key==="ArrowDown"){t.preventDefault(),this._openPanel("keyboard"),this._moveHighlight(1);return}if(t.key==="ArrowUp"){t.preventDefault(),this._openPanel("keyboard"),this._moveHighlight(-1);return}if(t.key==="Enter"){if(this.open&&this._highlightedIndex>=0){t.preventDefault();const e=this._filtered[this._highlightedIndex];e&&this._commitSelection(e)}else if(this.hasAttribute("allow-custom"))t.preventDefault(),this._commitCustomValue(),this._closePanel("keyboard");else if(this.open)t.preventDefault(),this._syncInputFromValue(),this._closePanel("keyboard");else{const e=this._findExactOptionByQuery(this._query);e&&(t.preventDefault(),this._commitSelection(e))}return}if(t.key==="Escape"){this.open&&(t.preventDefault(),this.hasAttribute("allow-custom")||this._syncInputFromValue(),this._closePanel("keyboard"));return}t.key==="Tab"&&(this.hasAttribute("allow-custom")?this._commitCustomValue():this._syncInputFromValue(),this._closePanel("keyboard"))}}_onClearClick(t){t.preventDefault(),this._input&&(this._isDisabled()||this._isReadonly()||(this._query="",this._input.value="",this._suppressValueSync=!0,this.value="",this._suppressValueSync=!1,this._rebuildFiltered({preserveHighlight:!1}),this._renderList(),this._updateClearButton(),this._openPanel("clear"),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("input",{detail:{query:"",value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:"",label:""},bubbles:!0,composed:!0}))))}_onToggleClick(t){t.preventDefault(),!this._isDisabled()&&(this.open?this._closePanel("toggle"):this._openPanel("toggle"),this._input?.focus())}_onPanelPointerDown(t){this._isReadonly()||!t.target?.closest("[data-option-index]")||(this._panelPointerDown=!0,t.preventDefault())}_onPanelClick(t){if(this._isReadonly())return;const i=t.target.closest("[data-option-index]");if(!i)return;const r=i.getAttribute("data-option-index"),s=r==null?-1:Number(r);if(!Number.isFinite(s)||s<0)return;const o=this._filtered[s];!o||o.disabled||this._commitSelection(o)}}typeof customElements<"u"&&!customElements.get("ui-combobox")&&customElements.define("ui-combobox",A);exports.UICombobox=A;
525
+ <div class="error" part="error" id="${y}" ${m?"":"hidden"}>${n(x)}</div>
526
+ ${w.html}
527
+ `),this._detachDomListeners(),this._input=this.root.querySelector("input"),this._control=this.root.querySelector(".control"),this._panel=this.root.querySelector("ui-listbox.panel"),this._clearBtn=this.root.querySelector(".clear-btn"),this._toggleBtn=this.root.querySelector(".toggle-btn"),this._listStructureFingerprint="",this._renderList(),this._updateClearButton(),this._applyOpenState(),this._input&&(this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onNativeChange),this._input.addEventListener("focus",this._onFocusIn),this._input.addEventListener("blur",this._onFocusOut),this._input.addEventListener("keydown",this._onKeyDown),this.hasAttribute("autofocus")&&(this._autofocusFrame&&cancelAnimationFrame(this._autofocusFrame),this._autofocusFrame=requestAnimationFrame(()=>{this._autofocusFrame=0;try{this._input?.focus()}catch{}}))),this._clearBtn&&this._clearBtn.addEventListener("click",this._onClearClick),this._toggleBtn&&this._toggleBtn.addEventListener("click",this._onToggleClick),this._panel&&(this._panel.addEventListener("pointerdown",this._onPanelPointerDown),this._panel.addEventListener("click",this._onPanelClick))}_detachDomListeners(){this._input&&(this._input.removeEventListener("input",this._onInput),this._input.removeEventListener("change",this._onNativeChange),this._input.removeEventListener("focus",this._onFocusIn),this._input.removeEventListener("blur",this._onFocusOut),this._input.removeEventListener("keydown",this._onKeyDown)),this._clearBtn&&this._clearBtn.removeEventListener("click",this._onClearClick),this._toggleBtn&&this._toggleBtn.removeEventListener("click",this._onToggleClick),this._panel&&(this._panel.removeEventListener("pointerdown",this._onPanelPointerDown),this._panel.removeEventListener("click",this._onPanelClick))}_onInput(t){if(!this._input||this._isDisabled()||this._isReadonly())return;const e=t.target.value;this._query=e,this._openPanel("keyboard"),this._rebuildFiltered({preserveHighlight:!1}),this._renderList(),this._updateClearButton(),this.dispatchEvent(new CustomEvent("input",{detail:{query:e,value:this.value},bubbles:!0,composed:!0}));const i=Number(this.getAttribute("debounce")||0);this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),i>0?this._debounceTimer=setTimeout(()=>{this.dispatchEvent(new CustomEvent("debounced-input",{detail:{query:e,value:this.value},bubbles:!0,composed:!0}))},i):this.dispatchEvent(new CustomEvent("debounced-input",{detail:{query:e,value:this.value},bubbles:!0,composed:!0}))}_onNativeChange(){this._isDisabled()||this._isReadonly()||this.hasAttribute("allow-custom")&&this._commitCustomValue()}_onFocusIn(){this._isFocused=!0,this._control&&this._control.setAttribute("data-focused","true"),this._isReadonly()||this._openPanel("keyboard")}_onFocusOut(){this._isFocused=!1,this._control&&this._control.setAttribute("data-focused","false"),queueMicrotask(()=>{if(this._panelPointerDown){this._panelPointerDown=!1;return}this.root.activeElement||this.open&&(this.hasAttribute("allow-custom")?this._commitCustomValue():this._syncInputFromValue(),this._closePanel("outside"))})}_refreshOptionsFromDom(){this._options=this._readOptions();const t=this._isFocused&&this.open;if(!t){const e=this._findOptionByValue(this.value),i=e?e.label:this.value;this._query=i,this._input&&(this._input.value=i)}this._rebuildFiltered({preserveHighlight:t}),this._renderList(),this._updateClearButton()}_scheduleOptionsRefresh(){this._optionsRefreshFrame||(this._optionsRefreshFrame=requestAnimationFrame(()=>{this._optionsRefreshFrame=0,this.isConnected&&this._refreshOptionsFromDom()}))}_onKeyDown(t){if(!this._isDisabled()&&this._input){if(t.key==="Home"&&this.open){t.preventDefault();const e=this._panel?.focusBoundary("first",{focus:!1,owner:this._input,scroll:!0})||null;this._highlightedIndex=Number(e?.getAttribute("data-option-index")||"-1"),this._renderList();return}if(t.key==="End"&&this.open){t.preventDefault();const e=this._panel?.focusBoundary("last",{focus:!1,owner:this._input,scroll:!0})||null;this._highlightedIndex=Number(e?.getAttribute("data-option-index")||"-1"),this._renderList();return}if(t.key==="ArrowDown"){t.preventDefault(),this._openPanel("keyboard"),this._moveHighlight(1);return}if(t.key==="ArrowUp"){t.preventDefault(),this._openPanel("keyboard"),this._moveHighlight(-1);return}if(t.key==="Enter"){if(this.open&&this._highlightedIndex>=0){t.preventDefault();const e=this._filtered[this._highlightedIndex];e&&this._commitSelection(e)}else if(this.hasAttribute("allow-custom"))t.preventDefault(),this._commitCustomValue(),this._closePanel("keyboard");else if(this.open)t.preventDefault(),this._syncInputFromValue(),this._closePanel("keyboard");else{const e=this._findExactOptionByQuery(this._query);e&&(t.preventDefault(),this._commitSelection(e))}return}if(t.key==="Escape"){this.open&&(t.preventDefault(),this.hasAttribute("allow-custom")||this._syncInputFromValue(),this._closePanel("keyboard"));return}t.key==="Tab"&&(this.hasAttribute("allow-custom")?this._commitCustomValue():this._syncInputFromValue(),this._closePanel("keyboard"))}}_onClearClick(t){t.preventDefault(),this._input&&(this._isDisabled()||this._isReadonly()||(this._query="",this._input.value="",this._suppressValueSync=!0,this.value="",this._suppressValueSync=!1,this._rebuildFiltered({preserveHighlight:!1}),this._renderList(),this._updateClearButton(),this._openPanel("clear"),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("input",{detail:{query:"",value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:"",label:""},bubbles:!0,composed:!0}))))}_onToggleClick(t){t.preventDefault(),!this._isDisabled()&&(this.open?this._closePanel("toggle"):this._openPanel("toggle"),this._input?.focus())}_onPanelPointerDown(t){this._isReadonly()||!t.target?.closest("[data-option-index]")||(this._panelPointerDown=!0,t.preventDefault())}_onPanelClick(t){if(this._isReadonly())return;const i=t.target.closest("[data-option-index]");if(!i)return;const r=i.getAttribute("data-option-index"),s=r==null?-1:Number(r);if(!Number.isFinite(s)||s<0)return;const o=this._filtered[s];!o||o.disabled||this._commitSelection(o)}}typeof customElements<"u"&&!customElements.get("ui-combobox")&&customElements.define("ui-combobox",k);exports.UICombobox=k;