@threadlabs/looma 0.1.22 → 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 (248) hide show
  1. package/dist/{chunk-NIPNHZ5W.js → chunk-GDMQKT5F.js} +63 -31
  2. package/dist/{chunk-SZJQ3NPX.js → chunk-TL4FIE7X.js} +4 -8
  3. package/dist/cjs/{index-D07f6BOw.js → index-BHG9Rpil.js} +33 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/looma.cjs.js +2 -2
  6. package/dist/cjs/{manager-C9j3HZay.js → manager-Ce25WRtl.js} +6 -7
  7. package/dist/cjs/ui-affordance-scope.cjs.entry.js +1 -1
  8. package/dist/cjs/ui-avatar-group.cjs.entry.js +1 -1
  9. package/dist/cjs/ui-avatar.cjs.entry.js +1 -1
  10. package/dist/cjs/ui-badge.cjs.entry.js +1 -1
  11. package/dist/cjs/ui-button.cjs.entry.js +16 -5
  12. package/dist/cjs/ui-checkbox.cjs.entry.js +1 -1
  13. package/dist/cjs/ui-combobox.cjs.entry.js +541 -0
  14. package/dist/cjs/ui-context-menu.cjs.entry.js +3 -3
  15. package/dist/cjs/ui-dialog.cjs.entry.js +3 -3
  16. package/dist/cjs/ui-disclosure.cjs.entry.js +2 -2
  17. package/dist/cjs/ui-floating-action-button.cjs.entry.js +2 -2
  18. package/dist/cjs/ui-form-field.cjs.entry.js +3 -3
  19. package/dist/cjs/ui-icon-button.cjs.entry.js +2 -2
  20. package/dist/cjs/ui-input.cjs.entry.js +11 -6
  21. package/dist/cjs/ui-menu-item.cjs.entry.js +2 -2
  22. package/dist/cjs/ui-menu.cjs.entry.js +3 -3
  23. package/dist/cjs/ui-popover.cjs.entry.js +3 -3
  24. package/dist/cjs/ui-radio-group.cjs.entry.js +2 -2
  25. package/dist/cjs/ui-radio.cjs.entry.js +3 -3
  26. package/dist/cjs/ui-search-result-row.cjs.entry.js +2 -2
  27. package/dist/cjs/ui-search-shell.cjs.entry.js +2 -2
  28. package/dist/cjs/ui-select.cjs.entry.js +15 -7
  29. package/dist/cjs/ui-switch.cjs.entry.js +3 -3
  30. package/dist/cjs/ui-tabs.cjs.entry.js +2 -2
  31. package/dist/cjs/ui-textarea.cjs.entry.js +10 -6
  32. package/dist/cjs/ui-toast-region.cjs.entry.js +2 -2
  33. package/dist/cjs/ui-tooltip.cjs.entry.js +52 -16
  34. package/dist/cjs/ui-top-bar.cjs.entry.js +2 -2
  35. package/dist/cjs/ui-tree-item.cjs.entry.js +7 -3
  36. package/dist/cjs/ui-tree.cjs.entry.js +81 -9
  37. package/dist/collection/collection-manifest.json +1 -0
  38. package/dist/collection/components/ui-button/ui-button.css +36 -26
  39. package/dist/collection/components/ui-button/ui-button.js +14 -3
  40. package/dist/collection/components/ui-combobox/ui-combobox.css +24 -0
  41. package/dist/collection/components/ui-combobox/ui-combobox.js +973 -0
  42. package/dist/collection/components/ui-context-menu/ui-context-menu.js +1 -1
  43. package/dist/collection/components/ui-dialog/ui-dialog.js +1 -1
  44. package/dist/collection/components/ui-disclosure/ui-disclosure.js +1 -1
  45. package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.js +1 -1
  46. package/dist/collection/components/ui-form-field/ui-form-field.css +4 -0
  47. package/dist/collection/components/ui-form-field/ui-form-field.js +1 -1
  48. package/dist/collection/components/ui-icon-button/ui-icon-button.js +1 -1
  49. package/dist/collection/components/ui-input/ui-input.css +8 -6
  50. package/dist/collection/components/ui-input/ui-input.js +11 -7
  51. package/dist/collection/components/ui-menu/ui-menu.js +1 -1
  52. package/dist/collection/components/ui-menu-item/ui-menu-item.js +1 -1
  53. package/dist/collection/components/ui-popover/ui-popover.js +1 -1
  54. package/dist/collection/components/ui-radio/ui-radio.js +2 -2
  55. package/dist/collection/components/ui-radio-group/ui-radio-group.js +1 -1
  56. package/dist/collection/components/ui-search-result-row/ui-search-result-row.js +1 -1
  57. package/dist/collection/components/ui-search-shell/ui-search-shell.js +1 -1
  58. package/dist/collection/components/ui-select/ui-select.css +8 -6
  59. package/dist/collection/components/ui-select/ui-select.js +17 -11
  60. package/dist/collection/components/ui-switch/ui-switch.js +2 -2
  61. package/dist/collection/components/ui-tabs/ui-tabs.js +1 -1
  62. package/dist/collection/components/ui-textarea/ui-textarea.css +7 -6
  63. package/dist/collection/components/ui-textarea/ui-textarea.js +10 -7
  64. package/dist/collection/components/ui-toast-region/ui-toast-region.js +1 -1
  65. package/dist/collection/components/ui-tooltip/ui-tooltip.js +102 -15
  66. package/dist/collection/components/ui-top-bar/ui-top-bar.js +1 -1
  67. package/dist/collection/components/ui-tree/ui-tree.js +100 -8
  68. package/dist/collection/components/ui-tree-item/ui-tree-item.js +44 -2
  69. package/dist/collection/field/combobox.js +4 -0
  70. package/dist/collection/field/valibot.js +5 -0
  71. package/dist/collection/field/validation.js +62 -0
  72. package/dist/collection/overlay/manager.js +6 -7
  73. package/dist/components/index.d.ts +2 -0
  74. package/dist/components/index.js +1 -1
  75. package/dist/components/p-Bh_1GxOD.js +1 -0
  76. package/dist/components/p-C-0syqXZ.js +1 -0
  77. package/dist/components/p-CaietZcq.js +1 -0
  78. package/dist/components/p-DHd18bK7.js +1 -0
  79. package/dist/components/ui-affordance-scope.js +1 -1
  80. package/dist/components/ui-avatar-group.js +1 -1
  81. package/dist/components/ui-avatar.js +1 -1
  82. package/dist/components/ui-badge.js +1 -1
  83. package/dist/components/ui-button.js +1 -1
  84. package/dist/components/ui-checkbox.js +1 -1
  85. package/dist/components/ui-combobox.d.ts +11 -0
  86. package/dist/components/ui-combobox.js +1 -0
  87. package/dist/components/ui-context-menu.js +1 -1
  88. package/dist/components/ui-dialog.js +1 -1
  89. package/dist/components/ui-disclosure.js +1 -1
  90. package/dist/components/ui-floating-action-button.js +1 -1
  91. package/dist/components/ui-form-field.js +1 -1
  92. package/dist/components/ui-icon-button.js +1 -1
  93. package/dist/components/ui-input.js +1 -1
  94. package/dist/components/ui-menu-item.js +1 -1
  95. package/dist/components/ui-menu.js +1 -1
  96. package/dist/components/ui-popover.js +1 -1
  97. package/dist/components/ui-radio-group.js +1 -1
  98. package/dist/components/ui-radio.js +1 -1
  99. package/dist/components/ui-search-result-row.js +1 -1
  100. package/dist/components/ui-search-shell.js +1 -1
  101. package/dist/components/ui-select.js +1 -1
  102. package/dist/components/ui-switch.js +1 -1
  103. package/dist/components/ui-tabs.js +1 -1
  104. package/dist/components/ui-textarea.js +1 -1
  105. package/dist/components/ui-toast-region.js +1 -1
  106. package/dist/components/ui-tooltip.js +1 -1
  107. package/dist/components/ui-top-bar.js +1 -1
  108. package/dist/components/ui-tree-item.js +2 -2
  109. package/dist/components/ui-tree.js +1 -1
  110. package/dist/esm/{index-CEeiinfk.js → index-8BGiMGQ0.js} +33 -1
  111. package/dist/esm/loader.js +3 -3
  112. package/dist/esm/looma.js +3 -3
  113. package/dist/esm/{manager-PM9a74r7.js → manager-C-0syqXZ.js} +6 -7
  114. package/dist/esm/ui-affordance-scope.entry.js +1 -1
  115. package/dist/esm/ui-avatar-group.entry.js +1 -1
  116. package/dist/esm/ui-avatar.entry.js +1 -1
  117. package/dist/esm/ui-badge.entry.js +1 -1
  118. package/dist/esm/ui-button.entry.js +16 -5
  119. package/dist/esm/ui-checkbox.entry.js +1 -1
  120. package/dist/esm/ui-combobox.entry.js +539 -0
  121. package/dist/esm/ui-context-menu.entry.js +3 -3
  122. package/dist/esm/ui-dialog.entry.js +3 -3
  123. package/dist/esm/ui-disclosure.entry.js +2 -2
  124. package/dist/esm/ui-floating-action-button.entry.js +2 -2
  125. package/dist/esm/ui-form-field.entry.js +3 -3
  126. package/dist/esm/ui-icon-button.entry.js +2 -2
  127. package/dist/esm/ui-input.entry.js +11 -6
  128. package/dist/esm/ui-menu-item.entry.js +2 -2
  129. package/dist/esm/ui-menu.entry.js +3 -3
  130. package/dist/esm/ui-popover.entry.js +3 -3
  131. package/dist/esm/ui-radio-group.entry.js +2 -2
  132. package/dist/esm/ui-radio.entry.js +3 -3
  133. package/dist/esm/ui-search-result-row.entry.js +2 -2
  134. package/dist/esm/ui-search-shell.entry.js +2 -2
  135. package/dist/esm/ui-select.entry.js +15 -7
  136. package/dist/esm/ui-switch.entry.js +3 -3
  137. package/dist/esm/ui-tabs.entry.js +2 -2
  138. package/dist/esm/ui-textarea.entry.js +10 -6
  139. package/dist/esm/ui-toast-region.entry.js +2 -2
  140. package/dist/esm/ui-tooltip.entry.js +52 -16
  141. package/dist/esm/ui-top-bar.entry.js +2 -2
  142. package/dist/esm/ui-tree-item.entry.js +7 -3
  143. package/dist/esm/ui-tree.entry.js +81 -9
  144. package/dist/index.cjs +883 -123
  145. package/dist/index.d.cts +104 -1
  146. package/dist/index.d.ts +104 -1
  147. package/dist/index.js +62 -8
  148. package/dist/looma/looma.esm.js +1 -1
  149. package/dist/looma/{p-0198bb21.entry.js → p-13347631.entry.js} +1 -1
  150. package/dist/looma/p-14c081cf.entry.js +1 -0
  151. package/dist/looma/{p-0f45c5f0.entry.js → p-25366205.entry.js} +1 -1
  152. package/dist/looma/{p-a9f46811.entry.js → p-2e3aa869.entry.js} +1 -1
  153. package/dist/looma/p-40fe7fee.entry.js +1 -0
  154. package/dist/looma/p-446cda76.entry.js +1 -0
  155. package/dist/looma/p-4fc1b005.entry.js +13 -0
  156. package/dist/looma/p-582973b5.entry.js +1 -0
  157. package/dist/looma/{p-d273b857.entry.js → p-5a87b59d.entry.js} +1 -1
  158. package/dist/looma/{p-2ed7e241.entry.js → p-5da09f47.entry.js} +1 -1
  159. package/dist/looma/{p-7e94d90d.entry.js → p-69a5557b.entry.js} +1 -1
  160. package/dist/looma/p-6a8a4736.entry.js +1 -0
  161. package/dist/looma/{p-caa8fc7b.entry.js → p-6bf4038b.entry.js} +1 -1
  162. package/dist/looma/p-7e0bb7f6.entry.js +1 -0
  163. package/dist/looma/{p-ed5abf6d.entry.js → p-8204fee6.entry.js} +1 -1
  164. package/dist/looma/{p-5ba9d496.entry.js → p-8238e0dc.entry.js} +1 -1
  165. package/dist/looma/p-8BGiMGQ0.js +2 -0
  166. package/dist/looma/{p-051f578c.entry.js → p-8b8840b8.entry.js} +1 -1
  167. package/dist/looma/{p-1674cda4.entry.js → p-99d88efb.entry.js} +1 -1
  168. package/dist/looma/p-C-0syqXZ.js +1 -0
  169. package/dist/looma/p-a27669b1.entry.js +1 -0
  170. package/dist/looma/{p-11083743.entry.js → p-a6ee76b7.entry.js} +1 -1
  171. package/dist/looma/p-a90d2821.entry.js +1 -0
  172. package/dist/looma/{p-2e6f791e.entry.js → p-add36e74.entry.js} +1 -1
  173. package/dist/looma/{p-0584a051.entry.js → p-b6398a6b.entry.js} +1 -1
  174. package/dist/looma/{p-078f9fb8.entry.js → p-d50faaff.entry.js} +1 -1
  175. package/dist/looma/{p-b7aa4488.entry.js → p-d77278ce.entry.js} +1 -1
  176. package/dist/looma/p-d9ec13b7.entry.js +1 -0
  177. package/dist/looma/{p-1681b218.entry.js → p-ecf8005f.entry.js} +1 -1
  178. package/dist/looma/p-ed368426.entry.js +1 -0
  179. package/dist/looma/{p-063f5a89.entry.js → p-f0487ff3.entry.js} +1 -1
  180. package/dist/looma/p-f74e5546.entry.js +1 -0
  181. package/dist/types/components/ui-combobox/ui-combobox.d.ts +93 -0
  182. package/dist/types/components/ui-input/ui-input.d.ts +1 -1
  183. package/dist/types/components/ui-select/ui-select.d.ts +3 -2
  184. package/dist/types/components/ui-textarea/ui-textarea.d.ts +1 -1
  185. package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +18 -1
  186. package/dist/types/components/ui-tree/ui-tree.d.ts +9 -1
  187. package/dist/types/components/ui-tree-item/ui-tree-item.d.ts +4 -0
  188. package/dist/types/components.d.ts +260 -28
  189. package/dist/types/field/combobox.d.ts +46 -0
  190. package/dist/types/field/valibot.d.ts +7 -0
  191. package/dist/types/field/validation.d.ts +56 -0
  192. package/dist/{ui-affordance-scope.entry-L533MECG.js → ui-affordance-scope.entry-VO4C2MZX.js} +1 -1
  193. package/dist/{ui-avatar-group.entry-BWS7E2CM.js → ui-avatar-group.entry-TAXJRIIU.js} +1 -1
  194. package/dist/{ui-avatar.entry-3INAY3XP.js → ui-avatar.entry-T6FU6ZYM.js} +1 -1
  195. package/dist/{ui-badge.entry-2WOBVOYP.js → ui-badge.entry-MZFYNBMJ.js} +1 -1
  196. package/dist/ui-button.entry-7UXMUGHN.js +80 -0
  197. package/dist/{ui-checkbox.entry-2PTBHSCQ.js → ui-checkbox.entry-DMZJB3RE.js} +1 -1
  198. package/dist/ui-combobox.entry-ZCTPXEES.js +553 -0
  199. package/dist/{ui-context-menu.entry-AYDDCIZS.js → ui-context-menu.entry-2WMCBGCP.js} +6 -6
  200. package/dist/{ui-dialog.entry-I2XI3ZTZ.js → ui-dialog.entry-WO23XOSW.js} +6 -6
  201. package/dist/{ui-disclosure.entry-5LY2BT7B.js → ui-disclosure.entry-USX7OUEW.js} +2 -2
  202. package/dist/{ui-floating-action-button.entry-EJAMR5AM.js → ui-floating-action-button.entry-MXDIN7MV.js} +2 -2
  203. package/dist/{ui-form-field.entry-SJ6NNFXB.js → ui-form-field.entry-7ZCMEHPY.js} +3 -3
  204. package/dist/{ui-icon-button.entry-7SD2LVXE.js → ui-icon-button.entry-MJUNXHBU.js} +2 -2
  205. package/dist/{ui-input.entry-7MM7GEQW.js → ui-input.entry-AWG63YIG.js} +8 -6
  206. package/dist/{ui-menu-item.entry-V3HIMR75.js → ui-menu-item.entry-HFTWG62N.js} +2 -2
  207. package/dist/{ui-menu.entry-R4WK5QSX.js → ui-menu.entry-IT3GW5TL.js} +7 -7
  208. package/dist/{ui-popover.entry-ZRJRTXA7.js → ui-popover.entry-ZQQB4N6E.js} +6 -6
  209. package/dist/{ui-radio-group.entry-S6RXHFSN.js → ui-radio-group.entry-V7PCTS7I.js} +2 -2
  210. package/dist/{ui-radio.entry-B73QZK2M.js → ui-radio.entry-JYH6TQBI.js} +3 -3
  211. package/dist/{ui-search-result-row.entry-DR2Y5S7P.js → ui-search-result-row.entry-JBNYXXUN.js} +2 -2
  212. package/dist/{ui-search-shell.entry-ST5IKJBC.js → ui-search-shell.entry-TEAWE76O.js} +2 -2
  213. package/dist/{ui-select.entry-7GPRFV67.js → ui-select.entry-F3A6TE2U.js} +13 -7
  214. package/dist/{ui-switch.entry-XQ5IRJRH.js → ui-switch.entry-MJIICMP2.js} +3 -3
  215. package/dist/{ui-tabs.entry-HPW5L5CY.js → ui-tabs.entry-6REFIUHV.js} +2 -2
  216. package/dist/{ui-textarea.entry-W2PSRYVS.js → ui-textarea.entry-OJTXCED7.js} +8 -6
  217. package/dist/{ui-toast-region.entry-FJUHFXKZ.js → ui-toast-region.entry-NOFXLKPS.js} +5 -5
  218. package/dist/{ui-tooltip.entry-G5WHQW7K.js → ui-tooltip.entry-COWTWVHX.js} +57 -21
  219. package/dist/{ui-top-bar.entry-3NCHFC4Y.js → ui-top-bar.entry-PIAWXJNV.js} +2 -2
  220. package/dist/{ui-tree-item.entry-45RR3CMP.js → ui-tree-item.entry-BSEWNL2O.js} +7 -3
  221. package/dist/{ui-tree.entry-SZW4Q5PY.js → ui-tree.entry-XYI3ZFAZ.js} +77 -8
  222. package/dist/valibot.d.ts +52 -0
  223. package/dist/valibot.js +7 -0
  224. package/package.json +11 -3
  225. package/styles.css +36 -20
  226. package/theme-high-contrast.css +12 -0
  227. package/tokens.css +23 -0
  228. package/vue/{chunk-5KWCMTXB.js → chunk-JLW23USW.js} +88 -1
  229. package/vue/editor/index.js +1 -1
  230. package/vue/index.d.ts +123 -1
  231. package/vue/index.js +3 -1
  232. package/dist/components/p-CEYIKqYc.js +0 -1
  233. package/dist/components/p-CIA4RyEp.js +0 -1
  234. package/dist/components/p-PM9a74r7.js +0 -1
  235. package/dist/looma/p-34417499.entry.js +0 -1
  236. package/dist/looma/p-4b422d40.entry.js +0 -1
  237. package/dist/looma/p-54722713.entry.js +0 -13
  238. package/dist/looma/p-54c41576.entry.js +0 -1
  239. package/dist/looma/p-5d4713a6.entry.js +0 -1
  240. package/dist/looma/p-624ba086.entry.js +0 -1
  241. package/dist/looma/p-8d5adb17.entry.js +0 -1
  242. package/dist/looma/p-9194a99d.entry.js +0 -1
  243. package/dist/looma/p-CEeiinfk.js +0 -2
  244. package/dist/looma/p-PM9a74r7.js +0 -1
  245. package/dist/looma/p-a33522a2.entry.js +0 -1
  246. package/dist/looma/p-a5127c7d.entry.js +0 -1
  247. package/dist/looma/p-e3f99a24.entry.js +0 -1
  248. package/dist/ui-button.entry-VCGSEONK.js +0 -71
@@ -2,7 +2,7 @@ import {
2
2
  Host,
3
3
  h,
4
4
  registerInstance
5
- } from "./chunk-NIPNHZ5W.js";
5
+ } from "./chunk-GDMQKT5F.js";
6
6
 
7
7
  // dist/esm/ui-badge.entry.js
8
8
  var uiBadgeCss = () => `:host{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--ui-border-default);border-radius:999px;background:var(--ui-surface-muted);color:var(--ui-text-secondary);font:inherit;font-size:0.75rem;line-height:1;padding:0.25em 0.6em;white-space:nowrap}:host([data-tone='accent']){background:var(--ui-accent-solid);border-color:var(--ui-accent-solid);color:var(--ui-text-on-accent)}:host([data-tone='danger']){background:var(--ui-danger-solid);border-color:var(--ui-danger-solid);color:var(--ui-text-on-accent)}:host([data-tone='success']){background:var(--ui-success-solid);border-color:var(--ui-success-solid);color:var(--ui-text-on-accent)}:host([data-tone='warning']){background:var(--ui-warning-solid);border-color:var(--ui-warning-solid);color:var(--ui-text-primary)}:host([data-tone='info']){background:var(--ui-info-solid);border-color:var(--ui-info-solid);color:var(--ui-text-on-accent)}:host([data-variant='subtle'][data-tone='accent']){background:var(--ui-accent-soft);border-color:var(--ui-accent-soft);color:var(--ui-accent-solid)}:host([data-variant='subtle'][data-tone='danger']){background:var(--ui-danger-soft);border-color:var(--ui-danger-soft);color:var(--ui-danger-solid)}:host([data-variant='subtle'][data-tone='success']){background:var(--ui-success-soft);border-color:var(--ui-success-soft);color:var(--ui-success-solid)}:host([data-variant='subtle'][data-tone='warning']){background:var(--ui-warning-soft);border-color:var(--ui-warning-soft);color:var(--ui-warning-solid)}:host([data-variant='subtle'][data-tone='info']){background:var(--ui-info-soft);border-color:var(--ui-info-soft);color:var(--ui-info-solid)}`;
@@ -0,0 +1,80 @@
1
+ import {
2
+ isActivationKey
3
+ } from "./chunk-UL7UIUJZ.js";
4
+ import {
5
+ Host,
6
+ getElement,
7
+ h,
8
+ registerInstance
9
+ } from "./chunk-GDMQKT5F.js";
10
+
11
+ // dist/esm/ui-button.entry.js
12
+ var uiButtonCss = () => `:host{display:inline-flex;vertical-align:middle;color:var(--ui-action-secondary-text, var(--ui-text-primary))}:host([data-variant='solid']){color:var(--ui-action-primary-text, var(--ui-text-on-accent))}:host([data-variant='outline']) ::slotted(button),::slotted(button){appearance:none;min-block-size:var(--ui-button-min-block-size, 2.5rem);border:1px solid var(--ui-control-border, var(--ui-border-default));border-radius:var(--ui-button-radius, var(--ui-radius-2));background:var(--ui-action-secondary-surface, var(--ui-surface-default));color:inherit;font:inherit;font-weight:var(--ui-font-medium, 500);line-height:var(--ui-line-height-tight);padding:var(--ui-space-2) var(--ui-space-3);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), border-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease), box-shadow var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease);margin:0}:host([data-size='sm']) ::slotted(button){padding:var(--ui-space-1) var(--ui-space-2);font-size:0.875rem}:host([data-size='lg']) ::slotted(button){min-block-size:var(--ui-control-min-block-size, 2.75rem);padding:var(--ui-space-3) var(--ui-space-4);font-size:1rem}::slotted(button:hover:enabled){background:var(--ui-action-secondary-surface-hover, var(--ui-surface-muted));border-color:var(--ui-control-border-hover, var(--ui-border-strong))}::slotted(button:active:enabled){background:var(--ui-surface-subtle)}:host([data-variant='solid']) ::slotted(button){border-color:var(--ui-action-primary-surface, var(--ui-accent-solid));background:var(--ui-action-primary-surface, var(--ui-accent-solid));color:var(--ui-action-primary-text, var(--ui-text-on-accent));box-shadow:var(--ui-button-solid-shadow, inset 0 1px rgb(255 255 255 / 0.16), var(--ui-shadow-xs))}:host([data-variant='solid']) ::slotted(button:hover:enabled){background:var(--ui-action-primary-surface-hover, var(--ui-accent-hover));border-color:var(--ui-action-primary-surface-hover, var(--ui-accent-hover));box-shadow:var(--ui-shadow-sm);transform:translateY(-1px)}:host([data-variant='solid']) ::slotted(button:active:enabled){background:var(--ui-action-primary-surface-active, var(--ui-accent-active));border-color:var(--ui-action-primary-surface-active, var(--ui-accent-active));box-shadow:none;transform:translateY(0)}:host([data-variant='destructive']) ::slotted(button){border-color:var(--ui-danger-solid);background:var(--ui-danger-solid);color:var(--ui-text-on-accent);box-shadow:var(--ui-button-destructive-shadow, inset 0 1px rgb(255 255 255 / 0.14), var(--ui-shadow-xs))}:host([data-variant='destructive']) ::slotted(button:hover:enabled){background:var(--ui-danger-hover);border-color:var(--ui-danger-hover);box-shadow:var(--ui-shadow-sm);transform:translateY(-1px)}:host([data-variant='destructive']) ::slotted(button:active:enabled){box-shadow:none;transform:translateY(0)}:host([data-variant='ghost']) ::slotted(button){border-color:transparent;background:transparent}:host([data-variant='ghost']) ::slotted(button:hover:enabled){background:var(--ui-surface-muted);border-color:transparent}:host([data-variant='ghost']) ::slotted(button:active:enabled){background:var(--ui-surface-subtle);border-color:transparent}::slotted(button:focus-visible){outline:2px solid var(--ui-focus-ring);outline-offset:2px}:host([data-disabled='true']),:host([disabled]){opacity:0.6;cursor:not-allowed}::slotted(button:disabled){cursor:not-allowed}`;
13
+ var UIButton = class {
14
+ constructor(hostRef) {
15
+ registerInstance(this, hostRef);
16
+ }
17
+ get host() {
18
+ return getElement(this);
19
+ }
20
+ variant = "outline";
21
+ size;
22
+ disabled = false;
23
+ slotRef;
24
+ syncToButton() {
25
+ const btn = this.getButton();
26
+ if (!btn)
27
+ return;
28
+ if (this.size) {
29
+ this.host.dataset.size = this.size;
30
+ } else {
31
+ delete this.host.dataset.size;
32
+ }
33
+ if (this.disabled) {
34
+ this.host.dataset.disabled = "true";
35
+ } else {
36
+ delete this.host.dataset.disabled;
37
+ }
38
+ this.host.dataset.variant = this.variant;
39
+ btn.disabled = this.disabled;
40
+ }
41
+ componentDidLoad() {
42
+ this.slotRef?.addEventListener("slotchange", () => this.syncToButton());
43
+ this.syncToButton();
44
+ }
45
+ componentDidUpdate() {
46
+ this.syncToButton();
47
+ }
48
+ getButton() {
49
+ const slot = this.host.shadowRoot?.querySelector("slot");
50
+ const nodes = slot?.assignedElements() ?? Array.from(this.host.children);
51
+ return nodes.find((el) => el.tagName === "BUTTON") ?? null;
52
+ }
53
+ onKeydown = (e) => {
54
+ const btn = this.getButton();
55
+ if (btn || this.disabled || !isActivationKey(e))
56
+ return;
57
+ e.preventDefault();
58
+ this.host.click();
59
+ };
60
+ render() {
61
+ return h(Host, { key: "9c8d479fe7f1873a447048944513648bac132d52", "data-size": this.size || void 0, "data-variant": this.variant, "data-disabled": this.disabled ? "true" : void 0, onKeyDown: this.onKeydown }, h("slot", { key: "741f48e7efd42262834992c07c4685d3e929d91c", ref: (el) => this.slotRef = el }));
62
+ }
63
+ static get watchers() {
64
+ return {
65
+ "variant": [{
66
+ "syncToButton": 0
67
+ }],
68
+ "size": [{
69
+ "syncToButton": 0
70
+ }],
71
+ "disabled": [{
72
+ "syncToButton": 0
73
+ }]
74
+ };
75
+ }
76
+ };
77
+ UIButton.style = uiButtonCss();
78
+ export {
79
+ UIButton as ui_button
80
+ };
@@ -7,7 +7,7 @@ import {
7
7
  getElement,
8
8
  h,
9
9
  registerInstance
10
- } from "./chunk-NIPNHZ5W.js";
10
+ } from "./chunk-GDMQKT5F.js";
11
11
 
12
12
  // dist/esm/ui-checkbox.entry.js
13
13
  var uiCheckboxCss = () => `:host{display:inline-flex;align-items:center;gap:var(--ui-space-2);color:var(--ui-text-primary)}:host([aria-disabled='true']),:host([data-disabled='true']){opacity:0.6;cursor:not-allowed}::slotted(input[type='checkbox']){accent-color:var(--ui-accent-solid);width:1.125em;height:1.125em;cursor:pointer}::slotted(input[type='checkbox']:focus-visible){outline:2px solid var(--ui-accent-solid);outline-offset:2px}`;
@@ -0,0 +1,553 @@
1
+ import {
2
+ closeOverlay,
3
+ openOverlay
4
+ } from "./chunk-TL4FIE7X.js";
5
+ import {
6
+ createAnchoredSurface
7
+ } from "./chunk-YHXJC5M5.js";
8
+ import {
9
+ Host,
10
+ createEvent,
11
+ getElement,
12
+ h,
13
+ registerInstance
14
+ } from "./chunk-GDMQKT5F.js";
15
+
16
+ // dist/esm/ui-combobox.entry.js
17
+ function formatEditingValue(raw, selection, format) {
18
+ const unchanged = { display: raw, selection };
19
+ if (!format)
20
+ return unchanged;
21
+ let result;
22
+ try {
23
+ result = format(raw, selection);
24
+ } catch {
25
+ return unchanged;
26
+ }
27
+ if (!result)
28
+ return unchanged;
29
+ const characters = Array.from(raw);
30
+ let cursor = 0;
31
+ for (const character of result.display)
32
+ if (character === characters[cursor])
33
+ cursor += 1;
34
+ if (!Number.isInteger(result.selection.start) || !Number.isInteger(result.selection.end) || cursor !== characters.length || result.selection.start < 0 || result.selection.end < result.selection.start || result.selection.end > result.display.length)
35
+ return unchanged;
36
+ return result;
37
+ }
38
+ async function validateField(request, config) {
39
+ let output = request.raw;
40
+ let issues = [];
41
+ const check = () => request.signal.throwIfAborted();
42
+ try {
43
+ check();
44
+ if (config.parse)
45
+ output = await config.parse(request.raw, request);
46
+ check();
47
+ if (config.schema) {
48
+ const result = await config.schema["~standard"].validate(output);
49
+ check();
50
+ if (result.issues)
51
+ issues = result.issues;
52
+ else if ("value" in result)
53
+ output = result.value;
54
+ }
55
+ if (!issues.some((issue) => issue.severity !== "warning")) {
56
+ if (config.normalize)
57
+ output = await config.normalize(output, request);
58
+ check();
59
+ if (config.validator) {
60
+ const result = await config.validator(output, request);
61
+ check();
62
+ issues = [...issues, ...result.issues ?? []];
63
+ if ("output" in result)
64
+ output = result.output;
65
+ }
66
+ }
67
+ } catch (error) {
68
+ check();
69
+ issues = [{ message: error instanceof Error ? error.message : "Unable to validate this value." }];
70
+ }
71
+ issues = [...issues, ...config.issues ?? []];
72
+ return { output: issues.some((issue) => issue.severity !== "warning") ? void 0 : output, issues };
73
+ }
74
+ var uiComboboxCss = () => `:host{display:grid;gap:var(--ui-space-1);min-inline-size:0;color:var(--ui-text-primary);font:inherit}label{color:var(--ui-field-label-color, var(--ui-text-primary));font-size:var(--ui-field-label-size, 0.875rem);font-weight:var(--ui-field-label-weight, 500)}.field{display:flex;min-inline-size:0;border:1px solid var(--ui-control-border, var(--ui-border-default));border-radius:var(--ui-radius-2);background:var(--ui-control-surface, var(--ui-surface-default))}.field:focus-within{border-color:var(--ui-control-focus, var(--ui-focus-ring));outline:2px solid var(--ui-control-focus, var(--ui-focus-ring));outline-offset:1px}input{appearance:none;width:100%;min-inline-size:0;min-block-size:var(--ui-control-min-block-size, 2.75rem);box-sizing:border-box;border:0;border-radius:inherit;background:transparent;color:inherit;font:inherit;line-height:var(--ui-line-height-md);padding:var(--ui-space-2) var(--ui-space-3);margin:0;outline:none}:host([data-size='sm']) input{min-block-size:var(--ui-field-compact-size, 2rem);padding:var(--ui-space-1) var(--ui-space-2)}button{appearance:none;border:0;border-radius:var(--ui-radius-2);background:transparent;color:var(--ui-field-affordance-color, var(--ui-text-secondary));font:inherit;font-weight:var(--ui-field-affordance-weight, 400);min-inline-size:2rem;padding:var(--ui-space-1);cursor:pointer}button:hover:enabled{background:var(--ui-surface-muted);color:var(--ui-text-primary)}button:focus-visible{outline:2px solid var(--ui-focus-ring);outline-offset:-3px}input:disabled,button:disabled{color:var(--ui-text-muted);cursor:not-allowed}.field:has(input:disabled){background:var(--ui-control-surface-disabled, var(--ui-surface-muted))}:host([data-validation='error']) .field{border-color:var(--ui-danger-solid, var(--ui-accent-active))}.popup{box-sizing:border-box;min-inline-size:12rem;max-inline-size:calc(100vw - 1rem);max-block-size:var(--ui-combobox-max-block-size, 18rem);overflow:auto;margin:0;padding:var(--ui-space-1);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-md)}[hidden]{display:none !important}.option{padding:var(--ui-space-2) var(--ui-space-3);border-radius:var(--ui-radius-1);cursor:pointer;overflow-wrap:anywhere}.option:hover,.option[data-active]{background:var(--ui-surface-muted);outline:1px solid var(--ui-focus-ring);outline-offset:-1px}.option[aria-disabled='true']{color:var(--ui-text-muted);cursor:not-allowed}.primary{display:block;color:var(--ui-option-primary-color, var(--ui-text-primary));font-weight:var(--ui-option-primary-weight, 500)}.secondary{display:block;color:var(--ui-option-secondary-color, var(--ui-text-secondary));font-weight:var(--ui-option-secondary-weight, 400);font-size:var(--ui-font-size-sm)}.message,.group{color:var(--ui-field-message-color, var(--ui-text-secondary));font-weight:var(--ui-field-message-weight, 400);font-size:var(--ui-font-size-sm);line-height:var(--ui-line-height-md);overflow-wrap:anywhere}.group,.popup .message{padding:var(--ui-space-2) var(--ui-space-3)}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){button{min-inline-size:2.75rem;min-block-size:2.75rem}}@media (forced-colors: active){.field,.popup{border-color:CanvasText}.option[data-active]{outline-color:Highlight}}`;
75
+ var UICombobox = class {
76
+ constructor(hostRef) {
77
+ registerInstance(this, hostRef);
78
+ this.queryChange = createEvent(this, "query-change");
79
+ this.valueChange = createEvent(this, "value-change");
80
+ this.freeEntry = createEvent(this, "free-entry");
81
+ this.createEntry = createEvent(this, "create-entry");
82
+ this.dependencyInvalidate = createEvent(this, "dependency-invalidate");
83
+ this.validationChange = createEvent(this, "validation-change");
84
+ this.optionsChange = createEvent(this, "options-change");
85
+ }
86
+ get host() {
87
+ return getElement(this);
88
+ }
89
+ /** Accessible visible label, associated with the native text input. */
90
+ label = "";
91
+ placeholder = "";
92
+ name = "";
93
+ /** Controlled canonical value. Undefined selects uncontrolled mode; null means no selection. */
94
+ value;
95
+ defaultValue;
96
+ /** Controlled raw editing text; independent of canonical selection. */
97
+ query;
98
+ defaultQuery = "";
99
+ /** Immutable configuration; replace the object/context when dependencies change. */
100
+ config = {};
101
+ disabled = false;
102
+ readOnly = false;
103
+ required = false;
104
+ size = "md";
105
+ disclosure = false;
106
+ clearable = false;
107
+ /** Optional description shown by the connected question-mark button. */
108
+ help = "";
109
+ queryChange;
110
+ valueChange;
111
+ freeEntry;
112
+ createEntry;
113
+ dependencyInvalidate;
114
+ validationChange;
115
+ /** Supplies the current result rows for framework-owned rich slots. */
116
+ optionsChange;
117
+ raw = "";
118
+ display = "";
119
+ selected = null;
120
+ expanded = false;
121
+ rows = [];
122
+ active = -1;
123
+ loading = false;
124
+ helpOpen = false;
125
+ lookupError = "";
126
+ validation = { status: "pristine", touched: false, dirty: false, issues: [] };
127
+ input;
128
+ popup;
129
+ field;
130
+ surface;
131
+ lookup;
132
+ validationRun;
133
+ lookupTimer;
134
+ composing = false;
135
+ initialRaw = "";
136
+ overlayId = `ui-combobox-${Math.random().toString(36).slice(2)}`;
137
+ alive = false;
138
+ fullSet = false;
139
+ knownOptions = /* @__PURE__ */ new Map();
140
+ awaitingLabel = null;
141
+ proposedChange;
142
+ formattedRaw;
143
+ formattedWith;
144
+ componentWillLoad() {
145
+ this.selected = this.value !== void 0 ? this.value : this.defaultValue ?? null;
146
+ this.raw = this.query ?? this.defaultQuery;
147
+ if (this.query === void 0 && !this.raw && this.selected !== null) {
148
+ this.raw = this.config.options?.find((row) => row.value === this.selected)?.label ?? this.selected;
149
+ }
150
+ if (this.query === void 0 && this.selected !== null && this.raw === this.selected)
151
+ this.awaitingLabel = this.selected;
152
+ this.display = this.raw;
153
+ this.initialRaw = this.raw;
154
+ this.applyServerIssues();
155
+ }
156
+ connectedCallback() {
157
+ this.alive = true;
158
+ this.setupSurface();
159
+ }
160
+ componentDidLoad() {
161
+ this.setupSurface();
162
+ }
163
+ componentDidUpdate() {
164
+ if (this.input && !this.composing && this.input.value !== this.display)
165
+ this.input.value = this.display;
166
+ if (this.expanded)
167
+ this.surface?.refresh();
168
+ }
169
+ disconnectedCallback() {
170
+ this.alive = false;
171
+ this.close();
172
+ this.validationRun?.abort();
173
+ this.surface?.destroy();
174
+ this.surface = void 0;
175
+ }
176
+ setupSurface() {
177
+ if (!this.surface && this.popup && this.field)
178
+ this.surface = createAnchoredSurface(this.popup, { anchor: this.field, placement: "bottom-start" });
179
+ }
180
+ syncValue() {
181
+ if (this.value === void 0)
182
+ return;
183
+ this.selected = this.value;
184
+ if (this.query === void 0) {
185
+ const proposal = this.proposedChange;
186
+ const option = this.config.options?.find((row) => row.value === this.selected) ?? (this.selected === null ? void 0 : this.knownOptions.get(this.selected));
187
+ const nextRaw = proposal?.value === this.selected ? proposal.query : option?.label ?? this.selected ?? "";
188
+ if (proposal?.value !== this.selected || nextRaw !== this.raw) {
189
+ this.raw = nextRaw;
190
+ this.display = this.raw;
191
+ this.formattedRaw = void 0;
192
+ }
193
+ this.awaitingLabel = !option && this.selected !== null ? this.selected : null;
194
+ }
195
+ this.resetValidation();
196
+ }
197
+ syncQuery() {
198
+ if (this.query === void 0 || this.query === this.raw)
199
+ return;
200
+ if (this.value === void 0 && this.proposedChange?.query !== this.query)
201
+ this.selected = null;
202
+ this.awaitingLabel = null;
203
+ this.formattedRaw = void 0;
204
+ this.raw = this.query;
205
+ this.display = this.raw;
206
+ this.resetValidation();
207
+ if (this.expanded)
208
+ this.search("input");
209
+ }
210
+ syncDisabled() {
211
+ if (this.disabled || this.readOnly) {
212
+ this.close();
213
+ this.resetValidation();
214
+ }
215
+ }
216
+ syncConfig(next, previous) {
217
+ this.validationRun?.abort();
218
+ if (next.provider !== previous?.provider || next.context !== previous?.context)
219
+ this.knownOptions.clear();
220
+ if (next.context !== previous?.context) {
221
+ this.close();
222
+ const policy = next.invalidation ?? "retain-query";
223
+ const value = policy === "retain" ? this.selected : null;
224
+ const query = policy === "clear" ? "" : this.raw;
225
+ this.commit(value, query, null, "invalidation", "programmatic");
226
+ this.validation = { status: "pristine", touched: false, dirty: this.raw !== this.initialRaw, issues: [] };
227
+ }
228
+ this.applyServerIssues();
229
+ if (this.expanded)
230
+ this.search("context");
231
+ }
232
+ applyServerIssues() {
233
+ const issues = this.config.issues ?? [];
234
+ if (issues.length)
235
+ this.setValidation({ issues }, this.validation.touched);
236
+ else
237
+ this.resetValidation();
238
+ }
239
+ resetValidation() {
240
+ this.validationRun?.abort();
241
+ this.validation = { status: "pristine", touched: this.validation.touched, dirty: this.raw !== this.initialRaw, issues: [] };
242
+ this.validationChange?.emit(this.validation);
243
+ }
244
+ cancelLookup() {
245
+ clearTimeout(this.lookupTimer);
246
+ this.lookup?.abort();
247
+ this.lookup = void 0;
248
+ this.loading = false;
249
+ }
250
+ close() {
251
+ this.expanded = false;
252
+ this.active = -1;
253
+ this.cancelLookup();
254
+ this.surface?.hide();
255
+ closeOverlay(this.overlayId);
256
+ }
257
+ open(reason = "input") {
258
+ if (this.disabled || this.readOnly)
259
+ return;
260
+ this.expanded = true;
261
+ if (this.popup && this.field)
262
+ this.popup.style.minWidth = `${this.field.getBoundingClientRect().width}px`;
263
+ this.surface?.show();
264
+ openOverlay({
265
+ id: this.overlayId,
266
+ element: this.popup,
267
+ relatedElements: [this.host],
268
+ modal: false,
269
+ requestClose: () => this.close()
270
+ });
271
+ this.search(reason);
272
+ }
273
+ search(reason) {
274
+ this.cancelLookup();
275
+ this.fullSet = reason === "disclosure";
276
+ this.active = -1;
277
+ this.lookupError = "";
278
+ const config = this.config;
279
+ const query = this.fullSet ? "" : this.raw;
280
+ const controller = new AbortController();
281
+ this.lookup = controller;
282
+ const apply = (options) => {
283
+ if (controller.signal.aborted || !this.alive)
284
+ return;
285
+ for (const option of options)
286
+ this.knownOptions.set(option.value, option);
287
+ const selectedOption = this.selected === null ? void 0 : this.knownOptions.get(this.selected);
288
+ if (this.query === void 0 && this.awaitingLabel === this.selected && selectedOption) {
289
+ this.raw = selectedOption.label;
290
+ this.display = this.raw;
291
+ this.awaitingLabel = null;
292
+ this.formattedRaw = void 0;
293
+ this.resetValidation();
294
+ }
295
+ const ids = /* @__PURE__ */ new Set();
296
+ this.rows = options.filter((option) => {
297
+ if (ids.has(option.id))
298
+ return false;
299
+ ids.add(option.id);
300
+ return this.fullSet || (config.filter ? config.filter(option, query, config.context) : config.provider ? true : option.label.toLocaleLowerCase().includes(query.toLocaleLowerCase()));
301
+ });
302
+ const groups = /* @__PURE__ */ new Map();
303
+ for (const row of this.rows) {
304
+ const group = row.group ?? "";
305
+ if (!groups.has(group))
306
+ groups.set(group, []);
307
+ groups.get(group).push(row);
308
+ }
309
+ this.rows = [...groups.values()].flat();
310
+ this.loading = false;
311
+ this.optionsChange.emit(this.rows);
312
+ };
313
+ if (!config.provider) {
314
+ apply(config.options ?? []);
315
+ return;
316
+ }
317
+ this.rows = [];
318
+ this.loading = true;
319
+ this.lookupTimer = setTimeout(async () => {
320
+ try {
321
+ apply(await config.provider({ query, context: config.context, signal: controller.signal, reason }));
322
+ } catch (error) {
323
+ if (controller.signal.aborted || !this.alive)
324
+ return;
325
+ this.loading = false;
326
+ this.lookupError = error instanceof Error ? error.message : "Unable to load suggestions.";
327
+ }
328
+ }, reason === "disclosure" ? 0 : Math.max(0, config.debounce ?? 200));
329
+ }
330
+ get canCreate() {
331
+ return Boolean(this.config.allowCreate && this.raw.trim() && !this.loading && !this.lookupError && !this.rows.some((row) => row.label.toLocaleLowerCase() === this.raw.toLocaleLowerCase()));
332
+ }
333
+ format(timing) {
334
+ if ((this.config.formatOn ?? "blur") !== timing || !this.input)
335
+ return;
336
+ if (this.formattedRaw === this.raw && this.formattedWith === this.config.format)
337
+ return;
338
+ const result = formatEditingValue(this.raw, {
339
+ start: this.input.selectionStart ?? this.raw.length,
340
+ end: this.input.selectionEnd ?? this.raw.length,
341
+ direction: this.input.selectionDirection ?? "none"
342
+ }, this.config.format);
343
+ this.formattedRaw = this.raw;
344
+ this.formattedWith = this.config.format;
345
+ this.display = result.display;
346
+ if (this.input.value !== result.display) {
347
+ this.input.value = result.display;
348
+ this.input.setSelectionRange(result.selection.start, result.selection.end, result.selection.direction);
349
+ }
350
+ }
351
+ onInput = (event) => {
352
+ if (this.composing || event.isComposing)
353
+ return;
354
+ this.awaitingLabel = null;
355
+ this.formattedRaw = void 0;
356
+ this.raw = this.input.value;
357
+ this.display = this.raw;
358
+ this.resetValidation();
359
+ this.format("input");
360
+ this.queryChange.emit({ query: this.raw, display: this.display, trigger: "keyboard" });
361
+ if (this.selected !== null)
362
+ this.commit(null, this.raw, null, "clear", "keyboard");
363
+ this.open();
364
+ if (this.config.validateOn === "input")
365
+ void this.validate();
366
+ queueMicrotask(() => {
367
+ if (this.query !== void 0 && this.query !== this.raw)
368
+ this.syncQuery();
369
+ });
370
+ };
371
+ commit(value, query, option, kind, trigger) {
372
+ this.awaitingLabel = null;
373
+ const queryChanged = query !== this.raw;
374
+ if (this.value === void 0)
375
+ this.selected = value;
376
+ if (this.query === void 0 && queryChanged) {
377
+ this.raw = query;
378
+ this.display = query;
379
+ this.formattedRaw = void 0;
380
+ }
381
+ this.resetValidation();
382
+ const detail = { value, query, option, kind, trigger };
383
+ const proposal = { value, query };
384
+ this.proposedChange = proposal;
385
+ this.valueChange.emit(detail);
386
+ if (queryChanged)
387
+ this.queryChange.emit({ query, display: query, trigger });
388
+ if (kind === "create")
389
+ this.createEntry.emit(detail);
390
+ if (kind === "free-entry")
391
+ this.freeEntry.emit(detail);
392
+ if (kind === "invalidation")
393
+ this.dependencyInvalidate.emit(detail);
394
+ queueMicrotask(() => {
395
+ if (this.proposedChange !== proposal)
396
+ return;
397
+ if (this.value !== void 0 && this.value !== proposal.value)
398
+ this.syncValue();
399
+ if (this.query !== void 0 && this.query !== proposal.query) {
400
+ if (this.value === void 0) {
401
+ this.selected = null;
402
+ this.resetValidation();
403
+ }
404
+ this.syncQuery();
405
+ }
406
+ this.proposedChange = void 0;
407
+ });
408
+ }
409
+ choose(index, trigger) {
410
+ const option = this.rows[index];
411
+ if (option?.disabled)
412
+ return;
413
+ if (option)
414
+ this.commit(option.value, option.label, option, "selection", trigger);
415
+ else if (this.canCreate && index === this.rows.length)
416
+ this.commit(null, this.raw, null, "create", trigger);
417
+ else
418
+ return;
419
+ this.close();
420
+ this.input?.focus();
421
+ if (this.config.validateOn !== "submit")
422
+ queueMicrotask(() => void this.validate());
423
+ }
424
+ move(key) {
425
+ const indices = this.rows.flatMap((row, index) => row.disabled ? [] : [index]);
426
+ if (this.canCreate)
427
+ indices.push(this.rows.length);
428
+ if (!indices.length)
429
+ return;
430
+ const current = indices.indexOf(this.active);
431
+ const next = key === "Home" ? 0 : key === "End" ? indices.length - 1 : key === "ArrowDown" ? Math.min(current + 1, indices.length - 1) : current < 0 ? indices.length - 1 : Math.max(0, current - 1);
432
+ this.active = indices[next];
433
+ requestAnimationFrame(() => this.host.shadowRoot?.getElementById(`option-${this.active}`)?.scrollIntoView({ block: "nearest" }));
434
+ }
435
+ onKeydown = (event) => {
436
+ if (this.composing || event.isComposing || this.disabled || this.readOnly)
437
+ return;
438
+ if (event.key === "Escape" && this.expanded) {
439
+ event.preventDefault();
440
+ event.stopPropagation();
441
+ this.close();
442
+ return;
443
+ }
444
+ if (event.key === "Tab") {
445
+ this.close();
446
+ return;
447
+ }
448
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
449
+ return;
450
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
451
+ event.preventDefault();
452
+ if (!this.expanded)
453
+ this.open("disclosure");
454
+ this.move(event.key);
455
+ } else if ((event.key === "Home" || event.key === "End") && this.expanded && this.active >= 0) {
456
+ event.preventDefault();
457
+ this.move(event.key);
458
+ } else if (event.key === "Enter" && this.expanded) {
459
+ if (this.active >= 0) {
460
+ event.preventDefault();
461
+ this.choose(this.active, "keyboard");
462
+ } else if (this.config.allowFreeText) {
463
+ event.preventDefault();
464
+ this.commit(null, this.raw, null, "free-entry", "keyboard");
465
+ this.close();
466
+ }
467
+ }
468
+ };
469
+ onFocusOut = (event) => {
470
+ if (event.relatedTarget instanceof Node && this.host.shadowRoot?.contains(event.relatedTarget))
471
+ return;
472
+ this.close();
473
+ this.format("blur");
474
+ this.validation = { ...this.validation, touched: true };
475
+ if (this.config.allowFreeText && this.selected === null)
476
+ this.commit(null, this.raw, null, "free-entry", "keyboard");
477
+ if ((this.config.validateOn ?? "blur") === "blur")
478
+ void this.validate();
479
+ };
480
+ setValidation(result, touched = this.validation.touched) {
481
+ const blocking = result.issues.some((issue) => issue.severity !== "warning");
482
+ this.validation = {
483
+ status: blocking ? "error" : result.issues.length ? "warning" : "valid",
484
+ touched,
485
+ dirty: this.raw !== this.initialRaw,
486
+ ...result
487
+ };
488
+ this.validationChange?.emit(this.validation);
489
+ }
490
+ /** Validate for submission. Caller submits only non-pending, non-error output. */
491
+ async validate() {
492
+ this.validationRun?.abort();
493
+ const run = new AbortController();
494
+ this.validationRun = run;
495
+ this.validation = { ...this.validation, status: "pending", output: void 0 };
496
+ this.validationChange.emit(this.validation);
497
+ try {
498
+ const result = await validateField({ raw: this.raw, value: this.selected, context: this.config.context, signal: run.signal }, this.config);
499
+ if (this.required && !this.raw.trim())
500
+ result.issues = [...result.issues, { message: "A value is required." }];
501
+ else if (this.raw && this.selected === null && !this.config.allowFreeText && !this.config.allowCreate)
502
+ result.issues = [...result.issues, { message: "Choose a suggestion." }];
503
+ if (result.issues.some((issue) => issue.severity !== "warning"))
504
+ result.output = void 0;
505
+ if (!run.signal.aborted && this.alive)
506
+ this.setValidation(result);
507
+ } catch {
508
+ }
509
+ return this.validation;
510
+ }
511
+ render() {
512
+ const description = [this.helpOpen ? "help-text" : "", this.validation.issues.length ? "validation" : ""].filter(Boolean).join(" ") || void 0;
513
+ const status = this.loading ? "Loading suggestions\u2026" : this.lookupError || (this.expanded ? `${this.rows.length} suggestions available.` : "");
514
+ const groups = [...new Set(this.rows.map((row) => row.group ?? ""))];
515
+ return h(Host, { key: "2378bfd8473852642fef21898f4a756eb3b092ba", "data-size": this.size, "data-validation": this.validation.status, onFocusout: this.onFocusOut }, h("label", { key: "7aba65aeb336d490ddeaf5db9bba9db8ab8b9dbb", htmlFor: "input", part: "label" }, this.label, this.required ? " *" : ""), h("div", { key: "ee87156259d0fe1e2e56c4b36667e8daf5e1e2c1", class: "field", part: "field", ref: (element) => this.field = element }, h("input", { key: "35c5b85ff9a4bcba9bddaf85ff1f118a94aa077b", id: "input", ref: (element) => this.input = element, role: "combobox", "aria-autocomplete": "list", "aria-expanded": String(this.expanded), "aria-controls": "listbox", "aria-activedescendant": this.expanded && this.active >= 0 ? `option-${this.active}` : void 0, "aria-describedby": description, "aria-invalid": String(this.validation.status === "error"), "aria-busy": String(this.validation.status === "pending"), value: this.display, placeholder: this.placeholder, name: this.name || void 0, disabled: this.disabled, readOnly: this.readOnly, required: this.required, autoComplete: "off", part: "input", onInput: this.onInput, onKeyDown: this.onKeydown, onCompositionstart: () => this.composing = true, onCompositionend: () => {
516
+ this.composing = false;
517
+ this.onInput(new InputEvent("input"));
518
+ } }), this.clearable && h("button", { key: "74e4f44836b751ab5e9f794a39b480602e0c106d", type: "button", part: "affordance", "aria-label": `Clear ${this.label}`, disabled: this.disabled || this.readOnly, onClick: () => {
519
+ this.commit(null, "", null, "clear", "pointer");
520
+ this.close();
521
+ this.input?.focus();
522
+ } }, "\xD7"), this.help && h("button", { key: "c870ced139fb22baa50a1795ab78f14c38647d34", id: "help", type: "button", part: "affordance", "aria-label": `Help for ${this.label}`, disabled: this.disabled }, h("span", { key: "ba3dc5128c1941b21b53a5ba78a27017b3df5ec8", "aria-hidden": "true" }, "?")), this.disclosure && h("button", { key: "eced588e3fa7958dd6185173faaef01219c30243", type: "button", part: "affordance", "aria-label": `Suggestions for ${this.label}`, "aria-controls": "listbox", "aria-expanded": String(this.expanded), disabled: this.disabled || this.readOnly, onClick: () => {
523
+ if (this.expanded)
524
+ this.close();
525
+ else
526
+ this.open("disclosure");
527
+ this.input?.focus();
528
+ } }, h("span", { key: "7cb9f7f2bb15246dcdd2348ea0ca656d1d0c8c33", "aria-hidden": "true" }, "\u2304"))), this.help && h("ui-tooltip", { key: "b1b5d42ca457f9b951758bb5e816c8dbbcd1087d", id: "help-text", for: "help", toggleOnClick: true, onOpen: () => this.helpOpen = true, onClose: () => this.helpOpen = false }, this.help), h("div", { key: "9eca2df66c72917e6bfda21205c2a4ef97dd91d5", class: "popup", part: "popup", hidden: !this.expanded, ref: (element) => this.popup = element }, h("div", { key: "641e1f137c9cfef5d08ec99f6178e59487a20bf1", id: "listbox", role: "listbox", "aria-label": `${this.label} suggestions`, "aria-busy": String(this.loading) }, groups.map((group) => h("div", { role: group ? "group" : "presentation", "aria-label": group || void 0 }, group && h("div", { class: "group", part: "group" }, group), this.rows.map((row, index) => (row.group ?? "") !== group ? null : h("div", { id: `option-${index}`, role: "option", "aria-selected": String(this.selected === row.value), "aria-disabled": String(Boolean(row.disabled)), "data-active": this.active === index ? "" : void 0, part: "option", class: "option", onPointerDown: (event) => event.preventDefault(), onClick: () => this.choose(index, "pointer") }, h("slot", { name: `option-${row.id}` }, h("span", { class: "primary", part: "option-primary" }, row.label), row.description && h("span", { class: "secondary", part: "option-secondary" }, row.description)))))), this.canCreate && h("div", { key: "38a3aa6b2ffae30e6f81e1f89d10c9966dd31b10", id: `option-${this.rows.length}`, role: "option", "aria-selected": "false", class: "option", part: "option", "data-active": this.active === this.rows.length ? "" : void 0, onPointerDown: (event) => event.preventDefault(), onClick: () => this.choose(this.rows.length, "pointer") }, h("slot", { key: "dd3e895ef363f6d30a0c25e4b5092a8feacc63e5", name: "create" }, "Create \u201C", this.raw, "\u201D"))), this.loading ? h("div", { class: "message" }, h("slot", { name: "loading" }, "Loading suggestions\u2026")) : this.lookupError ? h("div", { class: "message" }, h("slot", { name: "error" }, this.lookupError)) : !this.rows.length && !this.canCreate ? h("div", { class: "message" }, h("slot", { name: "empty" }, "No suggestions.")) : null), h("div", { key: "9cf12a8fde7d9cfb9e2d2a77669ac4708c7fded6", id: "validation", class: "message", part: "validation", hidden: !this.validation.issues.length }, this.validation.issues.map((issue) => h("div", null, issue.message))), h("div", { key: "1c7b1d3f658e500cbf5f5004a76a39511cc79c49", class: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true" }, status, " ", this.validation.status === "pending" ? "Checking value\u2026" : this.validation.issues.map((issue) => issue.message).join(" ")));
529
+ }
530
+ static get watchers() {
531
+ return {
532
+ "value": [{
533
+ "syncValue": 0
534
+ }],
535
+ "query": [{
536
+ "syncQuery": 0
537
+ }],
538
+ "disabled": [{
539
+ "syncDisabled": 0
540
+ }],
541
+ "readOnly": [{
542
+ "syncDisabled": 0
543
+ }],
544
+ "config": [{
545
+ "syncConfig": 0
546
+ }]
547
+ };
548
+ }
549
+ };
550
+ UICombobox.style = uiComboboxCss();
551
+ export {
552
+ UICombobox as ui_combobox
553
+ };