@threadlabs/looma 0.1.23 → 0.1.24

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 (287) hide show
  1. package/dist/chunk-HNFCGIBP.js +8 -0
  2. package/dist/{chunk-GDMQKT5F.js → chunk-IMHSPETJ.js} +32 -30
  3. package/dist/chunk-NB6DBRXQ.js +323 -0
  4. package/dist/cjs/controlled-state-BFya8rAX.js +9 -0
  5. package/dist/cjs/icons-BAdjrnhS.js +680 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/looma.cjs.js +1 -1
  8. package/dist/cjs/ui-affordance-scope.cjs.entry.js +1 -1
  9. package/dist/cjs/ui-avatar-group.cjs.entry.js +9 -17
  10. package/dist/cjs/ui-avatar.cjs.entry.js +2 -2
  11. package/dist/cjs/ui-badge.cjs.entry.js +2 -2
  12. package/dist/cjs/ui-button.cjs.entry.js +1 -1
  13. package/dist/cjs/ui-callout.cjs.entry.js +27 -0
  14. package/dist/cjs/ui-checkbox.cjs.entry.js +13 -7
  15. package/dist/cjs/ui-chip.cjs.entry.js +19 -0
  16. package/dist/cjs/ui-combobox.cjs.entry.js +3 -3
  17. package/dist/cjs/ui-context-menu.cjs.entry.js +1 -1
  18. package/dist/cjs/ui-dialog.cjs.entry.js +44 -8
  19. package/dist/cjs/ui-disclosure.cjs.entry.js +9 -6
  20. package/dist/cjs/ui-floating-action-button.cjs.entry.js +1 -1
  21. package/dist/cjs/ui-form-field.cjs.entry.js +59 -4
  22. package/dist/cjs/ui-icon-button.cjs.entry.js +1 -1
  23. package/dist/cjs/ui-input.cjs.entry.js +1 -1
  24. package/dist/cjs/ui-menu-item.cjs.entry.js +2 -2
  25. package/dist/cjs/ui-menu.cjs.entry.js +14 -9
  26. package/dist/cjs/ui-popover.cjs.entry.js +10 -7
  27. package/dist/cjs/ui-radio-group.cjs.entry.js +1 -1
  28. package/dist/cjs/ui-radio.cjs.entry.js +16 -7
  29. package/dist/cjs/ui-search-result-row.cjs.entry.js +1 -1
  30. package/dist/cjs/ui-search-shell.cjs.entry.js +1 -1
  31. package/dist/cjs/ui-select.cjs.entry.js +1 -1
  32. package/dist/cjs/ui-switch.cjs.entry.js +19 -10
  33. package/dist/cjs/ui-tabs.cjs.entry.js +10 -9
  34. package/dist/cjs/ui-textarea.cjs.entry.js +1 -1
  35. package/dist/cjs/ui-toast-region.cjs.entry.js +30 -19
  36. package/dist/cjs/ui-tooltip.cjs.entry.js +12 -8
  37. package/dist/cjs/ui-top-bar.cjs.entry.js +1 -1
  38. package/dist/cjs/ui-tree-item.cjs.entry.js +54 -617
  39. package/dist/cjs/ui-tree.cjs.entry.js +123 -11
  40. package/dist/collection/collection-manifest.json +2 -0
  41. package/dist/collection/components/ui-affordance-scope/ui-affordance-scope.js +1 -1
  42. package/dist/collection/components/ui-avatar/ui-avatar.css +4 -4
  43. package/dist/collection/components/ui-avatar/ui-avatar.js +1 -1
  44. package/dist/collection/components/ui-avatar-group/ui-avatar-group.css +2 -2
  45. package/dist/collection/components/ui-avatar-group/ui-avatar-group.js +8 -16
  46. package/dist/collection/components/ui-badge/ui-badge.css +64 -48
  47. package/dist/collection/components/ui-badge/ui-badge.js +1 -1
  48. package/dist/collection/components/ui-button/ui-button.js +1 -1
  49. package/dist/collection/components/ui-callout/ui-callout.css +74 -0
  50. package/dist/collection/components/ui-callout/ui-callout.js +59 -0
  51. package/dist/collection/components/ui-checkbox/ui-checkbox.js +16 -11
  52. package/dist/collection/components/ui-chip/ui-chip.css +43 -0
  53. package/dist/collection/components/ui-chip/ui-chip.js +45 -0
  54. package/dist/collection/components/ui-combobox/ui-combobox.js +3 -3
  55. package/dist/collection/components/ui-context-menu/ui-context-menu.js +1 -1
  56. package/dist/collection/components/ui-dialog/ui-dialog.js +49 -13
  57. package/dist/collection/components/ui-disclosure/ui-disclosure.js +12 -10
  58. package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.js +1 -1
  59. package/dist/collection/components/ui-form-field/ui-form-field.js +59 -4
  60. package/dist/collection/components/ui-icon-button/ui-icon-button.js +1 -1
  61. package/dist/collection/components/ui-input/ui-input.js +1 -1
  62. package/dist/collection/components/ui-menu/ui-menu.css +12 -23
  63. package/dist/collection/components/ui-menu/ui-menu.js +16 -12
  64. package/dist/collection/components/ui-menu-item/ui-menu-item.css +9 -3
  65. package/dist/collection/components/ui-menu-item/ui-menu-item.js +1 -1
  66. package/dist/collection/components/ui-popover/ui-popover.css +14 -5
  67. package/dist/collection/components/ui-popover/ui-popover.js +12 -10
  68. package/dist/collection/components/ui-radio/ui-radio.js +24 -11
  69. package/dist/collection/components/ui-radio-group/ui-radio-group.js +1 -1
  70. package/dist/collection/components/ui-search-result-row/ui-search-result-row.js +1 -1
  71. package/dist/collection/components/ui-search-shell/ui-search-shell.js +1 -1
  72. package/dist/collection/components/ui-select/ui-select.js +1 -1
  73. package/dist/collection/components/ui-switch/ui-switch.js +22 -14
  74. package/dist/collection/components/ui-tabs/ui-tabs.js +13 -13
  75. package/dist/collection/components/ui-textarea/ui-textarea.js +1 -1
  76. package/dist/collection/components/ui-toast-region/ui-toast-region.js +30 -19
  77. package/dist/collection/components/ui-tooltip/ui-tooltip.css +16 -7
  78. package/dist/collection/components/ui-tooltip/ui-tooltip.js +14 -11
  79. package/dist/collection/components/ui-top-bar/ui-top-bar.js +1 -1
  80. package/dist/collection/components/ui-tree/ui-tree.css +2 -1
  81. package/dist/collection/components/ui-tree/ui-tree.js +122 -10
  82. package/dist/collection/components/ui-tree-item/ui-tree-item.js +61 -44
  83. package/dist/collection/icons.js +6 -1
  84. package/dist/collection/utils/controlled-state.js +4 -0
  85. package/dist/components/index.d.ts +4 -0
  86. package/dist/components/index.js +1 -1
  87. package/dist/components/p-Bk55QiUK.js +1 -0
  88. package/dist/components/p-BnGhGgTH.js +1 -0
  89. package/dist/components/p-CoFximGM.js +13 -0
  90. package/dist/components/p-DIGcRYAW.js +1 -0
  91. package/dist/components/ui-affordance-scope.js +1 -1
  92. package/dist/components/ui-avatar-group.js +1 -1
  93. package/dist/components/ui-avatar.js +1 -1
  94. package/dist/components/ui-badge.js +1 -1
  95. package/dist/components/ui-button.js +1 -1
  96. package/dist/components/ui-callout.d.ts +11 -0
  97. package/dist/components/ui-callout.js +1 -0
  98. package/dist/components/ui-checkbox.js +1 -1
  99. package/dist/components/ui-chip.d.ts +11 -0
  100. package/dist/components/ui-chip.js +1 -0
  101. package/dist/components/ui-combobox.js +1 -1
  102. package/dist/components/ui-context-menu.js +1 -1
  103. package/dist/components/ui-dialog.js +1 -1
  104. package/dist/components/ui-disclosure.js +1 -1
  105. package/dist/components/ui-floating-action-button.js +1 -1
  106. package/dist/components/ui-form-field.js +1 -1
  107. package/dist/components/ui-icon-button.js +1 -1
  108. package/dist/components/ui-input.js +1 -1
  109. package/dist/components/ui-menu-item.js +1 -1
  110. package/dist/components/ui-menu.js +1 -1
  111. package/dist/components/ui-popover.js +1 -1
  112. package/dist/components/ui-radio-group.js +1 -1
  113. package/dist/components/ui-radio.js +1 -1
  114. package/dist/components/ui-search-result-row.js +1 -1
  115. package/dist/components/ui-search-shell.js +1 -1
  116. package/dist/components/ui-select.js +1 -1
  117. package/dist/components/ui-switch.js +1 -1
  118. package/dist/components/ui-tabs.js +1 -1
  119. package/dist/components/ui-textarea.js +1 -1
  120. package/dist/components/ui-toast-region.js +1 -1
  121. package/dist/components/ui-tooltip.js +1 -1
  122. package/dist/components/ui-top-bar.js +1 -1
  123. package/dist/components/ui-tree-item.js +1 -13
  124. package/dist/components/ui-tree.js +1 -1
  125. package/dist/esm/controlled-state-BnGhGgTH.js +6 -0
  126. package/dist/esm/icons-CoFximGM.js +678 -0
  127. package/dist/esm/loader.js +1 -1
  128. package/dist/esm/looma.js +1 -1
  129. package/dist/esm/ui-affordance-scope.entry.js +1 -1
  130. package/dist/esm/ui-avatar-group.entry.js +9 -17
  131. package/dist/esm/ui-avatar.entry.js +2 -2
  132. package/dist/esm/ui-badge.entry.js +2 -2
  133. package/dist/esm/ui-button.entry.js +1 -1
  134. package/dist/esm/ui-callout.entry.js +25 -0
  135. package/dist/esm/ui-checkbox.entry.js +13 -7
  136. package/dist/esm/ui-chip.entry.js +17 -0
  137. package/dist/esm/ui-combobox.entry.js +3 -3
  138. package/dist/esm/ui-context-menu.entry.js +1 -1
  139. package/dist/esm/ui-dialog.entry.js +44 -8
  140. package/dist/esm/ui-disclosure.entry.js +9 -6
  141. package/dist/esm/ui-floating-action-button.entry.js +1 -1
  142. package/dist/esm/ui-form-field.entry.js +59 -4
  143. package/dist/esm/ui-icon-button.entry.js +1 -1
  144. package/dist/esm/ui-input.entry.js +1 -1
  145. package/dist/esm/ui-menu-item.entry.js +2 -2
  146. package/dist/esm/ui-menu.entry.js +14 -9
  147. package/dist/esm/ui-popover.entry.js +10 -7
  148. package/dist/esm/ui-radio-group.entry.js +1 -1
  149. package/dist/esm/ui-radio.entry.js +16 -7
  150. package/dist/esm/ui-search-result-row.entry.js +1 -1
  151. package/dist/esm/ui-search-shell.entry.js +1 -1
  152. package/dist/esm/ui-select.entry.js +1 -1
  153. package/dist/esm/ui-switch.entry.js +19 -10
  154. package/dist/esm/ui-tabs.entry.js +10 -9
  155. package/dist/esm/ui-textarea.entry.js +1 -1
  156. package/dist/esm/ui-toast-region.entry.js +30 -19
  157. package/dist/esm/ui-tooltip.entry.js +12 -8
  158. package/dist/esm/ui-top-bar.entry.js +1 -1
  159. package/dist/esm/ui-tree-item.entry.js +54 -617
  160. package/dist/esm/ui-tree.entry.js +123 -11
  161. package/dist/index.cjs +1224 -842
  162. package/dist/index.d.cts +5 -0
  163. package/dist/index.d.ts +5 -0
  164. package/dist/index.js +12 -2
  165. package/dist/looma/looma.esm.js +1 -1
  166. package/dist/looma/p-03f44c45.entry.js +1 -0
  167. package/dist/looma/p-08f80207.entry.js +1 -0
  168. package/dist/looma/{p-f74e5546.entry.js → p-13f8195a.entry.js} +1 -1
  169. package/dist/looma/{p-5a87b59d.entry.js → p-25e18ad6.entry.js} +1 -1
  170. package/dist/looma/p-2c03fa73.entry.js +1 -0
  171. package/dist/looma/{p-ed368426.entry.js → p-314d5c7c.entry.js} +1 -1
  172. package/dist/looma/{p-5da09f47.entry.js → p-3ef2a21b.entry.js} +1 -1
  173. package/dist/looma/{p-f0487ff3.entry.js → p-5a900d89.entry.js} +1 -1
  174. package/dist/looma/p-5fdcee1d.entry.js +1 -0
  175. package/dist/looma/{p-13347631.entry.js → p-672e3d16.entry.js} +1 -1
  176. package/dist/looma/{p-582973b5.entry.js → p-68430534.entry.js} +1 -1
  177. package/dist/looma/{p-add36e74.entry.js → p-72338f53.entry.js} +1 -1
  178. package/dist/looma/{p-a90d2821.entry.js → p-7ab661ec.entry.js} +1 -1
  179. package/dist/looma/p-7c4a225f.entry.js +1 -0
  180. package/dist/looma/p-82f2fa3d.entry.js +1 -0
  181. package/dist/looma/p-839faf55.entry.js +1 -0
  182. package/dist/looma/{p-7e0bb7f6.entry.js → p-8e254bc4.entry.js} +1 -1
  183. package/dist/looma/p-8e6b1001.entry.js +1 -0
  184. package/dist/looma/p-920656cf.entry.js +1 -0
  185. package/dist/looma/{p-40fe7fee.entry.js → p-97e8cb0e.entry.js} +1 -1
  186. package/dist/looma/p-9d2662ca.entry.js +1 -0
  187. package/dist/looma/p-9e1c4020.entry.js +1 -0
  188. package/dist/looma/p-BnGhGgTH.js +1 -0
  189. package/dist/looma/p-CoFximGM.js +13 -0
  190. package/dist/looma/{p-8b8840b8.entry.js → p-a63e2561.entry.js} +1 -1
  191. package/dist/looma/p-add67e4c.entry.js +1 -0
  192. package/dist/looma/p-b63f6d4f.entry.js +1 -0
  193. package/dist/looma/p-bd00d4e8.entry.js +1 -0
  194. package/dist/looma/p-cc915913.entry.js +1 -0
  195. package/dist/looma/p-cfba8f7c.entry.js +1 -0
  196. package/dist/looma/p-d56571a2.entry.js +1 -0
  197. package/dist/looma/{p-69a5557b.entry.js → p-e0f241ab.entry.js} +1 -1
  198. package/dist/looma/p-f1750fd7.entry.js +1 -0
  199. package/dist/looma/p-fd1e4d22.entry.js +1 -0
  200. package/dist/types/components/ui-avatar-group/ui-avatar-group.d.ts +1 -2
  201. package/dist/types/components/ui-callout/ui-callout.d.ts +6 -0
  202. package/dist/types/components/ui-checkbox/ui-checkbox.d.ts +2 -1
  203. package/dist/types/components/ui-chip/ui-chip.d.ts +6 -0
  204. package/dist/types/components/ui-dialog/ui-dialog.d.ts +7 -1
  205. package/dist/types/components/ui-disclosure/ui-disclosure.d.ts +2 -1
  206. package/dist/types/components/ui-form-field/ui-form-field.d.ts +8 -0
  207. package/dist/types/components/ui-menu/ui-menu.d.ts +2 -1
  208. package/dist/types/components/ui-popover/ui-popover.d.ts +2 -1
  209. package/dist/types/components/ui-radio/ui-radio.d.ts +4 -1
  210. package/dist/types/components/ui-switch/ui-switch.d.ts +2 -1
  211. package/dist/types/components/ui-tabs/ui-tabs.d.ts +2 -1
  212. package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +3 -1
  213. package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +2 -1
  214. package/dist/types/components/ui-tree/ui-tree.d.ts +12 -0
  215. package/dist/types/components/ui-tree-item/ui-tree-item.d.ts +11 -7
  216. package/dist/types/components.d.ts +110 -47
  217. package/dist/types/icons.d.ts +5 -0
  218. package/dist/types/utils/controlled-state.d.ts +4 -0
  219. package/dist/{ui-affordance-scope.entry-VO4C2MZX.js → ui-affordance-scope.entry-3TUZ6GLW.js} +2 -2
  220. package/dist/ui-avatar-group.entry-XGJKN25W.js +51 -0
  221. package/dist/{ui-avatar.entry-T6FU6ZYM.js → ui-avatar.entry-SN3G44HW.js} +3 -3
  222. package/dist/ui-badge.entry-B6WDCWJX.js +22 -0
  223. package/dist/{ui-button.entry-7UXMUGHN.js → ui-button.entry-AZYUELLV.js} +2 -2
  224. package/dist/ui-callout.entry-QRPWRMPC.js +32 -0
  225. package/dist/{ui-checkbox.entry-DMZJB3RE.js → ui-checkbox.entry-OB6GFC4M.js} +17 -8
  226. package/dist/ui-chip.entry-XSNPJXX3.js +22 -0
  227. package/dist/{ui-combobox.entry-ZCTPXEES.js → ui-combobox.entry-IIMMUJF7.js} +5 -5
  228. package/dist/{ui-context-menu.entry-2WMCBGCP.js → ui-context-menu.entry-AIULIE5Y.js} +5 -5
  229. package/dist/{ui-dialog.entry-WO23XOSW.js → ui-dialog.entry-QSYWYHLY.js} +50 -12
  230. package/dist/{ui-disclosure.entry-USX7OUEW.js → ui-disclosure.entry-3BJEYU3U.js} +13 -7
  231. package/dist/{ui-floating-action-button.entry-MXDIN7MV.js → ui-floating-action-button.entry-JEVNV6FI.js} +2 -2
  232. package/dist/ui-form-field.entry-PKSY7UU4.js +120 -0
  233. package/dist/{ui-icon-button.entry-MJUNXHBU.js → ui-icon-button.entry-TPX7BE7R.js} +2 -2
  234. package/dist/{ui-input.entry-AWG63YIG.js → ui-input.entry-6NCLNW4E.js} +2 -2
  235. package/dist/ui-menu-item.entry-KA2K3PKV.js +22 -0
  236. package/dist/{ui-menu.entry-IT3GW5TL.js → ui-menu.entry-7GDO5L2T.js} +22 -14
  237. package/dist/{ui-popover.entry-ZQQB4N6E.js → ui-popover.entry-FR6YRNK6.js} +17 -11
  238. package/dist/{ui-radio-group.entry-V7PCTS7I.js → ui-radio-group.entry-7QHXQSNO.js} +2 -2
  239. package/dist/{ui-radio.entry-JYH6TQBI.js → ui-radio.entry-YNMXKLDW.js} +20 -8
  240. package/dist/{ui-search-result-row.entry-JBNYXXUN.js → ui-search-result-row.entry-AHVVAAIO.js} +2 -2
  241. package/dist/{ui-search-shell.entry-TEAWE76O.js → ui-search-shell.entry-CNBEAMEZ.js} +2 -2
  242. package/dist/{ui-select.entry-F3A6TE2U.js → ui-select.entry-TUY6TCTC.js} +2 -2
  243. package/dist/{ui-switch.entry-MJIICMP2.js → ui-switch.entry-26LFI7B5.js} +23 -11
  244. package/dist/{ui-tabs.entry-6REFIUHV.js → ui-tabs.entry-LXB62RJJ.js} +14 -10
  245. package/dist/{ui-textarea.entry-OJTXCED7.js → ui-textarea.entry-JYGMGPX2.js} +2 -2
  246. package/dist/{ui-toast-region.entry-NOFXLKPS.js → ui-toast-region.entry-TOW4KZLZ.js} +32 -23
  247. package/dist/{ui-tooltip.entry-COWTWVHX.js → ui-tooltip.entry-SKFNYXPH.js} +19 -12
  248. package/dist/{ui-top-bar.entry-PIAWXJNV.js → ui-top-bar.entry-S3YP52EA.js} +2 -2
  249. package/dist/ui-tree-item.entry-LWYIPYLC.js +145 -0
  250. package/dist/{ui-tree.entry-XYI3ZFAZ.js → ui-tree.entry-LXKUQFRU.js} +114 -12
  251. package/editor/{chunk-QCOYOVQL.js → chunk-B5WVJOPV.js} +113 -97
  252. package/editor/extensions/index.d.ts +14 -6
  253. package/editor/extensions/index.js +1 -1
  254. package/editor/index.js +1 -1
  255. package/editor.css +37 -20
  256. package/package.json +1 -1
  257. package/styles.css +10 -0
  258. package/tokens.css +3 -0
  259. package/vue/{chunk-JLW23USW.js → chunk-D4AJULDE.js} +28 -16
  260. package/vue/editor/index.d.ts +5 -15
  261. package/vue/editor/index.js +1 -1
  262. package/vue/index.d.ts +325 -115
  263. package/vue/index.js +5 -1
  264. package/dist/components/p-CaietZcq.js +0 -1
  265. package/dist/components/p-DHd18bK7.js +0 -1
  266. package/dist/looma/p-14c081cf.entry.js +0 -1
  267. package/dist/looma/p-25366205.entry.js +0 -1
  268. package/dist/looma/p-2e3aa869.entry.js +0 -1
  269. package/dist/looma/p-446cda76.entry.js +0 -1
  270. package/dist/looma/p-4fc1b005.entry.js +0 -13
  271. package/dist/looma/p-6a8a4736.entry.js +0 -1
  272. package/dist/looma/p-6bf4038b.entry.js +0 -1
  273. package/dist/looma/p-8204fee6.entry.js +0 -1
  274. package/dist/looma/p-8238e0dc.entry.js +0 -1
  275. package/dist/looma/p-99d88efb.entry.js +0 -1
  276. package/dist/looma/p-a27669b1.entry.js +0 -1
  277. package/dist/looma/p-a6ee76b7.entry.js +0 -1
  278. package/dist/looma/p-b6398a6b.entry.js +0 -1
  279. package/dist/looma/p-d50faaff.entry.js +0 -1
  280. package/dist/looma/p-d77278ce.entry.js +0 -1
  281. package/dist/looma/p-d9ec13b7.entry.js +0 -1
  282. package/dist/looma/p-ecf8005f.entry.js +0 -1
  283. package/dist/ui-avatar-group.entry-TAXJRIIU.js +0 -59
  284. package/dist/ui-badge.entry-MZFYNBMJ.js +0 -22
  285. package/dist/ui-form-field.entry-7ZCMEHPY.js +0 -67
  286. package/dist/ui-menu-item.entry-HFTWG62N.js +0 -22
  287. package/dist/ui-tree-item.entry-BSEWNL2O.js +0 -389
@@ -11,17 +11,62 @@ const UIFormField = class {
11
11
  invalid = false;
12
12
  disabled = false;
13
13
  required = false;
14
+ observer = null;
15
+ activeInput = null;
16
+ ownedDescriptionIds = new Set();
17
+ wireQueued = false;
14
18
  componentDidLoad() {
19
+ this.observer = new MutationObserver(this.scheduleWire);
20
+ this.observer.observe(this.host, {
21
+ childList: true,
22
+ subtree: true,
23
+ attributes: true,
24
+ attributeFilter: ['aria-describedby', 'data-slot', 'id', 'role'],
25
+ });
15
26
  this.wire();
16
27
  }
17
28
  componentDidUpdate() {
18
- this.wire();
29
+ this.scheduleWire();
30
+ }
31
+ disconnectedCallback() {
32
+ this.observer?.disconnect();
33
+ this.observer = null;
34
+ this.removeOwnedDescriptions(this.activeInput);
35
+ this.activeInput = null;
36
+ this.ownedDescriptionIds.clear();
19
37
  }
38
+ descriptionIds(input) {
39
+ return Array.from(new Set((input.getAttribute('aria-describedby') ?? '').split(/\s+/).filter(Boolean)));
40
+ }
41
+ removeOwnedDescriptions(input) {
42
+ if (!input || this.ownedDescriptionIds.size === 0)
43
+ return;
44
+ const remaining = this.descriptionIds(input)
45
+ .filter(id => !this.ownedDescriptionIds.has(id));
46
+ if (remaining.length > 0)
47
+ input.setAttribute('aria-describedby', remaining.join(' '));
48
+ else
49
+ input.removeAttribute('aria-describedby');
50
+ }
51
+ scheduleWire = () => {
52
+ if (this.wireQueued)
53
+ return;
54
+ this.wireQueued = true;
55
+ queueMicrotask(() => {
56
+ this.wireQueued = false;
57
+ this.wire();
58
+ });
59
+ };
20
60
  wire() {
21
61
  const label = this.host.querySelector('label');
22
62
  const input = this.host.querySelector('input, textarea, select');
23
63
  const help = this.host.querySelector('[data-slot="help"]');
24
64
  const error = this.host.querySelector('[data-slot="error"], [role="alert"]');
65
+ if (input !== this.activeInput) {
66
+ this.removeOwnedDescriptions(this.activeInput);
67
+ this.activeInput = input;
68
+ this.ownedDescriptionIds.clear();
69
+ }
25
70
  if (!input)
26
71
  return;
27
72
  if (!input.id) {
@@ -30,6 +75,9 @@ const UIFormField = class {
30
75
  if (label && !label.getAttribute('for')) {
31
76
  label.setAttribute('for', input.id);
32
77
  }
78
+ const previousOwnedIds = this.ownedDescriptionIds;
79
+ const externalIds = this.descriptionIds(input)
80
+ .filter(id => !previousOwnedIds.has(id));
33
81
  const describedIds = [];
34
82
  if (help) {
35
83
  if (!help.id)
@@ -41,15 +89,22 @@ const UIFormField = class {
41
89
  error.id = createId('form-field-error');
42
90
  describedIds.push(error.id);
43
91
  }
44
- if (describedIds.length) {
45
- input.setAttribute('aria-describedby', describedIds.join(' '));
92
+ const nextOwnedIds = describedIds.filter(id => !externalIds.includes(id));
93
+ const nextDescribedIds = Array.from(new Set([...externalIds, ...describedIds]));
94
+ const nextDescribedBy = nextDescribedIds.join(' ');
95
+ if (input.getAttribute('aria-describedby') !== nextDescribedBy) {
96
+ if (nextDescribedBy)
97
+ input.setAttribute('aria-describedby', nextDescribedBy);
98
+ else
99
+ input.removeAttribute('aria-describedby');
46
100
  }
101
+ this.ownedDescriptionIds = new Set(nextOwnedIds);
47
102
  input.disabled = this.disabled;
48
103
  input.required = this.required;
49
104
  input.setAttribute('aria-invalid', this.invalid ? 'true' : 'false');
50
105
  }
51
106
  render() {
52
- return (h(Host, { key: 'cdd06c6b16ac56f3547e64e7888d8766243392db', "data-invalid": this.invalid ? '' : undefined, "data-disabled": this.disabled ? '' : undefined, "data-required": this.required ? '' : undefined }, h("slot", { key: '7d545673a3485f8beee01b13ab56185b98ba8856' })));
107
+ return (h(Host, { key: '0b8fd5608631b5f9159fdf99d6eba918cc6587e4', "data-invalid": this.invalid ? '' : undefined, "data-disabled": this.disabled ? '' : undefined, "data-required": this.required ? '' : undefined }, h("slot", { key: '4ed78782bcc8b6699a40d8402994b486d71d730a', onSlotchange: this.scheduleWire })));
53
108
  }
54
109
  };
55
110
  UIFormField.style = uiFormFieldCss();
@@ -13,7 +13,7 @@ const UIIconButton = class {
13
13
  /** Reveals this control through a surrounding ui-affordance-scope. */
14
14
  anticipatory = false;
15
15
  render() {
16
- return (h(Host, { key: '8616d7e52a03a7a42738b11f4cabed3eb38c8640', "data-disabled": this.disabled ? '' : undefined, "data-ui-affordance": this.anticipatory ? 'button' : undefined }, h("button", { key: 'fae1362a50a0d80e2fcb3ab41f63ff21cf5d939a', type: "button", "aria-label": this.label || undefined, disabled: this.disabled }, h("slot", { key: 'e548fc504e3b26e85263fe3fc8faac0887fee16b' }))));
16
+ return (h(Host, { key: 'fb4534d977b4812f402855f78176b8316ebace61', "data-disabled": this.disabled ? '' : undefined, "data-ui-affordance": this.anticipatory ? 'button' : undefined }, h("button", { key: 'b90d290870ad76ba18de88a6b6947a15040ff12a', type: "button", "aria-label": this.label || undefined, disabled: this.disabled }, h("slot", { key: '88ded6ad90a4cfeffcd687990e5ba8b0c7d3bd30' }))));
17
17
  }
18
18
  };
19
19
  UIIconButton.style = uiIconButtonCss();
@@ -76,7 +76,7 @@ const UIInput = class {
76
76
  });
77
77
  };
78
78
  render() {
79
- return (h(Host, { key: 'a2f2c108144a7acae0dfb1bef6ea1f38a4dcca9c', "data-invalid": this.invalid ? '' : undefined }, h("slot", { key: '04284765a12089a8a1045056d72551a3494f00fc', ref: (el) => (this.slotRef = el) })));
79
+ return (h(Host, { key: 'fe125b4e8ec35e9ac0b0ca0434aa8439f515c51b', "data-invalid": this.invalid ? '' : undefined }, h("slot", { key: 'ec0609f9143435cf0436abb98488b9f30b71530b', ref: (el) => (this.slotRef = el) })));
80
80
  }
81
81
  static get watchers() { return {
82
82
  "value": [{
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-8BGiMGQ0.js';
2
2
 
3
- const uiMenuItemCss = () => `:host{display:block;width:100%;padding:var(--ui-space-2) var(--ui-space-3);text-align:left;background:none;border:none;border-radius:var(--ui-radius-2);color:var(--ui-text-primary);font-size:var(--ui-font-size-md);font-weight:var(--ui-font-medium, 500);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease)}:host(:hover:not([aria-disabled='true']):not([disabled])){background:var(--ui-surface-subtle)}:host([aria-disabled='true']),:host([disabled]){opacity:0.6;cursor:not-allowed}`;
3
+ const uiMenuItemCss = () => `:host{display:block;width:100%}.menu-item__surface{display:block;box-sizing:border-box;width:100%;padding:var(--ui-space-2) var(--ui-space-3);text-align:left;background:none;border:none;border-radius:var(--ui-radius-2);color:var(--ui-text-primary);font-size:var(--ui-font-size-md);font-weight:var(--ui-font-medium, 500);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease)}:host(:hover:not([aria-disabled='true']):not([disabled])) .menu-item__surface{background:var(--ui-surface-subtle)}:host([aria-disabled='true']) .menu-item__surface,:host([disabled]) .menu-item__surface{opacity:0.6;cursor:not-allowed}`;
4
4
 
5
5
  const UIMenuItem = class {
6
6
  constructor(hostRef) {
@@ -9,7 +9,7 @@ const UIMenuItem = class {
9
9
  disabled = false;
10
10
  value = '';
11
11
  render() {
12
- return (h(Host, { key: 'ebd7c5aa5c8fdce2d2349aef7f1a4505b9190852', role: "menuitem", tabIndex: this.disabled ? -1 : 0, "aria-disabled": this.disabled ? 'true' : undefined, "data-value": this.value || undefined }, h("slot", { key: '7b55a8545034b055f8cbd047a0f16ea729af097e' })));
12
+ return (h(Host, { key: 'f8a1721f8e516af04f901b53c3a66ce1de932608', role: "menuitem", tabIndex: this.disabled ? -1 : 0, "aria-disabled": this.disabled ? 'true' : undefined, "data-value": this.value || undefined }, h("span", { key: '6483d0b3ce1be06aed214f626b2d6a2963a44ade', class: "menu-item__surface" }, h("slot", { key: 'db470b1cbb54d56a14d05c0d7f72c43e37f4263e' }))));
13
13
  }
14
14
  };
15
15
  UIMenuItem.style = uiMenuItemCss();
@@ -1,16 +1,18 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
2
  import { d as dispatchDetail, e as eventToTrigger } from './events-JwSoedEO.js';
3
3
  import { o as openOverlay, c as closeOverlay, r as requestTopOverlayClose } from './manager-C-0syqXZ.js';
4
+ import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
4
5
  import { a as createAnchoredSurface } from './positioning-Bu0dmLBE.js';
5
6
 
6
- const uiMenuCss = () => `:host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:auto;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%;padding:var(--ui-space-2) var(--ui-space-3);text-align:left;background:none;border:none;border-radius:var(--ui-radius-2);color:var(--ui-text-primary);font-size:var(--ui-font-size-md);font-weight:var(--ui-font-medium, 500);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease)}::slotted(ui-menu-item:hover:not([aria-disabled='true']):not([disabled])){background:var(--ui-surface-subtle)}::slotted(ui-menu-item[aria-disabled='true']),::slotted(ui-menu-item[disabled]){opacity:0.6;cursor:not-allowed}`;
7
+ const uiMenuCss = () => `:host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;box-sizing:border-box;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:0;border:0;border-radius:0;background:transparent;box-shadow:var(--ui-shadow-lg)}.menu__surface{display:flex;flex-direction:column;box-sizing:border-box;padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:auto;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%}`;
7
8
 
8
9
  const UIMenu = class {
9
10
  constructor(hostRef) {
10
11
  registerInstance(this, hostRef);
11
12
  }
12
13
  get host() { return getElement(this); }
13
- open = false;
14
+ /** Controlled open state. Omit it to use defaultOpen and local interaction state. */
15
+ open;
14
16
  defaultOpen = false;
15
17
  /** Id of the control that anchors this menu in the top layer. */
16
18
  for;
@@ -21,7 +23,8 @@ const UIMenu = class {
21
23
  anchor = null;
22
24
  surface = null;
23
25
  syncFromProp() {
24
- this.internalOpen = this.open;
26
+ if (isControlled(this.open))
27
+ this.internalOpen = this.open;
25
28
  }
26
29
  resetSurface() {
27
30
  this.setupSurface();
@@ -48,8 +51,7 @@ const UIMenu = class {
48
51
  }
49
52
  }
50
53
  componentDidLoad() {
51
- this.syncFromProp();
52
- this.internalOpen = this.internalOpen || this.defaultOpen;
54
+ this.internalOpen = controlledOrDefault(this.open, this.defaultOpen);
53
55
  this.host.addEventListener('click', this.onItemClick);
54
56
  this.host.addEventListener('keydown', this.onKeydown);
55
57
  this.setupSurface();
@@ -82,7 +84,8 @@ const UIMenu = class {
82
84
  closeMenu(reason, trigger) {
83
85
  if (!this.internalOpen)
84
86
  return;
85
- this.internalOpen = false;
87
+ if (!isControlled(this.open))
88
+ this.internalOpen = false;
86
89
  dispatchDetail(this.host, 'close', {
87
90
  open: false,
88
91
  reason: reason,
@@ -113,7 +116,8 @@ const UIMenu = class {
113
116
  reason: 'action',
114
117
  trigger: eventToTrigger(e),
115
118
  });
116
- this.internalOpen = false;
119
+ if (!isControlled(this.open))
120
+ this.internalOpen = false;
117
121
  };
118
122
  onKeydown = (e) => {
119
123
  if (e.key === 'Escape') {
@@ -136,7 +140,8 @@ const UIMenu = class {
136
140
  reason: 'action',
137
141
  trigger: 'keyboard',
138
142
  });
139
- this.internalOpen = false;
143
+ if (!isControlled(this.open))
144
+ this.internalOpen = false;
140
145
  }
141
146
  return;
142
147
  }
@@ -153,7 +158,7 @@ const UIMenu = class {
153
158
  }
154
159
  };
155
160
  render() {
156
- return (h(Host, { key: '25ae79e914820dfc470fa03d8c843646c3c060d9', role: "menu", "aria-orientation": "vertical", "data-open": this.internalOpen ? '' : undefined }, h("slot", { key: 'b3a8b130e55610d948bc3e4603dede59dd560d05' })));
161
+ return (h(Host, { key: 'c5af7acaf41b75165e9f7cf47d65b7a1dcd4d1c0', role: "menu", "aria-orientation": "vertical", "data-open": this.internalOpen ? '' : undefined }, h("div", { key: '058fff9a00a1dcba26f6db425096e7a96d889896', class: "menu__surface" }, h("slot", { key: 'dbbf9eb4ba2a348b6d85049e229ed0562ee17318' }))));
157
162
  }
158
163
  static get watchers() { return {
159
164
  "open": [{
@@ -1,16 +1,18 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
2
  import { o as openOverlay, c as closeOverlay, r as requestTopOverlayClose } from './manager-C-0syqXZ.js';
3
3
  import { d as dispatchDetail } from './events-JwSoedEO.js';
4
+ import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
4
5
  import { a as createAnchoredSurface } from './positioning-Bu0dmLBE.js';
5
6
 
6
- const uiPopoverCss = () => `:host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg);max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:auto}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}`;
7
+ const uiPopoverCss = () => `:host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:auto;padding:0;border:0;border-radius:0;background:transparent;box-shadow:var(--ui-shadow-lg)}.popover__surface{box-sizing:border-box;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}`;
7
8
 
8
9
  const UIPopover = class {
9
10
  constructor(hostRef) {
10
11
  registerInstance(this, hostRef);
11
12
  }
12
13
  get host() { return getElement(this); }
13
- open = false;
14
+ /** Controlled open state. Omit it to use defaultOpen and local interaction state. */
15
+ open;
14
16
  defaultOpen = false;
15
17
  /** Optional id of the element this popover follows in the top layer. */
16
18
  for;
@@ -20,7 +22,8 @@ const UIPopover = class {
20
22
  anchor = null;
21
23
  surface = null;
22
24
  syncFromProp() {
23
- this.internalOpen = this.open;
25
+ if (isControlled(this.open))
26
+ this.internalOpen = this.open;
24
27
  }
25
28
  onOpenChange() {
26
29
  this.syncOverlay();
@@ -79,8 +82,7 @@ const UIPopover = class {
79
82
  }
80
83
  }
81
84
  componentDidLoad() {
82
- this.syncFromProp();
83
- this.internalOpen = this.internalOpen || this.defaultOpen;
85
+ this.internalOpen = controlledOrDefault(this.open, this.defaultOpen);
84
86
  this.host.addEventListener('keydown', this.onKeydown);
85
87
  this.setupSurface();
86
88
  this.syncOverlay();
@@ -95,7 +97,8 @@ const UIPopover = class {
95
97
  this.syncOverlay();
96
98
  }
97
99
  handleRequestClose(reason, trigger) {
98
- this.internalOpen = false;
100
+ if (!isControlled(this.open))
101
+ this.internalOpen = false;
99
102
  dispatchDetail(this.host, 'close', {
100
103
  open: false,
101
104
  reason: reason,
@@ -108,7 +111,7 @@ const UIPopover = class {
108
111
  }
109
112
  };
110
113
  render() {
111
- return (h(Host, { key: 'cd957cb9fd5d1c05da7729a16d4cb229bc1deffa', "data-open": this.internalOpen ? '' : undefined, onKeyDown: this.onKeydown }, h("slot", { key: 'd14960a1471948120f7173e18adae8d86e4fabb7' })));
114
+ return (h(Host, { key: '6a38873f2e4d085f733fa116057b1f55418e23ed', "data-open": this.internalOpen ? '' : undefined, onKeyDown: this.onKeydown }, h("div", { key: '6fef6e37921e8c52994617719f1ebb6d9bd54ee2', class: "popover__surface" }, h("slot", { key: '5ee4269592219035a3185f8f06fd71ecb12e4e71' }))));
112
115
  }
113
116
  static get watchers() { return {
114
117
  "open": [{
@@ -107,7 +107,7 @@ const UIRadioGroup = class {
107
107
  }
108
108
  };
109
109
  render() {
110
- return (h(Host, { key: 'e80e01600d499d1b8e3410060433dac2bb8cf38a', role: "radiogroup", "aria-orientation": this.orientation, "data-orientation": this.orientation, "data-disabled": this.disabled ? '' : undefined }, h("slot", { key: 'e60dcfa1b174b1a4c9092567e6ec4d9f5bcd9ffe' })));
110
+ return (h(Host, { key: '28c6eb6cc9520b570f40d2193d0c64a7a6c7db01', role: "radiogroup", "aria-orientation": this.orientation, "data-orientation": this.orientation, "data-disabled": this.disabled ? '' : undefined }, h("slot", { key: '97814378181be78bfac6090ff173459e1f539728' })));
111
111
  }
112
112
  static get watchers() { return {
113
113
  "value": [{
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
2
  import { d as dispatchDetail, e as eventToTrigger } from './events-JwSoedEO.js';
3
+ import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
3
4
 
4
5
  const uiRadioCss = () => `:host{display:inline-flex;align-items:center;gap:var(--ui-space-2);color:var(--ui-text-primary)}:host([data-disabled='true']),:host([aria-disabled='true']){opacity:0.6;cursor:not-allowed}::slotted(input[type='radio']){accent-color:var(--ui-accent-solid);cursor:pointer}::slotted(input[type='radio']:focus-visible){outline:2px solid var(--ui-accent-solid);outline-offset:2px}`;
5
6
 
@@ -8,28 +9,32 @@ const UIRadio = class {
8
9
  registerInstance(this, hostRef);
9
10
  }
10
11
  get host() { return getElement(this); }
11
- checked = false;
12
+ /** Controlled checked state. Omit it to use defaultChecked and local interaction state. */
13
+ checked;
12
14
  defaultChecked = false;
13
15
  disabled = false;
14
16
  name = '';
15
17
  required = false;
16
18
  value = 'on';
19
+ internalChecked = false;
17
20
  slotRef;
21
+ syncFromProp() {
22
+ if (isControlled(this.checked))
23
+ this.internalChecked = this.checked;
24
+ }
18
25
  syncToInput() {
19
26
  const input = this.getInput();
20
27
  if (!input)
21
28
  return;
22
29
  this.host.toggleAttribute('data-disabled', this.disabled);
23
- input.checked = this.checked;
30
+ input.checked = this.internalChecked;
24
31
  input.disabled = this.disabled;
25
32
  input.name = this.name;
26
33
  input.required = this.required;
27
34
  input.value = this.value;
28
35
  }
29
36
  componentDidLoad() {
30
- if (!this.checked && this.defaultChecked) {
31
- this.checked = true;
32
- }
37
+ this.internalChecked = controlledOrDefault(this.checked, this.defaultChecked);
33
38
  this.slotRef?.addEventListener('slotchange', () => this.syncToInput());
34
39
  this.syncToInput();
35
40
  const input = this.getInput();
@@ -51,6 +56,10 @@ const UIRadio = class {
51
56
  const input = e.target;
52
57
  if (!input || !input.checked)
53
58
  return;
59
+ if (!isControlled(this.checked))
60
+ this.internalChecked = true;
61
+ else
62
+ this.syncToInput();
54
63
  dispatchDetail(this.host, 'change', {
55
64
  checked: true,
56
65
  value: this.value,
@@ -58,11 +67,11 @@ const UIRadio = class {
58
67
  });
59
68
  };
60
69
  render() {
61
- return (h(Host, { key: '898869b84429366e43c075723e884f34da6fc6df', role: "radio", "aria-checked": String(this.checked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? '' : undefined }, h("slot", { key: '3f3b881175f25d439807ec9f8f0dd59a1acd6a90', ref: (el) => (this.slotRef = el) })));
70
+ return (h(Host, { key: 'a5220e72dbf1b55ca73a3e6234f31c99d806433a', role: "radio", "aria-checked": String(this.internalChecked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? '' : undefined }, h("slot", { key: '687e94b2036107c807e0319c3620bca7c06cbb26', ref: (el) => (this.slotRef = el) })));
62
71
  }
63
72
  static get watchers() { return {
64
73
  "checked": [{
65
- "syncToInput": 0
74
+ "syncFromProp": 0
66
75
  }],
67
76
  "disabled": [{
68
77
  "syncToInput": 0
@@ -37,7 +37,7 @@ const UISearchResultRow = class {
37
37
  this.hasTrailing = slotHasContent(this.trailingSlot);
38
38
  };
39
39
  render() {
40
- return (h(Host, { key: '8ef897782b50f1ecb129a51a25631d3d2bafe1e3' }, h("button", { key: '5b4fb4ac4968551a191e80bde7b991391d931220', class: "search-result-row", type: "button", disabled: this.disabled, part: "button" }, h("span", { key: '5f5988d87bcf754d8a521e19e0e2a490dd868bd2', class: "search-result-row__leading", part: "leading", hidden: !this.hasLeading }, h("slot", { key: 'a7671c75c28d71ab843dcbb1fcdd9f4d0e0f7361', name: "leading", ref: (el) => (this.leadingSlot = el), onSlotchange: this.syncSlots })), h("span", { key: '4ed60057e10ade9d7771812ad28aa25a017d34d8', class: "search-result-row__content", part: "content" }, h("span", { key: '37fa74ef4980ffd0b576ff824532d1267420461c', class: "search-result-row__title", part: "title" }, h("slot", { key: '187df950b39702723fa456b09e220e2b7587f00a', name: "title" })), h("span", { key: '6d2476c57d7c9c7530c3796a723f47f5f4859d71', class: "search-result-row__meta", part: "meta", hidden: !this.hasMeta }, h("slot", { key: 'd53329dd6865bbda005b0d25a2b9bc7b7a597452', name: "meta", ref: (el) => (this.metaSlot = el), onSlotchange: this.syncSlots })), h("span", { key: '8846c9669c0f65a739b770f41a93ddd4bef3f6bd', class: "search-result-row__excerpt", part: "excerpt", hidden: !this.hasExcerpt }, h("slot", { key: 'b63f70371538901aaff481a9e524bf817883cee6', name: "excerpt", ref: (el) => (this.excerptSlot = el), onSlotchange: this.syncSlots }))), h("span", { key: '1e8f94c3d83c3f649595c2843522b0973590a8d5', class: "search-result-row__trailing", part: "trailing", hidden: !this.hasTrailing }, h("slot", { key: 'cfba9301ad97c1130a01f78c16052fc26e249f4b', name: "trailing", ref: (el) => (this.trailingSlot = el), onSlotchange: this.syncSlots })))));
40
+ return (h(Host, { key: '01e795d1c723c4e56f5648c429b40fc7841ff9b5' }, h("button", { key: '7bdde5075c5a3112d14741aa87937e69a8f5fea9', class: "search-result-row", type: "button", disabled: this.disabled, part: "button" }, h("span", { key: '39ba47af68a23875eebdbdf8f87ca7d94d42ec43', class: "search-result-row__leading", part: "leading", hidden: !this.hasLeading }, h("slot", { key: 'f108b1c5d284057d5979bf4897f056543a1ff092', name: "leading", ref: (el) => (this.leadingSlot = el), onSlotchange: this.syncSlots })), h("span", { key: '0daeb171b7010f37d959c91f2a87c1ae7e96a56f', class: "search-result-row__content", part: "content" }, h("span", { key: 'd7ec1b67a15fa9c79ea0fd23db73bd7bca40a8ce', class: "search-result-row__title", part: "title" }, h("slot", { key: '8c4a45511580a655e0593c8c57fd98838f2cb896', name: "title" })), h("span", { key: '0d30a58a7079ea0c8992c9b0b02b516a65350425', class: "search-result-row__meta", part: "meta", hidden: !this.hasMeta }, h("slot", { key: '8de66e3b6adf89ed765ccc1c341ccac1b5513a6f', name: "meta", ref: (el) => (this.metaSlot = el), onSlotchange: this.syncSlots })), h("span", { key: '7c24542b9bb634a55530952c329242a351e813c3', class: "search-result-row__excerpt", part: "excerpt", hidden: !this.hasExcerpt }, h("slot", { key: 'a5bfc4fd17b8535aa996e792498b33f25dd30ecd', name: "excerpt", ref: (el) => (this.excerptSlot = el), onSlotchange: this.syncSlots }))), h("span", { key: '25c74d8508a0b3b527ef5529a02e54e407cae5ae', class: "search-result-row__trailing", part: "trailing", hidden: !this.hasTrailing }, h("slot", { key: 'cba6f957de902b9ed3dc05c8b20794c9b69c85c6', name: "trailing", ref: (el) => (this.trailingSlot = el), onSlotchange: this.syncSlots })))));
41
41
  }
42
42
  };
43
43
  UISearchResultRow.style = uiSearchResultRowCss();
@@ -29,7 +29,7 @@ const UISearchShell = class {
29
29
  this.hasFooter = slotHasContent(this.footerSlot);
30
30
  };
31
31
  render() {
32
- return (h("div", { key: '2a09e1ee81d04c0af5420887a9fa0dfb8057040c', class: "search-shell", part: "base" }, h("slot", { key: '9124af2e3e73b686a73b11c7fe8c9d40986e98c1', name: "backdrop" }), h("div", { key: 'cec39a8cbbfe99b7bbeb37ce32655a88cee2bec3', class: "search-shell__panel", part: "panel" }, h("div", { key: '8168eda720e031daf350800ac48dcf445be0c417', class: "search-shell__search", part: "search" }, h("slot", { key: 'b220c9670a6a53cd93fa434dc97dc9d2582bec08', name: "search" })), h("div", { key: '24386da67dd8ab5e865519e5b0b70fe9c8924010', class: "search-shell__status", part: "status", hidden: !this.hasStatus }, h("slot", { key: '7a0dfada13aca3275961667dadc9623729fbf644', name: "status", ref: (el) => (this.statusSlot = el), onSlotchange: this.syncSlots })), h("div", { key: 'e06b7da6219c7a71d69662c5bdcc24e6baa52aa9', class: "search-shell__body", part: "body" }, h("slot", { key: 'fabdea16cf443b57a826fc748b24342ff214b918', name: "body" })), h("div", { key: 'd38662a77f19fd59315b1882cda0a55680cc5a0b', class: "search-shell__footer", part: "footer", hidden: !this.hasFooter }, h("slot", { key: '56eb386e22ae033939cdbdf3c6b6edf68594ceb5', name: "footer", ref: (el) => (this.footerSlot = el), onSlotchange: this.syncSlots })))));
32
+ return (h("div", { key: 'c3a4366e1f22b249233e42fdc83f1620613cce52', class: "search-shell", part: "base" }, h("slot", { key: '4f22e4a44fe7ae190a80a6e5cd695c15eb4f029d', name: "backdrop" }), h("div", { key: 'bf452dae29f0ab31266d848a4dd4b794997b34a7', class: "search-shell__panel", part: "panel" }, h("div", { key: 'c0ef7d1d8ea95853404d39ddac1bff566d38d18e', class: "search-shell__search", part: "search" }, h("slot", { key: '462532250d8ba36aad1d31fe10da642d79e59faf', name: "search" })), h("div", { key: '4f7d91272d15f6e37df6fba4ae563efae5701b93', class: "search-shell__status", part: "status", hidden: !this.hasStatus }, h("slot", { key: 'd761691c1dd2c3012075163bb7eb9ce7e5bf3ef4', name: "status", ref: (el) => (this.statusSlot = el), onSlotchange: this.syncSlots })), h("div", { key: '1427a10b3f43ea31c2a482beb17f78d70b5fb2cf', class: "search-shell__body", part: "body" }, h("slot", { key: '6d6e8c2b4ee4833b5476795d4c7e184dda07f81e', name: "body" })), h("div", { key: '8f7d36040f7d21489c703b53581e392a2616963b', class: "search-shell__footer", part: "footer", hidden: !this.hasFooter }, h("slot", { key: '08b84f01091d95895ee8693e9b322511bf614342', name: "footer", ref: (el) => (this.footerSlot = el), onSlotchange: this.syncSlots })))));
33
33
  }
34
34
  };
35
35
  UISearchShell.style = uiSearchShellCss();
@@ -78,7 +78,7 @@ const UISelect = class {
78
78
  });
79
79
  };
80
80
  render() {
81
- return (h(Host, { key: '5ac54353f467b70e94fce0ae661dc86c305befe7', "data-invalid": this.invalid ? '' : undefined }, h("slot", { key: '1386f3e4912720ab597f4567112e9c8b4166bcc6', ref: (el) => (this.slotRef = el) })));
81
+ return (h(Host, { key: '9a83a040bbad98355999c8099a78c6eba3ffc995', "data-invalid": this.invalid ? '' : undefined }, h("slot", { key: '4a70aa44651132899e283e45c32213cf3f00be24', ref: (el) => (this.slotRef = el) })));
82
82
  }
83
83
  static get watchers() { return {
84
84
  "value": [{
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
2
  import { d as dispatchDetail } from './events-JwSoedEO.js';
3
+ import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
3
4
 
4
5
  const uiSwitchCss = () => `: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}:host([role='switch']){cursor:pointer}:host input[type='checkbox']{appearance:none;-webkit-appearance:none;display:block;position:relative;width:2.25rem;height:1.25rem;padding:0;border:1px solid var(--ui-border-default);border-radius:999px;background:var(--ui-surface-muted);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), border-color var(--ui-motion-fast) var(--ui-motion-ease);margin:0}:host input[type='checkbox']::after{content:'';position:absolute;top:2px;left:2px;width:0.875rem;height:0.875rem;border-radius:999px;background:var(--ui-surface-default);border:1px solid var(--ui-border-default);transition:transform var(--ui-motion-fast) var(--ui-motion-ease)}:host input[type='checkbox']:checked{background:var(--ui-accent-solid);border-color:var(--ui-accent-solid)}:host input[type='checkbox']:checked::after{transform:translateX(calc(2.25rem - 0.875rem - 4px));background:var(--ui-text-on-accent);border-color:var(--ui-text-on-accent)}:host input[type='checkbox']:focus-visible{outline:2px solid var(--ui-accent-solid);outline-offset:2px}`;
5
6
 
@@ -8,25 +9,28 @@ const UISwitch = class {
8
9
  registerInstance(this, hostRef);
9
10
  }
10
11
  get host() { return getElement(this); }
11
- checked = false;
12
+ /** Controlled checked state. Omit it to use defaultChecked and local interaction state. */
13
+ checked;
12
14
  defaultChecked = false;
13
15
  disabled = false;
14
16
  required = false;
15
17
  value = 'on';
16
18
  internalChecked = false;
17
19
  syncFromProp() {
18
- this.internalChecked = this.checked;
20
+ if (isControlled(this.checked))
21
+ this.internalChecked = this.checked;
19
22
  }
20
23
  componentDidLoad() {
21
- this.syncFromProp();
22
- this.internalChecked = this.internalChecked || this.defaultChecked;
24
+ this.internalChecked = controlledOrDefault(this.checked, this.defaultChecked);
23
25
  }
24
26
  toggle = (trigger) => {
25
27
  if (this.disabled)
26
28
  return;
27
- this.internalChecked = !this.internalChecked;
29
+ const checked = !this.internalChecked;
30
+ if (!isControlled(this.checked))
31
+ this.internalChecked = checked;
28
32
  dispatchDetail(this.host, 'change', {
29
- checked: this.internalChecked,
33
+ checked,
30
34
  value: this.value,
31
35
  trigger,
32
36
  });
@@ -43,14 +47,19 @@ const UISwitch = class {
43
47
  this.toggle('pointer');
44
48
  };
45
49
  render() {
46
- return (h(Host, { key: '14205d2856f8fb49b72d69d40f10ac1473a80c04', role: "switch", "aria-checked": String(this.internalChecked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? '' : undefined, tabIndex: this.disabled ? -1 : 0, onKeyDown: this.onKeydown, onClick: this.onClick }, h("input", { key: '974f8e487c8bf9196c05420e1817139dd6b4138c', type: "checkbox", checked: this.internalChecked, disabled: this.disabled, required: this.required, value: this.value, "aria-hidden": "true", tabIndex: -1, onChange: (e) => {
47
- this.internalChecked = e.target.checked;
50
+ return (h(Host, { key: 'e11500e37da6a52c0cb4e143254363f85911aac1', role: "switch", "aria-checked": String(this.internalChecked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? '' : undefined, tabIndex: this.disabled ? -1 : 0, onKeyDown: this.onKeydown, onClick: this.onClick }, h("input", { key: '777310a90b66f67e6a8eb0f77da5274e32f10db0', type: "checkbox", checked: this.internalChecked, disabled: this.disabled, required: this.required, value: this.value, "aria-hidden": "true", tabIndex: -1, onChange: (e) => {
51
+ const input = e.target;
52
+ const checked = input.checked;
53
+ if (!isControlled(this.checked))
54
+ this.internalChecked = checked;
48
55
  dispatchDetail(this.host, 'change', {
49
- checked: this.internalChecked,
56
+ checked,
50
57
  value: this.value,
51
58
  trigger: 'pointer',
52
59
  });
53
- } }), h("slot", { key: 'd1cd89aa2d5312cff8845364cdee64821977cb44' })));
60
+ if (isControlled(this.checked))
61
+ input.checked = this.internalChecked;
62
+ } }), h("slot", { key: '7d72db5b720c0af0c4561b485ca558de61e1ce6e' })));
54
63
  }
55
64
  static get watchers() { return {
56
65
  "checked": [{
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
2
  import { d as dispatchDetail, e as eventToTrigger } from './events-JwSoedEO.js';
3
+ import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
3
4
 
4
5
  const uiTabsCss = () => `:host{display:flex;flex-direction:column;gap:0}:host([data-orientation='vertical']){flex-direction:row}::slotted([role='tablist']){display:flex;gap:0;max-inline-size:100%;overflow-x:auto;overscroll-behavior-inline:contain;border-bottom:1px solid var(--ui-border-default)}:host([data-orientation='vertical']) ::slotted([role='tablist']){flex-direction:column;border-bottom:none;border-inline-end:1px solid var(--ui-border-default)}::slotted(button[role='tab']),::slotted([role='tab']),::slotted(ui-button) button[role='tab']{padding:var(--ui-space-2) var(--ui-space-3);font-size:var(--ui-font-size-sm);font-weight:var(--ui-font-medium, 500);color:var(--ui-text-secondary);background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;cursor:pointer;transition:color var(--ui-motion-fast) var(--ui-motion-ease);box-shadow:none}::slotted(button[role='tab']:hover),::slotted([role='tab']:hover){color:var(--ui-text-primary)}::slotted(button[role='tab'][aria-selected='true']),::slotted([role='tab'][aria-selected='true']){color:var(--ui-accent-solid);border-bottom-color:var(--ui-accent-solid)}:host([data-orientation='vertical']) ::slotted(button[role='tab']),:host([data-orientation='vertical']) ::slotted([role='tab']){border-bottom:none;border-inline-end:2px solid transparent;margin-bottom:0;margin-inline-end:-1px}:host([data-orientation='vertical']) ::slotted(button[role='tab'][aria-selected='true']),:host([data-orientation='vertical']) ::slotted([role='tab'][aria-selected='true']){border-inline-end-color:var(--ui-accent-solid)}::slotted([role='tabpanel']){padding:var(--ui-space-4)}`;
5
6
 
@@ -8,12 +9,14 @@ const UITabs = class {
8
9
  registerInstance(this, hostRef);
9
10
  }
10
11
  get host() { return getElement(this); }
11
- value = '';
12
+ /** Controlled selected tab value. Omit it to use defaultValue and local interaction state. */
13
+ value;
12
14
  defaultValue = '';
13
15
  orientation = 'horizontal';
14
16
  internalValue = '';
15
17
  syncFromProp() {
16
- this.internalValue = this.value;
18
+ if (isControlled(this.value))
19
+ this.internalValue = this.value;
17
20
  }
18
21
  syncState() {
19
22
  const tabs = this.getTabs();
@@ -34,11 +37,8 @@ const UITabs = class {
34
37
  });
35
38
  }
36
39
  componentDidLoad() {
37
- this.syncFromProp();
38
- if (!this.internalValue && this.defaultValue) {
39
- this.internalValue = this.defaultValue;
40
- }
41
- if (!this.internalValue) {
40
+ this.internalValue = controlledOrDefault(this.value, this.defaultValue);
41
+ if (!isControlled(this.value) && !this.internalValue) {
42
42
  const tabs = this.getTabs();
43
43
  if (tabs.length > 0) {
44
44
  this.internalValue = tabs[0]?.id ?? tabs[0]?.getAttribute('aria-controls') ?? '';
@@ -63,7 +63,8 @@ const UITabs = class {
63
63
  if (!newValue)
64
64
  return;
65
65
  const prev = this.internalValue;
66
- this.internalValue = newValue;
66
+ if (!isControlled(this.value))
67
+ this.internalValue = newValue;
67
68
  this.syncState();
68
69
  dispatchDetail(this.host, 'select', { value: newValue, previousValue: prev || undefined, trigger });
69
70
  }
@@ -96,7 +97,7 @@ const UITabs = class {
96
97
  }
97
98
  };
98
99
  render() {
99
- return (h(Host, { key: 'ca8671f06914de2bd6b412caf11e385d67ae722b', orientation: this.orientation, "data-orientation": this.orientation }, h("slot", { key: '49beb3783c8f6a330d25164c82933c2bf6345b1e' })));
100
+ return (h(Host, { key: '8681e699c6afdbafd59ed986b8bf3c815b32cd1c', orientation: this.orientation, "data-orientation": this.orientation }, h("slot", { key: '673f4db2ae0aded3bd40934c1fff518cf6f83837' })));
100
101
  }
101
102
  static get watchers() { return {
102
103
  "value": [{
@@ -77,7 +77,7 @@ const UITextarea = class {
77
77
  });
78
78
  };
79
79
  render() {
80
- return (h(Host, { key: '9ccc0464bca55b3364645ea90df3890f9ed9d697', "data-invalid": this.invalid ? '' : undefined }, h("slot", { key: '81c4df31064d4dcd2b2e27dfcf3141cc9f18f54e', ref: (el) => (this.slotRef = el) })));
80
+ return (h(Host, { key: '6ce80349ca316f7a44d08e83862125f6b4d736a6', "data-invalid": this.invalid ? '' : undefined }, h("slot", { key: '2c1ce87c9019d8346673ae5e7dd8a543d1bcb91c', ref: (el) => (this.slotRef = el) })));
81
81
  }
82
82
  static get watchers() { return {
83
83
  "value": [{
@@ -10,10 +10,12 @@ const UIToastRegion = class {
10
10
  }
11
11
  get host() { return getElement(this); }
12
12
  open = true;
13
- internalOpen = true;
13
+ internalOpen = false;
14
14
  surface = null;
15
+ contentObserver = null;
16
+ pendingDismiss = null;
15
17
  syncFromProp() {
16
- this.internalOpen = this.open;
18
+ this.syncContents();
17
19
  }
18
20
  syncSurface() {
19
21
  if (this.internalOpen)
@@ -23,22 +25,39 @@ const UIToastRegion = class {
23
25
  }
24
26
  componentDidLoad() {
25
27
  this.surface = createViewportSurface(this.host);
26
- this.syncFromProp();
28
+ this.contentObserver = new MutationObserver(this.syncContents);
29
+ this.contentObserver.observe(this.host, { childList: true, subtree: true });
30
+ this.syncContents();
27
31
  this.syncSurface();
28
32
  this.host.addEventListener('click', this.onClick);
29
33
  }
30
34
  disconnectedCallback() {
31
35
  this.host.removeEventListener('click', this.onClick);
36
+ this.contentObserver?.disconnect();
37
+ this.contentObserver = null;
32
38
  this.surface?.destroy();
33
39
  this.surface = null;
34
40
  }
35
41
  getToasts() {
36
42
  return Array.from(this.host.querySelectorAll('[data-ui-toast]'));
37
43
  }
38
- updateOpenState() {
39
- const toasts = this.getToasts();
40
- this.internalOpen = toasts.length > 0;
41
- }
44
+ syncContents = () => {
45
+ const nextOpen = this.open && this.getToasts().length > 0;
46
+ const wasOpen = this.internalOpen;
47
+ const completedDismiss = this.pendingDismiss && !this.host.contains(this.pendingDismiss.toast)
48
+ ? this.pendingDismiss
49
+ : null;
50
+ this.internalOpen = nextOpen;
51
+ if (wasOpen && !nextOpen && completedDismiss) {
52
+ dispatchDetail(this.host, 'close', {
53
+ open: false,
54
+ reason: 'action',
55
+ trigger: completedDismiss.trigger,
56
+ });
57
+ }
58
+ if (completedDismiss || !this.open)
59
+ this.pendingDismiss = null;
60
+ };
42
61
  onClick = (e) => {
43
62
  const dismissBtn = e.target.closest?.('[data-ui-toast-dismiss]');
44
63
  if (!dismissBtn)
@@ -47,24 +66,16 @@ const UIToastRegion = class {
47
66
  if (!toast)
48
67
  return;
49
68
  const id = toast.id ?? '';
50
- toast.setAttribute('aria-hidden', 'true');
51
- toast.remove();
69
+ const trigger = eventToTrigger(e);
70
+ this.pendingDismiss = { toast: toast, trigger };
52
71
  dispatchDetail(this.host, 'dismiss', {
53
72
  id,
54
73
  reason: 'action',
55
- trigger: eventToTrigger(e),
74
+ trigger,
56
75
  });
57
- this.updateOpenState();
58
- if (this.getToasts().length === 0) {
59
- dispatchDetail(this.host, 'close', {
60
- open: false,
61
- reason: 'action',
62
- trigger: eventToTrigger(e),
63
- });
64
- }
65
76
  };
66
77
  render() {
67
- return (h(Host, { key: '9ec1cc51ecc4e7a256be5d89a09a10788e46db53', role: "region", "aria-label": "Notifications", "data-open": this.internalOpen ? '' : undefined }, h("slot", { key: '7b08656f3745a02f8e9f0935e47d6f2cffd88f9b' })));
78
+ return (h(Host, { key: 'b4430aceacb7a66202c6a43ad7b0bbe31c51eb94', role: "region", "aria-label": "Notifications", "aria-live": "polite", "data-open": this.internalOpen ? '' : undefined }, h("slot", { key: '8bfb02d38366fab29a1668a53b7834ccd1a9aa65' })));
68
79
  }
69
80
  static get watchers() { return {
70
81
  "open": [{