@funstack/ui 0.1.0-alpha.14 → 0.1.0-alpha.16

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 (584) hide show
  1. package/README.md +22 -1
  2. package/dist/accordion/accordion-item.d.mts +19 -0
  3. package/dist/accordion/accordion-item.d.mts.map +1 -1
  4. package/dist/accordion/accordion-item.mjs +2 -0
  5. package/dist/accordion/accordion-item.mjs.map +1 -1
  6. package/dist/accordion/accordion-panel.d.mts +16 -0
  7. package/dist/accordion/accordion-panel.d.mts.map +1 -1
  8. package/dist/accordion/accordion-panel.mjs +2 -0
  9. package/dist/accordion/accordion-panel.mjs.map +1 -1
  10. package/dist/accordion/accordion-root.d.mts +36 -2
  11. package/dist/accordion/accordion-root.d.mts.map +1 -1
  12. package/dist/accordion/accordion-root.mjs +7 -4
  13. package/dist/accordion/accordion-root.mjs.map +1 -1
  14. package/dist/accordion/accordion-trigger.d.mts +9 -0
  15. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  16. package/dist/accordion/accordion-trigger.mjs +2 -0
  17. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  18. package/dist/accordion/index.d.mts +2 -0
  19. package/dist/accordion/index.d.mts.map +1 -1
  20. package/dist/accordion/index.mjs +2 -0
  21. package/dist/accordion/index.mjs.map +1 -1
  22. package/dist/bin/skill-installer.d.mts +1 -0
  23. package/dist/bin/skill-installer.mjs +12 -0
  24. package/dist/bin/skill-installer.mjs.map +1 -0
  25. package/dist/button/button.d.mts +25 -7
  26. package/dist/button/button.d.mts.map +1 -1
  27. package/dist/button/button.mjs +2 -0
  28. package/dist/button/button.mjs.map +1 -1
  29. package/dist/checkbox/checkbox.d.mts +25 -3
  30. package/dist/checkbox/checkbox.d.mts.map +1 -1
  31. package/dist/checkbox/checkbox.mjs +2 -0
  32. package/dist/checkbox/checkbox.mjs.map +1 -1
  33. package/dist/checkbox-group/checkbox-group-item.d.mts +15 -0
  34. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  35. package/dist/checkbox-group/checkbox-group-item.mjs +2 -0
  36. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  37. package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
  38. package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
  39. package/dist/checkbox-group/checkbox-group-label.mjs +2 -0
  40. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
  41. package/dist/checkbox-group/checkbox-group-parent.d.mts +19 -1
  42. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  43. package/dist/checkbox-group/checkbox-group-parent.mjs +2 -0
  44. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  45. package/dist/checkbox-group/checkbox-group-root.d.mts +31 -4
  46. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  47. package/dist/checkbox-group/checkbox-group-root.mjs +6 -5
  48. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  49. package/dist/checkbox-group/index.d.mts +2 -0
  50. package/dist/checkbox-group/index.d.mts.map +1 -1
  51. package/dist/checkbox-group/index.mjs +2 -0
  52. package/dist/checkbox-group/index.mjs.map +1 -1
  53. package/dist/combobox/combobox-clear.d.mts +18 -0
  54. package/dist/combobox/combobox-clear.d.mts.map +1 -1
  55. package/dist/combobox/combobox-clear.mjs +2 -0
  56. package/dist/combobox/combobox-clear.mjs.map +1 -1
  57. package/dist/combobox/combobox-context.mjs.map +1 -1
  58. package/dist/combobox/combobox-group.d.mts +49 -1
  59. package/dist/combobox/combobox-group.d.mts.map +1 -1
  60. package/dist/combobox/combobox-group.mjs +11 -1
  61. package/dist/combobox/combobox-group.mjs.map +1 -1
  62. package/dist/combobox/combobox-input.d.mts +18 -6
  63. package/dist/combobox/combobox-input.d.mts.map +1 -1
  64. package/dist/combobox/combobox-input.mjs +8 -5
  65. package/dist/combobox/combobox-input.mjs.map +1 -1
  66. package/dist/combobox/combobox-label.d.mts +18 -1
  67. package/dist/combobox/combobox-label.d.mts.map +1 -1
  68. package/dist/combobox/combobox-label.mjs +4 -1
  69. package/dist/combobox/combobox-label.mjs.map +1 -1
  70. package/dist/combobox/combobox-list.d.mts +14 -0
  71. package/dist/combobox/combobox-list.d.mts.map +1 -1
  72. package/dist/combobox/combobox-list.mjs +2 -0
  73. package/dist/combobox/combobox-list.mjs.map +1 -1
  74. package/dist/combobox/combobox-option.d.mts +25 -3
  75. package/dist/combobox/combobox-option.d.mts.map +1 -1
  76. package/dist/combobox/combobox-option.mjs +2 -0
  77. package/dist/combobox/combobox-option.mjs.map +1 -1
  78. package/dist/combobox/combobox-popup.d.mts +17 -1
  79. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  80. package/dist/combobox/combobox-popup.mjs +5 -15
  81. package/dist/combobox/combobox-popup.mjs.map +1 -1
  82. package/dist/combobox/combobox-root.d.mts +49 -12
  83. package/dist/combobox/combobox-root.d.mts.map +1 -1
  84. package/dist/combobox/combobox-root.mjs +11 -80
  85. package/dist/combobox/combobox-root.mjs.map +1 -1
  86. package/dist/combobox/combobox-trigger.d.mts +26 -8
  87. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  88. package/dist/combobox/combobox-trigger.mjs +23 -17
  89. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  90. package/dist/combobox/index.d.mts +4 -2
  91. package/dist/combobox/index.d.mts.map +1 -1
  92. package/dist/combobox/index.mjs +4 -2
  93. package/dist/combobox/index.mjs.map +1 -1
  94. package/dist/combobox/use-deferred-leave.mjs +105 -0
  95. package/dist/combobox/use-deferred-leave.mjs.map +1 -0
  96. package/dist/csp/csp-provider.d.mts +8 -0
  97. package/dist/csp/csp-provider.d.mts.map +1 -1
  98. package/dist/csp/csp-provider.mjs +2 -0
  99. package/dist/csp/csp-provider.mjs.map +1 -1
  100. package/dist/csp/style-hashes.d.mts +2 -0
  101. package/dist/csp/style-hashes.d.mts.map +1 -1
  102. package/dist/csp/style-hashes.mjs +2 -0
  103. package/dist/csp/style-hashes.mjs.map +1 -1
  104. package/dist/dialog/dialog-close.d.mts +18 -0
  105. package/dist/dialog/dialog-close.d.mts.map +1 -1
  106. package/dist/dialog/dialog-close.mjs +2 -0
  107. package/dist/dialog/dialog-close.mjs.map +1 -1
  108. package/dist/dialog/dialog-context.mjs.map +1 -1
  109. package/dist/dialog/dialog-description.d.mts +12 -0
  110. package/dist/dialog/dialog-description.d.mts.map +1 -1
  111. package/dist/dialog/dialog-description.mjs +2 -0
  112. package/dist/dialog/dialog-description.mjs.map +1 -1
  113. package/dist/dialog/dialog-form.d.mts +18 -1
  114. package/dist/dialog/dialog-form.d.mts.map +1 -1
  115. package/dist/dialog/dialog-form.mjs +2 -0
  116. package/dist/dialog/dialog-form.mjs.map +1 -1
  117. package/dist/dialog/dialog-popup.d.mts +25 -4
  118. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  119. package/dist/dialog/dialog-popup.mjs +4 -2
  120. package/dist/dialog/dialog-popup.mjs.map +1 -1
  121. package/dist/dialog/dialog-root.d.mts +15 -1
  122. package/dist/dialog/dialog-root.d.mts.map +1 -1
  123. package/dist/dialog/dialog-root.mjs +2 -0
  124. package/dist/dialog/dialog-root.mjs.map +1 -1
  125. package/dist/dialog/dialog-title.d.mts +11 -0
  126. package/dist/dialog/dialog-title.d.mts.map +1 -1
  127. package/dist/dialog/dialog-title.mjs +2 -0
  128. package/dist/dialog/dialog-title.mjs.map +1 -1
  129. package/dist/dialog/dialog-trigger.d.mts +16 -0
  130. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  131. package/dist/dialog/dialog-trigger.mjs +2 -0
  132. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  133. package/dist/dialog/index.d.mts +2 -0
  134. package/dist/dialog/index.d.mts.map +1 -1
  135. package/dist/dialog/index.mjs +2 -0
  136. package/dist/dialog/index.mjs.map +1 -1
  137. package/dist/docs/components/accordion.md +426 -0
  138. package/dist/docs/components/button.md +464 -0
  139. package/dist/docs/components/checkbox-group.md +474 -0
  140. package/dist/docs/components/checkbox.md +373 -0
  141. package/dist/docs/components/combobox.md +635 -0
  142. package/dist/docs/components/context-menu.md +524 -0
  143. package/dist/docs/components/dialog.md +686 -0
  144. package/dist/docs/components/field.md +587 -0
  145. package/dist/docs/components/menu.md +589 -0
  146. package/dist/docs/components/meter.md +313 -0
  147. package/dist/docs/components/number-field.md +528 -0
  148. package/dist/docs/components/popover.md +591 -0
  149. package/dist/docs/components/progress.md +450 -0
  150. package/dist/docs/components/radio-group.md +457 -0
  151. package/dist/docs/components/select.md +662 -0
  152. package/dist/docs/components/slider.md +558 -0
  153. package/dist/docs/components/switch.md +311 -0
  154. package/dist/docs/components/tabs.md +473 -0
  155. package/dist/docs/components/toast.md +576 -0
  156. package/dist/docs/components/toggle-group.md +341 -0
  157. package/dist/docs/components/toggle.md +245 -0
  158. package/dist/docs/components/toolbar.md +389 -0
  159. package/dist/docs/components/tooltip.md +494 -0
  160. package/dist/docs/concepts/action-props.md +251 -0
  161. package/dist/docs/concepts/ai-agents.md +56 -0
  162. package/dist/docs/concepts/browser-owned-state.md +118 -0
  163. package/dist/docs/concepts/content-security-policy.md +69 -0
  164. package/dist/docs/concepts/experimental.md +36 -0
  165. package/dist/docs/concepts/pending-and-optimistic.md +250 -0
  166. package/dist/docs/concepts/server-components.md +118 -0
  167. package/dist/docs/concepts/suspense.md +124 -0
  168. package/dist/docs/concepts/transitions.md +118 -0
  169. package/dist/docs/getting-started.md +115 -0
  170. package/dist/docs/index.md +181 -0
  171. package/dist/docs/roadmap.md +74 -0
  172. package/dist/docs/why.md +100 -0
  173. package/dist/field/field-control.d.mts +26 -3
  174. package/dist/field/field-control.d.mts.map +1 -1
  175. package/dist/field/field-control.mjs +2 -0
  176. package/dist/field/field-control.mjs.map +1 -1
  177. package/dist/field/field-description.d.mts +11 -0
  178. package/dist/field/field-description.d.mts.map +1 -1
  179. package/dist/field/field-description.mjs +2 -0
  180. package/dist/field/field-description.mjs.map +1 -1
  181. package/dist/field/field-error.d.mts +14 -2
  182. package/dist/field/field-error.d.mts.map +1 -1
  183. package/dist/field/field-error.mjs +2 -0
  184. package/dist/field/field-error.mjs.map +1 -1
  185. package/dist/field/field-label.d.mts +10 -0
  186. package/dist/field/field-label.d.mts.map +1 -1
  187. package/dist/field/field-label.mjs +2 -0
  188. package/dist/field/field-label.mjs.map +1 -1
  189. package/dist/field/field-root.d.mts +21 -2
  190. package/dist/field/field-root.d.mts.map +1 -1
  191. package/dist/field/field-root.mjs +2 -0
  192. package/dist/field/field-root.mjs.map +1 -1
  193. package/dist/field/index.d.mts +9 -0
  194. package/dist/field/index.d.mts.map +1 -1
  195. package/dist/field/index.mjs +9 -0
  196. package/dist/field/index.mjs.map +1 -1
  197. package/dist/form/form-root.d.mts +17 -1
  198. package/dist/form/form-root.d.mts.map +1 -1
  199. package/dist/form/form-root.mjs +3 -1
  200. package/dist/form/form-root.mjs.map +1 -1
  201. package/dist/form/form-submit.d.mts +18 -0
  202. package/dist/form/form-submit.d.mts.map +1 -1
  203. package/dist/form/form-submit.mjs +2 -0
  204. package/dist/form/form-submit.mjs.map +1 -1
  205. package/dist/form/index.d.mts +7 -0
  206. package/dist/form/index.d.mts.map +1 -1
  207. package/dist/form/index.mjs +7 -0
  208. package/dist/form/index.mjs.map +1 -1
  209. package/dist/index.d.mts +2 -1
  210. package/dist/internal/announce.mjs +12 -7
  211. package/dist/internal/announce.mjs.map +1 -1
  212. package/dist/internal/focus-first-invalid.mjs +2 -11
  213. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  214. package/dist/internal/focus-visible.mjs +26 -0
  215. package/dist/internal/focus-visible.mjs.map +1 -0
  216. package/dist/internal/{invoker-press.mjs → invokers.mjs} +22 -5
  217. package/dist/internal/invokers.mjs.map +1 -0
  218. package/dist/internal/platform-attributes.d.mts +1 -1
  219. package/dist/internal/pointer-capture.mjs +1 -1
  220. package/dist/internal/pointer-capture.mjs.map +1 -1
  221. package/dist/internal/trigger-ref.mjs +1 -1
  222. package/dist/internal/trigger-ref.mjs.map +1 -1
  223. package/dist/internal/types.d.mts +3 -0
  224. package/dist/internal/types.d.mts.map +1 -1
  225. package/dist/internal/use-interest-dismiss.mjs +84 -0
  226. package/dist/internal/use-interest-dismiss.mjs.map +1 -0
  227. package/dist/internal/use-overlay-root.mjs.map +1 -1
  228. package/dist/internal/use-popover-popup.mjs +43 -108
  229. package/dist/internal/use-popover-popup.mjs.map +1 -1
  230. package/dist/internal/use-popover-trigger.d.mts +1 -0
  231. package/dist/internal/use-popover-trigger.d.mts.map +1 -1
  232. package/dist/internal/use-popover-trigger.mjs +29 -10
  233. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  234. package/dist/internal/use-value-set.mjs +20 -0
  235. package/dist/internal/use-value-set.mjs.map +1 -0
  236. package/dist/internal/validity.d.mts +11 -0
  237. package/dist/internal/validity.d.mts.map +1 -1
  238. package/dist/internal/validity.mjs.map +1 -1
  239. package/dist/menu/index.d.mts +2 -0
  240. package/dist/menu/index.d.mts.map +1 -1
  241. package/dist/menu/index.mjs +2 -0
  242. package/dist/menu/index.mjs.map +1 -1
  243. package/dist/menu/menu-checkbox-item.d.mts +26 -2
  244. package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
  245. package/dist/menu/menu-checkbox-item.mjs +2 -0
  246. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  247. package/dist/menu/menu-context-trigger.d.mts +24 -2
  248. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  249. package/dist/menu/menu-context-trigger.mjs +2 -0
  250. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  251. package/dist/menu/menu-group.d.mts +36 -1
  252. package/dist/menu/menu-group.d.mts.map +1 -1
  253. package/dist/menu/menu-group.mjs +9 -1
  254. package/dist/menu/menu-group.mjs.map +1 -1
  255. package/dist/menu/menu-item.d.mts +23 -1
  256. package/dist/menu/menu-item.d.mts.map +1 -1
  257. package/dist/menu/menu-item.mjs +2 -0
  258. package/dist/menu/menu-item.mjs.map +1 -1
  259. package/dist/menu/menu-popup.d.mts +34 -9
  260. package/dist/menu/menu-popup.d.mts.map +1 -1
  261. package/dist/menu/menu-popup.mjs +15 -27
  262. package/dist/menu/menu-popup.mjs.map +1 -1
  263. package/dist/menu/menu-radio-group.d.mts +20 -1
  264. package/dist/menu/menu-radio-group.d.mts.map +1 -1
  265. package/dist/menu/menu-radio-group.mjs +2 -0
  266. package/dist/menu/menu-radio-group.mjs.map +1 -1
  267. package/dist/menu/menu-radio-item.d.mts +16 -0
  268. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  269. package/dist/menu/menu-radio-item.mjs +2 -0
  270. package/dist/menu/menu-radio-item.mjs.map +1 -1
  271. package/dist/menu/menu-root.d.mts +22 -3
  272. package/dist/menu/menu-root.d.mts.map +1 -1
  273. package/dist/menu/menu-root.mjs +2 -0
  274. package/dist/menu/menu-root.mjs.map +1 -1
  275. package/dist/menu/menu-submenu-trigger.d.mts +21 -8
  276. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  277. package/dist/menu/menu-submenu-trigger.mjs +11 -10
  278. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  279. package/dist/menu/menu-trigger.d.mts +23 -7
  280. package/dist/menu/menu-trigger.d.mts.map +1 -1
  281. package/dist/menu/menu-trigger.mjs +8 -12
  282. package/dist/menu/menu-trigger.mjs.map +1 -1
  283. package/dist/meter/index.d.mts +2 -0
  284. package/dist/meter/index.d.mts.map +1 -1
  285. package/dist/meter/index.mjs +2 -0
  286. package/dist/meter/index.mjs.map +1 -1
  287. package/dist/meter/meter-indicator.d.mts +11 -0
  288. package/dist/meter/meter-indicator.d.mts.map +1 -1
  289. package/dist/meter/meter-indicator.mjs +2 -0
  290. package/dist/meter/meter-indicator.mjs.map +1 -1
  291. package/dist/meter/meter-label.d.mts +11 -0
  292. package/dist/meter/meter-label.d.mts.map +1 -1
  293. package/dist/meter/meter-label.mjs +2 -0
  294. package/dist/meter/meter-label.mjs.map +1 -1
  295. package/dist/meter/meter-region.d.mts +5 -0
  296. package/dist/meter/meter-region.d.mts.map +1 -1
  297. package/dist/meter/meter-region.mjs.map +1 -1
  298. package/dist/meter/meter-root.d.mts +52 -10
  299. package/dist/meter/meter-root.d.mts.map +1 -1
  300. package/dist/meter/meter-root.mjs +2 -0
  301. package/dist/meter/meter-root.mjs.map +1 -1
  302. package/dist/meter/meter-track.d.mts +11 -0
  303. package/dist/meter/meter-track.d.mts.map +1 -1
  304. package/dist/meter/meter-track.mjs +2 -0
  305. package/dist/meter/meter-track.mjs.map +1 -1
  306. package/dist/meter/meter-value.d.mts +15 -1
  307. package/dist/meter/meter-value.d.mts.map +1 -1
  308. package/dist/meter/meter-value.mjs +2 -0
  309. package/dist/meter/meter-value.mjs.map +1 -1
  310. package/dist/number-field/index.d.mts +2 -0
  311. package/dist/number-field/index.d.mts.map +1 -1
  312. package/dist/number-field/index.mjs +2 -0
  313. package/dist/number-field/index.mjs.map +1 -1
  314. package/dist/number-field/number-field-decrement.d.mts +2 -0
  315. package/dist/number-field/number-field-decrement.d.mts.map +1 -1
  316. package/dist/number-field/number-field-decrement.mjs +2 -0
  317. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  318. package/dist/number-field/number-field-increment.d.mts +2 -0
  319. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  320. package/dist/number-field/number-field-increment.mjs +2 -0
  321. package/dist/number-field/number-field-increment.mjs.map +1 -1
  322. package/dist/number-field/number-field-input.d.mts +9 -0
  323. package/dist/number-field/number-field-input.d.mts.map +1 -1
  324. package/dist/number-field/number-field-input.mjs +2 -0
  325. package/dist/number-field/number-field-input.mjs.map +1 -1
  326. package/dist/number-field/number-field-label.d.mts +10 -0
  327. package/dist/number-field/number-field-label.d.mts.map +1 -1
  328. package/dist/number-field/number-field-label.mjs +2 -0
  329. package/dist/number-field/number-field-label.mjs.map +1 -1
  330. package/dist/number-field/number-field-root.d.mts +62 -14
  331. package/dist/number-field/number-field-root.d.mts.map +1 -1
  332. package/dist/number-field/number-field-root.mjs +3 -1
  333. package/dist/number-field/number-field-root.mjs.map +1 -1
  334. package/dist/number-field/use-step-button.d.mts +20 -0
  335. package/dist/number-field/use-step-button.d.mts.map +1 -1
  336. package/dist/number-field/use-step-button.mjs.map +1 -1
  337. package/dist/popover/index.d.mts +2 -0
  338. package/dist/popover/index.d.mts.map +1 -1
  339. package/dist/popover/index.mjs +2 -0
  340. package/dist/popover/index.mjs.map +1 -1
  341. package/dist/popover/popover-close.d.mts +21 -3
  342. package/dist/popover/popover-close.d.mts.map +1 -1
  343. package/dist/popover/popover-close.mjs +3 -1
  344. package/dist/popover/popover-close.mjs.map +1 -1
  345. package/dist/popover/popover-description.d.mts +12 -0
  346. package/dist/popover/popover-description.d.mts.map +1 -1
  347. package/dist/popover/popover-description.mjs +2 -0
  348. package/dist/popover/popover-description.mjs.map +1 -1
  349. package/dist/popover/popover-popup.d.mts +30 -4
  350. package/dist/popover/popover-popup.d.mts.map +1 -1
  351. package/dist/popover/popover-popup.mjs +2 -0
  352. package/dist/popover/popover-popup.mjs.map +1 -1
  353. package/dist/popover/popover-root.d.mts +9 -0
  354. package/dist/popover/popover-root.d.mts.map +1 -1
  355. package/dist/popover/popover-root.mjs +2 -0
  356. package/dist/popover/popover-root.mjs.map +1 -1
  357. package/dist/popover/popover-title.d.mts +11 -0
  358. package/dist/popover/popover-title.d.mts.map +1 -1
  359. package/dist/popover/popover-title.mjs +2 -0
  360. package/dist/popover/popover-title.mjs.map +1 -1
  361. package/dist/popover/popover-trigger.d.mts +24 -9
  362. package/dist/popover/popover-trigger.d.mts.map +1 -1
  363. package/dist/popover/popover-trigger.mjs +11 -9
  364. package/dist/popover/popover-trigger.mjs.map +1 -1
  365. package/dist/progress/index.d.mts +2 -0
  366. package/dist/progress/index.d.mts.map +1 -1
  367. package/dist/progress/index.mjs +2 -0
  368. package/dist/progress/index.mjs.map +1 -1
  369. package/dist/progress/progress-indicator.d.mts +11 -0
  370. package/dist/progress/progress-indicator.d.mts.map +1 -1
  371. package/dist/progress/progress-indicator.mjs +2 -0
  372. package/dist/progress/progress-indicator.mjs.map +1 -1
  373. package/dist/progress/progress-label.d.mts +11 -0
  374. package/dist/progress/progress-label.d.mts.map +1 -1
  375. package/dist/progress/progress-label.mjs +2 -0
  376. package/dist/progress/progress-label.mjs.map +1 -1
  377. package/dist/progress/progress-root.d.mts +36 -8
  378. package/dist/progress/progress-root.d.mts.map +1 -1
  379. package/dist/progress/progress-root.mjs +2 -0
  380. package/dist/progress/progress-root.mjs.map +1 -1
  381. package/dist/progress/progress-track.d.mts +11 -0
  382. package/dist/progress/progress-track.d.mts.map +1 -1
  383. package/dist/progress/progress-track.mjs +2 -0
  384. package/dist/progress/progress-track.mjs.map +1 -1
  385. package/dist/progress/progress-value.d.mts +15 -1
  386. package/dist/progress/progress-value.d.mts.map +1 -1
  387. package/dist/progress/progress-value.mjs +2 -0
  388. package/dist/progress/progress-value.mjs.map +1 -1
  389. package/dist/radio-group/index.d.mts +2 -0
  390. package/dist/radio-group/index.d.mts.map +1 -1
  391. package/dist/radio-group/index.mjs +2 -0
  392. package/dist/radio-group/index.mjs.map +1 -1
  393. package/dist/radio-group/radio-group-item.d.mts +18 -1
  394. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  395. package/dist/radio-group/radio-group-item.mjs +2 -0
  396. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  397. package/dist/radio-group/radio-group-label.d.mts +10 -0
  398. package/dist/radio-group/radio-group-label.d.mts.map +1 -1
  399. package/dist/radio-group/radio-group-label.mjs +2 -0
  400. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  401. package/dist/radio-group/radio-group-root.d.mts +29 -5
  402. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  403. package/dist/radio-group/radio-group-root.mjs +2 -0
  404. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  405. package/dist/select/index.d.mts +2 -0
  406. package/dist/select/index.d.mts.map +1 -1
  407. package/dist/select/index.mjs +2 -0
  408. package/dist/select/index.mjs.map +1 -1
  409. package/dist/select/select-group-label.d.mts +10 -0
  410. package/dist/select/select-group-label.d.mts.map +1 -1
  411. package/dist/select/select-group-label.mjs +2 -0
  412. package/dist/select/select-group-label.mjs.map +1 -1
  413. package/dist/select/select-group.d.mts +15 -1
  414. package/dist/select/select-group.d.mts.map +1 -1
  415. package/dist/select/select-group.mjs +2 -0
  416. package/dist/select/select-group.mjs.map +1 -1
  417. package/dist/select/select-option.d.mts +19 -1
  418. package/dist/select/select-option.d.mts.map +1 -1
  419. package/dist/select/select-option.mjs +2 -0
  420. package/dist/select/select-option.mjs.map +1 -1
  421. package/dist/select/select-root.d.mts +24 -1
  422. package/dist/select/select-root.d.mts.map +1 -1
  423. package/dist/select/select-root.mjs +2 -0
  424. package/dist/select/select-root.mjs.map +1 -1
  425. package/dist/select/select-separator.d.mts +9 -0
  426. package/dist/select/select-separator.d.mts.map +1 -1
  427. package/dist/select/select-separator.mjs +2 -0
  428. package/dist/select/select-separator.mjs.map +1 -1
  429. package/dist/select/select-trigger.d.mts +9 -0
  430. package/dist/select/select-trigger.d.mts.map +1 -1
  431. package/dist/select/select-trigger.mjs +2 -0
  432. package/dist/select/select-trigger.mjs.map +1 -1
  433. package/dist/select/select-value.d.mts +9 -0
  434. package/dist/select/select-value.d.mts.map +1 -1
  435. package/dist/select/select-value.mjs +2 -0
  436. package/dist/select/select-value.mjs.map +1 -1
  437. package/dist/slider/index.d.mts +2 -0
  438. package/dist/slider/index.d.mts.map +1 -1
  439. package/dist/slider/index.mjs +2 -0
  440. package/dist/slider/index.mjs.map +1 -1
  441. package/dist/slider/slider-indicator.d.mts +12 -0
  442. package/dist/slider/slider-indicator.d.mts.map +1 -1
  443. package/dist/slider/slider-indicator.mjs +2 -0
  444. package/dist/slider/slider-indicator.mjs.map +1 -1
  445. package/dist/slider/slider-label.d.mts +11 -1
  446. package/dist/slider/slider-label.d.mts.map +1 -1
  447. package/dist/slider/slider-label.mjs +2 -0
  448. package/dist/slider/slider-label.mjs.map +1 -1
  449. package/dist/slider/slider-root.d.mts +53 -9
  450. package/dist/slider/slider-root.d.mts.map +1 -1
  451. package/dist/slider/slider-root.mjs +2 -0
  452. package/dist/slider/slider-root.mjs.map +1 -1
  453. package/dist/slider/slider-thumb.d.mts +32 -3
  454. package/dist/slider/slider-thumb.d.mts.map +1 -1
  455. package/dist/slider/slider-thumb.mjs +2 -0
  456. package/dist/slider/slider-thumb.mjs.map +1 -1
  457. package/dist/slider/slider-track.d.mts +17 -0
  458. package/dist/slider/slider-track.d.mts.map +1 -1
  459. package/dist/slider/slider-track.mjs +2 -0
  460. package/dist/slider/slider-track.mjs.map +1 -1
  461. package/dist/slider/slider-value.d.mts +11 -0
  462. package/dist/slider/slider-value.d.mts.map +1 -1
  463. package/dist/slider/slider-value.mjs +2 -0
  464. package/dist/slider/slider-value.mjs.map +1 -1
  465. package/dist/switch/switch.d.mts +23 -3
  466. package/dist/switch/switch.d.mts.map +1 -1
  467. package/dist/switch/switch.mjs +2 -0
  468. package/dist/switch/switch.mjs.map +1 -1
  469. package/dist/tabs/index.d.mts +2 -0
  470. package/dist/tabs/index.d.mts.map +1 -1
  471. package/dist/tabs/index.mjs +2 -0
  472. package/dist/tabs/index.mjs.map +1 -1
  473. package/dist/tabs/tabs-context.d.mts +5 -0
  474. package/dist/tabs/tabs-context.d.mts.map +1 -1
  475. package/dist/tabs/tabs-context.mjs.map +1 -1
  476. package/dist/tabs/tabs-indicator.d.mts +17 -0
  477. package/dist/tabs/tabs-indicator.d.mts.map +1 -1
  478. package/dist/tabs/tabs-indicator.mjs +2 -0
  479. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  480. package/dist/tabs/tabs-list.d.mts +19 -1
  481. package/dist/tabs/tabs-list.d.mts.map +1 -1
  482. package/dist/tabs/tabs-list.mjs +2 -0
  483. package/dist/tabs/tabs-list.mjs.map +1 -1
  484. package/dist/tabs/tabs-panel.d.mts +19 -0
  485. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  486. package/dist/tabs/tabs-panel.mjs +2 -0
  487. package/dist/tabs/tabs-panel.mjs.map +1 -1
  488. package/dist/tabs/tabs-root.d.mts +39 -5
  489. package/dist/tabs/tabs-root.d.mts.map +1 -1
  490. package/dist/tabs/tabs-root.mjs +2 -0
  491. package/dist/tabs/tabs-root.mjs.map +1 -1
  492. package/dist/tabs/tabs-tab.d.mts +22 -1
  493. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  494. package/dist/tabs/tabs-tab.mjs +2 -0
  495. package/dist/tabs/tabs-tab.mjs.map +1 -1
  496. package/dist/toast/index.d.mts +2 -0
  497. package/dist/toast/index.d.mts.map +1 -1
  498. package/dist/toast/index.mjs +2 -0
  499. package/dist/toast/index.mjs.map +1 -1
  500. package/dist/toast/toast-action.d.mts +28 -3
  501. package/dist/toast/toast-action.d.mts.map +1 -1
  502. package/dist/toast/toast-action.mjs +2 -0
  503. package/dist/toast/toast-action.mjs.map +1 -1
  504. package/dist/toast/toast-close.d.mts +16 -0
  505. package/dist/toast/toast-close.d.mts.map +1 -1
  506. package/dist/toast/toast-close.mjs +2 -0
  507. package/dist/toast/toast-close.mjs.map +1 -1
  508. package/dist/toast/toast-description.d.mts +16 -1
  509. package/dist/toast/toast-description.d.mts.map +1 -1
  510. package/dist/toast/toast-description.mjs +2 -0
  511. package/dist/toast/toast-description.mjs.map +1 -1
  512. package/dist/toast/toast-root.d.mts +20 -0
  513. package/dist/toast/toast-root.d.mts.map +1 -1
  514. package/dist/toast/toast-root.mjs +2 -0
  515. package/dist/toast/toast-root.mjs.map +1 -1
  516. package/dist/toast/toast-title.d.mts +15 -1
  517. package/dist/toast/toast-title.d.mts.map +1 -1
  518. package/dist/toast/toast-title.mjs +2 -0
  519. package/dist/toast/toast-title.mjs.map +1 -1
  520. package/dist/toast/toast-viewport.d.mts +34 -5
  521. package/dist/toast/toast-viewport.d.mts.map +1 -1
  522. package/dist/toast/toast-viewport.mjs +6 -5
  523. package/dist/toast/toast-viewport.mjs.map +1 -1
  524. package/dist/toast/toast.d.mts +46 -6
  525. package/dist/toast/toast.d.mts.map +1 -1
  526. package/dist/toast/toast.mjs +4 -0
  527. package/dist/toast/toast.mjs.map +1 -1
  528. package/dist/toggle/toggle.d.mts +20 -2
  529. package/dist/toggle/toggle.d.mts.map +1 -1
  530. package/dist/toggle/toggle.mjs +2 -0
  531. package/dist/toggle/toggle.mjs.map +1 -1
  532. package/dist/toggle-group/index.d.mts +2 -0
  533. package/dist/toggle-group/index.d.mts.map +1 -1
  534. package/dist/toggle-group/index.mjs +2 -0
  535. package/dist/toggle-group/index.mjs.map +1 -1
  536. package/dist/toggle-group/toggle-group-context.d.mts +1 -0
  537. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  538. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  539. package/dist/toggle-group/toggle-group-item.d.mts +16 -0
  540. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  541. package/dist/toggle-group/toggle-group-item.mjs +2 -0
  542. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  543. package/dist/toggle-group/toggle-group-root.d.mts +73 -12
  544. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  545. package/dist/toggle-group/toggle-group-root.mjs +6 -5
  546. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  547. package/dist/toolbar/index.d.mts +2 -0
  548. package/dist/toolbar/index.d.mts.map +1 -1
  549. package/dist/toolbar/index.mjs +2 -0
  550. package/dist/toolbar/index.mjs.map +1 -1
  551. package/dist/toolbar/toolbar-root.d.mts +30 -3
  552. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  553. package/dist/toolbar/toolbar-root.mjs +2 -0
  554. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  555. package/dist/toolbar/toolbar-separator.d.mts +13 -0
  556. package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
  557. package/dist/toolbar/toolbar-separator.mjs +2 -0
  558. package/dist/toolbar/toolbar-separator.mjs.map +1 -1
  559. package/dist/tooltip/index.d.mts +2 -0
  560. package/dist/tooltip/index.d.mts.map +1 -1
  561. package/dist/tooltip/index.mjs +2 -0
  562. package/dist/tooltip/index.mjs.map +1 -1
  563. package/dist/tooltip/tooltip-arrow.d.mts +16 -0
  564. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
  565. package/dist/tooltip/tooltip-arrow.mjs +2 -0
  566. package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
  567. package/dist/tooltip/tooltip-context.d.mts +4 -0
  568. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  569. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  570. package/dist/tooltip/tooltip-popup.d.mts +24 -3
  571. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  572. package/dist/tooltip/tooltip-popup.mjs +2 -0
  573. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  574. package/dist/tooltip/tooltip-root.d.mts +24 -2
  575. package/dist/tooltip/tooltip-root.d.mts.map +1 -1
  576. package/dist/tooltip/tooltip-root.mjs +2 -0
  577. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  578. package/dist/tooltip/tooltip-trigger.d.mts +18 -1
  579. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  580. package/dist/tooltip/tooltip-trigger.mjs +2 -0
  581. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  582. package/package.json +9 -1
  583. package/skills/funstack-ui-knowledge/SKILL.md +75 -0
  584. package/dist/internal/invoker-press.mjs.map +0 -1
@@ -0,0 +1,635 @@
1
+ # Combobox
2
+
3
+ A text input with a listbox of suggestions (the WAI-ARIA "editable combobox with list autocomplete"). Focus stays in the input; the active option moves with `aria-activedescendant`. The listbox is a `popover="auto"` anchored to the input with CSS, so the platform provides the top layer, light dismiss, Escape and nesting inside dialogs. The library filters nothing: you render the options for a query, synchronously or with `use()` under your own `<Suspense>`.
4
+
5
+ ```tsx title="ComboboxCountry.tsx"
6
+ "use client";
7
+ import { Suspense, startTransition, use, useState } from "react";
8
+ import { Combobox } from "@funstack/ui/combobox";
9
+ import { DemoErrorBoundary } from "./DemoErrorBoundary.js";
10
+ import { fakeSave, sleep } from "./fake-api.js";
11
+
12
+ interface Country {
13
+ readonly code: string;
14
+ readonly name: string;
15
+ }
16
+
17
+ const COUNTRIES: readonly Country[] = [
18
+ { code: "ar", name: "Argentina" },
19
+ { code: "au", name: "Australia" },
20
+ { code: "br", name: "Brazil" },
21
+ { code: "ca", name: "Canada" },
22
+ { code: "fr", name: "France" },
23
+ { code: "de", name: "Germany" },
24
+ { code: "in", name: "India" },
25
+ { code: "jm", name: "Jamaica" },
26
+ { code: "jp", name: "Japan" },
27
+ { code: "je", name: "Jersey" },
28
+ { code: "ke", name: "Kenya" },
29
+ { code: "mx", name: "Mexico" },
30
+ { code: "nz", name: "New Zealand" },
31
+ { code: "no", name: "Norway" },
32
+ { code: "es", name: "Spain" },
33
+ { code: "gb", name: "United Kingdom" },
34
+ ];
35
+
36
+ // A pretend search API with a cache keyed by query: one promise per query, read with `use()`.
37
+ // Results arrive in random order; React only ever renders the latest query's.
38
+ const cache = new Map<string, Promise<readonly Country[]>>();
39
+ function searchCountries(query: string): Promise<readonly Country[]> {
40
+ const key = query.trim().toLowerCase();
41
+ let promise = cache.get(key);
42
+ if (promise === undefined) {
43
+ promise = sleep(300 + Math.random() * 500).then(() =>
44
+ COUNTRIES.filter((c) => c.name.toLowerCase().includes(key)),
45
+ );
46
+ cache.set(key, promise);
47
+ }
48
+ return promise;
49
+ }
50
+
51
+ function CountryOptions({ query }: { query: string }) {
52
+ const countries = use(searchCountries(query));
53
+ return countries.map((c) => (
54
+ <Combobox.Option key={c.code} value={c.code} label={c.name}>
55
+ {({ pending }) => (
56
+ <>
57
+ {c.name}
58
+ {pending && <span className="demo-spinner" aria-hidden />}
59
+ </>
60
+ )}
61
+ </Combobox.Option>
62
+ ));
63
+ }
64
+
65
+ export function ComboboxCountry() {
66
+ const [country, setCountry] = useState<string | null>(null);
67
+ const [fail, setFail] = useState(false);
68
+ return (
69
+ <div className="demo-stack">
70
+ <DemoErrorBoundary>
71
+ <Combobox.Root
72
+ valueChangeAction={async (next) => {
73
+ await fakeSave(`country ${next}`, { fail });
74
+ startTransition(() => setCountry(next));
75
+ }}
76
+ >
77
+ <Combobox.Label>Country</Combobox.Label>
78
+ <div className="demo-combobox-field">
79
+ <Combobox.Input className="demo-combobox-input" placeholder="Type to search" />
80
+ <Combobox.Clear className="demo-combobox-icon demo-combobox-clear" aria-label="Clear">
81
+ ×
82
+ </Combobox.Clear>
83
+ <Combobox.Trigger className="demo-combobox-icon" aria-label="Show countries">
84
+ ▾
85
+ </Combobox.Trigger>
86
+ <Combobox.Popup
87
+ className="demo-combobox-popup"
88
+ transition={{
89
+ "fsui-combobox-open": "demo-combobox-pop",
90
+ "fsui-combobox-close": "demo-combobox-pop",
91
+ default: "none",
92
+ }}
93
+ >
94
+ <Combobox.List>
95
+ {({ query }) => (
96
+ <Suspense
97
+ fallback={
98
+ <Combobox.Status className="demo-combobox-status">Searching…</Combobox.Status>
99
+ }
100
+ >
101
+ <CountryOptions query={query} />
102
+ </Suspense>
103
+ )}
104
+ </Combobox.List>
105
+ <Combobox.Empty className="demo-combobox-status">No country matches.</Combobox.Empty>
106
+ </Combobox.Popup>
107
+ </div>
108
+ </Combobox.Root>
109
+ </DemoErrorBoundary>
110
+ <label>
111
+ <input type="checkbox" checked={fail} onChange={(e) => setFail(e.target.checked)} /> Make
112
+ the save fail
113
+ </label>
114
+ <output className="demo-readout">
115
+ saved: <code>{JSON.stringify(country)}</code>
116
+ </output>
117
+ </div>
118
+ );
119
+ }
120
+ ```
121
+
122
+ ```css title="combobox.css"
123
+ /* Combobox: the Input is a text field with role="combobox"; the Popup is a <div popover="auto">
124
+ placed below it by the library's inline anchor positioning; the List inside is the listbox.
125
+ The active option (virtual focus) carries `data-active`, the selected one `data-selected`, the
126
+ one being saved `data-pending`; stale results carry `data-stale` on the Popup and the List. */
127
+
128
+ .demo-combobox-field {
129
+ display: inline-flex;
130
+ align-items: center;
131
+ gap: 2px;
132
+ padding-inline-end: 2px;
133
+ border: 1px solid var(--color-border);
134
+ border-radius: 6px;
135
+ background: var(--color-bg);
136
+ }
137
+ .demo-combobox-field:focus-within {
138
+ outline: 2px solid var(--color-primary);
139
+ outline-offset: 1px;
140
+ }
141
+ .demo-combobox-input {
142
+ min-inline-size: 14rem;
143
+ padding: 0.4em 0.6em;
144
+ border: 0;
145
+ outline: none;
146
+ background: transparent;
147
+ color: var(--color-text);
148
+ font: inherit;
149
+ }
150
+ .demo-combobox-input[data-pending] {
151
+ cursor: progress;
152
+ }
153
+ .demo-combobox-icon {
154
+ padding: 0.2em 0.45em;
155
+ border: 0;
156
+ background: none;
157
+ color: var(--color-text-secondary);
158
+ font: inherit;
159
+ cursor: pointer;
160
+ }
161
+ /* Nothing to clear: hide Clear (the input shows its placeholder when empty). */
162
+ .demo-combobox-field:has(.demo-combobox-input:placeholder-shown) .demo-combobox-clear {
163
+ visibility: hidden;
164
+ }
165
+
166
+ .demo-combobox-popup {
167
+ /* The popover UA stylesheet sets `inset: 0; margin: auto`: reset both for anchored placement. */
168
+ margin: 0;
169
+ margin-block-start: 4px;
170
+ inset: auto;
171
+ max-block-size: 16rem;
172
+ overflow: auto;
173
+ padding: 4px;
174
+ border: 1px solid var(--color-border);
175
+ border-radius: 8px;
176
+ background: var(--color-bg);
177
+ color: var(--color-text);
178
+ box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
179
+ /* CSS enter / exit, used by dismissals (Escape, a click outside). */
180
+ opacity: 0;
181
+ transition:
182
+ opacity 120ms,
183
+ display 120ms allow-discrete,
184
+ overlay 120ms allow-discrete;
185
+ }
186
+ .demo-combobox-popup:popover-open {
187
+ opacity: 1;
188
+ }
189
+ @starting-style {
190
+ .demo-combobox-popup:popover-open {
191
+ opacity: 0;
192
+ }
193
+ }
194
+
195
+ /* Old results while the next ones load. */
196
+ .demo-combobox-popup [role="listbox"][data-stale] {
197
+ opacity: 0.55;
198
+ transition: opacity 150ms 100ms;
199
+ }
200
+ .demo-combobox-popup [role="option"] {
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: space-between;
204
+ gap: 1rem;
205
+ padding: 6px 10px;
206
+ border-radius: 4px;
207
+ cursor: default;
208
+ }
209
+ /* Virtual focus; hovering makes an option active too, so this is the hover style as well. */
210
+ .demo-combobox-popup [role="option"][data-active] {
211
+ background: var(--color-bg-secondary);
212
+ }
213
+ .demo-combobox-popup [role="option"][data-selected]::after {
214
+ content: "✓";
215
+ color: var(--color-primary);
216
+ }
217
+ .demo-combobox-popup [role="option"][data-pending] {
218
+ cursor: progress;
219
+ }
220
+ .demo-combobox-status {
221
+ padding: 6px 10px;
222
+ color: var(--color-text-secondary);
223
+ }
224
+
225
+ /* The library's view transition types: animate the library-driven open and close, nothing else
226
+ (a results change would cross-fade otherwise). */
227
+ ::view-transition-old(.demo-combobox-pop) {
228
+ animation: 120ms ease-in both demo-combobox-out;
229
+ }
230
+ ::view-transition-new(.demo-combobox-pop) {
231
+ animation: 120ms ease-out both demo-combobox-in;
232
+ }
233
+ @keyframes demo-combobox-out {
234
+ to {
235
+ opacity: 0;
236
+ }
237
+ }
238
+ @keyframes demo-combobox-in {
239
+ from {
240
+ opacity: 0;
241
+ }
242
+ }
243
+
244
+ /* Keep the CSS exit for dismissals, but not while a view transition runs (Chromium would
245
+ capture a fading listbox twice). */
246
+ html:active-view-transition .demo-combobox-popup {
247
+ transition: none;
248
+ }
249
+
250
+ @media (prefers-reduced-motion: reduce) {
251
+ .demo-combobox-popup {
252
+ transition: none;
253
+ }
254
+ }
255
+ ```
256
+
257
+ ## Anatomy
258
+
259
+ ```tsx
260
+ import { Combobox } from "@funstack/ui/combobox";
261
+
262
+ <Combobox.Root name="country" valueChangeAction={saveCountry}> {/* no DOM; a hidden input with name */}
263
+ <Combobox.Label>Country</Combobox.Label> {/* label[for] */}
264
+ <Combobox.Input placeholder="Type to search" required /> {/* input[role=combobox] */}
265
+ <Combobox.Clear aria-label="Clear" /> {/* button, optional */}
266
+ <Combobox.Trigger aria-label="Show all countries" /> {/* button, optional */}
267
+ <Combobox.Popup className="listbox"> {/* div[popover=auto] */}
268
+ <Combobox.List> {/* div[role=listbox] */}
269
+ {({ query }) => (
270
+ <Suspense fallback={<Combobox.Status>Searching…</Combobox.Status>}>
271
+ <CountryOptions query={query} /> {/* Combobox.Option… */}
272
+ </Suspense>
273
+ )}
274
+ </Combobox.List>
275
+ <Combobox.Empty>No country matches.</Combobox.Empty> {/* only when settled and empty */}
276
+ </Combobox.Popup>
277
+ </Combobox.Root>
278
+ ```
279
+
280
+ - **Two states.** `value` (`string | null`) is what is chosen; `inputValue` is what is typed. The library writes the text itself only at defined moments: typing, an accepted option (its `label`, else its text), a revert, Clear, a form reset, and text typed before hydration. It never derives the text from `value`, so a preselected value needs its text too: `<Combobox.Root defaultValue={user.country} defaultInputValue={user.countryName}>` (development warns otherwise).
281
+ - **Popup and List are separate** because a listbox may contain only options and groups: `Empty` and a hint `Status` go in the Popup, outside the List. A `Status` inside the List (the Suspense fallback above) marks the results as loading: it renders with `role="none"` (no live region inside the listbox), the List gets `aria-busy="true"`, `Empty` stays hidden and nothing is announced until the results arrive.
282
+ - **No portal, no positioner.** The Popup is shown with `showPopover({ source: input })`: the input is its implicit anchor, and a press on the input keeps the listbox open (the Input captures the pointer to the Popup; in Firefox a drag-to-select in the field does not extend while the listbox is open). Known hole: in Chromium, a touch tap on the field inside a same-origin iframe (a Storybook or sandbox preview) still closes it (#124, upstream). Render the Popup next to the Input.
283
+ - The listbox is always anchored to the input and opened by the library. The server HTML gives the Trigger no `popovertarget`; after hydration a `<button>` Trigger becomes the listbox's [invoker](../concepts/browser-owned-state.md#popup-triggers) (with every click cancelled), so pressing it while the listbox is open is not a light dismiss, and the browser exposes the listbox's state on it. The Input renders `aria-expanded` itself. Before hydration the input is a plain text field; text typed then is kept and adopted at mount, and nothing opens until the next keystroke.
284
+
285
+ ## How it works
286
+
287
+ ### Typing is urgent; everything it causes is not
288
+
289
+ "Everything is a transition" has one exception, and this is it: React requires a controlled text input to update urgently, in the same event as the keystroke. So the text is the library's first **urgent state**. It keeps the usual pair, `inputValue` / `defaultInputValue`, but its callback is a handler, not an action: `onInputValueChange` ([the urgent lane](../concepts/action-props.md#urgent-lane)) is called synchronously, outside any transition, and never awaited. A controlled parent simply sets its state in the body:
290
+
291
+ ```tsx
292
+ const [text, setText] = useState("");
293
+ <Combobox.Root inputValue={text} onInputValueChange={(next) => setText(next)}>
294
+ ```
295
+
296
+ Everything downstream of the text leaves the urgent lane at once:
297
+
298
+ - **The results** render from `query`, which is `useDeferredValue(inputValue)`. A slow search never blocks a keystroke; the previous results stay on screen (no fallback flash) with `data-stale` and `aria-busy="true"` until the new ones are ready; and only the latest query is ever rendered, so a slow response for "ja" cannot overwrite the results for "jap".
299
+ - **Opening** is a transition (`openChangeAction`).
300
+ - **Choosing** an option is a transition (`valueChangeAction`) with an optimistic selection, exactly as every other value in the library.
301
+
302
+ > **Do not fetch in onInputValueChange**
303
+ >
304
+ > `onInputValueChange={async (q) => setResults(await search(q))}` brings back every problem the deferred query solves: responses land in completion order, nothing marks the results stale, and the urgent handler is not awaited anyway (development warns when it returns a promise). Read a query-keyed cache with `use()` inside the List instead.
305
+
306
+ While any async action is pending in the app (this combobox's own slow save included), React holds every transition. Typing is unaffected (urgent), and so are the results: a deferred render is not held by a pending action (verified in Chromium and Firefox). Opening the listbox while a save is pending is a transition, so it waits for the save: the input shows `data-open` and `data-pending` meanwhile, and its `aria-expanded` turns `"true"` when the listbox is shown.
307
+
308
+ ### Accepting an option
309
+
310
+ Enter on the active option, or a click: the input text becomes the option's label at once, the option gets `data-selected` and `data-pending`, and `valueChangeAction` runs in the Root's transition while the listbox stays open. When it settles the listbox closes in the same commit. A rejection rolls the text and the selection back, leaves the listbox open and reaches the nearest Error Boundary. Re-choosing the selected option dispatches nothing and closes. If you type a new search while the save runs, the listbox stays open when it settles.
311
+
312
+ A controlled "update on success" parent (`startTransition(() => setValue(next))` after its `await`) works as everywhere. A parent that refuses a value gets the text and the selection reverted; the listbox closes anyway, because the close is part of the action's commit.
313
+
314
+ ### Free text
315
+
316
+ ```tsx title="ComboboxDrink.tsx"
317
+ "use client";
318
+ import { useState } from "react";
319
+ import { Combobox } from "@funstack/ui/combobox";
320
+
321
+ const SUGGESTIONS = ["Coffee", "Tea", "Matcha", "Hot chocolate", "Lemonade"];
322
+
323
+ // Free text: `allowCustomValue` makes the typed text the value (Enter with no active
324
+ // suggestion, or leaving the field). The text is controlled with a plain setState in the urgent
325
+ // `onInputValueChange`. `name` puts the value in a hidden input for the form.
326
+ export function ComboboxDrink() {
327
+ const [text, setText] = useState("");
328
+ const [submitted, setSubmitted] = useState<string | null>(null);
329
+ return (
330
+ <form
331
+ className="demo-stack"
332
+ onSubmit={(event) => {
333
+ event.preventDefault();
334
+ setSubmitted(String(new FormData(event.currentTarget).get("drink")));
335
+ }}
336
+ >
337
+ <Combobox.Root
338
+ name="drink"
339
+ allowCustomValue
340
+ inputValue={text}
341
+ onInputValueChange={(next) => setText(next)}
342
+ >
343
+ <Combobox.Label>Favourite drink</Combobox.Label>
344
+ <div className="demo-combobox-field">
345
+ <Combobox.Input className="demo-combobox-input" placeholder="Anything" required />
346
+ <Combobox.Popup className="demo-combobox-popup">
347
+ <Combobox.List>
348
+ {({ query }) =>
349
+ SUGGESTIONS.filter((s) => s.toLowerCase().includes(query.toLowerCase())).map(
350
+ (s) => (
351
+ <Combobox.Option key={s} value={s}>
352
+ {s}
353
+ </Combobox.Option>
354
+ ),
355
+ )
356
+ }
357
+ </Combobox.List>
358
+ <Combobox.Empty className="demo-combobox-status">
359
+ Press Enter to use your own.
360
+ </Combobox.Empty>
361
+ </Combobox.Popup>
362
+ </div>
363
+ </Combobox.Root>
364
+ <div className="demo-row">
365
+ <button type="submit" className="demo-button demo-primary">
366
+ Submit
367
+ </button>
368
+ <output className="demo-readout">
369
+ text: <code>{JSON.stringify(text)}</code>, submitted:{" "}
370
+ <code>{JSON.stringify(submitted)}</code>
371
+ </output>
372
+ </div>
373
+ </form>
374
+ );
375
+ }
376
+ ```
377
+
378
+ `combobox.css`: the same file as above.
379
+
380
+ With `allowCustomValue` the typed text is a value: Enter with no active option, or focus leaving, dispatches it with `details.custom: true` (an emptied text dispatches `null`). Enter on a closed listbox is not prevented, so a form still submits, and the hidden input already holds the new text. Without `allowCustomValue`, text that is not the selection's label reverts when focus leaves (`reason: "dismiss"`), so the field never shows a value it does not have.
381
+
382
+ ## Props
383
+
384
+ ### `Combobox.Root`
385
+
386
+ | Prop | Type | Default | Description |
387
+ | - | - | - | - |
388
+ | `value` | `string \| null` | – | Controlled selection. `null`: nothing selected. `undefined` means uncontrolled. |
389
+ | `defaultValue` | `string \| null` | `null` | Initial selection when uncontrolled; what a form reset returns to. |
390
+ | `valueChangeAction` | `ChangeAction<string \| null, ComboboxValueChangeDetails>` | – | Runs in the Root's transition when the user accepts an option, commits free text, presses Clear, or the form resets. Awaited; the listbox closes in the commit that ends it; a rejection rolls the text and the selection back and leaves the listbox open. May be a Server Function. A `setState` after your own `await` needs `startTransition`. |
391
+ | `inputValue` | `string` | – | Controlled text. `undefined` means uncontrolled. |
392
+ | `defaultInputValue` | `string` | `""` | Initial text when uncontrolled, and the visible input's form-reset target. Pass the selected option's label together with `defaultValue`. |
393
+ | `onInputValueChange` | `UrgentChangeHandler<string, ComboboxInputValueChangeDetails>` | – | A handler, not an action: [the urgent lane](../concepts/action-props.md#urgent-lane), called synchronously, outside any transition, on every change of the text (typing, and the library's own writes). Not awaited, never pending. Set your state in the body. |
394
+ | `open` | `boolean` | – | Controlled open state. `undefined` means uncontrolled. |
395
+ | `defaultOpen` | `boolean` | `false` | Initial open state; opens after hydration. |
396
+ | `openChangeAction` | `ChangeAction<boolean, ComboboxOpenChangeDetails>` | – | Awaited for opens and for the closes the library performs (an accepted option, the Trigger); a notification for dismissals (Escape, a click outside, focus leaving). A [foreign invoker](../concepts/browser-owned-state.md#foreign-invoker) closes it as `"activate"`, a notification; pressing one does not move focus out of the input, so the text is left as typed. |
397
+ | `allowCustomValue` | `boolean` | `false` | Free text is a value (Enter with no active option, focus leaving), dispatched with `details.custom: true`. Otherwise unmatched text reverts when focus leaves. |
398
+ | `autoHighlight` | `boolean` | `false` | Make the first enabled option active when the results for an open or an edit settle (APG automatic selection): typing then Enter picks the first match. Stale results are never highlighted, so an Enter before they settle commits the typed text (`allowCustomValue`) or does nothing. |
399
+ | `openOnClick` | `boolean` | `false` | Open on a click in the input (never on focus alone). |
400
+ | `loop` | `boolean` | `false` | ArrowDown / ArrowUp wrap from the last option to the first and back. |
401
+ | `announce` | `(count: number, state: ComboboxRootState) => string \| null` | `"No results" / "1 result" / "N results"` | The message `ariaNotify()` announces on the List when the results settle. Override for localisation; return `null` to announce nothing. Ignored where `ariaNotify` is missing. |
402
+ | `name` | `string` | – | Renders `<input type="hidden" name>` holding the optimistic value (`""` for `null`), the Root's only element. |
403
+ | `form` | `string` | – | The hidden input's `form` attribute. |
404
+ | `disabled` | `boolean` | `false` | Disables the Input, Trigger and Clear; nothing dispatches for user interaction. The hidden input stays enabled, so the selection still posts (wrap in `<fieldset disabled>` to drop it). |
405
+ | `children` | `ReactNode \| ((state: ComboboxRootState) => ReactNode)` | – | The parts, or a function of the Root's state. |
406
+
407
+ - **State**: `ComboboxRootState` is `{ value, inputValue, query, stale, activeValue, open, pending, disabled }`; `value` and `open` are optimistic; `stale` is `inputValue !== query`; `pending` covers the value and the open transitions.
408
+ - **Owned**: nothing rendered: the Root has no element (no `ref`, `className` or `style`), only the hidden input when `name` is given.
409
+
410
+ `multiple` is not part of this version.
411
+
412
+ `ComboboxValueChangeDetails`: `{ reason, custom, event }`. `reason` is `"activate"` (an accepted option: the `keydown` or `click`; free text: the `keydown` or `focusout`; Clear: the `click`) or `"platform"` (a form reset: the `reset` event). `ComboboxInputValueChangeDetails`: `{ reason, event }`, with `"activate"` for typing (the `input` event), an accepted label and Clear, `"dismiss"` for a revert, `"platform"` for a reset or text found at mount (no event). `ComboboxOpenChangeDetails`: `{ reason, event }`, as Popover's.
413
+
414
+ ### `Combobox.Label`
415
+
416
+ | Prop | Type | Default | Description |
417
+ | - | - | - | - |
418
+ | `className` | `string \| ((state: ComboboxLabelState) => string \| undefined)` | – | A class name, or a function of the part's state. |
419
+ | `style` | `CSSProperties \| ((state: ComboboxLabelState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
420
+ | `children` | `ReactNode \| ((state: ComboboxLabelState) => ReactNode)` | – | Content, or a function of the part's state. |
421
+ | `render` | `ReactElement \| ((props, state: ComboboxLabelState) => ReactNode)` | – | Replace the default \<label> (element form) or take over rendering (function form). |
422
+
423
+ - **State**: `ComboboxLabelState` is `{ disabled }`.
424
+ - **Owned**: `id`, `htmlFor`.
425
+
426
+ A `<label for>` of the Input; its id also names the List (`aria-labelledby`), only while a Label is mounted. Inside a `Field.Root`, `Field.Label` takes that role instead.
427
+
428
+ ### `Combobox.Input`
429
+
430
+ One per Root: the Input is the listbox's anchor, so a second `Combobox.Input` in the same Root is not supported (development warns). Use a Root per input.
431
+
432
+ | Prop | Type | Default | Description |
433
+ | - | - | - | - |
434
+ | `required` | `boolean` | – | Native: an empty text is `valueMissing`, with the browser's message. |
435
+ | `className` | `string \| ((state: ComboboxInputState) => string \| undefined)` | – | A class name, or a function of the part's state. |
436
+ | `style` | `CSSProperties \| ((state: ComboboxInputState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
437
+ | `render` | `ReactElement \| ((props, state: ComboboxInputState) => ReactNode)` | – | Replace the default \<input> (element form) or take over rendering (function form). |
438
+
439
+ - **State**: `ComboboxInputState` is `{ value, inputValue, open, pending, stale, disabled }`.
440
+ - **Owned**: `id`, `type` (`"text"`, or `"search"` when a `render` element says so), `role`, `value`, `autoComplete` (`"off"`), `aria-autocomplete`, `aria-expanded`, `aria-controls`, `aria-activedescendant`, `disabled`, `onChange`, `onKeyDown`, `onFocus`, `onBlur`, `onClick`, `onPointerDown`, `data-open`, `data-pending`, `data-selected`, `data-stale`, `data-disabled`. Inside a `Field.Root` also `required`, `aria-invalid`, `aria-describedby` (token-merged) and `data-invalid`.
441
+
442
+ `placeholder`, `name` (a second field with the raw text), `aria-describedby`, `onFocusCapture` (to react to focus) and other input props pass through. During a primary mouse or pen press while the listbox is open, the Input's `onPointerUp`, `onMouseUp` and `onDoubleClick` go to the Popup instead (the press is captured to it), and the Input gets pointer and mouse leave (then enter) events. A `render` element must stay an `<input>` of type text or search.
443
+
444
+ ### `Combobox.Trigger`, `Combobox.Clear`
445
+
446
+ | Prop | Type | Default | Description |
447
+ | - | - | - | - |
448
+ | `disabled` | `boolean` | `false` | Native `disabled`; the Root's `disabled` applies too. With a link or component `render`, `aria-disabled="true"` instead. |
449
+ | `className` | `string \| ((state: ComboboxTriggerState \| ComboboxClearState) => string \| undefined)` | – | A class name, or a function of the part's state. |
450
+ | `style` | `CSSProperties \| ((state: ComboboxTriggerState \| ComboboxClearState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
451
+ | `children` | `ReactNode \| ((state: ComboboxTriggerState \| ComboboxClearState) => ReactNode)` | – | Content, usually an icon; give the button an `aria-label` (development warns without a name). |
452
+ | `render` | `ReactElement \| ((props, state: ComboboxTriggerState \| ComboboxClearState) => ReactNode)` | – | Replace the default \<button> (element form) or take over rendering (function form). |
453
+
454
+ - **State**: `ComboboxTriggerState` is `{ open, pending, disabled }`; `ComboboxClearState` is `{ value, inputValue, disabled }`.
455
+ - **Owned**: `type` (on a `<button>`), `tabIndex` (`-1`: the input is the one Tab stop), `disabled`, `aria-disabled` (link or component `render`), `onClick`, `onPointerDown`, `onMouseDown`, `data-disabled`; the Trigger also `aria-expanded` (only when it is no invoker: a non-button `render`, or while `aria-disabled`), `aria-controls`, `popovertarget` (written as an attribute after hydration, only on a `<button>`, while enabled or natively disabled; not while `aria-disabled`), `data-open`, `data-pending`. Owned on the Trigger and never written as props: `popoverTarget`, `popoverTargetAction`, `commandfor`, `command`; these and `aria-expanded` are not in its props type.
456
+
457
+ Both keep focus in the input when pressed and focus it when clicked. The Trigger toggles the listbox; on a `<button>` Trigger a click while it is open keeps it shown until `openChangeAction(false)` settles (a controlled parent that keeps `open` sees no flicker). A Trigger rendered as another element is light-dismissed before its click and warns in development ([Triggers of a popup](../concepts/browser-owned-state.md#popup-triggers)). Clear empties the text and dispatches `null` unless nothing is selected; it is always rendered, so hide it with CSS (`:has(input:placeholder-shown)`) or its state. A click on Clear while the listbox is open closes it (light dismiss: the button is outside the popup).
458
+
459
+ ### `Combobox.Popup`
460
+
461
+ | Prop | Type | Default | Description |
462
+ | - | - | - | - |
463
+ | `keepMounted` | `boolean` | `false` | `false`: the children render only while open. `true`: they stay mounted in a hidden `<Activity>`. |
464
+ | `transition` | `ViewTransitionClass` | – | The `<ViewTransition default>` around the popover element. Animates library-driven opens and closes in every engine. A deferred results render activates it too, so use a map with `default: "none"` (below). Keep it static. |
465
+ | `className` | `string \| ((state: ComboboxPopupState) => string \| undefined)` | – | A class name, or a function of the part's state. |
466
+ | `style` | `CSSProperties \| ((state: ComboboxPopupState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
467
+ | `children` | `ReactNode \| ((state: ComboboxPopupState) => ReactNode)` | – | Content, or a function of the part's state. |
468
+ | `render` | `ReactElement \| ((props, state: ComboboxPopupState) => ReactNode)` | – | Replace the default \<div> (element form) or take over rendering (function form). |
469
+
470
+ - **State**: `ComboboxPopupState` is `{ open, stale, query }`; `open` is committed.
471
+ - **Owned**: `id`, `popover` (`"auto"`), `onPointerDown` and `onMouseDown` (a press anywhere in it keeps focus in the input), `data-stale`; no role.
472
+
473
+ Inline style `position-area: self-block-end span-self-inline-end; position-try-fallbacks: flip-block; min-width: anchor-size(width)` places it below the input (above when it does not fit), at least as wide; your `style` wins per property. A `render` element must stay a `<div>`.
474
+
475
+ ### `Combobox.List`
476
+
477
+ | Prop | Type | Default | Description |
478
+ | - | - | - | - |
479
+ | `className` | `string \| ((state: ComboboxListState) => string \| undefined)` | – | A class name, or a function of the part's state. |
480
+ | `style` | `CSSProperties \| ((state: ComboboxListState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
481
+ | `children` | `ReactNode \| ((state: ComboboxListState) => ReactNode)` | – | Usually a function of `{ query }` returning the Options for it, under your own `<Suspense>` for an async search. |
482
+ | `render` | `ReactElement \| ((props, state: ComboboxListState) => ReactNode)` | – | Replace the default \<div> (element form) or take over rendering (function form). |
483
+
484
+ - **State**: `ComboboxListState` is `{ query, stale, empty }`.
485
+ - **Owned**: `id`, `role` (`"listbox"`), `aria-labelledby` (token-merged with yours; only while a `Combobox.Label` is rendered), `aria-busy`, `data-stale`, `data-empty`.
486
+
487
+ Without a Label give the List an `aria-label` (development warns otherwise). `aria-busy="true"` is set while the results are stale or loading (a `Status` fallback inside it); `data-empty` when settled with no options.
488
+
489
+ ### `Combobox.Option`
490
+
491
+ | Prop | Type | Default | Description |
492
+ | - | - | - | - |
493
+ | `value` | `string` | – | Required and unique within the Combobox; the option's id is derived from it, so it keeps its id across result sets. |
494
+ | `label` | `string` | – | The text written into the input when the option is accepted. Default: the option's trimmed text at that moment. Not used for matching. |
495
+ | `disabled` | `boolean` | `false` | `aria-disabled`: shown, skipped by the arrow keys, never accepted. |
496
+ | `className` | `string \| ((state: ComboboxOptionState) => string \| undefined)` | – | A class name, or a function of the part's state. |
497
+ | `style` | `CSSProperties \| ((state: ComboboxOptionState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
498
+ | `children` | `ReactNode \| ((state: ComboboxOptionState) => ReactNode)` | – | Content, or a function of the option's state; must not suspend. |
499
+ | `render` | `ReactElement \| ((props, state: ComboboxOptionState) => ReactNode)` | – | Replace the default \<div> (element form) or take over rendering (function form). |
500
+
501
+ - **State**: `ComboboxOptionState` is `{ value, selected, active, pending, disabled }`; `selected` is optimistic, `active` is virtual focus, `pending` is true on the option being saved.
502
+ - **Owned**: `id` (derived from `value`), `role`, `aria-selected`, `aria-disabled`, `onClick`, `onPointerDown`, `onMouseDown`, `onPointerMove`, `data-selected`, `data-active`, `data-pending`, `data-disabled`.
503
+
504
+ Never focused, no `tabindex`; hovering makes it active.
505
+
506
+ ### `Combobox.Group`, `Combobox.GroupLabel`, `Combobox.Empty`, `Combobox.Status`
507
+
508
+ | Prop | Type | Default | Description |
509
+ | - | - | - | - |
510
+ | `className` | `string \| ((state: {} (Empty: ComboboxListState)) => string \| undefined)` | – | A class name, or a function of the part's state. |
511
+ | `style` | `CSSProperties \| ((state: {} (Empty: ComboboxListState)) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
512
+ | `children` | `ReactNode \| ((state: {} (Empty: ComboboxListState)) => ReactNode)` | – | Content. Empty renders only when the List has no options, the results are not stale and none are loading. |
513
+ | `render` | `ReactElement \| ((props, state) => ReactNode)` | – | Replace the default \<div>. |
514
+
515
+ - **State**: none (Empty: `ComboboxListState`).
516
+ - **Owned**: Group: `role` (`"group"`), `aria-labelledby`; GroupLabel: `id`; Status: `role` (`"none"` inside the List, `"status"` in the Popup).
517
+
518
+ `Group` is named by the `GroupLabel` inside it. `Status` inside the List (as a Suspense fallback) marks the results as loading (the List is `aria-busy`); in the Popup it is a plain hint. `Empty` is a plain `<div>` that renders nothing unless the results are settled and empty, so "No results" never flashes during a search.
519
+
520
+ ## Data attributes
521
+
522
+ | Hook | On | Meaning |
523
+ | - | - | - |
524
+ | `data-open` | Input, Trigger | Optimistic open state. The Input's `aria-expanded` follows the shown listbox instead; a `<button>` Trigger has no `aria-expanded` (the browser exposes its state). |
525
+ | `data-pending` | Input | A selection or an open is in flight (the Root's `pending`). |
526
+ | `data-pending` | Trigger | The open (or close) is in flight. |
527
+ | `data-pending` | Option | The option the in-flight selection is choosing. |
528
+ | `data-selected` | Input | A value is selected (optimistic, not `null`). |
529
+ | `data-selected` | Option | This option is the optimistic selection. |
530
+ | `data-active` | Option | `aria-activedescendant` points here (keyboard or hover). |
531
+ | `data-stale` | Input, Popup, List | The results shown are for an older text; the List also has `aria-busy`. |
532
+ | `data-empty` | List | Settled with no options. |
533
+ | `data-disabled` | Input, Trigger, Clear, Option | Disabled. |
534
+ | `:popover-open` | Popup | The listbox is shown (browser-owned, no attribute). |
535
+
536
+ ## Keyboard and ARIA
537
+
538
+ | Key | Listbox | Behaviour |
539
+ | - | - | - |
540
+ | Typing, Backspace, paste | any | Changes the text (urgent), clears the active option and opens the listbox. |
541
+ | ArrowDown / ArrowUp | closed | Opens with the first / last enabled option active. |
542
+ | ArrowDown / ArrowUp | open | Next / previous enabled option; stops at the ends (wraps with `loop`). |
543
+ | Alt+ArrowDown | closed | Opens with no option active. |
544
+ | Alt+ArrowUp | open | Accepts the active option, or closes. |
545
+ | Enter | open | Accepts the active option; with none, commits free text (`allowCustomValue`) or does nothing. |
546
+ | Enter | closed | Not handled (a form submits); commits changed free text first with `allowCustomValue`. |
547
+ | Escape | open | The platform closes the listbox; focus and text stay. A second Escape reaches an enclosing Dialog or Popover. |
548
+ | Tab / Shift+Tab | any | Focus moves on and the listbox closes; the text reverts or, with `allowCustomValue`, commits. Tab never accepts the active option. |
549
+ | Home / End, Left / Right | any | The input's caret; the active option is cleared (focus is back on the text). |
550
+
551
+ Disabled options are skipped. Keys during an IME composition belong to the composition. Ctrl and Meta combinations are left alone.
552
+
553
+ ### Accessibility and announcements
554
+
555
+ - The Input is `role="combobox"` with `aria-autocomplete="list"`, `aria-expanded`, `aria-controls` (the List) and `aria-activedescendant` (the active option, never a stale id; removed while you edit the text). Name it with `Combobox.Label`, which names the listbox too.
556
+ - When results settle, the library announces their count with `ariaNotify()` on the List: by default the English `"No results"`, `"1 result"`, `"N results"`. Nothing is announced while results are stale or loading (a `Status` fallback showing in the List), or for an unchanged result set. Localise with one function:
557
+
558
+ ```tsx
559
+ <Combobox.Root announce={(n) => (n === 0 ? "該当なし" : `${n}件`)}>
560
+ ```
561
+
562
+ ## Transition types
563
+
564
+ Concept: [Transitions & ViewTransition](../concepts/transitions.md#transition-types)
565
+
566
+ Every value dispatch: `fsui-combobox` and `fsui-combobox-select`. Opens and closes: `fsui-combobox` plus `fsui-combobox-open` or `fsui-combobox-close`. A deferred results render carries no `fsui-*` type, so give the Popup's `transition` a map with `default: "none"`.
567
+
568
+ ## Optimistic and pending
569
+
570
+ Concept: [Pending & optimistic state](../concepts/pending-and-optimistic.md)
571
+
572
+ The selected value and the open state are optimistic (`data-selected` on the Input and the Option). `data-pending` is on the Input while a selection or an open is in flight, on the Trigger while an open or close is, and on the Option being chosen. The typed text is urgent, not optimistic (see [the urgent lane](../concepts/action-props.md#urgent-lane)).
573
+
574
+ ## Suspense
575
+
576
+ Concept: [Suspense](../concepts/suspense.md)
577
+
578
+ Results render from a deferred copy of the text (`useDeferredValue`), so an async search is `use(search(query))` inside a boundary in the List. The first load shows your fallback; after that every keystroke keeps the previous results on screen, marked `data-stale` and `aria-busy`, until the new ones are ready. Only the latest query is ever rendered. Option content must not suspend.
579
+
580
+ ## Browser-owned state
581
+
582
+ Concept: [Browser-owned state](../concepts/browser-owned-state.md)
583
+
584
+ The listbox is a popover: a dismissal (Escape, a click outside, another popover opening) is the browser's. Focus leaving the input is closed by the library but reported the same way. Either way `openChangeAction(false)` is a notification with `reason: "dismiss"`.
585
+
586
+ ## Before hydration
587
+
588
+ Concept: [Server Components](../concepts/server-components.md#before-hydration)
589
+
590
+ A plain text field: typing works and the form posts the default selection (and the raw text, if the Input has a `name`). The listbox never opens before hydration. Text typed then is kept and reported once, with `reason: "platform"`.
591
+
592
+ ## Forms
593
+
594
+ - `name` on the Root posts the value through a hidden input (`""` for `null`); a `name` on the Input posts the raw text as well. `required` on the Input is native.
595
+ - A form reset (the Reset button, `form.reset()`, or React's automatic reset after a form action) dispatches `valueChangeAction` with `reason: "platform"` and writes the text: uncontrolled, back to the latest `defaultValue` / `defaultInputValue`; controlled, to the mount-time values.
596
+ - Text typed before hydration (and Firefox's form restoration) is kept and reported once through `onInputValueChange` with `reason: "platform"`.
597
+
598
+ ## Styling
599
+
600
+ ```css
601
+ .listbox { margin: 0; inset: auto; max-block-size: 20rem; overflow: auto; }
602
+ .listbox [role="listbox"][data-stale] { opacity: .6; } /* old results while searching */
603
+ .listbox [role="option"][data-active] { background: var(--accent-weak); }
604
+ .listbox [role="option"][data-selected]::after { content: "✓"; }
605
+ .listbox [role="option"][data-pending] { cursor: progress; }
606
+ .combobox-input:user-invalid { border-color: var(--danger); }
607
+
608
+ /* Enter / exit for dismissals too (Escape, a click outside). */
609
+ .listbox { opacity: 0; transition: opacity 120ms, display 120ms allow-discrete, overlay 120ms allow-discrete; }
610
+ .listbox:popover-open { opacity: 1; }
611
+ @starting-style { .listbox:popover-open { opacity: 0; } }
612
+ ```
613
+
614
+ `transition` on the Popup animates the library's own opens and closes with a view transition in every engine (including the close after an accepted option, which shows the pending option until it fades). A results change is a deferred render, and React runs a view transition for it too, during which the page takes no pointer input. Unless every results change should cross-fade, give it a type map:
615
+
616
+ ```tsx
617
+ <Combobox.Popup
618
+ transition={{ "fsui-combobox-open": "pop", "fsui-combobox-close": "pop", default: "none" }}
619
+ >
620
+ ```
621
+
622
+ Types: every value dispatch adds `fsui-combobox` and `fsui-combobox-select`; opens and closes add `fsui-combobox-open` / `fsui-combobox-close`.
623
+
624
+ With both the CSS exit above and `transition`, turn the CSS exit off while a view transition runs ([A popup with a CSS exit and a view transition](../concepts/transitions.md#css-exit)):
625
+
626
+ ```css
627
+ html:active-view-transition .listbox { transition: none; }
628
+ ```
629
+
630
+ ## Browser notes
631
+
632
+ - **Right-to-left:** the listbox lines up with the input's inline-start edge (the right edge in RTL) under a `dir="rtl"` page or container. The `self-*` `position-area` keywords follow the popup's own inherited direction, with no JavaScript; plain logical keywords would follow the root's only, because the listbox is in the top layer. Firefox misplaces a popover inside a direction island ([#89](https://github.com/uhyo/funstack-ui/issues/89); see [Tooltip](tooltip.md#browser-notes)). The Popup emits no `data-side`.
633
+ - Inside a Dialog or a Popover the listbox nests in the top layer: the first Escape closes the listbox, the next the outer overlay; an outside click closes the stack. Inside a `Menu.Popup` a combobox is not supported (the menu's typeahead and focus handling compete with the input).
634
+ - Safari: a WebKit bug (302008) can hang a page that opens a popover with position fallbacks inside another popover. If a Combobox inside a Popover or Dialog misbehaves in Safari, turn the flip off: `style={{ positionTryFallbacks: "none" }}` on `Combobox.Popup`.
635
+ - Want the listbox as wide as an input-plus-buttons group? Give the group an `anchor-name` and pass `positionAnchor` and `minWidth: "anchor-size(--group width)"` through `style`.