@bigbinary/neeto-atoms 1.0.9 → 1.0.11

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 (614) hide show
  1. package/dist/Accordion-Ch9S_qd3.js +22 -0
  2. package/dist/Accordion-Ch9S_qd3.js.map +1 -0
  3. package/dist/Alert-D_FV8xxo.js +65 -0
  4. package/dist/Alert-D_FV8xxo.js.map +1 -0
  5. package/dist/Avatar-D5YGlXVF.js +50 -0
  6. package/dist/Avatar-D5YGlXVF.js.map +1 -0
  7. package/dist/Badge-8FkscqDt.js +59 -0
  8. package/dist/Badge-8FkscqDt.js.map +1 -0
  9. package/dist/Button-Q7MPG6ph.js +92 -0
  10. package/dist/Button-Q7MPG6ph.js.map +1 -0
  11. package/dist/Calendar-pDD7nRF-.js +8025 -0
  12. package/dist/Calendar-pDD7nRF-.js.map +1 -0
  13. package/dist/Callout-B0w4GQtx.js +65 -0
  14. package/dist/Callout-B0w4GQtx.js.map +1 -0
  15. package/dist/Checkbox-zCxgcZiC.js +24 -0
  16. package/dist/Checkbox-zCxgcZiC.js.map +1 -0
  17. package/dist/{ColorPicker-D-7QGnf9.js → ColorPicker-DtOvy0Gy.js} +3 -2
  18. package/dist/ColorPicker-DtOvy0Gy.js.map +1 -0
  19. package/dist/DatePicker-COxwHPIZ.js +2960 -0
  20. package/dist/DatePicker-COxwHPIZ.js.map +1 -0
  21. package/dist/Dialog-BURSzxaP.js +61 -0
  22. package/dist/Dialog-BURSzxaP.js.map +1 -0
  23. package/dist/Empty-B2JwFmru.js +26 -0
  24. package/dist/Empty-B2JwFmru.js.map +1 -0
  25. package/dist/Input-C1gcv9o2.js +147 -0
  26. package/dist/Input-C1gcv9o2.js.map +1 -0
  27. package/dist/Kbd-EqbC0bua.js +36 -0
  28. package/dist/Kbd-EqbC0bua.js.map +1 -0
  29. package/dist/Label-BVy4hy9Z.js +58 -0
  30. package/dist/Label-BVy4hy9Z.js.map +1 -0
  31. package/dist/MultiEmailInput-SCTYovtX.js +139 -0
  32. package/dist/MultiEmailInput-SCTYovtX.js.map +1 -0
  33. package/dist/Pagination-DSc9yXPy.js +61 -0
  34. package/dist/Pagination-DSc9yXPy.js.map +1 -0
  35. package/dist/Popover-BFMrtVPq.js +95 -0
  36. package/dist/Popover-BFMrtVPq.js.map +1 -0
  37. package/dist/Progress-B9NlUm6e.js +13 -0
  38. package/dist/Progress-B9NlUm6e.js.map +1 -0
  39. package/dist/RadioGroup-BNeYQAoT.js +34 -0
  40. package/dist/RadioGroup-BNeYQAoT.js.map +1 -0
  41. package/dist/Select-TlFBcxcY.js +565 -0
  42. package/dist/Select-TlFBcxcY.js.map +1 -0
  43. package/dist/{components/SelectFieldWrapper.js → SelectFieldWrapper-BJzq9aCY.js} +3 -11
  44. package/dist/SelectFieldWrapper-BJzq9aCY.js.map +1 -0
  45. package/dist/Sheet-QFC_mHyj.js +63 -0
  46. package/dist/Sheet-QFC_mHyj.js.map +1 -0
  47. package/dist/Slider-BCQXhs0Q.js +25 -0
  48. package/dist/Slider-BCQXhs0Q.js.map +1 -0
  49. package/dist/Spinner-C8HSac-2.js +17 -0
  50. package/dist/Spinner-C8HSac-2.js.map +1 -0
  51. package/dist/Stepper-BoGkmkY0.js +29 -0
  52. package/dist/Stepper-BoGkmkY0.js.map +1 -0
  53. package/dist/Switch-B83TGxJ_.js +20 -0
  54. package/dist/Switch-B83TGxJ_.js.map +1 -0
  55. package/dist/Tabs-DWfKnl3S.js +38 -0
  56. package/dist/Tabs-DWfKnl3S.js.map +1 -0
  57. package/dist/Textarea-C0z50h0N.js +73 -0
  58. package/dist/Textarea-C0z50h0N.js.map +1 -0
  59. package/dist/TimePicker-C4x62jI1.js +142 -0
  60. package/dist/TimePicker-C4x62jI1.js.map +1 -0
  61. package/dist/TimePickerPanel-CiF0RExY.js +126 -0
  62. package/dist/TimePickerPanel-CiF0RExY.js.map +1 -0
  63. package/dist/Toastr-DYqpSaMd.js +115 -0
  64. package/dist/Toastr-DYqpSaMd.js.map +1 -0
  65. package/dist/Tooltip-DhwIZnOU.js +80 -0
  66. package/dist/Tooltip-DhwIZnOU.js.map +1 -0
  67. package/dist/TranslationProvider-Ba9rn47H.js.map +1 -1
  68. package/dist/Tree-C7r10UY5.js +7977 -0
  69. package/dist/Tree-C7r10UY5.js.map +1 -0
  70. package/dist/TreeSelect-DRGcYz-6.js +168 -0
  71. package/dist/TreeSelect-DRGcYz-6.js.map +1 -0
  72. package/dist/Typography-CMJ8OveZ.js +76 -0
  73. package/dist/Typography-CMJ8OveZ.js.map +1 -0
  74. package/dist/cjs/Accordion-BoTckTBI.js +28 -0
  75. package/dist/cjs/Accordion-BoTckTBI.js.map +1 -0
  76. package/dist/cjs/Alert-BVvLyM_d.js +67 -0
  77. package/dist/cjs/Alert-BVvLyM_d.js.map +1 -0
  78. package/dist/cjs/Avatar-CNao5gvP.js +52 -0
  79. package/dist/cjs/Avatar-CNao5gvP.js.map +1 -0
  80. package/dist/cjs/Badge-STBHzYLs.js +61 -0
  81. package/dist/cjs/Badge-STBHzYLs.js.map +1 -0
  82. package/dist/cjs/Button-Bt_AElge.js +94 -0
  83. package/dist/cjs/Button-Bt_AElge.js.map +1 -0
  84. package/dist/cjs/Calendar-Nk76Y9yP.js +8066 -0
  85. package/dist/cjs/Calendar-Nk76Y9yP.js.map +1 -0
  86. package/dist/cjs/Callout-CS2U6pM7.js +67 -0
  87. package/dist/cjs/Callout-CS2U6pM7.js.map +1 -0
  88. package/dist/cjs/Checkbox-DOlS2oCD.js +26 -0
  89. package/dist/cjs/Checkbox-DOlS2oCD.js.map +1 -0
  90. package/dist/cjs/{ColorPicker-DEELmqH8.js → ColorPicker-Uxgn8U0h.js} +3 -2
  91. package/dist/cjs/ColorPicker-Uxgn8U0h.js.map +1 -0
  92. package/dist/cjs/DatePicker-DpijPndg.js +2962 -0
  93. package/dist/cjs/DatePicker-DpijPndg.js.map +1 -0
  94. package/dist/cjs/Dialog-CtI_yWsJ.js +63 -0
  95. package/dist/cjs/Dialog-CtI_yWsJ.js.map +1 -0
  96. package/dist/cjs/Empty-qzle6YvT.js +28 -0
  97. package/dist/cjs/Empty-qzle6YvT.js.map +1 -0
  98. package/dist/cjs/Input-pkugjUb0.js +149 -0
  99. package/dist/cjs/Input-pkugjUb0.js.map +1 -0
  100. package/dist/cjs/Kbd-DHirsI--.js +38 -0
  101. package/dist/cjs/Kbd-DHirsI--.js.map +1 -0
  102. package/dist/cjs/Label-DpyfZsiT.js +60 -0
  103. package/dist/cjs/Label-DpyfZsiT.js.map +1 -0
  104. package/dist/cjs/MultiEmailInput-l0_YVjbp.js +141 -0
  105. package/dist/cjs/MultiEmailInput-l0_YVjbp.js.map +1 -0
  106. package/dist/cjs/Pagination-Byzt9Kmj.js +63 -0
  107. package/dist/cjs/Pagination-Byzt9Kmj.js.map +1 -0
  108. package/dist/cjs/Popover-LIxANoTc.js +101 -0
  109. package/dist/cjs/Popover-LIxANoTc.js.map +1 -0
  110. package/dist/cjs/Progress-DoCxZ_ZH.js +15 -0
  111. package/dist/cjs/Progress-DoCxZ_ZH.js.map +1 -0
  112. package/dist/cjs/RadioGroup-1RAoe38m.js +36 -0
  113. package/dist/cjs/RadioGroup-1RAoe38m.js.map +1 -0
  114. package/dist/cjs/Select-Br1AT_wm.js +571 -0
  115. package/dist/cjs/Select-Br1AT_wm.js.map +1 -0
  116. package/dist/cjs/{components/SelectFieldWrapper.js → SelectFieldWrapper-DEA--2wj.js} +2 -10
  117. package/dist/cjs/SelectFieldWrapper-DEA--2wj.js.map +1 -0
  118. package/dist/cjs/Sheet-CIhtNCBV.js +65 -0
  119. package/dist/cjs/Sheet-CIhtNCBV.js.map +1 -0
  120. package/dist/cjs/Slider-jNUS9vt8.js +27 -0
  121. package/dist/cjs/Slider-jNUS9vt8.js.map +1 -0
  122. package/dist/cjs/Spinner-DQutDMQq.js +19 -0
  123. package/dist/cjs/Spinner-DQutDMQq.js.map +1 -0
  124. package/dist/cjs/Stepper-DCoLl2ZS.js +35 -0
  125. package/dist/cjs/Stepper-DCoLl2ZS.js.map +1 -0
  126. package/dist/cjs/Switch-CFf8DtB_.js +22 -0
  127. package/dist/cjs/Switch-CFf8DtB_.js.map +1 -0
  128. package/dist/cjs/Tabs-D2247rd7.js +40 -0
  129. package/dist/cjs/Tabs-D2247rd7.js.map +1 -0
  130. package/dist/cjs/Textarea-BfdlAJ59.js +75 -0
  131. package/dist/cjs/Textarea-BfdlAJ59.js.map +1 -0
  132. package/dist/cjs/TimePicker-Ba2FdT1O.js +144 -0
  133. package/dist/cjs/TimePicker-Ba2FdT1O.js.map +1 -0
  134. package/dist/cjs/TimePickerPanel-DGNr97cj.js +132 -0
  135. package/dist/cjs/TimePickerPanel-DGNr97cj.js.map +1 -0
  136. package/dist/cjs/Toastr-BGp7-kmf.js +117 -0
  137. package/dist/cjs/Toastr-BGp7-kmf.js.map +1 -0
  138. package/dist/cjs/Tooltip-CtxI7QBY.js +86 -0
  139. package/dist/cjs/Tooltip-CtxI7QBY.js.map +1 -0
  140. package/dist/cjs/TranslationProvider-DBZHXmzX.js.map +1 -1
  141. package/dist/cjs/Tree-BPd0DuLh.js +7985 -0
  142. package/dist/cjs/Tree-BPd0DuLh.js.map +1 -0
  143. package/dist/cjs/TreeSelect-C9nQJKNo.js +170 -0
  144. package/dist/cjs/TreeSelect-C9nQJKNo.js.map +1 -0
  145. package/dist/cjs/Typography-PojQmdAY.js +79 -0
  146. package/dist/cjs/Typography-PojQmdAY.js.map +1 -0
  147. package/dist/cjs/components/Accordion.js +6 -28
  148. package/dist/cjs/components/Accordion.js.map +1 -1
  149. package/dist/cjs/components/Alert.js +9 -70
  150. package/dist/cjs/components/Alert.js.map +1 -1
  151. package/dist/cjs/components/Avatar.js +8 -51
  152. package/dist/cjs/components/Avatar.js.map +1 -1
  153. package/dist/cjs/components/Badge.js +10 -64
  154. package/dist/cjs/components/Badge.js.map +1 -1
  155. package/dist/cjs/components/Button.js +10 -94
  156. package/dist/cjs/components/Button.js.map +1 -1
  157. package/dist/cjs/components/Callout.js +9 -66
  158. package/dist/cjs/components/Callout.js.map +1 -1
  159. package/dist/cjs/components/Checkbox.js +8 -24
  160. package/dist/cjs/components/Checkbox.js.map +1 -1
  161. package/dist/cjs/components/ColorPicker.js +1 -1
  162. package/dist/cjs/components/DataTable.js +1 -1
  163. package/dist/cjs/components/DatePicker.js +45 -0
  164. package/dist/cjs/components/DatePicker.js.map +1 -0
  165. package/dist/cjs/components/Dialog.js +7 -63
  166. package/dist/cjs/components/Dialog.js.map +1 -1
  167. package/dist/cjs/components/DropdownMenu.js.map +1 -1
  168. package/dist/cjs/components/Empty.js +10 -29
  169. package/dist/cjs/components/Empty.js.map +1 -1
  170. package/dist/cjs/components/Input.js +8 -151
  171. package/dist/cjs/components/Input.js.map +1 -1
  172. package/dist/cjs/components/Kbd.js +8 -41
  173. package/dist/cjs/components/Kbd.js.map +1 -1
  174. package/dist/cjs/components/Label.js +11 -59
  175. package/dist/cjs/components/Label.js.map +1 -1
  176. package/dist/cjs/components/MultiEmailInput.js +20 -0
  177. package/dist/cjs/components/MultiEmailInput.js.map +1 -0
  178. package/dist/cjs/components/Pagination.js +21 -0
  179. package/dist/cjs/components/Pagination.js.map +1 -0
  180. package/dist/cjs/components/Popover.js +7 -103
  181. package/dist/cjs/components/Popover.js.map +1 -1
  182. package/dist/cjs/components/Progress.js +7 -13
  183. package/dist/cjs/components/Progress.js.map +1 -1
  184. package/dist/cjs/components/RadioGroup.js +9 -40
  185. package/dist/cjs/components/RadioGroup.js.map +1 -1
  186. package/dist/cjs/components/Select.js +33 -0
  187. package/dist/cjs/components/Select.js.map +1 -1
  188. package/dist/cjs/components/Sheet.js +7 -65
  189. package/dist/cjs/components/Sheet.js.map +1 -1
  190. package/dist/cjs/components/Slider.js +8 -25
  191. package/dist/cjs/components/Slider.js.map +1 -1
  192. package/dist/cjs/components/Spinner.js +7 -19
  193. package/dist/cjs/components/Spinner.js.map +1 -1
  194. package/dist/cjs/components/Stepper.js +6 -32
  195. package/dist/cjs/components/Stepper.js.map +1 -1
  196. package/dist/cjs/components/Switch.js +8 -20
  197. package/dist/cjs/components/Switch.js.map +1 -1
  198. package/dist/cjs/components/Tabs.js +8 -55
  199. package/dist/cjs/components/Tabs.js.map +1 -1
  200. package/dist/cjs/components/Textarea.js +8 -77
  201. package/dist/cjs/components/Textarea.js.map +1 -1
  202. package/dist/cjs/components/TimePicker.js +42 -0
  203. package/dist/cjs/components/TimePicker.js.map +1 -0
  204. package/dist/cjs/components/Toastr.js +4 -126
  205. package/dist/cjs/components/Toastr.js.map +1 -1
  206. package/dist/cjs/components/Tooltip.js +5 -85
  207. package/dist/cjs/components/Tooltip.js.map +1 -1
  208. package/dist/cjs/components/Tree.js +34 -0
  209. package/dist/cjs/components/Tree.js.map +1 -0
  210. package/dist/cjs/components/TreeSelect.js +45 -0
  211. package/dist/cjs/components/TreeSelect.js.map +1 -0
  212. package/dist/cjs/components/Typography.js +8 -98
  213. package/dist/cjs/components/Typography.js.map +1 -1
  214. package/dist/cjs/components/index.js +180 -0
  215. package/dist/cjs/components/index.js.map +1 -0
  216. package/dist/cjs/formik/ActionBlock.js +48 -0
  217. package/dist/cjs/formik/ActionBlock.js.map +1 -0
  218. package/dist/cjs/formik/BlockNavigation.js +111 -0
  219. package/dist/cjs/formik/BlockNavigation.js.map +1 -0
  220. package/dist/cjs/formik/Button.js +45 -0
  221. package/dist/cjs/formik/Button.js.map +1 -0
  222. package/dist/cjs/formik/Checkbox.js +38 -0
  223. package/dist/cjs/formik/Checkbox.js.map +1 -0
  224. package/dist/cjs/formik/Form.js +116 -0
  225. package/dist/cjs/formik/Form.js.map +1 -0
  226. package/dist/cjs/formik/Input.js +38 -0
  227. package/dist/cjs/formik/Input.js.map +1 -0
  228. package/dist/cjs/formik/MultiEmailInput.js +31 -0
  229. package/dist/cjs/formik/MultiEmailInput.js.map +1 -0
  230. package/dist/cjs/formik/RadioGroup.js +44 -0
  231. package/dist/cjs/formik/RadioGroup.js.map +1 -0
  232. package/dist/cjs/formik/Select.js +61 -0
  233. package/dist/cjs/formik/Select.js.map +1 -0
  234. package/dist/cjs/formik/Slider.js +39 -0
  235. package/dist/cjs/formik/Slider.js.map +1 -0
  236. package/dist/cjs/formik/Switch.js +33 -0
  237. package/dist/cjs/formik/Switch.js.map +1 -0
  238. package/dist/cjs/formik/Textarea.js +34 -0
  239. package/dist/cjs/formik/Textarea.js.map +1 -0
  240. package/dist/cjs/formik/TreeSelect.js +56 -0
  241. package/dist/cjs/formik/TreeSelect.js.map +1 -0
  242. package/dist/cjs/formik/index.js +110 -0
  243. package/dist/cjs/formik/index.js.map +1 -0
  244. package/dist/cjs/index.js +319 -428
  245. package/dist/cjs/index.js.map +1 -1
  246. package/dist/cjs/primitives/Calendar.js +10 -8020
  247. package/dist/cjs/primitives/Calendar.js.map +1 -1
  248. package/dist/cjs/primitives/Chart.js +410 -207
  249. package/dist/cjs/primitives/Chart.js.map +1 -1
  250. package/dist/cjs/primitives/Combobox.js +783 -1096
  251. package/dist/cjs/primitives/Combobox.js.map +1 -1
  252. package/dist/cjs/primitives/Pagination.js +1 -1
  253. package/dist/cjs/primitives/Resizable.js +799 -778
  254. package/dist/cjs/primitives/Resizable.js.map +1 -1
  255. package/dist/cjs/primitives/ScrollArea.js +10 -10
  256. package/dist/cjs/primitives/Select.js +77 -77
  257. package/dist/cjs/primitives/index.js +3 -2
  258. package/dist/cjs/primitives/index.js.map +1 -1
  259. package/dist/cjs/redux-DEF7lAd1.js +240 -0
  260. package/dist/cjs/redux-DEF7lAd1.js.map +1 -0
  261. package/dist/cjs/search-CfYUGi4v.js +37 -0
  262. package/dist/cjs/search-CfYUGi4v.js.map +1 -0
  263. package/dist/cjs/with-selector-DeKHbQY7.js +121 -0
  264. package/dist/cjs/with-selector-DeKHbQY7.js.map +1 -0
  265. package/dist/components/{Accordion.d.ts → Accordion/Accordion.d.ts} +3 -1
  266. package/dist/components/Accordion/index.d.ts +2 -0
  267. package/dist/components/Accordion.js +5 -27
  268. package/dist/components/Accordion.js.map +1 -1
  269. package/dist/components/{Alert.d.ts → Alert/Alert.d.ts} +2 -2
  270. package/dist/components/Alert/constants.d.ts +3 -0
  271. package/dist/components/Alert/index.d.ts +2 -0
  272. package/dist/components/Alert.js +10 -75
  273. package/dist/components/Alert.js.map +1 -1
  274. package/dist/components/{Avatar.d.ts → Avatar/Avatar.d.ts} +2 -2
  275. package/dist/components/Avatar/constants.d.ts +3 -0
  276. package/dist/components/Avatar/index.d.ts +2 -0
  277. package/dist/components/Avatar/utils.d.ts +1 -0
  278. package/dist/components/Avatar.js +9 -56
  279. package/dist/components/Avatar.js.map +1 -1
  280. package/dist/components/{Badge.d.ts → Badge/Badge.d.ts} +1 -1
  281. package/dist/components/Badge/constants.d.ts +25 -0
  282. package/dist/components/Badge/index.d.ts +2 -0
  283. package/dist/components/Badge.js +8 -66
  284. package/dist/components/Badge.js.map +1 -1
  285. package/dist/components/Button/constants.d.ts +5 -0
  286. package/dist/components/Button/index.d.ts +2 -0
  287. package/dist/components/Button.js +11 -99
  288. package/dist/components/Button.js.map +1 -1
  289. package/dist/components/{Callout.d.ts → Callout/Callout.d.ts} +1 -1
  290. package/dist/components/Callout/constants.d.ts +8 -0
  291. package/dist/components/Callout/index.d.ts +2 -0
  292. package/dist/components/Callout.js +8 -69
  293. package/dist/components/Callout.js.map +1 -1
  294. package/dist/components/Checkbox/index.d.ts +2 -0
  295. package/dist/components/Checkbox.js +6 -26
  296. package/dist/components/Checkbox.js.map +1 -1
  297. package/dist/components/ColorPicker/ColorPicker.d.ts +1 -2
  298. package/dist/components/ColorPicker/Palette.d.ts +1 -1
  299. package/dist/components/ColorPicker/types.d.ts +6 -1
  300. package/dist/components/ColorPicker.js +3 -3
  301. package/dist/components/DataTable.js +4 -4
  302. package/dist/components/DatePicker/DatePicker.d.ts +4 -0
  303. package/dist/components/DatePicker/DatePickerFooter.d.ts +12 -0
  304. package/dist/components/DatePicker/TimezoneSelect.d.ts +8 -0
  305. package/dist/components/DatePicker/constants.d.ts +17 -0
  306. package/dist/components/DatePicker/index.d.ts +2 -0
  307. package/dist/components/DatePicker/types.d.ts +56 -0
  308. package/dist/components/DatePicker/utils.d.ts +6 -0
  309. package/dist/components/DatePicker.js +39 -0
  310. package/dist/components/DatePicker.js.map +1 -0
  311. package/dist/components/{Dialog.d.ts → Dialog/Dialog.d.ts} +1 -1
  312. package/dist/components/Dialog/constants.d.ts +2 -0
  313. package/dist/components/Dialog/index.d.ts +2 -0
  314. package/dist/components/Dialog.js +5 -65
  315. package/dist/components/Dialog.js.map +1 -1
  316. package/dist/components/DropdownMenu/MenuItemButton.d.ts +1 -2
  317. package/dist/components/DropdownMenu/index.d.ts +1 -0
  318. package/dist/components/DropdownMenu.js +3 -3
  319. package/dist/components/DropdownMenu.js.map +1 -1
  320. package/dist/components/Empty/index.d.ts +2 -0
  321. package/dist/components/Empty.js +11 -34
  322. package/dist/components/Empty.js.map +1 -1
  323. package/dist/components/{Input.d.ts → Input/Input.d.ts} +3 -1
  324. package/dist/components/Input/constants.d.ts +17 -0
  325. package/dist/components/Input/index.d.ts +2 -0
  326. package/dist/components/Input/utils.d.ts +7 -0
  327. package/dist/components/Input.js +6 -153
  328. package/dist/components/Input.js.map +1 -1
  329. package/dist/components/{Kbd.d.ts → Kbd/Kbd.d.ts} +1 -1
  330. package/dist/components/Kbd/constants.d.ts +1 -0
  331. package/dist/components/Kbd/index.d.ts +2 -0
  332. package/dist/components/Kbd.js +9 -46
  333. package/dist/components/Kbd.js.map +1 -1
  334. package/dist/components/Label/constants.d.ts +1 -0
  335. package/dist/components/Label/index.d.ts +2 -0
  336. package/dist/components/Label.js +13 -65
  337. package/dist/components/Label.js.map +1 -1
  338. package/dist/components/MultiEmailInput/MultiEmailInput.d.ts +2 -0
  339. package/dist/components/MultiEmailInput/constants.d.ts +3 -0
  340. package/dist/components/MultiEmailInput/index.d.ts +2 -0
  341. package/dist/components/MultiEmailInput/types.d.ts +53 -0
  342. package/dist/components/MultiEmailInput/useMultiEmailState.d.ts +18 -0
  343. package/dist/components/MultiEmailInput/utils.d.ts +9 -0
  344. package/dist/components/MultiEmailInput.js +14 -0
  345. package/dist/components/MultiEmailInput.js.map +1 -0
  346. package/dist/components/Pagination/Pagination.d.ts +18 -0
  347. package/dist/components/Pagination/constants.d.ts +1 -0
  348. package/dist/components/Pagination/hooks/usePaginationRange.d.ts +7 -0
  349. package/dist/components/Pagination/index.d.ts +2 -0
  350. package/dist/components/Pagination/utils.d.ts +1 -0
  351. package/dist/components/Pagination.js +15 -0
  352. package/dist/components/Pagination.js.map +1 -0
  353. package/dist/components/Popover/constants.d.ts +2 -0
  354. package/dist/components/Popover/index.d.ts +2 -0
  355. package/dist/components/Popover.js +8 -104
  356. package/dist/components/Popover.js.map +1 -1
  357. package/dist/components/Progress/index.d.ts +2 -0
  358. package/dist/components/Progress.js +5 -15
  359. package/dist/components/Progress.js.map +1 -1
  360. package/dist/components/{RadioGroup.d.ts → RadioGroup/RadioGroup.d.ts} +1 -1
  361. package/dist/components/RadioGroup/index.d.ts +2 -0
  362. package/dist/components/RadioGroup.js +7 -42
  363. package/dist/components/RadioGroup.js.map +1 -1
  364. package/dist/components/Select/MultiSelectCombobox.d.ts +2 -0
  365. package/dist/components/{MultiSelectCombobox.types.d.ts → Select/MultiSelectCombobox.types.d.ts} +3 -13
  366. package/dist/components/{OptionItem.d.ts → Select/OptionItem.d.ts} +1 -1
  367. package/dist/components/Select/Select.d.ts +4 -0
  368. package/dist/components/Select/SelectCombobox.d.ts +2 -0
  369. package/dist/components/Select/SelectCombobox.types.d.ts +73 -0
  370. package/dist/components/Select/dropdown.types.d.ts +12 -0
  371. package/dist/components/Select/index.d.ts +2 -0
  372. package/dist/components/Select/types.d.ts +148 -0
  373. package/dist/components/{MultiSelect.utils.d.ts → Select/utils.d.ts} +1 -1
  374. package/dist/components/Select.js +29 -1
  375. package/dist/components/Select.js.map +1 -1
  376. package/dist/components/Sheet/constants.d.ts +3 -0
  377. package/dist/components/Sheet/index.d.ts +2 -0
  378. package/dist/components/Sheet.js +5 -67
  379. package/dist/components/Sheet.js.map +1 -1
  380. package/dist/components/Slider/index.d.ts +2 -0
  381. package/dist/components/Slider.js +6 -27
  382. package/dist/components/Slider.js.map +1 -1
  383. package/dist/components/Spinner/constants.d.ts +1 -0
  384. package/dist/components/Spinner/index.d.ts +2 -0
  385. package/dist/components/Spinner.js +5 -21
  386. package/dist/components/Spinner.js.map +1 -1
  387. package/dist/components/Stepper/index.d.ts +2 -0
  388. package/dist/components/Stepper.js +5 -31
  389. package/dist/components/Stepper.js.map +1 -1
  390. package/dist/components/Switch/index.d.ts +2 -0
  391. package/dist/components/Switch.js +6 -22
  392. package/dist/components/Switch.js.map +1 -1
  393. package/dist/components/Tabs/constants.d.ts +5 -0
  394. package/dist/components/Tabs/index.d.ts +2 -0
  395. package/dist/components/Tabs.js +6 -57
  396. package/dist/components/Tabs.js.map +1 -1
  397. package/dist/components/{Textarea.d.ts → Textarea/Textarea.d.ts} +4 -2
  398. package/dist/components/Textarea/constants.d.ts +5 -0
  399. package/dist/components/Textarea/index.d.ts +2 -0
  400. package/dist/components/Textarea/utils.d.ts +2 -0
  401. package/dist/components/Textarea.js +6 -79
  402. package/dist/components/Textarea.js.map +1 -1
  403. package/dist/components/TimePicker/TimeColumn.d.ts +11 -0
  404. package/dist/components/TimePicker/TimePicker.d.ts +4 -0
  405. package/dist/components/TimePicker/TimePickerPanel.d.ts +3 -0
  406. package/dist/components/TimePicker/constants.d.ts +3 -0
  407. package/dist/components/TimePicker/index.d.ts +3 -0
  408. package/dist/components/TimePicker/types.d.ts +61 -0
  409. package/dist/components/TimePicker/utils.d.ts +11 -0
  410. package/dist/components/TimePicker.js +35 -0
  411. package/dist/components/TimePicker.js.map +1 -0
  412. package/dist/components/{Toastr.d.ts → Toastr/Toastr.d.ts} +2 -2
  413. package/dist/components/Toastr/index.d.ts +2 -0
  414. package/dist/components/Toastr/utils.d.ts +10 -0
  415. package/dist/components/Toastr.js +2 -128
  416. package/dist/components/Toastr.js.map +1 -1
  417. package/dist/components/Tooltip/constants.d.ts +2 -0
  418. package/dist/components/Tooltip/index.d.ts +2 -0
  419. package/dist/components/Tooltip.js +7 -87
  420. package/dist/components/Tooltip.js.map +1 -1
  421. package/dist/components/Tree/Tree.d.ts +2 -0
  422. package/dist/components/Tree/TreeContext.d.ts +26 -0
  423. package/dist/components/Tree/components/SwitcherIcon.d.ts +6 -0
  424. package/dist/components/Tree/components/TreeCheckbox.d.ts +8 -0
  425. package/dist/components/Tree/components/TreeNode.d.ts +3 -0
  426. package/dist/components/Tree/constants.d.ts +3 -0
  427. package/dist/components/Tree/hooks/useTreeCheck.d.ts +18 -0
  428. package/dist/components/Tree/hooks/useTreeExpansion.d.ts +18 -0
  429. package/dist/components/Tree/hooks/useTreeSelection.d.ts +16 -0
  430. package/dist/components/Tree/index.d.ts +3 -0
  431. package/dist/components/Tree/types.d.ts +110 -0
  432. package/dist/components/Tree/utils/adapter.d.ts +10 -0
  433. package/dist/components/Tree/utils/checkCascade.d.ts +5 -0
  434. package/dist/components/Tree/utils/search.d.ts +10 -0
  435. package/dist/components/Tree.js +25 -0
  436. package/dist/components/Tree.js.map +1 -0
  437. package/dist/components/TreeSelect/TreeSelect.d.ts +3 -0
  438. package/dist/components/TreeSelect/TreeSelectTrigger.d.ts +14 -0
  439. package/dist/components/{Select.constants.d.ts → TreeSelect/constants.d.ts} +2 -2
  440. package/dist/components/TreeSelect/hooks/useTreeSelectState.d.ts +30 -0
  441. package/dist/components/TreeSelect/hooks/useTreeSelectValue.d.ts +19 -0
  442. package/dist/components/TreeSelect/index.d.ts +2 -0
  443. package/dist/components/TreeSelect/types.d.ts +49 -0
  444. package/dist/components/TreeSelect/utils/pruneTree.d.ts +2 -0
  445. package/dist/components/TreeSelect/utils/resolveFieldNames.d.ts +5 -0
  446. package/dist/components/TreeSelect.js +39 -0
  447. package/dist/components/TreeSelect.js.map +1 -0
  448. package/dist/{shadcn/components/typography.d.ts → components/Typography/Typography.d.ts} +3 -3
  449. package/dist/components/Typography/index.d.ts +1 -0
  450. package/dist/components/Typography.js +6 -81
  451. package/dist/components/Typography.js.map +1 -1
  452. package/dist/components/index.d.ts +36 -0
  453. package/dist/components/index.js +128 -0
  454. package/dist/components/index.js.map +1 -0
  455. package/dist/{floating-ui.react-dom-CcGbtPEK.js → floating-ui.react-dom-D8_f_WWh.js} +2 -2
  456. package/dist/{floating-ui.react-dom-CcGbtPEK.js.map → floating-ui.react-dom-D8_f_WWh.js.map} +1 -1
  457. package/dist/formik/ActionBlock.d.ts +18 -0
  458. package/dist/formik/ActionBlock.js +46 -0
  459. package/dist/formik/ActionBlock.js.map +1 -0
  460. package/dist/formik/BlockNavigation/BlockNavigationAlert.d.ts +23 -0
  461. package/dist/formik/BlockNavigation/index.d.ts +11 -0
  462. package/dist/formik/BlockNavigation.js +109 -0
  463. package/dist/formik/BlockNavigation.js.map +1 -0
  464. package/dist/formik/Button.d.ts +7 -0
  465. package/dist/formik/Button.js +43 -0
  466. package/dist/formik/Button.js.map +1 -0
  467. package/dist/formik/Checkbox.d.ts +8 -0
  468. package/dist/formik/Checkbox.js +36 -0
  469. package/dist/formik/Checkbox.js.map +1 -0
  470. package/dist/formik/Form/FormWrapper.d.ts +9 -0
  471. package/dist/formik/Form/ScrollToErrorField/index.d.ts +5 -0
  472. package/dist/formik/Form/ScrollToErrorField/utils.d.ts +2 -0
  473. package/dist/formik/Form/index.d.ts +16 -0
  474. package/dist/formik/Form.js +114 -0
  475. package/dist/formik/Form.js.map +1 -0
  476. package/dist/formik/Input.d.ts +8 -0
  477. package/dist/formik/Input.js +36 -0
  478. package/dist/formik/Input.js.map +1 -0
  479. package/dist/formik/MultiEmailInput.d.ts +7 -0
  480. package/dist/formik/MultiEmailInput.js +29 -0
  481. package/dist/formik/MultiEmailInput.js.map +1 -0
  482. package/dist/formik/RadioGroup.d.ts +11 -0
  483. package/dist/formik/RadioGroup.js +42 -0
  484. package/dist/formik/RadioGroup.js.map +1 -0
  485. package/dist/formik/Select.d.ts +7 -0
  486. package/dist/formik/Select.js +59 -0
  487. package/dist/formik/Select.js.map +1 -0
  488. package/dist/formik/Slider.d.ts +8 -0
  489. package/dist/formik/Slider.js +37 -0
  490. package/dist/formik/Slider.js.map +1 -0
  491. package/dist/formik/Switch.d.ts +10 -0
  492. package/dist/formik/Switch.js +31 -0
  493. package/dist/formik/Switch.js.map +1 -0
  494. package/dist/formik/Textarea.d.ts +8 -0
  495. package/dist/formik/Textarea.js +32 -0
  496. package/dist/formik/Textarea.js.map +1 -0
  497. package/dist/formik/TreeSelect.d.ts +7 -0
  498. package/dist/formik/TreeSelect.js +54 -0
  499. package/dist/formik/TreeSelect.js.map +1 -0
  500. package/dist/formik/index.d.ts +26 -0
  501. package/dist/formik/index.js +92 -0
  502. package/dist/formik/index.js.map +1 -0
  503. package/dist/hooks/useAsyncOptions.d.ts +4 -4
  504. package/dist/hooks/useComboboxAnchor.d.ts +6 -0
  505. package/dist/hooks/useCreatableItems.d.ts +1 -1
  506. package/dist/hooks/useMultiSelectOptions.d.ts +22 -4
  507. package/dist/hooks/useMultiSelectState.d.ts +7 -4
  508. package/dist/hooks/useNavPrompt.d.ts +15 -0
  509. package/dist/hooks/useSelectState.d.ts +39 -14
  510. package/dist/{index-ByEpUy7w.js → index-C3hByjk3.js} +2 -2
  511. package/dist/{index-ByEpUy7w.js.map → index-C3hByjk3.js.map} +1 -1
  512. package/dist/{index-KzJfsx-e.js → index-DLPtgEJ_.js} +2 -2
  513. package/dist/{index-KzJfsx-e.js.map → index-DLPtgEJ_.js.map} +1 -1
  514. package/dist/index.css +2 -1
  515. package/dist/index.d.ts +13 -2
  516. package/dist/index.js +283 -403
  517. package/dist/index.js.map +1 -1
  518. package/dist/primitives/Calendar.js +8 -8003
  519. package/dist/primitives/Calendar.js.map +1 -1
  520. package/dist/primitives/Chart.js +253 -50
  521. package/dist/primitives/Chart.js.map +1 -1
  522. package/dist/primitives/Combobox.d.ts +3 -3
  523. package/dist/primitives/Combobox.js +787 -1100
  524. package/dist/primitives/Combobox.js.map +1 -1
  525. package/dist/primitives/ContextMenu.js +3 -3
  526. package/dist/primitives/DropdownMenu.js +3 -3
  527. package/dist/primitives/HoverCard.js +2 -2
  528. package/dist/primitives/Menubar.js +3 -3
  529. package/dist/primitives/Pagination.js +1 -1
  530. package/dist/primitives/Popover.js +2 -2
  531. package/dist/primitives/Resizable.js +799 -778
  532. package/dist/primitives/Resizable.js.map +1 -1
  533. package/dist/primitives/Select.js +4 -4
  534. package/dist/primitives/Sidebar.js +3 -3
  535. package/dist/primitives/Tooltip.js +3 -3
  536. package/dist/primitives/index.js +7 -6
  537. package/dist/primitives/index.js.map +1 -1
  538. package/dist/redux-BKH6DnBB.js +235 -0
  539. package/dist/redux-BKH6DnBB.js.map +1 -0
  540. package/dist/search-BK7Ozh5_.js +33 -0
  541. package/dist/search-BK7Ozh5_.js.map +1 -0
  542. package/dist/shadcn/components/combobox.d.ts +1 -1
  543. package/dist/{tooltip-DzjIJacP.js → tooltip-XkHLgxlU.js} +2 -2
  544. package/dist/{tooltip-DzjIJacP.js.map → tooltip-XkHLgxlU.js.map} +1 -1
  545. package/dist/utils/dayjs/index.d.ts +4 -0
  546. package/dist/utils/dayjs/timezonePlugin.d.ts +3 -0
  547. package/dist/with-selector-Dv0G_V_o.js +115 -0
  548. package/dist/with-selector-Dv0G_V_o.js.map +1 -0
  549. package/package.json +31 -4
  550. package/dist/ColorPicker-D-7QGnf9.js.map +0 -1
  551. package/dist/cjs/ColorPicker-DEELmqH8.js.map +0 -1
  552. package/dist/cjs/components/MultiSelect.js +0 -13
  553. package/dist/cjs/components/MultiSelect.js.map +0 -1
  554. package/dist/cjs/components/MultiSelectCombobox.js +0 -3
  555. package/dist/cjs/components/MultiSelectCombobox.js.map +0 -1
  556. package/dist/cjs/components/MultiSelectDropdown.js +0 -38
  557. package/dist/cjs/components/MultiSelectDropdown.js.map +0 -1
  558. package/dist/cjs/components/OptionItem.js +0 -34
  559. package/dist/cjs/components/OptionItem.js.map +0 -1
  560. package/dist/cjs/components/SelectFieldWrapper.js.map +0 -1
  561. package/dist/cjs/components/SelectOptions.js +0 -43
  562. package/dist/cjs/components/SelectOptions.js.map +0 -1
  563. package/dist/cjs/components/SelectTriggerContent.js +0 -47
  564. package/dist/cjs/components/SelectTriggerContent.js.map +0 -1
  565. package/dist/cjs/components/shared.js +0 -8
  566. package/dist/cjs/components/shared.js.map +0 -1
  567. package/dist/cjs/useCreatableItems-BTHtd7uo.js +0 -100
  568. package/dist/cjs/useCreatableItems-BTHtd7uo.js.map +0 -1
  569. package/dist/cjs/with-selector-u4xTSzCv.js +0 -457
  570. package/dist/cjs/with-selector-u4xTSzCv.js.map +0 -1
  571. package/dist/components/MultiSelect.d.ts +0 -4
  572. package/dist/components/MultiSelect.js +0 -4
  573. package/dist/components/MultiSelect.js.map +0 -1
  574. package/dist/components/MultiSelect.types.d.ts +0 -121
  575. package/dist/components/MultiSelectCombobox.d.ts +0 -3
  576. package/dist/components/MultiSelectCombobox.js +0 -2
  577. package/dist/components/MultiSelectCombobox.js.map +0 -1
  578. package/dist/components/MultiSelectDropdown.js +0 -36
  579. package/dist/components/MultiSelectDropdown.js.map +0 -1
  580. package/dist/components/OptionItem.js +0 -32
  581. package/dist/components/OptionItem.js.map +0 -1
  582. package/dist/components/Select.d.ts +0 -4
  583. package/dist/components/Select.types.d.ts +0 -58
  584. package/dist/components/SelectFieldWrapper.js.map +0 -1
  585. package/dist/components/SelectOptions.d.ts +0 -2
  586. package/dist/components/SelectOptions.js +0 -41
  587. package/dist/components/SelectOptions.js.map +0 -1
  588. package/dist/components/SelectTriggerContent.d.ts +0 -18
  589. package/dist/components/SelectTriggerContent.js +0 -45
  590. package/dist/components/SelectTriggerContent.js.map +0 -1
  591. package/dist/components/Typography.d.ts +0 -10
  592. package/dist/components/shared.js +0 -6
  593. package/dist/components/shared.js.map +0 -1
  594. package/dist/components/shared.types.d.ts +0 -16
  595. package/dist/useCreatableItems-B0seQA1_.js +0 -89
  596. package/dist/useCreatableItems-B0seQA1_.js.map +0 -1
  597. package/dist/with-selector--fY1NrB9.js +0 -448
  598. package/dist/with-selector--fY1NrB9.js.map +0 -1
  599. /package/dist/components/{Button.d.ts → Button/Button.d.ts} +0 -0
  600. /package/dist/components/{Checkbox.d.ts → Checkbox/Checkbox.d.ts} +0 -0
  601. /package/dist/components/{Empty.d.ts → Empty/Empty.d.ts} +0 -0
  602. /package/dist/components/{Label.d.ts → Label/Label.d.ts} +0 -0
  603. /package/dist/components/{Popover.d.ts → Popover/Popover.d.ts} +0 -0
  604. /package/dist/components/{Progress.d.ts → Progress/Progress.d.ts} +0 -0
  605. /package/dist/components/{MultiSelectDropdown.d.ts → Select/MultiSelectDropdown.d.ts} +0 -0
  606. /package/dist/components/{SelectFieldWrapper.d.ts → Select/SelectFieldWrapper.d.ts} +0 -0
  607. /package/dist/components/{MultiSelect.constants.d.ts → Select/constants.d.ts} +0 -0
  608. /package/dist/components/{Sheet.d.ts → Sheet/Sheet.d.ts} +0 -0
  609. /package/dist/components/{Slider.d.ts → Slider/Slider.d.ts} +0 -0
  610. /package/dist/components/{Spinner.d.ts → Spinner/Spinner.d.ts} +0 -0
  611. /package/dist/components/{Stepper.d.ts → Stepper/Stepper.d.ts} +0 -0
  612. /package/dist/components/{Switch.d.ts → Switch/Switch.d.ts} +0 -0
  613. /package/dist/components/{Tabs.d.ts → Tabs/Tabs.d.ts} +0 -0
  614. /package/dist/components/{Tooltip.d.ts → Tooltip/Tooltip.d.ts} +0 -0
@@ -5,13 +5,13 @@ var React = require('react');
5
5
  var utils = require('../utils-CTr7wn5d.js');
6
6
  var button = require('../button-B8XGl69v.js');
7
7
  var inputGroup = require('../input-group-DoK0-4fL.js');
8
- var x = require('../x-Brw3FJst.js');
9
8
  var check = require('../check-BQgcDXys.js');
9
+ var x = require('../x-Brw3FJst.js');
10
10
  var chevronDown = require('../chevron-down-CPsWSS51.js');
11
- var withSelector = require('../with-selector-u4xTSzCv.js');
12
- var ReactDOM = require('react-dom');
13
11
  var floatingUi_reactDom = require('../floating-ui.react-dom-B4Aw6O7R.js');
14
12
  var index = require('../index-DnKJmaCq.js');
13
+ var withSelector = require('../with-selector-DeKHbQY7.js');
14
+ var ReactDOM = require('react-dom');
15
15
  require('../index-BZhTddX0.js');
16
16
  require('../index-DuNgWCXZ.js');
17
17
  require('../index-D-iDn9RI.js');
@@ -514,7 +514,7 @@ const EMPTY_PROPS = {};
514
514
  * Props can either be provided as objects or as functions that take the previous props as an argument.
515
515
  * The function will receive the merged props up to that point (going from left to right):
516
516
  * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.
517
- * The function is responsible for chaining event handlers if needed (i.e. we don't run the merge logic).
517
+ * The function is responsible for chaining event handlers if needed (that is, we don't run the merge logic).
518
518
  *
519
519
  * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.
520
520
  * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.
@@ -530,18 +530,20 @@ const EMPTY_PROPS = {};
530
530
  */
531
531
 
532
532
  function mergeProps$1(a, b, c, d, e) {
533
- // We need to mutably own `merged`
534
- let merged = {
535
- ...resolvePropsGetter(a, EMPTY_PROPS)
536
- };
533
+ if (!c && !d && true && !a) {
534
+ return createInitialMergedProps(b);
535
+ }
536
+
537
+ // We need to mutably own `merged`.
538
+ let merged = createInitialMergedProps(a);
537
539
  if (b) {
538
- merged = mergeOne(merged, b);
540
+ merged = mergeInto(merged, b);
539
541
  }
540
542
  if (c) {
541
- merged = mergeOne(merged, c);
543
+ merged = mergeInto(merged, c);
542
544
  }
543
545
  if (d) {
544
- merged = mergeOne(merged, d);
546
+ merged = mergeInto(merged, d);
545
547
  }
546
548
  return merged;
547
549
  }
@@ -565,24 +567,46 @@ function mergePropsN(props) {
565
567
  return EMPTY_PROPS;
566
568
  }
567
569
  if (props.length === 1) {
568
- return resolvePropsGetter(props[0], EMPTY_PROPS);
570
+ return createInitialMergedProps(props[0]);
569
571
  }
570
572
 
571
- // We need to mutably own `merged`
572
- let merged = {
573
- ...resolvePropsGetter(props[0], EMPTY_PROPS)
574
- };
573
+ // We need to mutably own `merged`.
574
+ let merged = createInitialMergedProps(props[0]);
575
575
  for (let i = 1; i < props.length; i += 1) {
576
- merged = mergeOne(merged, props[i]);
576
+ merged = mergeInto(merged, props[i]);
577
577
  }
578
578
  return merged;
579
579
  }
580
- function mergeOne(merged, inputProps) {
580
+ function createInitialMergedProps(inputProps) {
581
+ if (isPropsGetter(inputProps)) {
582
+ // Getter-returned handlers intentionally keep their existing semantics.
583
+ return {
584
+ ...resolvePropsGetter(inputProps, EMPTY_PROPS)
585
+ };
586
+ }
587
+ return copyInitialProps(inputProps);
588
+ }
589
+ function mergeInto(merged, inputProps) {
581
590
  if (isPropsGetter(inputProps)) {
582
- return inputProps(merged);
591
+ return resolvePropsGetter(inputProps, merged);
583
592
  }
584
593
  return mutablyMergeInto(merged, inputProps);
585
594
  }
595
+ function copyInitialProps(inputProps) {
596
+ const copiedProps = {
597
+ ...inputProps
598
+ };
599
+
600
+ // `copiedProps` is our fresh own-object copy, so iterating with `for...in` is safe here.
601
+ // eslint-disable-next-line guard-for-in
602
+ for (const propName in copiedProps) {
603
+ const propValue = copiedProps[propName];
604
+ if (isEventHandler(propName, propValue)) {
605
+ copiedProps[propName] = wrapEventHandler(propValue);
606
+ }
607
+ }
608
+ return copiedProps;
609
+ }
586
610
 
587
611
  /**
588
612
  * Merges two sets of props. In case of conflicts, the external props take precedence.
@@ -639,7 +663,7 @@ function mergeEventHandlers(ourHandler, theirHandler) {
639
663
  return ourHandler;
640
664
  }
641
665
  if (!ourHandler) {
642
- return theirHandler;
666
+ return wrapEventHandler(theirHandler);
643
667
  }
644
668
  return event => {
645
669
  if (isSyntheticEvent(event)) {
@@ -656,6 +680,17 @@ function mergeEventHandlers(ourHandler, theirHandler) {
656
680
  return result;
657
681
  };
658
682
  }
683
+ function wrapEventHandler(handler) {
684
+ if (!handler) {
685
+ return handler;
686
+ }
687
+ return event => {
688
+ if (isSyntheticEvent(event)) {
689
+ makeEventPreventable(event);
690
+ }
691
+ return handler(event);
692
+ };
693
+ }
659
694
  function makeEventPreventable(event) {
660
695
  event.preventBaseUIHandler = () => {
661
696
  event.baseUIHandlerPrevented = true;
@@ -744,7 +779,12 @@ function useRenderElementProps(componentProps, params = {}) {
744
779
  const className = enabled ? resolveClassName(classNameProp, state) : undefined;
745
780
  const style = enabled ? resolveStyle(styleProp, state) : undefined;
746
781
  const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
747
- const outProps = enabled ? mergeObjects(stateProps, Array.isArray(props) ? mergePropsN(props) : props) ?? EMPTY_OBJECT : EMPTY_OBJECT;
782
+ const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : undefined;
783
+
784
+ // Ensure outProps is always a new mutable object when enabled, never EMPTY_OBJECT.
785
+ // This prevents potential TypeError when setting ref, className, or style properties,
786
+ // since EMPTY_OBJECT is frozen and mutations would fail in strict mode.
787
+ const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
748
788
 
749
789
  // SAFETY: The `useMergedRefs` functions use a single hook to store the same value,
750
790
  // switching between them at runtime is safe. If this assertion fails, React will
@@ -772,6 +812,12 @@ function useRenderElementProps(componentProps, params = {}) {
772
812
  }
773
813
  return outProps;
774
814
  }
815
+ function resolveRenderFunctionProps(props) {
816
+ if (Array.isArray(props)) {
817
+ return mergePropsN(props);
818
+ }
819
+ return mergeProps$1(undefined, props);
820
+ }
775
821
 
776
822
  // The symbol React uses internally for lazy components
777
823
  // https://github.com/facebook/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/shared/ReactSymbols.js#L31
@@ -1112,70 +1158,67 @@ function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false
1112
1158
  */
1113
1159
  signal = null) => {
1114
1160
  frame.cancel();
1115
- function done() {
1116
- // Synchronously flush the unmounting of the component so that the browser doesn't
1117
- // paint: https://github.com/mui/base-ui/issues/979
1118
- ReactDOM__namespace.flushSync(fnToExecute);
1119
- }
1120
1161
  const element = resolveRef(elementOrRef);
1121
1162
  if (element == null) {
1122
1163
  return;
1123
1164
  }
1124
1165
  const resolvedElement = element;
1166
+ const done = () => {
1167
+ // Synchronously flush the unmounting of the component so that the browser doesn't
1168
+ // paint: https://github.com/mui/base-ui/issues/979
1169
+ ReactDOM__namespace.flushSync(fnToExecute);
1170
+ };
1125
1171
  if (typeof resolvedElement.getAnimations !== 'function' || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1126
1172
  fnToExecute();
1127
- } else {
1128
- function execWaitForStartingStyleRemoved() {
1129
- const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
1130
-
1131
- // If `[data-starting-style]` isn't present, fall back to waiting one more frame
1132
- // to give "open" animations a chance to be registered.
1133
- if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1134
- frame.request(exec);
1135
- return;
1136
- }
1137
-
1138
- // Wait for `[data-starting-style]` to have been removed.
1139
- const attributeObserver = new MutationObserver(() => {
1140
- if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1141
- attributeObserver.disconnect();
1142
- exec();
1143
- }
1144
- });
1145
- attributeObserver.observe(resolvedElement, {
1146
- attributes: true,
1147
- attributeFilter: [startingStyleAttribute]
1148
- });
1149
- signal?.addEventListener('abort', () => attributeObserver.disconnect(), {
1150
- once: true
1151
- });
1152
- }
1153
- function exec() {
1154
- Promise.all(resolvedElement.getAnimations().map(anim => anim.finished)).then(() => {
1155
- if (signal?.aborted) {
1156
- return;
1157
- }
1173
+ return;
1174
+ }
1175
+ function exec() {
1176
+ Promise.all(resolvedElement.getAnimations().map(animation => animation.finished)).then(() => {
1177
+ if (!signal?.aborted) {
1158
1178
  done();
1159
- }).catch(() => {
1160
- const currentAnimations = resolvedElement.getAnimations();
1161
- if (treatAbortedAsFinished) {
1162
- if (signal?.aborted) {
1163
- return;
1164
- }
1179
+ }
1180
+ }).catch(() => {
1181
+ if (treatAbortedAsFinished) {
1182
+ if (!signal?.aborted) {
1165
1183
  done();
1166
- } else if (currentAnimations.length > 0 && currentAnimations.some(anim => anim.pending || anim.playState !== 'finished')) {
1167
- // Sometimes animations can be aborted because a property they depend on changes while the animation plays.
1168
- // In such cases, we need to re-check if any new animations have started.
1169
- exec();
1170
1184
  }
1171
- });
1172
- }
1173
- if (waitForStartingStyleRemoved) {
1174
- execWaitForStartingStyleRemoved();
1185
+ return;
1186
+ }
1187
+ const currentAnimations = resolvedElement.getAnimations();
1188
+ if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some(animation => animation.pending || animation.playState !== 'finished')) {
1189
+ // Sometimes animations can be aborted because a property they depend on changes while the animation plays.
1190
+ // In such cases, we need to re-check if any new animations have started.
1191
+ exec();
1192
+ }
1193
+ });
1194
+ }
1195
+ if (waitForStartingStyleRemoved) {
1196
+ const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
1197
+
1198
+ // If `[data-starting-style]` isn't present, fall back to waiting one more frame
1199
+ // to give "open" animations a chance to be registered.
1200
+ if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1201
+ frame.request(exec);
1175
1202
  return;
1176
1203
  }
1177
- frame.request(exec);
1204
+
1205
+ // Wait for `[data-starting-style]` to have been removed.
1206
+ const attributeObserver = new MutationObserver(() => {
1207
+ if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1208
+ attributeObserver.disconnect();
1209
+ exec();
1210
+ }
1211
+ });
1212
+ attributeObserver.observe(resolvedElement, {
1213
+ attributes: true,
1214
+ attributeFilter: [startingStyleAttribute]
1215
+ });
1216
+ signal?.addEventListener('abort', () => attributeObserver.disconnect(), {
1217
+ once: true
1218
+ });
1219
+ return;
1178
1220
  }
1221
+ frame.request(exec);
1179
1222
  });
1180
1223
  }
1181
1224
 
@@ -1234,12 +1277,12 @@ function useTransitionStatus(open, enableIdleState = false, deferEndingState = f
1234
1277
  return () => {
1235
1278
  AnimationFrame.cancel(frame);
1236
1279
  };
1237
- }, [enableIdleState, open, mounted, setTransitionStatus, transitionStatus]);
1238
- return React__namespace.useMemo(() => ({
1280
+ }, [enableIdleState, open, mounted, transitionStatus]);
1281
+ return {
1239
1282
  mounted,
1240
1283
  setMounted,
1241
1284
  transitionStatus
1242
- }), [mounted, transitionStatus]);
1285
+ };
1243
1286
  }
1244
1287
 
1245
1288
  let IndexGuessBehavior = /*#__PURE__*/function (IndexGuessBehavior) {
@@ -1598,12 +1641,12 @@ function contains(parent, child) {
1598
1641
  }
1599
1642
  const rootNode = child.getRootNode?.();
1600
1643
 
1601
- // First, attempt with faster native method
1644
+ // First, attempt with the faster native method.
1602
1645
  if (parent.contains(child)) {
1603
1646
  return true;
1604
1647
  }
1605
1648
 
1606
- // then fallback to custom implementation with Shadow DOM support
1649
+ // Then fall back to traversing out of shadow roots when needed.
1607
1650
  if (rootNode && floatingUi_reactDom.isShadowRoot(rootNode)) {
1608
1651
  let next = child;
1609
1652
  while (next) {
@@ -1613,8 +1656,6 @@ function contains(parent, child) {
1613
1656
  next = next.parentNode || next.host;
1614
1657
  }
1615
1658
  }
1616
-
1617
- // Give up, the result is false
1618
1659
  return false;
1619
1660
  }
1620
1661
  function getTarget(event) {
@@ -1622,10 +1663,11 @@ function getTarget(event) {
1622
1663
  return event.composedPath()[0];
1623
1664
  }
1624
1665
 
1625
- // TS thinks `event` is of type never as it assumes all browsers support
1626
- // `composedPath()`, but browsers without shadow DOM don't.
1666
+ // TS assumes `composedPath()` always exists, but older browsers without
1667
+ // shadow DOM support still fall back to `target`.
1627
1668
  return event.target;
1628
1669
  }
1670
+
1629
1671
  function isEventTargetWithin(event, node) {
1630
1672
  if (node == null) {
1631
1673
  return false;
@@ -1644,6 +1686,9 @@ function isRootElement(element) {
1644
1686
  function isTypeableElement(element) {
1645
1687
  return floatingUi_reactDom.isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
1646
1688
  }
1689
+ function isInteractiveElement(element) {
1690
+ return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
1691
+ }
1647
1692
  function isTypeableCombobox(element) {
1648
1693
  if (!element) {
1649
1694
  return false;
@@ -1664,8 +1709,8 @@ function getFloatingFocusElement(floatingElement) {
1664
1709
  /* eslint-disable @typescript-eslint/no-loop-func */
1665
1710
 
1666
1711
  function getNodeChildren(nodes, id, onlyOpenChildren = true) {
1667
- const directChildren = nodes.filter(node => node.parentId === id && (!onlyOpenChildren || node.context?.open));
1668
- return directChildren.flatMap(child => [child, ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
1712
+ const directChildren = nodes.filter(node => node.parentId === id);
1713
+ return directChildren.flatMap(child => [...(!onlyOpenChildren || child.context?.open ? [child] : []), ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
1669
1714
  }
1670
1715
  function getNodeAncestors(nodes, id) {
1671
1716
  let allAncestors = [];
@@ -1720,22 +1765,22 @@ function isClickLikeEvent(event) {
1720
1765
  function isDifferentGridRow(index, cols, prevRow) {
1721
1766
  return Math.floor(index / cols) !== prevRow;
1722
1767
  }
1723
- function isIndexOutOfListBounds(listRef, index) {
1724
- return index < 0 || index >= listRef.current.length;
1768
+ function isIndexOutOfListBounds(list, index) {
1769
+ return index < 0 || index >= list.length;
1725
1770
  }
1726
1771
  function getMinListIndex(listRef, disabledIndices) {
1727
- return findNonDisabledListIndex(listRef, {
1772
+ return findNonDisabledListIndex(listRef.current, {
1728
1773
  disabledIndices
1729
1774
  });
1730
1775
  }
1731
1776
  function getMaxListIndex(listRef, disabledIndices) {
1732
- return findNonDisabledListIndex(listRef, {
1777
+ return findNonDisabledListIndex(listRef.current, {
1733
1778
  decrement: true,
1734
1779
  startingIndex: listRef.current.length,
1735
1780
  disabledIndices
1736
1781
  });
1737
1782
  }
1738
- function findNonDisabledListIndex(listRef, {
1783
+ function findNonDisabledListIndex(list, {
1739
1784
  startingIndex = -1,
1740
1785
  decrement = false,
1741
1786
  disabledIndices,
@@ -1744,13 +1789,14 @@ function findNonDisabledListIndex(listRef, {
1744
1789
  let index = startingIndex;
1745
1790
  do {
1746
1791
  index += decrement ? -amount : amount;
1747
- } while (index >= 0 && index <= listRef.current.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));
1792
+ } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));
1748
1793
  return index;
1749
1794
  }
1750
- function getGridNavigatedIndex(listRef, {
1795
+ function getGridNavigatedIndex(list, {
1751
1796
  event,
1752
1797
  orientation,
1753
1798
  loopFocus,
1799
+ onLoop,
1754
1800
  rtl,
1755
1801
  cols,
1756
1802
  disabledIndices,
@@ -1778,7 +1824,7 @@ function getGridNavigatedIndex(listRef, {
1778
1824
  {
1779
1825
  let currentRowEl = null;
1780
1826
  let currentRowIndex = -1;
1781
- listRef.current.forEach((el, idx) => {
1827
+ list.forEach((el, idx) => {
1782
1828
  if (el == null) {
1783
1829
  return;
1784
1830
  }
@@ -1809,7 +1855,7 @@ function getGridNavigatedIndex(listRef, {
1809
1855
  }
1810
1856
  }
1811
1857
  }
1812
- const hasVirtualizedGaps = hasDomRows && visibleItemCount < listRef.current.length;
1858
+ const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;
1813
1859
  const verticalCols = inferredDomCols || cols;
1814
1860
  const navigateVertically = direction => {
1815
1861
  if (!hasDomRows || prevIndex === -1) {
@@ -1827,11 +1873,17 @@ function getGridNavigatedIndex(listRef, {
1827
1873
  return undefined;
1828
1874
  }
1829
1875
  nextRow = nextRow < 0 ? rows.length - 1 : 0;
1876
+ if (onLoop) {
1877
+ const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);
1878
+ const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];
1879
+ const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);
1880
+ nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;
1881
+ }
1830
1882
  }
1831
1883
  const targetRow = rows[nextRow];
1832
1884
  for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {
1833
1885
  const candidate = targetRow[col];
1834
- if (!isListIndexDisabled(listRef, candidate, disabledIndices)) {
1886
+ if (!isListIndexDisabled(list, candidate, disabledIndices)) {
1835
1887
  return candidate;
1836
1888
  }
1837
1889
  }
@@ -1855,7 +1907,7 @@ function getGridNavigatedIndex(listRef, {
1855
1907
  }
1856
1908
  const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);
1857
1909
  for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {
1858
- if (!isListIndexDisabled(listRef, candidate, disabledIndices)) {
1910
+ if (!isListIndexDisabled(list, candidate, disabledIndices)) {
1859
1911
  return candidate;
1860
1912
  }
1861
1913
  }
@@ -1871,7 +1923,7 @@ function getGridNavigatedIndex(listRef, {
1871
1923
  } else if (prevIndex === -1) {
1872
1924
  nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;
1873
1925
  } else {
1874
- nextIndex = findNonDisabledListIndex(listRef, {
1926
+ nextIndex = findNonDisabledListIndex(list, {
1875
1927
  startingIndex: prevIndex,
1876
1928
  amount: verticalCols,
1877
1929
  decrement: verticalDirection === 'up',
@@ -1887,17 +1939,23 @@ function getGridNavigatedIndex(listRef, {
1887
1939
  } else {
1888
1940
  nextIndex = maxCol > col ? offset : offset - verticalCols;
1889
1941
  }
1942
+ if (onLoop) {
1943
+ nextIndex = onLoop(event, prevIndex, nextIndex);
1944
+ }
1890
1945
  }
1891
1946
  if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {
1892
- nextIndex = findNonDisabledListIndex(listRef, {
1947
+ nextIndex = findNonDisabledListIndex(list, {
1893
1948
  startingIndex: prevIndex % verticalCols - verticalCols,
1894
1949
  amount: verticalCols,
1895
1950
  disabledIndices
1896
1951
  });
1952
+ if (onLoop) {
1953
+ nextIndex = onLoop(event, prevIndex, nextIndex);
1954
+ }
1897
1955
  }
1898
1956
  }
1899
1957
  }
1900
- if (isIndexOutOfListBounds(listRef, nextIndex)) {
1958
+ if (isIndexOutOfListBounds(list, nextIndex)) {
1901
1959
  nextIndex = prevIndex;
1902
1960
  }
1903
1961
  }
@@ -1910,21 +1968,27 @@ function getGridNavigatedIndex(listRef, {
1910
1968
  stopEvent(event);
1911
1969
  }
1912
1970
  if (prevIndex % cols !== cols - 1) {
1913
- nextIndex = findNonDisabledListIndex(listRef, {
1971
+ nextIndex = findNonDisabledListIndex(list, {
1914
1972
  startingIndex: prevIndex,
1915
1973
  disabledIndices
1916
1974
  });
1917
1975
  if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
1918
- nextIndex = findNonDisabledListIndex(listRef, {
1976
+ nextIndex = findNonDisabledListIndex(list, {
1919
1977
  startingIndex: prevIndex - prevIndex % cols - 1,
1920
1978
  disabledIndices
1921
1979
  });
1980
+ if (onLoop) {
1981
+ nextIndex = onLoop(event, prevIndex, nextIndex);
1982
+ }
1922
1983
  }
1923
1984
  } else if (loopFocus) {
1924
- nextIndex = findNonDisabledListIndex(listRef, {
1985
+ nextIndex = findNonDisabledListIndex(list, {
1925
1986
  startingIndex: prevIndex - prevIndex % cols - 1,
1926
1987
  disabledIndices
1927
1988
  });
1989
+ if (onLoop) {
1990
+ nextIndex = onLoop(event, prevIndex, nextIndex);
1991
+ }
1928
1992
  }
1929
1993
  if (isDifferentGridRow(nextIndex, cols, prevRow)) {
1930
1994
  nextIndex = prevIndex;
@@ -1935,36 +1999,45 @@ function getGridNavigatedIndex(listRef, {
1935
1999
  stopEvent(event);
1936
2000
  }
1937
2001
  if (prevIndex % cols !== 0) {
1938
- nextIndex = findNonDisabledListIndex(listRef, {
2002
+ nextIndex = findNonDisabledListIndex(list, {
1939
2003
  startingIndex: prevIndex,
1940
2004
  decrement: true,
1941
2005
  disabledIndices
1942
2006
  });
1943
2007
  if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
1944
- nextIndex = findNonDisabledListIndex(listRef, {
2008
+ nextIndex = findNonDisabledListIndex(list, {
1945
2009
  startingIndex: prevIndex + (cols - prevIndex % cols),
1946
2010
  decrement: true,
1947
2011
  disabledIndices
1948
2012
  });
2013
+ if (onLoop) {
2014
+ nextIndex = onLoop(event, prevIndex, nextIndex);
2015
+ }
1949
2016
  }
1950
2017
  } else if (loopFocus) {
1951
- nextIndex = findNonDisabledListIndex(listRef, {
2018
+ nextIndex = findNonDisabledListIndex(list, {
1952
2019
  startingIndex: prevIndex + (cols - prevIndex % cols),
1953
2020
  decrement: true,
1954
2021
  disabledIndices
1955
2022
  });
2023
+ if (onLoop) {
2024
+ nextIndex = onLoop(event, prevIndex, nextIndex);
2025
+ }
1956
2026
  }
1957
2027
  if (isDifferentGridRow(nextIndex, cols, prevRow)) {
1958
2028
  nextIndex = prevIndex;
1959
2029
  }
1960
2030
  }
1961
2031
  const lastRow = floatingUi_reactDom.floor(maxIndex / cols) === prevRow;
1962
- if (isIndexOutOfListBounds(listRef, nextIndex)) {
2032
+ if (isIndexOutOfListBounds(list, nextIndex)) {
1963
2033
  if (loopFocus && lastRow) {
1964
- nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(listRef, {
2034
+ nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {
1965
2035
  startingIndex: prevIndex - prevIndex % cols - 1,
1966
2036
  disabledIndices
1967
2037
  });
2038
+ if (onLoop) {
2039
+ nextIndex = onLoop(event, prevIndex, nextIndex);
2040
+ }
1968
2041
  } else {
1969
2042
  nextIndex = prevIndex;
1970
2043
  }
@@ -2035,12 +2108,12 @@ function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
2035
2108
  function getGridCellIndices(indices, cellMap) {
2036
2109
  return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);
2037
2110
  }
2038
- function isListIndexDisabled(listRef, index, disabledIndices) {
2111
+ function isListIndexDisabled(list, index, disabledIndices) {
2039
2112
  const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;
2040
2113
  if (isExplicitlyDisabled) {
2041
2114
  return true;
2042
2115
  }
2043
- const element = listRef.current[index];
2116
+ const element = list[index];
2044
2117
  if (!element) {
2045
2118
  return false;
2046
2119
  }
@@ -2050,599 +2123,137 @@ function isListIndexDisabled(listRef, index, disabledIndices) {
2050
2123
  return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');
2051
2124
  }
2052
2125
  function isElementVisible(element) {
2126
+ if (typeof element.checkVisibility === 'function') {
2127
+ return element.checkVisibility();
2128
+ }
2053
2129
  return floatingUi_reactDom.getComputedStyle(element).display !== 'none';
2054
2130
  }
2055
2131
 
2056
- /*!
2057
- * tabbable 6.4.0
2058
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
2059
- */
2060
- // NOTE: separate `:not()` selectors has broader browser support than the newer
2061
- // `:not([inert], [inert] *)` (Feb 2023)
2062
- var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
2063
- var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
2064
- var NoElement = typeof Element === 'undefined';
2065
- var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
2066
- var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
2067
- var _element$getRootNode;
2068
- return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
2069
- } : function (element) {
2070
- return element === null || element === void 0 ? void 0 : element.ownerDocument;
2071
- };
2072
-
2073
- /**
2074
- * Determines if a node is inert or in an inert ancestor.
2075
- * @param {Node} [node]
2076
- * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
2077
- * see if any of them are inert. If false, only `node` itself is considered.
2078
- * @returns {boolean} True if inert itself or by way of being in an inert ancestor.
2079
- * False if `node` is falsy.
2080
- */
2081
- var _isInert = function isInert(node, lookUp) {
2082
- var _node$getAttribute;
2083
- if (lookUp === void 0) {
2084
- lookUp = true;
2085
- }
2086
- // CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
2087
- // JS API property; we have to check the attribute, which can either be empty or 'true';
2088
- // if it's `null` (not specified) or 'false', it's an active element
2089
- var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
2090
- var inert = inertAtt === '' || inertAtt === 'true';
2091
-
2092
- // NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
2093
- // if it weren't for `matches()` not being a function on shadow roots; the following
2094
- // code works for any kind of node
2095
- var result = inert || lookUp && node && (
2096
- // closest does not exist on shadow roots, so we fall back to a manual
2097
- // lookup upward, in case it is not defined.
2098
- typeof node.closest === 'function' ? node.closest('[inert]') : _isInert(node.parentNode));
2099
- return result;
2100
- };
2101
-
2102
- /**
2103
- * Determines if a node's content is editable.
2104
- * @param {Element} [node]
2105
- * @returns True if it's content-editable; false if it's not or `node` is falsy.
2106
- */
2107
- var isContentEditable = function isContentEditable(node) {
2108
- var _node$getAttribute2;
2109
- // CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
2110
- // to use the attribute directly to check for this, which can either be empty or 'true';
2111
- // if it's `null` (not specified) or 'false', it's a non-editable element
2112
- var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
2113
- return attValue === '' || attValue === 'true';
2114
- };
2115
-
2116
- /**
2117
- * @param {Element} el container to check in
2118
- * @param {boolean} includeContainer add container to check
2119
- * @param {(node: Element) => boolean} filter filter candidates
2120
- * @returns {Element[]}
2121
- */
2122
- var getCandidates = function getCandidates(el, includeContainer, filter) {
2123
- // even if `includeContainer=false`, we still have to check it for inertness because
2124
- // if it's inert (either by itself or via its parent), then all its children are inert
2125
- if (_isInert(el)) {
2126
- return [];
2127
- }
2128
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
2129
- if (includeContainer && matches.call(el, candidateSelector)) {
2130
- candidates.unshift(el);
2131
- }
2132
- candidates = candidates.filter(filter);
2133
- return candidates;
2134
- };
2135
-
2136
- /**
2137
- * @callback GetShadowRoot
2138
- * @param {Element} element to check for shadow root
2139
- * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
2140
- */
2141
-
2142
- /**
2143
- * @callback ShadowRootFilter
2144
- * @param {Element} shadowHostNode the element which contains shadow content
2145
- * @returns {boolean} true if a shadow root could potentially contain valid candidates.
2146
- */
2147
-
2148
- /**
2149
- * @typedef {Object} CandidateScope
2150
- * @property {Element} scopeParent contains inner candidates
2151
- * @property {Element[]} candidates list of candidates found in the scope parent
2152
- */
2153
-
2154
- /**
2155
- * @typedef {Object} IterativeOptions
2156
- * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
2157
- * if a function, implies shadow support is enabled and either returns the shadow root of an element
2158
- * or a boolean stating if it has an undisclosed shadow root
2159
- * @property {(node: Element) => boolean} filter filter candidates
2160
- * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list
2161
- * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
2162
- */
2163
-
2164
- /**
2165
- * @param {Element[]} elements list of element containers to match candidates from
2166
- * @param {boolean} includeContainer add container list to check
2167
- * @param {IterativeOptions} options
2168
- * @returns {Array.<Element|CandidateScope>}
2169
- */
2170
- var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
2171
- var candidates = [];
2172
- var elementsToCheck = Array.from(elements);
2173
- while (elementsToCheck.length) {
2174
- var element = elementsToCheck.shift();
2175
- if (_isInert(element, false)) {
2176
- // no need to look up since we're drilling down
2177
- // anything inside this container will also be inert
2178
- continue;
2179
- }
2180
- if (element.tagName === 'SLOT') {
2181
- // add shadow dom slot scope (slot itself cannot be focusable)
2182
- var assigned = element.assignedElements();
2183
- var content = assigned.length ? assigned : element.children;
2184
- var nestedCandidates = _getCandidatesIteratively(content, true, options);
2185
- if (options.flatten) {
2186
- candidates.push.apply(candidates, nestedCandidates);
2187
- } else {
2188
- candidates.push({
2189
- scopeParent: element,
2190
- candidates: nestedCandidates
2191
- });
2192
- }
2193
- } else {
2194
- // check candidate element
2195
- var validCandidate = matches.call(element, candidateSelector);
2196
- if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
2197
- candidates.push(element);
2198
- }
2199
-
2200
- // iterate over shadow content if possible
2201
- var shadowRoot = element.shadowRoot ||
2202
- // check for an undisclosed shadow
2203
- typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
2204
-
2205
- // no inert look up because we're already drilling down and checking for inertness
2206
- // on the way down, so all containers to this root node should have already been
2207
- // vetted as non-inert
2208
- var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
2209
- if (shadowRoot && validShadowRoot) {
2210
- // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
2211
- // shadow exists, so look at light dom children as fallback BUT create a scope for any
2212
- // child candidates found because they're likely slotted elements (elements that are
2213
- // children of the web component element (which has the shadow), in the light dom, but
2214
- // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
2215
- // _after_ we return from this recursive call
2216
- var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
2217
- if (options.flatten) {
2218
- candidates.push.apply(candidates, _nestedCandidates);
2219
- } else {
2220
- candidates.push({
2221
- scopeParent: element,
2222
- candidates: _nestedCandidates
2223
- });
2224
- }
2225
- } else {
2226
- // there's not shadow so just dig into the element's (light dom) children
2227
- // __without__ giving the element special scope treatment
2228
- elementsToCheck.unshift.apply(elementsToCheck, element.children);
2229
- }
2230
- }
2231
- }
2232
- return candidates;
2233
- };
2234
-
2235
- /**
2236
- * @private
2237
- * Determines if the node has an explicitly specified `tabindex` attribute.
2238
- * @param {HTMLElement} node
2239
- * @returns {boolean} True if so; false if not.
2240
- */
2241
- var hasTabIndex = function hasTabIndex(node) {
2242
- return !isNaN(parseInt(node.getAttribute('tabindex'), 10));
2243
- };
2132
+ function ownerDocument(node) {
2133
+ return node?.ownerDocument || document;
2134
+ }
2244
2135
 
2245
- /**
2246
- * Determine the tab index of a given node.
2247
- * @param {HTMLElement} node
2248
- * @returns {number} Tab order (negative, 0, or positive number).
2249
- * @throws {Error} If `node` is falsy.
2250
- */
2251
- var getTabIndex = function getTabIndex(node) {
2252
- if (!node) {
2253
- throw new Error('No node provided');
2254
- }
2255
- if (node.tabIndex < 0) {
2256
- // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
2257
- // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
2258
- // yet they are still part of the regular tab order; in FF, they get a default
2259
- // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
2260
- // order, consider their tab index to be 0.
2261
- // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
2262
- // so if they don't have a tabindex attribute specifically set, assume it's 0.
2263
- if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
2264
- return 0;
2265
- }
2136
+ const CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
2137
+ function getParentElement(element) {
2138
+ const assignedSlot = element.assignedSlot;
2139
+ if (assignedSlot) {
2140
+ return assignedSlot;
2266
2141
  }
2267
- return node.tabIndex;
2268
- };
2269
-
2270
- /**
2271
- * Determine the tab index of a given node __for sort order purposes__.
2272
- * @param {HTMLElement} node
2273
- * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
2274
- * has tabIndex -1, but needs to be sorted by document order in order for its content to be
2275
- * inserted into the correct sort position.
2276
- * @returns {number} Tab order (negative, 0, or positive number).
2277
- */
2278
- var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
2279
- var tabIndex = getTabIndex(node);
2280
- if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
2281
- return 0;
2142
+ if (element.parentElement) {
2143
+ return element.parentElement;
2282
2144
  }
2283
- return tabIndex;
2284
- };
2285
- var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
2286
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
2287
- };
2288
- var isInput = function isInput(node) {
2289
- return node.tagName === 'INPUT';
2290
- };
2291
- var isHiddenInput = function isHiddenInput(node) {
2292
- return isInput(node) && node.type === 'hidden';
2293
- };
2294
- var isDetailsWithSummary = function isDetailsWithSummary(node) {
2295
- var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
2296
- return child.tagName === 'SUMMARY';
2297
- });
2298
- return r;
2299
- };
2300
- var getCheckedRadio = function getCheckedRadio(nodes, form) {
2301
- for (var i = 0; i < nodes.length; i++) {
2302
- if (nodes[i].checked && nodes[i].form === form) {
2303
- return nodes[i];
2145
+ const rootNode = element.getRootNode();
2146
+ return floatingUi_reactDom.isShadowRoot(rootNode) ? rootNode.host : null;
2147
+ }
2148
+ function getDetailsSummary(details) {
2149
+ for (const child of Array.from(details.children)) {
2150
+ if (floatingUi_reactDom.getNodeName(child) === 'summary') {
2151
+ return child;
2304
2152
  }
2305
2153
  }
2306
- };
2307
- var isTabbableRadio = function isTabbableRadio(node) {
2308
- if (!node.name) {
2309
- return true;
2154
+ return null;
2155
+ }
2156
+ function isWithinOpenDetailsSummary(element, details) {
2157
+ const summary = getDetailsSummary(details);
2158
+ return !!summary && (element === summary || contains(summary, element));
2159
+ }
2160
+ function isFocusableCandidate(element) {
2161
+ const nodeName = element ? floatingUi_reactDom.getNodeName(element) : '';
2162
+ return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== 'summary' || element.parentElement != null && floatingUi_reactDom.getNodeName(element.parentElement) === 'details' && getDetailsSummary(element.parentElement) === element) && (nodeName !== 'details' || getDetailsSummary(element) == null) && (nodeName !== 'input' || element.type !== 'hidden');
2163
+ }
2164
+ function isFocusableElement(element) {
2165
+ if (!isFocusableCandidate(element) || !element.isConnected || element.matches(':disabled')) {
2166
+ return false;
2310
2167
  }
2311
- var radioScope = node.form || getRootNode(node);
2312
- var queryRadios = function queryRadios(name) {
2313
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
2314
- };
2315
- var radioSet;
2316
- if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
2317
- radioSet = queryRadios(window.CSS.escape(node.name));
2318
- } else {
2319
- try {
2320
- radioSet = queryRadios(node.name);
2321
- } catch (err) {
2322
- // eslint-disable-next-line no-console
2323
- console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
2168
+ for (let current = element; current; current = getParentElement(current)) {
2169
+ const isSlot = floatingUi_reactDom.getNodeName(current) === 'slot';
2170
+ if (current.hasAttribute('inert')) {
2324
2171
  return false;
2325
2172
  }
2326
- }
2327
- var checked = getCheckedRadio(radioSet, node.form);
2328
- return !checked || checked === node;
2329
- };
2330
- var isRadio = function isRadio(node) {
2331
- return isInput(node) && node.type === 'radio';
2332
- };
2333
- var isNonTabbableRadio = function isNonTabbableRadio(node) {
2334
- return isRadio(node) && !isTabbableRadio(node);
2335
- };
2336
-
2337
- // determines if a node is ultimately attached to the window's document
2338
- var isNodeAttached = function isNodeAttached(node) {
2339
- var _nodeRoot;
2340
- // The root node is the shadow root if the node is in a shadow DOM; some document otherwise
2341
- // (but NOT _the_ document; see second 'If' comment below for more).
2342
- // If rootNode is shadow root, it'll have a host, which is the element to which the shadow
2343
- // is attached, and the one we need to check if it's in the document or not (because the
2344
- // shadow, and all nodes it contains, is never considered in the document since shadows
2345
- // behave like self-contained DOMs; but if the shadow's HOST, which is part of the document,
2346
- // is hidden, or is not in the document itself but is detached, it will affect the shadow's
2347
- // visibility, including all the nodes it contains). The host could be any normal node,
2348
- // or a custom element (i.e. web component). Either way, that's the one that is considered
2349
- // part of the document, not the shadow root, nor any of its children (i.e. the node being
2350
- // tested).
2351
- // To further complicate things, we have to look all the way up until we find a shadow HOST
2352
- // that is attached (or find none) because the node might be in nested shadows...
2353
- // If rootNode is not a shadow root, it won't have a host, and so rootNode should be the
2354
- // document (per the docs) and while it's a Document-type object, that document does not
2355
- // appear to be the same as the node's `ownerDocument` for some reason, so it's safer
2356
- // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
2357
- // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
2358
- // node is actually detached.
2359
- // NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible
2360
- // if a tabbable/focusable node was quickly added to the DOM, focused, and then removed
2361
- // from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then
2362
- // `ownerDocument` will be `null`, hence the optional chaining on it.
2363
- var nodeRoot = node && getRootNode(node);
2364
- var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
2365
-
2366
- // in some cases, a detached node will return itself as the root instead of a document or
2367
- // shadow root object, in which case, we shouldn't try to look further up the host chain
2368
- var attached = false;
2369
- if (nodeRoot && nodeRoot !== node) {
2370
- var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
2371
- attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
2372
- while (!attached && nodeRootHost) {
2373
- var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
2374
- // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
2375
- // which means we need to get the host's host and check if that parent host is contained
2376
- // in (i.e. attached to) the document
2377
- nodeRoot = getRootNode(nodeRootHost);
2378
- nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
2379
- attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
2380
- }
2381
- }
2382
- return attached;
2383
- };
2384
- var isZeroArea = function isZeroArea(node) {
2385
- var _node$getBoundingClie = node.getBoundingClientRect(),
2386
- width = _node$getBoundingClie.width,
2387
- height = _node$getBoundingClie.height;
2388
- return width === 0 && height === 0;
2389
- };
2390
- var isHidden = function isHidden(node, _ref) {
2391
- var displayCheck = _ref.displayCheck,
2392
- getShadowRoot = _ref.getShadowRoot;
2393
- if (displayCheck === 'full-native') {
2394
- if ('checkVisibility' in node) {
2395
- // Chrome >= 105, Edge >= 105, Firefox >= 106, Safari >= 17.4
2396
- // @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility#browser_compatibility
2397
- var visible = node.checkVisibility({
2398
- // Checking opacity might be desirable for some use cases, but natively,
2399
- // opacity zero elements _are_ focusable and tabbable.
2400
- checkOpacity: false,
2401
- opacityProperty: false,
2402
- contentVisibilityAuto: true,
2403
- visibilityProperty: true,
2404
- // This is an alias for `visibilityProperty`. Contemporary browsers
2405
- // support both. However, this alias has wider browser support (Chrome
2406
- // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
2407
- // we include it anyway.
2408
- checkVisibilityCSS: true
2409
- });
2410
- return !visible;
2173
+ if (current !== element && floatingUi_reactDom.getNodeName(current) === 'details' && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute('hidden') || !isSlot && !isElementVisible(current)) {
2174
+ return false;
2411
2175
  }
2412
- // Fall through to manual visibility checks
2413
2176
  }
2414
-
2415
- // NOTE: visibility will be `undefined` if node is detached from the document
2416
- // (see notes about this further down), which means we will consider it visible
2417
- // (this is legacy behavior from a very long way back)
2418
- // NOTE: we check this regardless of `displayCheck="none"` because this is a
2419
- // _visibility_ check, not a _display_ check
2420
- if (getComputedStyle(node).visibility === 'hidden') {
2421
- return true;
2422
- }
2423
- var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
2424
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
2425
- if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
2426
- return true;
2427
- }
2428
- if (!displayCheck || displayCheck === 'full' ||
2429
- // full-native can run this branch when it falls through in case
2430
- // Element#checkVisibility is unsupported
2431
- displayCheck === 'full-native' || displayCheck === 'legacy-full') {
2432
- if (typeof getShadowRoot === 'function') {
2433
- // figure out if we should consider the node to be in an undisclosed shadow and use the
2434
- // 'non-zero-area' fallback
2435
- var originalNode = node;
2436
- while (node) {
2437
- var parentElement = node.parentElement;
2438
- var rootNode = getRootNode(node);
2439
- if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
2440
- ) {
2441
- // node has an undisclosed shadow which means we can only treat it as a black box, so we
2442
- // fall back to a non-zero-area test
2443
- return isZeroArea(node);
2444
- } else if (node.assignedSlot) {
2445
- // iterate up slot
2446
- node = node.assignedSlot;
2447
- } else if (!parentElement && rootNode !== node.ownerDocument) {
2448
- // cross shadow boundary
2449
- node = rootNode.host;
2450
- } else {
2451
- // iterate up normal dom
2452
- node = parentElement;
2453
- }
2454
- }
2455
- node = originalNode;
2456
- }
2457
- // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
2458
- // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
2459
- // it might be a falsy value, which means shadow DOM support is disabled
2460
-
2461
- // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)
2462
- // now we can just test to see if it would normally be visible or not, provided it's
2463
- // attached to the main document.
2464
- // NOTE: We must consider case where node is inside a shadow DOM and given directly to
2465
- // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.
2466
-
2467
- if (isNodeAttached(node)) {
2468
- // this works wherever the node is: if there's at least one client rect, it's
2469
- // somehow displayed; it also covers the CSS 'display: contents' case where the
2470
- // node itself is hidden in place of its contents; and there's no need to search
2471
- // up the hierarchy either
2472
- return !node.getClientRects().length;
2473
- }
2474
-
2475
- // Else, the node isn't attached to the document, which means the `getClientRects()`
2476
- // API will __always__ return zero rects (this can happen, for example, if React
2477
- // is used to render nodes onto a detached tree, as confirmed in this thread:
2478
- // https://github.com/facebook/react/issues/9117#issuecomment-284228870)
2479
- //
2480
- // It also means that even window.getComputedStyle(node).display will return `undefined`
2481
- // because styles are only computed for nodes that are in the document.
2482
- //
2483
- // NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable
2484
- // somehow. Though it was never stated officially, anyone who has ever used tabbable
2485
- // APIs on nodes in detached containers has actually implicitly used tabbable in what
2486
- // was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck="none"` mode -- essentially
2487
- // considering __everything__ to be visible because of the innability to determine styles.
2488
- //
2489
- // v6.0.0: As of this major release, the default 'full' option __no longer treats detached
2490
- // nodes as visible with the 'none' fallback.__
2491
- if (displayCheck !== 'legacy-full') {
2492
- return true; // hidden
2493
- }
2494
- // else, fallback to 'none' mode and consider the node visible
2495
- } else if (displayCheck === 'non-zero-area') {
2496
- // NOTE: Even though this tests that the node's client rect is non-zero to determine
2497
- // whether it's displayed, and that a detached node will __always__ have a zero-area
2498
- // client rect, we don't special-case for whether the node is attached or not. In
2499
- // this mode, we do want to consider nodes that have a zero area to be hidden at all
2500
- // times, and that includes attached or not.
2501
- return isZeroArea(node);
2502
- }
2503
-
2504
- // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume
2505
- // it's visible
2506
- return false;
2507
- };
2508
-
2509
- // form fields (nested) inside a disabled fieldset are not focusable/tabbable
2510
- // unless they are in the _first_ <legend> element of the top-most disabled
2511
- // fieldset
2512
- var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
2513
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
2514
- var parentNode = node.parentElement;
2515
- // check if `node` is contained in a disabled <fieldset>
2516
- while (parentNode) {
2517
- if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
2518
- // look for the first <legend> among the children of the disabled <fieldset>
2519
- for (var i = 0; i < parentNode.children.length; i++) {
2520
- var child = parentNode.children.item(i);
2521
- // when the first <legend> (in document order) is found
2522
- if (child.tagName === 'LEGEND') {
2523
- // if its parent <fieldset> is not nested in another disabled <fieldset>,
2524
- // return whether `node` is a descendant of its first <legend>
2525
- return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
2526
- }
2527
- }
2528
- // the disabled <fieldset> containing `node` has no <legend>
2529
- return true;
2530
- }
2531
- parentNode = parentNode.parentElement;
2177
+ return true;
2178
+ }
2179
+ function getTabIndex(element) {
2180
+ const tabIndex = element.tabIndex;
2181
+ if (tabIndex < 0) {
2182
+ const nodeName = floatingUi_reactDom.getNodeName(element);
2183
+ if (nodeName === 'details' || nodeName === 'audio' || nodeName === 'video' || floatingUi_reactDom.isHTMLElement(element) && element.isContentEditable) {
2184
+ return 0;
2532
2185
  }
2533
2186
  }
2534
-
2535
- // else, node's tabbable/focusable state should not be affected by a fieldset's
2536
- // enabled/disabled state
2537
- return false;
2538
- };
2539
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
2540
- if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
2541
- // For a details element with a summary, the summary element gets the focus
2542
- isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
2543
- return false;
2544
- }
2545
- return true;
2546
- };
2547
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
2548
- if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
2549
- return false;
2187
+ return tabIndex;
2188
+ }
2189
+ function getNamedRadioInput(element) {
2190
+ if (floatingUi_reactDom.getNodeName(element) !== 'input') {
2191
+ return null;
2550
2192
  }
2551
- return true;
2552
- };
2553
- var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {
2554
- var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
2555
- if (isNaN(tabIndex) || tabIndex >= 0) {
2193
+ const input = element;
2194
+ return input.type === 'radio' && input.name !== '' ? input : null;
2195
+ }
2196
+ function isTabbableRadio(element, candidates) {
2197
+ const input = getNamedRadioInput(element);
2198
+ if (!input) {
2556
2199
  return true;
2557
2200
  }
2558
- // If a custom element has an explicit negative tabindex,
2559
- // browsers will not allow tab targeting said element's children.
2560
- return false;
2561
- };
2562
-
2563
- /**
2564
- * @param {Array.<Element|CandidateScope>} candidates
2565
- * @returns Element[]
2566
- */
2567
- var _sortByOrder = function sortByOrder(candidates) {
2568
- var regularTabbables = [];
2569
- var orderedTabbables = [];
2570
- candidates.forEach(function (item, i) {
2571
- var isScope = !!item.scopeParent;
2572
- var element = isScope ? item.scopeParent : item;
2573
- var candidateTabindex = getSortOrderTabIndex(element, isScope);
2574
- var elements = isScope ? _sortByOrder(item.candidates) : element;
2575
- if (candidateTabindex === 0) {
2576
- isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
2577
- } else {
2578
- orderedTabbables.push({
2579
- documentOrder: i,
2580
- tabIndex: candidateTabindex,
2581
- item: item,
2582
- isScope: isScope,
2583
- content: elements
2584
- });
2585
- }
2201
+ const checkedRadio = candidates.find(candidate => {
2202
+ const radio = getNamedRadioInput(candidate);
2203
+ return radio?.name === input.name && radio.form === input.form && radio.checked;
2586
2204
  });
2587
- return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
2588
- sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
2589
- return acc;
2590
- }, []).concat(regularTabbables);
2591
- };
2592
- var tabbable = function tabbable(container, options) {
2593
- options = options || {};
2594
- var candidates;
2595
- if (options.getShadowRoot) {
2596
- candidates = _getCandidatesIteratively([container], options.includeContainer, {
2597
- filter: isNodeMatchingSelectorTabbable.bind(null, options),
2598
- flatten: false,
2599
- getShadowRoot: options.getShadowRoot,
2600
- shadowRootFilter: isShadowRootTabbable
2205
+ if (checkedRadio) {
2206
+ return checkedRadio === input;
2207
+ }
2208
+ return candidates.find(candidate => {
2209
+ const radio = getNamedRadioInput(candidate);
2210
+ return radio?.name === input.name && radio.form === input.form;
2211
+ }) === input;
2212
+ }
2213
+ function getComposedChildren(container) {
2214
+ if (floatingUi_reactDom.isHTMLElement(container) && floatingUi_reactDom.getNodeName(container) === 'slot') {
2215
+ const assignedElements = container.assignedElements({
2216
+ flatten: true
2601
2217
  });
2602
- } else {
2603
- candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
2604
- }
2605
- return _sortByOrder(candidates);
2606
- };
2607
- var focusable = function focusable(container, options) {
2608
- options = options || {};
2609
- var candidates;
2610
- if (options.getShadowRoot) {
2611
- candidates = _getCandidatesIteratively([container], options.includeContainer, {
2612
- filter: isNodeMatchingSelectorFocusable.bind(null, options),
2613
- flatten: true,
2614
- getShadowRoot: options.getShadowRoot
2615
- });
2616
- } else {
2617
- candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
2618
- }
2619
- return candidates;
2620
- };
2621
- var isTabbable = function isTabbable(node, options) {
2622
- options = options || {};
2623
- if (!node) {
2624
- throw new Error('No node provided');
2218
+ if (assignedElements.length > 0) {
2219
+ return assignedElements;
2220
+ }
2625
2221
  }
2626
- if (matches.call(node, candidateSelector) === false) {
2627
- return false;
2222
+ if (floatingUi_reactDom.isHTMLElement(container) && container.shadowRoot) {
2223
+ return Array.from(container.shadowRoot.children);
2628
2224
  }
2629
- return isNodeMatchingSelectorTabbable(options, node);
2630
- };
2631
-
2632
- function ownerDocument(node) {
2633
- return node?.ownerDocument || document;
2225
+ return Array.from(container.children);
2226
+ }
2227
+ function appendCandidates(container, list) {
2228
+ getComposedChildren(container).forEach(child => {
2229
+ if (isFocusableCandidate(child)) {
2230
+ list.push(child);
2231
+ }
2232
+ appendCandidates(child, list);
2233
+ });
2234
+ }
2235
+ function appendMatchingElements(container, selector, list) {
2236
+ getComposedChildren(container).forEach(child => {
2237
+ if (floatingUi_reactDom.isHTMLElement(child) && child.matches(selector)) {
2238
+ list.push(child);
2239
+ }
2240
+ appendMatchingElements(child, selector, list);
2241
+ });
2242
+ }
2243
+ function isTabbable(element) {
2244
+ return isFocusableElement(element) && getTabIndex(element) >= 0;
2245
+ }
2246
+ function focusable(container) {
2247
+ const candidates = [];
2248
+ appendCandidates(container, candidates);
2249
+ return candidates.filter(isFocusableElement);
2250
+ }
2251
+ function tabbable(container) {
2252
+ const candidates = focusable(container);
2253
+ return candidates.filter(element => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
2634
2254
  }
2635
-
2636
- const getTabbableOptions = () => ({
2637
- getShadowRoot: true,
2638
- displayCheck:
2639
- // JSDOM does not support the `tabbable` library. To solve this we can
2640
- // check if `ResizeObserver` is a real function (not polyfilled), which
2641
- // determines if the current environment is JSDOM-like.
2642
- typeof ResizeObserver === 'function' && ResizeObserver.toString().includes('[native code]') ? 'full' : 'none'
2643
- });
2644
2255
  function getTabbableIn(container, dir) {
2645
- const list = tabbable(container, getTabbableOptions());
2256
+ const list = tabbable(container);
2646
2257
  const len = list.length;
2647
2258
  if (len === 0) {
2648
2259
  return undefined;
@@ -2665,14 +2276,15 @@ function isOutsideEvent(event, container) {
2665
2276
  return !relatedTarget || !contains(containerElement, relatedTarget);
2666
2277
  }
2667
2278
  function disableFocusInside(container) {
2668
- const tabbableElements = tabbable(container, getTabbableOptions());
2279
+ const tabbableElements = tabbable(container);
2669
2280
  tabbableElements.forEach(element => {
2670
2281
  element.dataset.tabindex = element.getAttribute('tabindex') || '';
2671
2282
  element.setAttribute('tabindex', '-1');
2672
2283
  });
2673
2284
  }
2674
2285
  function enableFocusInside(container) {
2675
- const elements = container.querySelectorAll('[data-tabindex]');
2286
+ const elements = [];
2287
+ appendMatchingElements(container, '[data-tabindex]', elements);
2676
2288
  elements.forEach(element => {
2677
2289
  const tabindex = element.dataset.tabindex;
2678
2290
  delete element.dataset.tabindex;
@@ -2684,6 +2296,17 @@ function enableFocusInside(container) {
2684
2296
  });
2685
2297
  }
2686
2298
 
2299
+ /**
2300
+ * Adds an event listener and returns a cleanup function to remove it.
2301
+ */
2302
+
2303
+ function addEventListener(target, type, listener, options) {
2304
+ target.addEventListener(type, listener, options);
2305
+ return () => {
2306
+ target.removeEventListener(type, listener, options);
2307
+ };
2308
+ }
2309
+
2687
2310
  /**
2688
2311
  * Calls the provided function when the CSS open/close animation or transition completes.
2689
2312
  */
@@ -2708,6 +2331,14 @@ function useOpenChangeComplete(parameters) {
2708
2331
  }, [enabled, open, onComplete, runOnceAnimationsFinish]);
2709
2332
  }
2710
2333
 
2334
+ function useOnFirstRender(fn) {
2335
+ const ref = React__namespace.useRef(true);
2336
+ if (ref.current) {
2337
+ ref.current = false;
2338
+ fn();
2339
+ }
2340
+ }
2341
+
2711
2342
  const EMPTY = 0;
2712
2343
  class Timeout {
2713
2344
  static create() {
@@ -2906,16 +2537,15 @@ function preventScrollInsetScrollbars(referenceElement) {
2906
2537
  resizeFrame.request(lockScroll);
2907
2538
  }
2908
2539
  lockScroll();
2909
- win.addEventListener('resize', handleResize);
2540
+ const unsubscribeResize = addEventListener(win, 'resize', handleResize);
2910
2541
  return () => {
2911
2542
  resizeFrame.cancel();
2912
2543
  cleanup();
2913
- // Sometimes this cleanup can be run after test teardown
2914
- // because it is called in a `setTimeout(fn, 0)`,
2915
- // in which case `removeEventListener` wouldn't be available,
2916
- // so we check for it to avoid test failures.
2544
+ // Sometimes this cleanup can run after test teardown because it is called
2545
+ // in a `setTimeout(fn, 0)`. Guard the returned cleanup to avoid calling
2546
+ // `removeEventListener` when it is no longer available in tests.
2917
2547
  if (typeof win.removeEventListener === 'function') {
2918
- win.removeEventListener('resize', handleResize);
2548
+ unsubscribeResize();
2919
2549
  }
2920
2550
  };
2921
2551
  }
@@ -2984,6 +2614,20 @@ function useScrollLock(enabled = true, referenceElement = null) {
2984
2614
  }, [enabled, referenceElement]);
2985
2615
  }
2986
2616
 
2617
+ /**
2618
+ * Combines multiple cleanup functions into a single cleanup function.
2619
+ */
2620
+ function mergeCleanups(...cleanups) {
2621
+ return () => {
2622
+ for (let i = 0; i < cleanups.length; i += 1) {
2623
+ const cleanup = cleanups[i];
2624
+ if (cleanup) {
2625
+ cleanup();
2626
+ }
2627
+ }
2628
+ };
2629
+ }
2630
+
2987
2631
  /**
2988
2632
  * Untracks the provided value by turning it into a ref to remove its reactivity.
2989
2633
  *
@@ -3073,9 +2717,16 @@ function enqueueFocus(el, options = {}) {
3073
2717
  });
3074
2718
  if (sync) {
3075
2719
  exec();
3076
- } else {
3077
- rafId = requestAnimationFrame(exec);
2720
+ return NOOP;
3078
2721
  }
2722
+ const currentRafId = requestAnimationFrame(exec);
2723
+ rafId = currentRafId;
2724
+ return () => {
2725
+ if (rafId === currentRafId) {
2726
+ cancelAnimationFrame(currentRafId);
2727
+ rafId = 0;
2728
+ }
2729
+ };
3079
2730
  }
3080
2731
 
3081
2732
  // Modified to add conditional `aria-hidden` support:
@@ -3322,6 +2973,7 @@ const FloatingPortal = /*#__PURE__*/React__namespace.forwardRef(function Floatin
3322
2973
  className,
3323
2974
  render,
3324
2975
  renderGuards,
2976
+ style,
3325
2977
  ...elementProps
3326
2978
  } = componentProps;
3327
2979
  const {
@@ -3338,6 +2990,7 @@ const FloatingPortal = /*#__PURE__*/React__namespace.forwardRef(function Floatin
3338
2990
  const beforeInsideRef = React__namespace.useRef(null);
3339
2991
  const afterInsideRef = React__namespace.useRef(null);
3340
2992
  const [focusManagerState, setFocusManagerState] = React__namespace.useState(null);
2993
+ const focusInsideDisabledRef = React__namespace.useRef(false);
3341
2994
  const modal = focusManagerState?.modal;
3342
2995
  const open = focusManagerState?.open;
3343
2996
  const shouldRenderGuards = typeof renderGuards === 'boolean' ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
@@ -3353,26 +3006,28 @@ const FloatingPortal = /*#__PURE__*/React__namespace.forwardRef(function Floatin
3353
3006
  // element outside or using the mouse.
3354
3007
  function onFocus(event) {
3355
3008
  if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
3356
- const focusing = event.type === 'focusin';
3357
- const manageFocus = focusing ? enableFocusInside : disableFocusInside;
3358
- manageFocus(portalNode);
3009
+ if (event.type === 'focusin') {
3010
+ if (focusInsideDisabledRef.current) {
3011
+ enableFocusInside(portalNode);
3012
+ focusInsideDisabledRef.current = false;
3013
+ }
3014
+ } else {
3015
+ disableFocusInside(portalNode);
3016
+ focusInsideDisabledRef.current = true;
3017
+ }
3359
3018
  }
3360
3019
  }
3361
3020
 
3362
3021
  // Listen to the event on the capture phase so they run before the focus
3363
3022
  // trap elements onFocus prop is called.
3364
- portalNode.addEventListener('focusin', onFocus, true);
3365
- portalNode.addEventListener('focusout', onFocus, true);
3366
- return () => {
3367
- portalNode.removeEventListener('focusin', onFocus, true);
3368
- portalNode.removeEventListener('focusout', onFocus, true);
3369
- };
3023
+ return mergeCleanups(addEventListener(portalNode, 'focusin', onFocus, true), addEventListener(portalNode, 'focusout', onFocus, true));
3370
3024
  }, [portalNode, modal]);
3371
3025
  React__namespace.useEffect(() => {
3372
- if (!portalNode || open) {
3026
+ if (!portalNode || open !== false) {
3373
3027
  return;
3374
3028
  }
3375
3029
  enableFocusInside(portalNode);
3030
+ focusInsideDisabledRef.current = false;
3376
3031
  }, [open, portalNode]);
3377
3032
  const portalContextValue = React__namespace.useMemo(() => ({
3378
3033
  beforeOutsideRef,
@@ -3451,7 +3106,7 @@ const useFloatingTree = externalTree => {
3451
3106
  };
3452
3107
 
3453
3108
  function getEventType(event, lastInteractionType) {
3454
- const win = floatingUi_reactDom.getWindow(event.target);
3109
+ const win = floatingUi_reactDom.getWindow(getTarget(event));
3455
3110
  if (event instanceof win.KeyboardEvent) {
3456
3111
  return 'keyboard';
3457
3112
  }
@@ -3496,11 +3151,10 @@ function getFirstTabbableElement(container) {
3496
3151
  if (!container) {
3497
3152
  return null;
3498
3153
  }
3499
- const tabbableOptions = getTabbableOptions();
3500
- if (isTabbable(container, tabbableOptions)) {
3154
+ if (isTabbable(container)) {
3501
3155
  return container;
3502
3156
  }
3503
- return tabbable(container, tabbableOptions)[0] || container;
3157
+ return tabbable(container)[0] || container;
3504
3158
  }
3505
3159
  function isFocusable(element) {
3506
3160
  if (!element || !element.isConnected) {
@@ -3512,14 +3166,16 @@ function isFocusable(element) {
3512
3166
  return isElementVisible(element);
3513
3167
  }
3514
3168
  function handleTabIndex(floatingFocusElement, orderRef) {
3169
+ if (floatingFocusElement.hasAttribute('tabindex') && !floatingFocusElement.hasAttribute('data-tabindex')) {
3170
+ return;
3171
+ }
3515
3172
  if (!orderRef.current.includes('floating') && !floatingFocusElement.getAttribute('role')?.includes('dialog')) {
3516
3173
  return;
3517
3174
  }
3518
- const options = getTabbableOptions();
3519
- const focusableElements = focusable(floatingFocusElement, options);
3175
+ const focusableElements = focusable(floatingFocusElement);
3520
3176
  const tabbableContent = focusableElements.filter(element => {
3521
3177
  const dataTabIndex = element.getAttribute('data-tabindex') || '';
3522
- return isTabbable(element, options) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');
3178
+ return isTabbable(element) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');
3523
3179
  });
3524
3180
  const tabIndex = floatingFocusElement.getAttribute('tabindex');
3525
3181
  if (orderRef.current.includes('floating') || tabbableContent.length === 0) {
@@ -3578,7 +3234,7 @@ function FloatingFocusManager(props) {
3578
3234
  const preventReturnFocusRef = React__namespace.useRef(false);
3579
3235
  const isPointerDownRef = React__namespace.useRef(false);
3580
3236
  const pointerDownOutsideRef = React__namespace.useRef(false);
3581
- const tabbableIndexRef = React__namespace.useRef(-1);
3237
+ const lastFocusedTabbableRef = React__namespace.useRef(null);
3582
3238
  const closeTypeRef = React__namespace.useRef('');
3583
3239
  const lastInteractionTypeRef = React__namespace.useRef('');
3584
3240
  const beforeGuardRef = React__namespace.useRef(null);
@@ -3591,13 +3247,9 @@ function FloatingFocusManager(props) {
3591
3247
  const isInsidePortal = portalContext != null;
3592
3248
  const floatingFocusElement = getFloatingFocusElement(floating);
3593
3249
  const getTabbableContent = useStableCallback((container = floatingFocusElement) => {
3594
- return container ? tabbable(container, getTabbableOptions()) : [];
3250
+ return container ? tabbable(container) : [];
3595
3251
  });
3596
3252
  const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter(element => element != null) ?? []);
3597
- const getTabbableElements = useStableCallback(container => {
3598
- const content = getTabbableContent(container);
3599
- return orderRef.current.map(() => content).filter(Boolean).flat();
3600
- });
3601
3253
 
3602
3254
  // Prevent Tab from escaping the modal when there are no tabbable elements.
3603
3255
  React__namespace.useEffect(() => {
@@ -3612,12 +3264,9 @@ function FloatingFocusManager(props) {
3612
3264
  }
3613
3265
  }
3614
3266
  }
3615
- const doc = ownerDocument(floatingFocusElement);
3616
- doc.addEventListener('keydown', onKeyDown);
3617
- return () => {
3618
- doc.removeEventListener('keydown', onKeyDown);
3619
- };
3620
- }, [disabled, domReference, floatingFocusElement, modal, orderRef, isUntrappedTypeableCombobox, getTabbableContent, getTabbableElements]);
3267
+ const doc = ownerDocument(floatingFocusElement);
3268
+ return addEventListener(doc, 'keydown', onKeyDown);
3269
+ }, [disabled, domReference, floatingFocusElement, modal, orderRef, isUntrappedTypeableCombobox, getTabbableContent]);
3621
3270
 
3622
3271
  // Track pointer/keyboard interactions to disambiguate focus and outside presses.
3623
3272
  React__namespace.useEffect(() => {
@@ -3641,16 +3290,7 @@ function FloatingFocusManager(props) {
3641
3290
  function onKeyDown() {
3642
3291
  lastInteractionTypeRef.current = 'keyboard';
3643
3292
  }
3644
- doc.addEventListener('pointerdown', onPointerDown, true);
3645
- doc.addEventListener('pointerup', clearPointerDownOutside, true);
3646
- doc.addEventListener('pointercancel', clearPointerDownOutside, true);
3647
- doc.addEventListener('keydown', onKeyDown, true);
3648
- return () => {
3649
- doc.removeEventListener('pointerdown', onPointerDown, true);
3650
- doc.removeEventListener('pointerup', clearPointerDownOutside, true);
3651
- doc.removeEventListener('pointercancel', clearPointerDownOutside, true);
3652
- doc.removeEventListener('keydown', onKeyDown, true);
3653
- };
3293
+ return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true));
3654
3294
  }, [disabled, floating, domReference, floatingFocusElement, open, portalContext, getResolvedInsideElements]);
3655
3295
 
3656
3296
  // Close on focus out and restore focus within the floating tree when needed.
@@ -3669,10 +3309,8 @@ function FloatingFocusManager(props) {
3669
3309
  }
3670
3310
  function handleFocusIn(event) {
3671
3311
  const target = getTarget(event);
3672
- const tabbableContent = getTabbableContent();
3673
- const tabbableIndex = tabbableContent.indexOf(target);
3674
- if (tabbableIndex !== -1) {
3675
- tabbableIndexRef.current = tabbableIndex;
3312
+ if (isTabbable(target)) {
3313
+ lastFocusedTabbableRef.current = target;
3676
3314
  }
3677
3315
  }
3678
3316
  function handleFocusOutside(event) {
@@ -3709,9 +3347,9 @@ function FloatingFocusManager(props) {
3709
3347
  return;
3710
3348
  }
3711
3349
  }
3712
- const prevTabbableIndex = tabbableIndexRef.current;
3713
3350
  const tabbableContent = getTabbableContent();
3714
- const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
3351
+ const prevTabbable = lastFocusedTabbableRef.current;
3352
+ const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
3715
3353
  if (floatingUi_reactDom.isHTMLElement(nodeToFocus)) {
3716
3354
  nodeToFocus.focus();
3717
3355
  }
@@ -3749,37 +3387,10 @@ function FloatingFocusManager(props) {
3749
3387
  });
3750
3388
  }
3751
3389
  const domReferenceElement = floatingUi_reactDom.isHTMLElement(domReference) ? domReference : null;
3752
- const cleanups = [];
3753
3390
  if (!floating && !domReferenceElement) {
3754
3391
  return undefined;
3755
3392
  }
3756
- if (domReferenceElement) {
3757
- domReferenceElement.addEventListener('focusout', handleFocusOutside);
3758
- domReferenceElement.addEventListener('pointerdown', handlePointerDown);
3759
- cleanups.push(() => {
3760
- domReferenceElement.removeEventListener('focusout', handleFocusOutside);
3761
- domReferenceElement.removeEventListener('pointerdown', handlePointerDown);
3762
- });
3763
- }
3764
- if (floating) {
3765
- floating.addEventListener('focusin', handleFocusIn);
3766
- floating.addEventListener('focusout', handleFocusOutside);
3767
- if (portalContext) {
3768
- floating.addEventListener('focusout', markInsideReactTree, true);
3769
- cleanups.push(() => {
3770
- floating.removeEventListener('focusout', markInsideReactTree, true);
3771
- });
3772
- }
3773
- cleanups.push(() => {
3774
- floating.removeEventListener('focusin', handleFocusIn);
3775
- floating.removeEventListener('focusout', handleFocusOutside);
3776
- });
3777
- }
3778
- return () => {
3779
- cleanups.forEach(cleanup => {
3780
- cleanup();
3781
- });
3782
- };
3393
+ return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, 'focusout', handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, 'pointerdown', handlePointerDown), floating && addEventListener(floating, 'focusin', handleFocusIn), floating && addEventListener(floating, 'focusout', handleFocusOutside), floating && portalContext && addEventListener(floating, 'focusout', markInsideReactTree, true));
3783
3394
  }, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, orderRef, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);
3784
3395
 
3785
3396
  // Hide everything outside the floating tree from assistive tech while open.
@@ -3816,7 +3427,6 @@ function FloatingFocusManager(props) {
3816
3427
 
3817
3428
  // Wait for any layout effect state setters to execute to set `tabIndex`.
3818
3429
  queueMicrotask(() => {
3819
- const focusableElements = getTabbableElements(floatingFocusElement);
3820
3430
  const initialFocusValueOrFn = initialFocusRef.current;
3821
3431
  const resolvedInitialFocus = typeof initialFocusValueOrFn === 'function' ? initialFocusValueOrFn(openInteractionTypeRef.current || '') : initialFocusValueOrFn;
3822
3432
 
@@ -3824,22 +3434,29 @@ function FloatingFocusManager(props) {
3824
3434
  if (resolvedInitialFocus === undefined || resolvedInitialFocus === false) {
3825
3435
  return;
3826
3436
  }
3437
+ const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);
3438
+ if (focusAlreadyInsideFloatingEl) {
3439
+ return;
3440
+ }
3441
+ let focusableElements = null;
3442
+ const getDefaultFocusElement = () => {
3443
+ if (focusableElements == null) {
3444
+ focusableElements = getTabbableContent(floatingFocusElement);
3445
+ }
3446
+ return focusableElements[0] || floatingFocusElement;
3447
+ };
3827
3448
  let elToFocus;
3828
3449
  if (resolvedInitialFocus === true || resolvedInitialFocus === null) {
3829
- elToFocus = focusableElements[0] || floatingFocusElement;
3450
+ elToFocus = getDefaultFocusElement();
3830
3451
  } else {
3831
3452
  elToFocus = resolveRef(resolvedInitialFocus);
3832
3453
  }
3833
- elToFocus = elToFocus || focusableElements[0] || floatingFocusElement;
3834
- const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);
3835
- if (focusAlreadyInsideFloatingEl) {
3836
- return;
3837
- }
3454
+ elToFocus = elToFocus || getDefaultFocusElement();
3838
3455
  enqueueFocus(elToFocus, {
3839
3456
  preventScroll: elToFocus === floatingFocusElement
3840
3457
  });
3841
3458
  });
3842
- }, [disabled, open, floatingFocusElement, ignoreInitialFocus, getTabbableElements, initialFocusRef, openInteractionTypeRef]);
3459
+ }, [disabled, open, floatingFocusElement, ignoreInitialFocus, getTabbableContent, initialFocusRef, openInteractionTypeRef]);
3843
3460
 
3844
3461
  // Track return focus targets and restore focus on unmount/close.
3845
3462
  useIsoLayoutEffect(() => {
@@ -3868,7 +3485,7 @@ function FloatingFocusManager(props) {
3868
3485
  preventReturnFocusRef.current = false;
3869
3486
  } else {
3870
3487
  let isPreventScrollSupported = false;
3871
- document.createElement('div').focus({
3488
+ ownerDocument(floatingFocusElement).createElement('div').focus({
3872
3489
  get preventScroll() {
3873
3490
  isPreventScrollSupported = true;
3874
3491
  return false;
@@ -3905,14 +3522,15 @@ function FloatingFocusManager(props) {
3905
3522
  const activeEl = activeElement(doc);
3906
3523
  const insideElements = getResolvedInsideElements();
3907
3524
  const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some(element => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some(node => contains(node.context?.elements.floating, activeEl));
3525
+
3526
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3527
+ const returnFocusValueOrFn = returnFocusRef.current;
3908
3528
  const returnElement = getReturnElement();
3909
3529
  queueMicrotask(() => {
3910
3530
  // This is `returnElement`, if it's tabbable, or its first tabbable child.
3911
3531
  const tabbableReturnElement = getFirstTabbableElement(returnElement);
3912
- const hasExplicitReturnFocus = typeof returnFocusRef.current !== 'boolean';
3913
- if (
3914
- // eslint-disable-next-line react-hooks/exhaustive-deps
3915
- returnFocusRef.current && !preventReturnFocusRef.current && floatingUi_reactDom.isHTMLElement(tabbableReturnElement) && (
3532
+ const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== 'boolean';
3533
+ if (returnFocusValueOrFn && !preventReturnFocusRef.current && floatingUi_reactDom.isHTMLElement(tabbableReturnElement) && (
3916
3534
  // If the focus moved somewhere else after mount, avoid returning focus
3917
3535
  // since it likely entered a different element which should be
3918
3536
  // respected: https://github.com/floating-ui/floating-ui/issues/2607
@@ -3976,7 +3594,7 @@ function FloatingFocusManager(props) {
3976
3594
  ref: mergedBeforeGuardRef,
3977
3595
  onFocus: event => {
3978
3596
  if (modal) {
3979
- const els = getTabbableElements();
3597
+ const els = getTabbableContent();
3980
3598
  enqueueFocus(els[els.length - 1]);
3981
3599
  } else if (portalContext?.portalNode) {
3982
3600
  preventReturnFocusRef.current = false;
@@ -3993,7 +3611,7 @@ function FloatingFocusManager(props) {
3993
3611
  ref: mergedAfterGuardRef,
3994
3612
  onFocus: event => {
3995
3613
  if (modal) {
3996
- enqueueFocus(getTabbableElements()[0]);
3614
+ enqueueFocus(getTabbableContent()[0]);
3997
3615
  } else if (portalContext?.portalNode) {
3998
3616
  if (closeOnFocusOut) {
3999
3617
  preventReturnFocusRef.current = true;
@@ -4050,8 +3668,9 @@ function useClick(context, props = {}) {
4050
3668
 
4051
3669
  // Animations sometimes won't run on a typeable element if using a rAF.
4052
3670
  // Focus is always set on these elements. For touch, we may delay opening.
4053
- if (isTypeableElement(nativeEvent.target)) {
4054
- const details = createChangeEventDetails(reason, nativeEvent, nativeEvent.target);
3671
+ const target = getTarget(nativeEvent);
3672
+ if (isTypeableElement(target)) {
3673
+ const details = createChangeEventDetails(reason, nativeEvent, target);
4055
3674
  if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {
4056
3675
  touchOpenTimeout.start(touchOpenDelay, () => {
4057
3676
  store.setOpen(true, details);
@@ -4272,11 +3891,8 @@ function useDismiss(context, props = {}) {
4272
3891
  }
4273
3892
  const target = getTarget(event);
4274
3893
  const inertSelector = `[${createAttribute('inert')}]`;
4275
- let markers = Array.from(ownerDocument(store.select('floatingElement')).querySelectorAll(inertSelector));
4276
3894
  const targetRoot = floatingUi_reactDom.isElement(target) ? target.getRootNode() : null;
4277
- if (floatingUi_reactDom.isShadowRoot(targetRoot)) {
4278
- markers = markers.concat(Array.from(targetRoot.querySelectorAll(inertSelector)));
4279
- }
3895
+ const markers = Array.from((floatingUi_reactDom.isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select('floatingElement'))).querySelectorAll(inertSelector));
4280
3896
  const triggers = store.context.triggerElements;
4281
3897
 
4282
3898
  // If another trigger is clicked, don't close the floating element.
@@ -4384,14 +4000,19 @@ function useDismiss(context, props = {}) {
4384
4000
  });
4385
4001
  }
4386
4002
  }
4387
- function handleTouchStartCapture(event) {
4388
- currentPointerTypeRef.current = 'touch';
4003
+ function addTargetEventListenerOnce(event, listener) {
4389
4004
  const target = getTarget(event);
4390
- function callback() {
4391
- handleTouchStart(event);
4392
- target?.removeEventListener(event.type, callback);
4005
+ if (!target) {
4006
+ return;
4393
4007
  }
4394
- target?.addEventListener(event.type, callback);
4008
+ const unsubscribe = addEventListener(target, event.type, () => {
4009
+ listener(event);
4010
+ unsubscribe();
4011
+ });
4012
+ }
4013
+ function handleTouchStartCapture(event) {
4014
+ currentPointerTypeRef.current = 'touch';
4015
+ addTargetEventListenerOnce(event, handleTouchStart);
4395
4016
  }
4396
4017
  function closeOnPressOutsideCapture(event) {
4397
4018
  cancelDismissOnEndTimeout.clear();
@@ -4401,16 +4022,13 @@ function useDismiss(context, props = {}) {
4401
4022
  if (event.type === 'mousedown' && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
4402
4023
  return;
4403
4024
  }
4404
- const target = getTarget(event);
4405
- function callback() {
4406
- if (event.type === 'pointerdown') {
4407
- handlePointerDown(event);
4025
+ addTargetEventListenerOnce(event, targetEvent => {
4026
+ if (targetEvent.type === 'pointerdown') {
4027
+ handlePointerDown(targetEvent);
4408
4028
  } else {
4409
- closeOnPressOutside(event);
4029
+ closeOnPressOutside(targetEvent);
4410
4030
  }
4411
- target?.removeEventListener(event.type, callback);
4412
- }
4413
- target?.addEventListener(event.type, callback);
4031
+ });
4414
4032
  }
4415
4033
  function handlePressEndCapture(event) {
4416
4034
  if (!pressStartedInsideRef.current) {
@@ -4469,12 +4087,7 @@ function useDismiss(context, props = {}) {
4469
4087
  }
4470
4088
  }
4471
4089
  function handleTouchMoveCapture(event) {
4472
- const target = getTarget(event);
4473
- function callback() {
4474
- handleTouchMove(event);
4475
- target?.removeEventListener(event.type, callback);
4476
- }
4477
- target?.addEventListener(event.type, callback);
4090
+ addTargetEventListenerOnce(event, handleTouchMove);
4478
4091
  }
4479
4092
  function handleTouchEnd(event) {
4480
4093
  if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventTargetWithin(event, store.select('floatingElement')) || isEventTargetWithin(event, store.select('domReferenceElement'))) {
@@ -4487,47 +4100,12 @@ function useDismiss(context, props = {}) {
4487
4100
  touchStateRef.current = null;
4488
4101
  }
4489
4102
  function handleTouchEndCapture(event) {
4490
- const target = getTarget(event);
4491
- function callback() {
4492
- handleTouchEnd(event);
4493
- target?.removeEventListener(event.type, callback);
4494
- }
4495
- target?.addEventListener(event.type, callback);
4103
+ addTargetEventListenerOnce(event, handleTouchEnd);
4496
4104
  }
4497
4105
  const doc = ownerDocument(floatingElement);
4498
- if (escapeKey$1) {
4499
- doc.addEventListener('keydown', closeOnEscapeKeyDown);
4500
- doc.addEventListener('compositionstart', handleCompositionStart);
4501
- doc.addEventListener('compositionend', handleCompositionEnd);
4502
- }
4503
- if (outsidePressEnabled) {
4504
- doc.addEventListener('click', closeOnPressOutsideCapture, true);
4505
- doc.addEventListener('pointerdown', closeOnPressOutsideCapture, true);
4506
- doc.addEventListener('pointerup', handlePressEndCapture, true);
4507
- doc.addEventListener('pointercancel', handlePressEndCapture, true);
4508
- doc.addEventListener('mousedown', closeOnPressOutsideCapture, true);
4509
- doc.addEventListener('mouseup', handlePressEndCapture, true);
4510
- doc.addEventListener('touchstart', handleTouchStartCapture, true);
4511
- doc.addEventListener('touchmove', handleTouchMoveCapture, true);
4512
- doc.addEventListener('touchend', handleTouchEndCapture, true);
4513
- }
4106
+ const unsubscribe = mergeCleanups(escapeKey$1 && mergeCleanups(addEventListener(doc, 'keydown', closeOnEscapeKeyDown), addEventListener(doc, 'compositionstart', handleCompositionStart), addEventListener(doc, 'compositionend', handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, 'click', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerdown', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerup', handlePressEndCapture, true), addEventListener(doc, 'pointercancel', handlePressEndCapture, true), addEventListener(doc, 'mousedown', closeOnPressOutsideCapture, true), addEventListener(doc, 'mouseup', handlePressEndCapture, true), addEventListener(doc, 'touchstart', handleTouchStartCapture, true), addEventListener(doc, 'touchmove', handleTouchMoveCapture, true), addEventListener(doc, 'touchend', handleTouchEndCapture, true)));
4514
4107
  return () => {
4515
- if (escapeKey$1) {
4516
- doc.removeEventListener('keydown', closeOnEscapeKeyDown);
4517
- doc.removeEventListener('compositionstart', handleCompositionStart);
4518
- doc.removeEventListener('compositionend', handleCompositionEnd);
4519
- }
4520
- if (outsidePressEnabled) {
4521
- doc.removeEventListener('click', closeOnPressOutsideCapture, true);
4522
- doc.removeEventListener('pointerdown', closeOnPressOutsideCapture, true);
4523
- doc.removeEventListener('pointerup', handlePressEndCapture, true);
4524
- doc.removeEventListener('pointercancel', handlePressEndCapture, true);
4525
- doc.removeEventListener('mousedown', closeOnPressOutsideCapture, true);
4526
- doc.removeEventListener('mouseup', handlePressEndCapture, true);
4527
- doc.removeEventListener('touchstart', handleTouchStartCapture, true);
4528
- doc.removeEventListener('touchmove', handleTouchMoveCapture, true);
4529
- doc.removeEventListener('touchend', handleTouchEndCapture, true);
4530
- }
4108
+ unsubscribe();
4531
4109
  compositionTimeout.clear();
4532
4110
  preventedPressSuppressionTimeout.clear();
4533
4111
  resetPressStartState();
@@ -4605,20 +4183,24 @@ function useDismiss(context, props = {}) {
4605
4183
  } : {}, [enabled, reference, floating]);
4606
4184
  }
4607
4185
 
4608
- /* eslint-disable no-underscore-dangle */ // __cacheKey__
4186
+ /**
4187
+ * The NoOptionalParams type is a utility type that checks if a function has optional or default parameters.
4188
+ * If the function has optional or default parameters, it returns a string literal type with an error message.
4189
+ * Otherwise, it returns the original function type.
4190
+ *
4191
+ * This is used to enforce that the combiner function passed to createSelector does not have optional or default parameters,
4192
+ * as memoization relies on the Function.length property, which does not account for optional or default parameters.
4193
+ */
4609
4194
 
4610
- withSelector.createSelectorCreator({
4611
- memoize: withSelector.lruMemoize,
4612
- memoizeOptions: {
4613
- maxSize: 1,
4614
- equalityCheck: Object.is
4615
- }
4616
- });
4617
4195
  /**
4618
4196
  * Creates a selector function that can be used to derive values from the store's state.
4619
- * The selector can take up to three additional arguments that can be used in the selector logic.
4197
+ *
4198
+ * The combiner function can have up to three additional parameters, but it **cannot have optional or default parameters**.
4199
+ *
4620
4200
  * This function accepts up to six functions and combines them into a single selector function.
4621
- * The last parameter is the combiner function that combines the results of the previous selectors.
4201
+ * The resulting selector will take the state from the combined selectors and any additional parameters required by the combiner.
4202
+ *
4203
+ * The return type of the resulting selector is determined by the return type of the combiner function.
4622
4204
  *
4623
4205
  * @example
4624
4206
  * const selector = createSelector(
@@ -4631,7 +4213,6 @@ withSelector.createSelectorCreator({
4631
4213
  * (state) => state.open,
4632
4214
  * (disabled, open) => ({ disabled, open })
4633
4215
  * );
4634
- *
4635
4216
  */
4636
4217
  /* eslint-disable id-denylist */
4637
4218
  const createSelector = (a, b, c, d, e, f, ...other) => {
@@ -4646,6 +4227,7 @@ const createSelector = (a, b, c, d, e, f, ...other) => {
4646
4227
  }
4647
4228
  return selector;
4648
4229
  };
4230
+ /* eslint-enable id-denylist */
4649
4231
 
4650
4232
  /* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work
4651
4233
  * but for now we only enable it for R19+. */
@@ -4953,6 +4535,7 @@ class ReactStore extends Store {
4953
4535
 
4954
4536
  const selectors$1 = {
4955
4537
  open: createSelector(state => state.open),
4538
+ transitionStatus: createSelector(state => state.transitionStatus),
4956
4539
  domReferenceElement: createSelector(state => state.domReferenceElement),
4957
4540
  referenceElement: createSelector(state => state.positionReference ?? state.referenceElement),
4958
4541
  floatingElement: createSelector(state => state.floatingElement),
@@ -4961,8 +4544,8 @@ const selectors$1 = {
4961
4544
  class FloatingRootStore extends ReactStore {
4962
4545
  constructor(options) {
4963
4546
  const {
4547
+ syncOnly,
4964
4548
  nested,
4965
- noEmit,
4966
4549
  onOpenChange,
4967
4550
  triggerElements,
4968
4551
  ...initialState
@@ -4978,11 +4561,38 @@ class FloatingRootStore extends ReactStore {
4978
4561
  },
4979
4562
  events: createEventEmitter(),
4980
4563
  nested,
4981
- noEmit,
4982
4564
  triggerElements
4983
4565
  }, selectors$1);
4566
+ this.syncOnly = syncOnly;
4984
4567
  }
4985
4568
 
4569
+ /**
4570
+ * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
4571
+ */
4572
+ syncOpenEvent = (newOpen, event) => {
4573
+ if (!newOpen || !this.state.open ||
4574
+ // Prevent a pending hover-open from overwriting a click-open event, while allowing
4575
+ // click events to upgrade a hover-open.
4576
+ event != null && isClickLikeEvent(event)) {
4577
+ this.context.dataRef.current.openEvent = newOpen ? event : undefined;
4578
+ }
4579
+ };
4580
+
4581
+ /**
4582
+ * Runs the root-owned side effects for an open state change.
4583
+ */
4584
+ dispatchOpenChange = (newOpen, eventDetails) => {
4585
+ this.syncOpenEvent(newOpen, eventDetails.event);
4586
+ const details = {
4587
+ open: newOpen,
4588
+ reason: eventDetails.reason,
4589
+ nativeEvent: eventDetails.event,
4590
+ nested: this.context.nested,
4591
+ triggerElement: eventDetails.trigger
4592
+ };
4593
+ this.context.events.emit('openchange', details);
4594
+ };
4595
+
4986
4596
  /**
4987
4597
  * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
4988
4598
  *
@@ -4990,22 +4600,11 @@ class FloatingRootStore extends ReactStore {
4990
4600
  * @param eventDetails Details about the event that triggered the open state change.
4991
4601
  */
4992
4602
  setOpen = (newOpen, eventDetails) => {
4993
- if (!newOpen || !this.state.open ||
4994
- // Prevent a pending hover-open from overwriting a click-open event, while allowing
4995
- // click events to upgrade a hover-open.
4996
- isClickLikeEvent(eventDetails.event)) {
4997
- this.context.dataRef.current.openEvent = newOpen ? eventDetails.event : undefined;
4998
- }
4999
- if (!this.context.noEmit) {
5000
- const details = {
5001
- open: newOpen,
5002
- reason: eventDetails.reason,
5003
- nativeEvent: eventDetails.event,
5004
- nested: this.context.nested,
5005
- triggerElement: eventDetails.trigger
5006
- };
5007
- this.context.events.emit('openchange', details);
4603
+ if (this.syncOnly) {
4604
+ this.context.onOpenChange?.(newOpen, eventDetails);
4605
+ return;
5008
4606
  }
4607
+ this.dispatchOpenChange(newOpen, eventDetails);
5009
4608
  this.context.onOpenChange?.(newOpen, eventDetails);
5010
4609
  };
5011
4610
  }
@@ -5108,13 +4707,14 @@ function useFloatingRootContext(options) {
5108
4707
  const nested = useFloatingParentNodeId() != null;
5109
4708
  const store = useRefWithInit(() => new FloatingRootStore({
5110
4709
  open,
4710
+ transitionStatus: undefined,
5111
4711
  onOpenChange,
5112
4712
  referenceElement: elements.reference ?? null,
5113
4713
  floatingElement: elements.floating ?? null,
5114
4714
  triggerElements: new PopupTriggerMap(),
5115
4715
  floatingId,
5116
- nested,
5117
- noEmit: false
4716
+ syncOnly: false,
4717
+ nested
5118
4718
  })).current;
5119
4719
  useIsoLayoutEffect(() => {
5120
4720
  const valuesToSync = {
@@ -5134,7 +4734,6 @@ function useFloatingRootContext(options) {
5134
4734
  }, [open, floatingId, elements.reference, elements.floating, store]);
5135
4735
  store.context.onOpenChange = onOpenChange;
5136
4736
  store.context.nested = nested;
5137
- store.context.noEmit = false;
5138
4737
  return store;
5139
4738
  }
5140
4739
 
@@ -5182,10 +4781,11 @@ function useFloating(options = {}) {
5182
4781
  setPositionReferenceRaw(computedPositionReference);
5183
4782
  position.refs.setReference(computedPositionReference);
5184
4783
  }, [position.refs]);
5185
- const [localDomReference, setLocalDomReference] = React__namespace.useState(null);
4784
+ const [localDomReference, setLocalDomReference] = React__namespace.useState(undefined);
5186
4785
  const [localFloatingElement, setLocalFloatingElement] = React__namespace.useState(null);
5187
- rootContext.useSyncedValue('referenceElement', localDomReference);
5188
- rootContext.useSyncedValue('domReferenceElement', floatingUi_reactDom.isElement(localDomReference) ? localDomReference : null);
4786
+ rootContext.useSyncedValue('referenceElement', localDomReference ?? null);
4787
+ const localDomReferenceElement = floatingUi_reactDom.isElement(localDomReference) ? localDomReference : null;
4788
+ rootContext.useSyncedValue('domReferenceElement', localDomReference === undefined ? rootContextElements.domReference : localDomReferenceElement);
5189
4789
  rootContext.useSyncedValue('floatingElement', localFloatingElement);
5190
4790
  const setReference = React__namespace.useCallback(node => {
5191
4791
  if (floatingUi_reactDom.isElement(node) || node === null) {
@@ -5335,6 +4935,17 @@ function mutablyMergeProps(outputProps, props, isItem, eventHandlers) {
5335
4935
  }
5336
4936
  }
5337
4937
 
4938
+ function isMouseWithinBounds(event) {
4939
+ const targetRect = event.currentTarget.getBoundingClientRect();
4940
+
4941
+ // Safari randomly fires `mouseleave` incorrectly when the item is
4942
+ // aligned to the trigger. This is a workaround to prevent the highlight
4943
+ // from being removed while the cursor is still within the bounds of the item.
4944
+ // https://github.com/mui/base-ui/issues/869
4945
+ const isWithinBounds = targetRect.top + 1 <= event.clientY && event.clientY <= targetRect.bottom - 1 && targetRect.left + 1 <= event.clientX && event.clientX <= targetRect.right - 1;
4946
+ return isWithinBounds;
4947
+ }
4948
+
5338
4949
  const ESCAPE = 'Escape';
5339
4950
  function doSwitch(orientation, vertical, horizontal) {
5340
4951
  switch (orientation) {
@@ -5422,6 +5033,7 @@ function useListNavigation(context, props) {
5422
5033
  const previousOpenRef = React__namespace.useRef(open);
5423
5034
  const forceSyncFocusRef = React__namespace.useRef(false);
5424
5035
  const forceScrollIntoViewRef = React__namespace.useRef(false);
5036
+ const cancelQueuedFocusRef = React__namespace.useRef(null);
5425
5037
  const disabledIndicesRef = useValueAsRef(disabledIndices);
5426
5038
  const latestOpenRef = useValueAsRef(open);
5427
5039
  const selectedIndexRef = useValueAsRef(selectedIndex);
@@ -5431,7 +5043,7 @@ function useListNavigation(context, props) {
5431
5043
  if (virtual) {
5432
5044
  tree?.events.emit('virtualfocus', item);
5433
5045
  } else {
5434
- enqueueFocus(item, {
5046
+ cancelQueuedFocusRef.current = enqueueFocus(item, {
5435
5047
  sync: forceSyncFocusRef.current,
5436
5048
  preventScroll: true
5437
5049
  });
@@ -5535,7 +5147,7 @@ function useListNavigation(context, props) {
5535
5147
  };
5536
5148
  waitForListPopulated();
5537
5149
  }
5538
- } else if (!isIndexOutOfListBounds(listRef, activeIndex)) {
5150
+ } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {
5539
5151
  indexRef.current = activeIndex;
5540
5152
  focusItem();
5541
5153
  forceScrollIntoViewRef.current = false;
@@ -5570,17 +5182,17 @@ function useListNavigation(context, props) {
5570
5182
  }
5571
5183
  }, [open, focusItemOnOpen]);
5572
5184
  const hasActiveIndex = activeIndex != null;
5573
- const item = React__namespace.useMemo(() => {
5574
- function syncCurrentTarget(event) {
5575
- if (!latestOpenRef.current) {
5576
- return;
5577
- }
5578
- const index = listRef.current.indexOf(event.currentTarget);
5579
- if (index !== -1 && indexRef.current !== index) {
5580
- indexRef.current = index;
5581
- onNavigate(event);
5582
- }
5185
+ const syncCurrentTarget = useStableCallback(event => {
5186
+ if (!latestOpenRef.current) {
5187
+ return;
5188
+ }
5189
+ const index = listRef.current.indexOf(event.currentTarget);
5190
+ if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {
5191
+ indexRef.current = index;
5192
+ onNavigate(event);
5583
5193
  }
5194
+ });
5195
+ const item = React__namespace.useMemo(() => {
5584
5196
  const itemProps = {
5585
5197
  onFocus(event) {
5586
5198
  forceSyncFocusRef.current = true;
@@ -5605,15 +5217,17 @@ function useListNavigation(context, props) {
5605
5217
  }
5606
5218
  forceSyncFocusRef.current = true;
5607
5219
  const relatedTarget = event.relatedTarget;
5220
+ if (isMouseWithinBounds(event)) {
5221
+ return;
5222
+ }
5608
5223
  if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {
5609
5224
  return;
5610
5225
  }
5611
5226
  if (!resetOnPointerLeaveRef.current) {
5612
5227
  return;
5613
5228
  }
5614
- enqueueFocus(null, {
5615
- sync: true
5616
- });
5229
+ cancelQueuedFocusRef.current?.();
5230
+ cancelQueuedFocusRef.current = null;
5617
5231
  indexRef.current = -1;
5618
5232
  onNavigate(event);
5619
5233
  if (!virtual) {
@@ -5628,7 +5242,7 @@ function useListNavigation(context, props) {
5628
5242
  }
5629
5243
  };
5630
5244
  return itemProps;
5631
- }, [latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);
5245
+ }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);
5632
5246
  const getParentOrientation = React__namespace.useCallback(() => {
5633
5247
  return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;
5634
5248
  }, [parentId, tree, parentOrientation]);
@@ -5693,12 +5307,10 @@ function useListNavigation(context, props) {
5693
5307
  // To calculate movements on the grid, we use hypothetical cell indices
5694
5308
  // as if every item was 1x1, then convert back to real indices.
5695
5309
  const cellMap = createGridCellMap(sizes, cols);
5696
- const minGridIndex = cellMap.findIndex(index => index != null && !isListIndexDisabled(listRef, index, disabledIndices));
5310
+ const minGridIndex = cellMap.findIndex(index => index != null && !isListIndexDisabled(listRef.current, index, disabledIndices));
5697
5311
  // last enabled index
5698
- const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isListIndexDisabled(listRef, index, disabledIndices) ? cellIndex : foundIndex, -1);
5699
- const index = cellMap[getGridNavigatedIndex({
5700
- current: cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null)
5701
- }, {
5312
+ const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isListIndexDisabled(listRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1);
5313
+ const index = cellMap[getGridNavigatedIndex(cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null), {
5702
5314
  event,
5703
5315
  orientation,
5704
5316
  loopFocus,
@@ -5706,7 +5318,7 @@ function useListNavigation(context, props) {
5706
5318
  cols,
5707
5319
  // treat undefined (empty grid spaces) as disabled indices so we
5708
5320
  // don't end up in them
5709
- disabledIndices: getGridCellIndices([...((typeof disabledIndices !== 'function' ? disabledIndices : null) || listRef.current.map((_, listIndex) => isListIndexDisabled(listRef, listIndex, disabledIndices) ? listIndex : undefined)), undefined], cellMap),
5321
+ disabledIndices: getGridCellIndices([...((typeof disabledIndices !== 'function' ? disabledIndices : null) || listRef.current.map((_, listIndex) => isListIndexDisabled(listRef.current, listIndex, disabledIndices) ? listIndex : undefined)), undefined], cellMap),
5710
5322
  minIndex: minGridIndex,
5711
5323
  maxIndex: maxGridIndex,
5712
5324
  prevIndex: getGridCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols,
@@ -5745,13 +5357,13 @@ function useListNavigation(context, props) {
5745
5357
  indexRef.current = minIndex;
5746
5358
  }
5747
5359
  } else {
5748
- indexRef.current = findNonDisabledListIndex(listRef, {
5360
+ indexRef.current = findNonDisabledListIndex(listRef.current, {
5749
5361
  startingIndex: currentIndex,
5750
5362
  disabledIndices
5751
5363
  });
5752
5364
  }
5753
5365
  } else {
5754
- indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef, {
5366
+ indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {
5755
5367
  startingIndex: currentIndex,
5756
5368
  disabledIndices
5757
5369
  }));
@@ -5766,20 +5378,20 @@ function useListNavigation(context, props) {
5766
5378
  indexRef.current = maxIndex;
5767
5379
  }
5768
5380
  } else {
5769
- indexRef.current = findNonDisabledListIndex(listRef, {
5381
+ indexRef.current = findNonDisabledListIndex(listRef.current, {
5770
5382
  startingIndex: currentIndex,
5771
5383
  decrement: true,
5772
5384
  disabledIndices
5773
5385
  });
5774
5386
  }
5775
5387
  } else {
5776
- indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef, {
5388
+ indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, {
5777
5389
  startingIndex: currentIndex,
5778
5390
  decrement: true,
5779
5391
  disabledIndices
5780
5392
  }));
5781
5393
  }
5782
- if (isIndexOutOfListBounds(listRef, indexRef.current)) {
5394
+ if (isIndexOutOfListBounds(listRef.current, indexRef.current)) {
5783
5395
  indexRef.current = -1;
5784
5396
  }
5785
5397
  onNavigate(event);
@@ -6262,19 +5874,8 @@ const InternalBackdrop = /*#__PURE__*/React__namespace.forwardRef(function Inter
6262
5874
  } = props;
6263
5875
  let clipPath;
6264
5876
  if (cutout) {
6265
- const rect = cutout?.getBoundingClientRect();
6266
- clipPath = `polygon(
6267
- 0% 0%,
6268
- 100% 0%,
6269
- 100% 100%,
6270
- 0% 100%,
6271
- 0% 0%,
6272
- ${rect.left}px ${rect.top}px,
6273
- ${rect.left}px ${rect.bottom}px,
6274
- ${rect.right}px ${rect.bottom}px,
6275
- ${rect.right}px ${rect.top}px,
6276
- ${rect.left}px ${rect.top}px
6277
- )`;
5877
+ const rect = cutout.getBoundingClientRect();
5878
+ clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;
6278
5879
  }
6279
5880
  return /*#__PURE__*/jsxRuntime.jsx("div", {
6280
5881
  ref: ref,
@@ -6294,14 +5895,6 @@ const InternalBackdrop = /*#__PURE__*/React__namespace.forwardRef(function Inter
6294
5895
  });
6295
5896
  });
6296
5897
 
6297
- function useOnFirstRender(fn) {
6298
- const ref = React__namespace.useRef(true);
6299
- if (ref.current) {
6300
- ref.current = false;
6301
- fn();
6302
- }
6303
- }
6304
-
6305
5898
  const ComboboxRootContext = /*#__PURE__*/React__namespace.createContext(undefined);
6306
5899
  const ComboboxFloatingContext = /*#__PURE__*/React__namespace.createContext(undefined);
6307
5900
  const ComboboxDerivedItemsContext = /*#__PURE__*/React__namespace.createContext(undefined);
@@ -6485,7 +6078,6 @@ function resolveMultipleLabels(values, items, itemToStringLabel) {
6485
6078
  const selectors = {
6486
6079
  id: createSelector(state => state.id),
6487
6080
  labelId: createSelector(state => state.labelId),
6488
- query: createSelector(state => state.query),
6489
6081
  items: createSelector(state => state.items),
6490
6082
  selectedValue: createSelector(state => state.selectedValue),
6491
6083
  hasSelectionChips: createSelector(state => {
@@ -6537,25 +6129,13 @@ const selectors = {
6537
6129
  openMethod: createSelector(state => state.openMethod),
6538
6130
  inputInsidePopup: createSelector(state => state.inputInsidePopup),
6539
6131
  selectionMode: createSelector(state => state.selectionMode),
6540
- listRef: createSelector(state => state.listRef),
6541
- labelsRef: createSelector(state => state.labelsRef),
6542
- popupRef: createSelector(state => state.popupRef),
6543
- emptyRef: createSelector(state => state.emptyRef),
6544
- inputRef: createSelector(state => state.inputRef),
6545
- keyboardActiveRef: createSelector(state => state.keyboardActiveRef),
6546
- chipsContainerRef: createSelector(state => state.chipsContainerRef),
6547
- clearRef: createSelector(state => state.clearRef),
6548
- valuesRef: createSelector(state => state.valuesRef),
6549
- allValuesRef: createSelector(state => state.allValuesRef),
6550
6132
  name: createSelector(state => state.name),
6133
+ form: createSelector(state => state.form),
6551
6134
  disabled: createSelector(state => state.disabled),
6552
6135
  readOnly: createSelector(state => state.readOnly),
6553
6136
  required: createSelector(state => state.required),
6554
6137
  grid: createSelector(state => state.grid),
6555
- isGrouped: createSelector(state => state.isGrouped),
6556
6138
  virtualized: createSelector(state => state.virtualized),
6557
- onOpenChangeComplete: createSelector(state => state.onOpenChangeComplete),
6558
- openOnInputClick: createSelector(state => state.openOnInputClick),
6559
6139
  itemToStringLabel: createSelector(state => state.itemToStringLabel),
6560
6140
  isItemEqualToValue: createSelector(state => state.isItemEqualToValue),
6561
6141
  modal: createSelector(state => state.modal),
@@ -6663,6 +6243,7 @@ const FieldRootContext = /*#__PURE__*/React__namespace.createContext({
6663
6243
  markedDirtyRef: {
6664
6244
  current: false
6665
6245
  },
6246
+ registerFieldControl: NOOP,
6666
6247
  validation: {
6667
6248
  getValidationProps: (props = EMPTY_OBJECT) => props,
6668
6249
  getInputValidationProps: (props = EMPTY_OBJECT) => props,
@@ -6680,18 +6261,35 @@ function useFieldRootContext(optional = true) {
6680
6261
  return context;
6681
6262
  }
6682
6263
 
6683
- /**
6684
- * Combines the field's client-side, stateful validity data with the external invalid state to
6685
- * determine the field's true validity.
6686
- */
6687
- function getCombinedFieldValidityData(validityData, invalid) {
6688
- return {
6689
- ...validityData,
6690
- state: {
6691
- ...validityData.state,
6692
- valid: !invalid && validityData.state.valid
6264
+ function useRegisterFieldControl(controlRef, params) {
6265
+ const {
6266
+ enabled = true,
6267
+ getValue,
6268
+ id,
6269
+ value
6270
+ } = params;
6271
+ const {
6272
+ registerFieldControl
6273
+ } = useFieldRootContext();
6274
+ const sourceRef = React__namespace.useRef(null);
6275
+ if (!sourceRef.current) {
6276
+ sourceRef.current = Symbol();
6277
+ }
6278
+ useIsoLayoutEffect(() => {
6279
+ const source = sourceRef.current;
6280
+ if (!source || !enabled) {
6281
+ return undefined;
6693
6282
  }
6694
- };
6283
+ registerFieldControl(source, {
6284
+ controlRef,
6285
+ getValue,
6286
+ id,
6287
+ value
6288
+ });
6289
+ return () => {
6290
+ registerFieldControl(source, undefined);
6291
+ };
6292
+ }, [controlRef, enabled, getValue, id, registerFieldControl, value]);
6695
6293
  }
6696
6294
 
6697
6295
  const FormContext = /*#__PURE__*/React__namespace.createContext({
@@ -6711,74 +6309,6 @@ function useFormContext() {
6711
6309
  return React__namespace.useContext(FormContext);
6712
6310
  }
6713
6311
 
6714
- function useField(params) {
6715
- const {
6716
- enabled = true,
6717
- value,
6718
- id,
6719
- name,
6720
- controlRef,
6721
- commit
6722
- } = params;
6723
- const {
6724
- formRef
6725
- } = useFormContext();
6726
- const {
6727
- invalid,
6728
- markedDirtyRef,
6729
- validityData,
6730
- setValidityData
6731
- } = useFieldRootContext();
6732
- const getValue = useStableCallback(params.getValue);
6733
- useIsoLayoutEffect(() => {
6734
- if (!enabled) {
6735
- return;
6736
- }
6737
- let initialValue = value;
6738
- if (initialValue === undefined) {
6739
- initialValue = getValue();
6740
- }
6741
- if (validityData.initialValue === null && initialValue !== null) {
6742
- setValidityData(prev => ({
6743
- ...prev,
6744
- initialValue
6745
- }));
6746
- }
6747
- }, [enabled, setValidityData, value, validityData.initialValue, getValue]);
6748
- useIsoLayoutEffect(() => {
6749
- if (!enabled || !id) {
6750
- return;
6751
- }
6752
- formRef.current.fields.set(id, {
6753
- getValue,
6754
- name,
6755
- controlRef,
6756
- validityData: getCombinedFieldValidityData(validityData, invalid),
6757
- validate(flushSync = true) {
6758
- let nextValue = value;
6759
- if (nextValue === undefined) {
6760
- nextValue = getValue();
6761
- }
6762
- markedDirtyRef.current = true;
6763
- if (!flushSync) {
6764
- commit(nextValue);
6765
- } else {
6766
- // Synchronously update the validity state so the submit event can be prevented.
6767
- ReactDOM__namespace.flushSync(() => commit(nextValue));
6768
- }
6769
- }
6770
- });
6771
- }, [commit, controlRef, enabled, formRef, getValue, id, invalid, markedDirtyRef, name, validityData, value]);
6772
- useIsoLayoutEffect(() => {
6773
- const fields = formRef.current.fields;
6774
- return () => {
6775
- if (id) {
6776
- fields.delete(id);
6777
- }
6778
- };
6779
- }, [formRef, id]);
6780
- }
6781
-
6782
6312
  /**
6783
6313
  * A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\
6784
6314
  * with an accessible name (label) and description.
@@ -6968,9 +6498,12 @@ function AriaCombobox(props) {
6968
6498
  onSelectedValueChange,
6969
6499
  defaultInputValue: defaultInputValueProp,
6970
6500
  inputValue: inputValueProp,
6501
+ open: openProp,
6502
+ defaultOpen = false,
6971
6503
  selectionMode = 'none',
6972
6504
  onItemHighlighted: onItemHighlightedProp,
6973
6505
  name: nameProp,
6506
+ form,
6974
6507
  disabled: disabledProp = false,
6975
6508
  readOnly = false,
6976
6509
  required = false,
@@ -7096,8 +6629,8 @@ function AriaCombobox(props) {
7096
6629
  state: 'inputValue'
7097
6630
  });
7098
6631
  const [open, setOpenUnwrapped] = useControlled({
7099
- controlled: props.open,
7100
- default: props.defaultOpen,
6632
+ controlled: openProp,
6633
+ default: defaultOpen,
7101
6634
  name: 'Combobox',
7102
6635
  state: 'open'
7103
6636
  });
@@ -7199,6 +6732,7 @@ function AriaCombobox(props) {
7199
6732
  allValuesRef,
7200
6733
  selectionEventRef,
7201
6734
  name,
6735
+ form,
7202
6736
  disabled,
7203
6737
  readOnly,
7204
6738
  required,
@@ -7272,13 +6806,11 @@ function AriaCombobox(props) {
7272
6806
  openMethod,
7273
6807
  triggerProps
7274
6808
  } = useOpenInteractionType(open);
7275
- useField({
6809
+ const getFieldValue = useStableCallback(() => fieldStringValue);
6810
+ useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, {
7276
6811
  id,
7277
- name,
7278
- commit: validation.commit,
7279
6812
  value: fieldRawValue,
7280
- controlRef: inputInsidePopup ? triggerRef : inputRef,
7281
- getValue: () => fieldStringValue
6813
+ getValue: getFieldValue
7282
6814
  });
7283
6815
  const forceMount = useStableCallback(() => {
7284
6816
  if (items) {
@@ -7459,9 +6991,9 @@ function AriaCombobox(props) {
7459
6991
  if (!store.state.submitOnItemClick) {
7460
6992
  return;
7461
6993
  }
7462
- const form = store.state.inputElement?.form;
7463
- if (form && typeof form.requestSubmit === 'function') {
7464
- form.requestSubmit();
6994
+ const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;
6995
+ if (formElement && typeof formElement.requestSubmit === 'function') {
6996
+ formElement.requestSubmit();
7465
6997
  }
7466
6998
  });
7467
6999
  const handleUnmount = useStableCallback(() => {
@@ -7716,9 +7248,9 @@ function AriaCombobox(props) {
7716
7248
  enabled: !readOnly && !disabled && openOnInputClick,
7717
7249
  event: 'mousedown-only',
7718
7250
  toggle: false,
7719
- // Apply a small delay for touch to let iOS viewport centering settle.
7251
+ // Apply a small delay for touch to let mobile viewport/keyboard positioning settle.
7720
7252
  // This avoids top-bottom flip flickers if the preferred position is "top" when first tapping.
7721
- touchOpenDelay: inputInsidePopup ? 0 : 50,
7253
+ touchOpenDelay: inputInsidePopup ? 0 : 100,
7722
7254
  reason: inputPress
7723
7255
  });
7724
7256
  const dismiss = useDismiss(floatingRootContext, {
@@ -7811,6 +7343,7 @@ function AriaCombobox(props) {
7811
7343
  getItemProps,
7812
7344
  selectionMode,
7813
7345
  name,
7346
+ form,
7814
7347
  disabled,
7815
7348
  readOnly,
7816
7349
  required,
@@ -7827,7 +7360,7 @@ function AriaCombobox(props) {
7827
7360
  hasInputValue,
7828
7361
  requestSubmit
7829
7362
  });
7830
- }, [store, id, selectedValue, open, mounted, transitionStatus, items, getFloatingProps, getReferenceProps, getItemProps, openMethod, triggerProps, selectionMode, name, disabled, readOnly, required, validation, grid, isGrouped, virtualized, onOpenChangeComplete, openOnInputClick, itemToStringLabel, modal, isItemEqualToValue, submitOnItemClick, hasInputValue, inlineProp, requestSubmit, autoHighlightMode]);
7363
+ }, [store, id, selectedValue, open, mounted, transitionStatus, items, getFloatingProps, getReferenceProps, getItemProps, openMethod, triggerProps, selectionMode, name, disabled, readOnly, required, validation, grid, isGrouped, virtualized, onOpenChangeComplete, openOnInputClick, itemToStringLabel, modal, isItemEqualToValue, submitOnItemClick, hasInputValue, inlineProp, requestSubmit, autoHighlightMode, form]);
7831
7364
  const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);
7832
7365
  const itemsContextValue = React__namespace.useMemo(() => ({
7833
7366
  query,
@@ -7851,11 +7384,12 @@ function AriaCombobox(props) {
7851
7384
  const currentSerializedValue = stringifyAsValue(value, itemToStringValue);
7852
7385
  return /*#__PURE__*/jsxRuntime.jsx("input", {
7853
7386
  type: "hidden",
7387
+ form: form,
7854
7388
  name: name,
7855
7389
  value: currentSerializedValue
7856
7390
  }, currentSerializedValue);
7857
7391
  });
7858
- }, [multiple, selectedValue, name, itemToStringValue]);
7392
+ }, [multiple, selectedValue, form, name, itemToStringValue]);
7859
7393
  const children = /*#__PURE__*/jsxRuntime.jsxs(React__namespace.Fragment, {
7860
7394
  children: [props.children, /*#__PURE__*/jsxRuntime.jsx("input", {
7861
7395
  ...validation.getInputValidationProps({
@@ -7873,7 +7407,7 @@ function AriaCombobox(props) {
7873
7407
  if (event.nativeEvent.defaultPrevented) {
7874
7408
  return;
7875
7409
  }
7876
- const nextValue = event.target.value;
7410
+ const nextValue = event.currentTarget.value;
7877
7411
  const details = createChangeEventDetails(none, event.nativeEvent);
7878
7412
  function handleChange() {
7879
7413
  // Browser autofill only writes a single scalar value.
@@ -7889,8 +7423,15 @@ function AriaCombobox(props) {
7889
7423
  return;
7890
7424
  }
7891
7425
  const matchingValue = valuesRef.current.find(v => {
7892
- const candidate = stringifyAsValue(v, itemToStringValue);
7893
- if (candidate.toLowerCase() === nextValue.toLowerCase()) {
7426
+ // Try matching by value first (e.g., "US" for country code)
7427
+ const candidateValue = stringifyAsValue(v, itemToStringValue);
7428
+ if (candidateValue.toLowerCase() === nextValue.toLowerCase()) {
7429
+ return true;
7430
+ }
7431
+ // Also try matching by label for browser autofill compatibility
7432
+ // (browsers autofill with displayed text like "United States", not the underlying value)
7433
+ const candidateLabel = stringifyAsLabel(v, itemToStringLabel);
7434
+ if (candidateLabel.toLowerCase() === nextValue.toLowerCase()) {
7894
7435
  return true;
7895
7436
  }
7896
7437
  return false;
@@ -7912,6 +7453,7 @@ function AriaCombobox(props) {
7912
7453
  }
7913
7454
  }),
7914
7455
  id: id && hiddenInputName == null ? `${id}-hidden-input` : undefined,
7456
+ form: form,
7915
7457
  name: hiddenInputName,
7916
7458
  autoComplete: formAutoComplete,
7917
7459
  disabled: disabled,
@@ -7921,7 +7463,8 @@ function AriaCombobox(props) {
7921
7463
  ref: hiddenInputRef,
7922
7464
  style: hiddenInputName ? visuallyHiddenInput : visuallyHidden,
7923
7465
  tabIndex: -1,
7924
- "aria-hidden": true
7466
+ "aria-hidden": true,
7467
+ suppressHydrationWarning: true
7925
7468
  }), hiddenInputs]
7926
7469
  });
7927
7470
  return /*#__PURE__*/jsxRuntime.jsx(ComboboxRootContext.Provider, {
@@ -7952,8 +7495,9 @@ const triggerStateAttributesMapping = {
7952
7495
 
7953
7496
  function getPseudoElementBounds(element) {
7954
7497
  const elementRect = element.getBoundingClientRect();
7955
- const beforeStyles = window.getComputedStyle(element, '::before');
7956
- const afterStyles = window.getComputedStyle(element, '::after');
7498
+ const win = floatingUi_reactDom.getWindow(element);
7499
+ const beforeStyles = win.getComputedStyle(element, '::before');
7500
+ const afterStyles = win.getComputedStyle(element, '::after');
7957
7501
  const hasPseudoElements = beforeStyles.content !== 'none' || afterStyles.content !== 'none';
7958
7502
  if (!hasPseudoElements) {
7959
7503
  return elementRect;
@@ -7989,6 +7533,8 @@ const BOUNDARY_OFFSET = 2;
7989
7533
  /**
7990
7534
  * A button that opens the popup.
7991
7535
  * Renders a `<button>` element.
7536
+ *
7537
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
7992
7538
  */
7993
7539
  const ComboboxTrigger$2 = /*#__PURE__*/React__namespace.forwardRef(function ComboboxTrigger(componentProps, forwardedRef) {
7994
7540
  const {
@@ -7997,6 +7543,7 @@ const ComboboxTrigger$2 = /*#__PURE__*/React__namespace.forwardRef(function Comb
7997
7543
  nativeButton = true,
7998
7544
  disabled: disabledProp = false,
7999
7545
  id: idProp,
7546
+ style,
8000
7547
  ...elementProps
8001
7548
  } = componentProps;
8002
7549
  const {
@@ -8092,7 +7639,7 @@ const ComboboxTrigger$2 = /*#__PURE__*/React__namespace.forwardRef(function Comb
8092
7639
  disabled,
8093
7640
  popupSide,
8094
7641
  listEmpty,
8095
- placeholder: !hasSelectedValue
7642
+ placeholder: selectionMode === 'none' ? false : !hasSelectedValue
8096
7643
  };
8097
7644
  const setTriggerElement = useStableCallback(element => {
8098
7645
  store.set('triggerElement', element);
@@ -8237,6 +7784,7 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8237
7784
  className,
8238
7785
  disabled: disabledProp = false,
8239
7786
  id: idProp,
7787
+ style,
8240
7788
  ...elementProps
8241
7789
  } = componentProps;
8242
7790
  const {
@@ -8265,6 +7813,7 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8265
7813
  const comboboxDisabled = useStore(store, selectors.disabled);
8266
7814
  const readOnly = useStore(store, selectors.readOnly);
8267
7815
  const name = useStore(store, selectors.name);
7816
+ const form = useStore(store, selectors.form);
8268
7817
  const selectionMode = useStore(store, selectors.selectionMode);
8269
7818
  const autoHighlightMode = useStore(store, selectors.autoHighlight);
8270
7819
  const inputProps = useStore(store, selectors.inputProps);
@@ -8317,6 +7866,7 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8317
7866
  const {
8318
7867
  highlightedChipIndex
8319
7868
  } = comboboxChipsContext;
7869
+ const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
8320
7870
  if (highlightedChipIndex !== undefined) {
8321
7871
  if (event.key === 'ArrowLeft') {
8322
7872
  event.preventDefault();
@@ -8327,7 +7877,7 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8327
7877
  }
8328
7878
  } else if (event.key === 'ArrowRight') {
8329
7879
  event.preventDefault();
8330
- if (highlightedChipIndex < selectedValue.length - 1) {
7880
+ if (highlightedChipIndex < renderedChipsCount - 1) {
8331
7881
  nextIndex = highlightedChipIndex + 1;
8332
7882
  } else {
8333
7883
  nextIndex = undefined;
@@ -8350,8 +7900,7 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8350
7900
  // Handle navigation when no chip is highlighted
8351
7901
  if (event.key === 'ArrowLeft' && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
8352
7902
  event.preventDefault();
8353
- const lastChipIndex = Math.max(selectedValue.length - 1, 0);
8354
- nextIndex = lastChipIndex;
7903
+ nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : undefined;
8355
7904
  } else if (event.key === 'Backspace' && event.currentTarget.value === '' && selectedValue.length > 0) {
8356
7905
  store.state.setIndices({
8357
7906
  activeIndex: null,
@@ -8374,6 +7923,7 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8374
7923
  disabled,
8375
7924
  readOnly,
8376
7925
  required: selectionMode === 'none' ? required : undefined,
7926
+ form,
8377
7927
  ...(selectionMode === 'none' && name && {
8378
7928
  name
8379
7929
  }),
@@ -8541,7 +8091,9 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8541
8091
 
8542
8092
  // Handle deletion when no chip is highlighted and the input is empty.
8543
8093
  if (comboboxChipsContext && event.key === 'Backspace' && input.value === '' && comboboxChipsContext.highlightedChipIndex === undefined && Array.isArray(selectedValue) && selectedValue.length > 0) {
8544
- const newValue = selectedValue.slice(0, -1);
8094
+ const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
8095
+ const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;
8096
+ const newValue = selectedValue.filter((_, index) => index !== removalIndex);
8545
8097
  // If the removed item was also the active (highlighted) item, clear highlight
8546
8098
  store.state.setIndices({
8547
8099
  activeIndex: null,
@@ -8601,6 +8153,25 @@ const ComboboxInput$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8601
8153
  });
8602
8154
  });
8603
8155
 
8156
+ function handleInputPress(event, store, disabled, readOnly, shouldIgnoreTarget) {
8157
+ if (event.baseUIHandlerPrevented || readOnly) {
8158
+ return;
8159
+ }
8160
+ const target = getTarget(event.nativeEvent);
8161
+ const targetElement = floatingUi_reactDom.isElement(target) ? target : null;
8162
+ if (targetElement !== event.currentTarget && (isInteractiveElement(targetElement))) {
8163
+ return;
8164
+ }
8165
+ event.preventDefault();
8166
+ if (disabled) {
8167
+ return;
8168
+ }
8169
+ store.state.inputRef.current?.focus();
8170
+ if (store.state.openOnInputClick) {
8171
+ store.state.setOpen(true, createChangeEventDetails(inputPress, event.nativeEvent));
8172
+ }
8173
+ }
8174
+
8604
8175
  const stateAttributesMapping$1 = {
8605
8176
  ...transitionStatusMapping,
8606
8177
  ...triggerOpenStateMapping
@@ -8609,6 +8180,8 @@ const stateAttributesMapping$1 = {
8609
8180
  /**
8610
8181
  * Clears the value when clicked.
8611
8182
  * Renders a `<button>` element.
8183
+ *
8184
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8612
8185
  */
8613
8186
  const ComboboxClear$1 = /*#__PURE__*/React__namespace.forwardRef(function ComboboxClear(componentProps, forwardedRef) {
8614
8187
  const {
@@ -8617,6 +8190,7 @@ const ComboboxClear$1 = /*#__PURE__*/React__namespace.forwardRef(function Combob
8617
8190
  disabled: disabledProp = false,
8618
8191
  nativeButton = true,
8619
8192
  keepMounted = false,
8193
+ style,
8620
8194
  ...elementProps
8621
8195
  } = componentProps;
8622
8196
  const {
@@ -8746,6 +8320,7 @@ const ComboboxList$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
8746
8320
  const {
8747
8321
  render,
8748
8322
  className,
8323
+ style,
8749
8324
  children,
8750
8325
  ...elementProps
8751
8326
  } = componentProps;
@@ -8753,16 +8328,12 @@ const ComboboxList$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
8753
8328
  const floatingRootContext = useComboboxFloatingContext();
8754
8329
  const hasPositionerContext = Boolean(useComboboxPositionerContext(true));
8755
8330
  const {
8756
- filteredItems
8331
+ filteredItems,
8332
+ hasItems
8757
8333
  } = useComboboxDerivedItemsContext();
8758
- const items = useStore(store, selectors.items);
8759
- const labelsRef = useStore(store, selectors.labelsRef);
8760
- const listRef = useStore(store, selectors.listRef);
8761
8334
  const selectionMode = useStore(store, selectors.selectionMode);
8762
8335
  const grid = useStore(store, selectors.grid);
8763
8336
  const popupProps = useStore(store, selectors.popupProps);
8764
- const disabled = useStore(store, selectors.disabled);
8765
- const readOnly = useStore(store, selectors.readOnly);
8766
8337
  const virtualized = useStore(store, selectors.virtualized);
8767
8338
  const multiple = selectionMode === 'multiple';
8768
8339
  const empty = filteredItems.length === 0;
@@ -8799,7 +8370,7 @@ const ComboboxList$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
8799
8370
  role: grid ? 'grid' : 'listbox',
8800
8371
  'aria-multiselectable': multiple ? 'true' : undefined,
8801
8372
  onKeyDown(event) {
8802
- if (disabled || readOnly) {
8373
+ if (store.state.disabled || store.state.readOnly) {
8803
8374
  return;
8804
8375
  }
8805
8376
  if (event.key === 'Enter') {
@@ -8830,12 +8401,62 @@ const ComboboxList$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
8830
8401
  return element;
8831
8402
  }
8832
8403
  return /*#__PURE__*/jsxRuntime.jsx(CompositeList, {
8833
- elementsRef: listRef,
8834
- labelsRef: items ? undefined : labelsRef,
8404
+ elementsRef: store.state.listRef,
8405
+ labelsRef: hasItems ? undefined : store.state.labelsRef,
8835
8406
  children: element
8836
8407
  });
8837
8408
  });
8838
8409
 
8410
+ // Word Joiner is invisible and zero-width, so it forces a text mutation without shifting layout.
8411
+ const LIVE_REGION_MARKER = '\u2060';
8412
+ // Safari VoiceOver needed roughly 200ms to reliably notice the initial polite live-region change.
8413
+ const INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY = 200;
8414
+ function findLastTextNode(root) {
8415
+ const walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT);
8416
+ let lastTextNode = null;
8417
+ while (walker.nextNode()) {
8418
+ const textNode = walker.currentNode;
8419
+ if (textNode.nodeValue !== '') {
8420
+ lastTextNode = textNode;
8421
+ }
8422
+ }
8423
+ return lastTextNode;
8424
+ }
8425
+ function useInitialLiveRegionTextMutation() {
8426
+ const timeout = useTimeout();
8427
+ const rootRef = React__namespace.useRef(null);
8428
+
8429
+ // Only the initial mounted announcement needs the marker; later text updates announce naturally.
8430
+ React__namespace.useEffect(() => {
8431
+ if (isIOS) {
8432
+ return undefined;
8433
+ }
8434
+ const root = rootRef.current;
8435
+ if (root == null) {
8436
+ return undefined;
8437
+ }
8438
+ const textNode = findLastTextNode(root);
8439
+ if (textNode == null) {
8440
+ return undefined;
8441
+ }
8442
+ const originalValue = textNode.nodeValue ?? '';
8443
+ const markedValue = `${originalValue}${LIVE_REGION_MARKER}`;
8444
+ textNode.nodeValue = markedValue;
8445
+ timeout.start(INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY, () => {
8446
+ if (textNode.nodeValue === markedValue) {
8447
+ textNode.nodeValue = originalValue;
8448
+ }
8449
+ });
8450
+ return () => {
8451
+ timeout.clear();
8452
+ if (textNode.nodeValue === markedValue) {
8453
+ textNode.nodeValue = originalValue;
8454
+ }
8455
+ };
8456
+ }, [rootRef, timeout]);
8457
+ return rootRef;
8458
+ }
8459
+
8839
8460
  const ComboboxPortalContext = /*#__PURE__*/React__namespace.createContext(undefined);
8840
8461
  function useComboboxPortalContext() {
8841
8462
  const context = React__namespace.useContext(ComboboxPortalContext);
@@ -9054,6 +8675,7 @@ function useAnchorPositioning(params) {
9054
8675
  const anchorFnCallback = useStableCallback(anchorFn);
9055
8676
  const anchorDep = anchorFn ? anchorFnCallback : anchor;
9056
8677
  const anchorValueRef = useValueAsRef(anchor);
8678
+ const mountedRef = useValueAsRef(mounted);
9057
8679
  const direction = useDirection();
9058
8680
  const isRtl = direction === 'rtl';
9059
8681
  const side = mountSide || {
@@ -9179,12 +8801,15 @@ function useAnchorPositioning(params) {
9179
8801
  availableHeight,
9180
8802
  rects
9181
8803
  }) {
8804
+ if (!mountedRef.current) {
8805
+ return;
8806
+ }
9182
8807
  const floatingStyle = floating.style;
9183
8808
  floatingStyle.setProperty('--available-width', `${availableWidth}px`);
9184
8809
  floatingStyle.setProperty('--available-height', `${availableHeight}px`);
9185
8810
 
9186
8811
  // Snap anchor dimensions to device pixels to ensure the popup's visual width matches the anchor's one.
9187
- const dpr = window.devicePixelRatio || 1;
8812
+ const dpr = floatingUi_reactDom.getWindow(floating).devicePixelRatio || 1;
9188
8813
  const {
9189
8814
  x,
9190
8815
  y,
@@ -9199,7 +8824,7 @@ function useAnchorPositioning(params) {
9199
8824
  }), arrow(() => ({
9200
8825
  // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
9201
8826
  // we'll create a fake element.
9202
- element: arrowRef.current || document.createElement('div'),
8827
+ element: arrowRef.current || ownerDocument(arrowRef.current).createElement('div'),
9203
8828
  padding: arrowPadding,
9204
8829
  offsetParent: 'floating'
9205
8830
  }), [arrowPadding]), {
@@ -9243,7 +8868,8 @@ function useAnchorPositioning(params) {
9243
8868
  floatingRootContext.update({
9244
8869
  referenceElement: null,
9245
8870
  floatingElement: null,
9246
- domReferenceElement: null
8871
+ domReferenceElement: null,
8872
+ positionReference: null
9247
8873
  });
9248
8874
  }
9249
8875
  }, [mounted, floatingRootContext]);
@@ -9264,6 +8890,7 @@ function useAnchorPositioning(params) {
9264
8890
  floatingStyles: originalFloatingStyles
9265
8891
  } = useFloating({
9266
8892
  rootContext: floatingRootContext,
8893
+ open: keepMounted ? mounted : undefined,
9267
8894
  placement,
9268
8895
  middleware,
9269
8896
  strategy: positionMethod,
@@ -9373,6 +9000,61 @@ function getDisabledMountTransitionStyles(transitionStatus) {
9373
9000
  return transitionStatus === 'starting' ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
9374
9001
  }
9375
9002
 
9003
+ /**
9004
+ * Renders the shared outer Positioner element used by popup components.
9005
+ * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling.
9006
+ */
9007
+ function usePositioner(componentProps, state, {
9008
+ styles,
9009
+ transitionStatus,
9010
+ props,
9011
+ refs,
9012
+ hidden,
9013
+ inert = false
9014
+ }) {
9015
+ const style = {
9016
+ ...styles
9017
+ };
9018
+ if (inert) {
9019
+ style.pointerEvents = 'none';
9020
+ }
9021
+ return useRenderElement('div', componentProps, {
9022
+ state,
9023
+ ref: refs,
9024
+ props: [{
9025
+ role: 'presentation',
9026
+ hidden,
9027
+ style
9028
+ }, getDisabledMountTransitionStyles(transitionStatus), props],
9029
+ stateAttributesMapping: popupStateMapping
9030
+ });
9031
+ }
9032
+
9033
+ // Touch-opened popups normally avoid scroll locking so users can still swipe outside to dismiss.
9034
+ // This hook re-enables scroll lock only when the popup is effectively full-width.
9035
+ // Treat popups with up to 20px of total horizontal gutter as full-width so common ~10px side
9036
+ // padding still locks scroll, since that leaves too little outside space for a reliable swipe.
9037
+ const VIEWPORT_WIDTH_TOLERANCE_PX = 20;
9038
+
9039
+ /**
9040
+ * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when
9041
+ * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively
9042
+ * viewport-sized.
9043
+ */
9044
+ function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {
9045
+ const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React__namespace.useState(false);
9046
+ useIsoLayoutEffect(() => {
9047
+ if (!enabled || !touchOpen || positionerElement == null) {
9048
+ setTouchOpenShouldLockScroll(false);
9049
+ return;
9050
+ }
9051
+ const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;
9052
+ const popupWidth = positionerElement.offsetWidth;
9053
+ setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);
9054
+ }, [enabled, touchOpen, positionerElement]);
9055
+ useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);
9056
+ }
9057
+
9376
9058
  const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function ComboboxPositioner(componentProps, forwardedRef) {
9377
9059
  const {
9378
9060
  render,
@@ -9389,6 +9071,7 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
9389
9071
  sticky = false,
9390
9072
  disableAnchorTracking = false,
9391
9073
  collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE,
9074
+ style: styleProp,
9392
9075
  ...elementProps
9393
9076
  } = componentProps;
9394
9077
  const store = useComboboxRootContext();
@@ -9401,6 +9084,7 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
9401
9084
  const open = useStore(store, selectors.open);
9402
9085
  const mounted = useStore(store, selectors.mounted);
9403
9086
  const openMethod = useStore(store, selectors.openMethod);
9087
+ const positionerElement = useStore(store, selectors.positionerElement);
9404
9088
  const triggerElement = useStore(store, selectors.triggerElement);
9405
9089
  const inputElement = useStore(store, selectors.inputElement);
9406
9090
  const inputGroupElement = useStore(store, selectors.inputGroupElement);
@@ -9426,20 +9110,7 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
9426
9110
  collisionAvoidance,
9427
9111
  lazyFlip: true
9428
9112
  });
9429
- useScrollLock(open && modal && openMethod !== 'touch', triggerElement);
9430
- const defaultProps = React__namespace.useMemo(() => {
9431
- const style = {
9432
- ...positioning.positionerStyles
9433
- };
9434
- if (!open) {
9435
- style.pointerEvents = 'none';
9436
- }
9437
- return {
9438
- role: 'presentation',
9439
- hidden: !mounted,
9440
- style
9441
- };
9442
- }, [open, mounted, positioning.positionerStyles]);
9113
+ useAnchoredPopupScrollLock(open && modal, openMethod === 'touch', positionerElement, triggerElement);
9443
9114
  const state = {
9444
9115
  open,
9445
9116
  side: positioning.side,
@@ -9450,26 +9121,19 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
9450
9121
  useIsoLayoutEffect(() => {
9451
9122
  store.set('popupSide', positioning.side);
9452
9123
  }, [store, positioning.side]);
9453
- const contextValue = React__namespace.useMemo(() => ({
9454
- side: positioning.side,
9455
- align: positioning.align,
9456
- arrowRef: positioning.arrowRef,
9457
- arrowUncentered: positioning.arrowUncentered,
9458
- arrowStyles: positioning.arrowStyles,
9459
- anchorHidden: positioning.anchorHidden,
9460
- isPositioned: positioning.isPositioned
9461
- }), [positioning.side, positioning.align, positioning.arrowRef, positioning.arrowUncentered, positioning.arrowStyles, positioning.anchorHidden, positioning.isPositioned]);
9462
9124
  const setPositionerElement = useStableCallback(element => {
9463
9125
  store.set('positionerElement', element);
9464
9126
  });
9465
- const element = useRenderElement('div', componentProps, {
9466
- state,
9467
- ref: [forwardedRef, setPositionerElement],
9468
- props: [defaultProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
9469
- stateAttributesMapping: popupStateMapping
9127
+ const element = usePositioner(componentProps, state, {
9128
+ styles: positioning.positionerStyles,
9129
+ transitionStatus,
9130
+ props: elementProps,
9131
+ refs: [forwardedRef, setPositionerElement],
9132
+ hidden: !mounted,
9133
+ inert: !open
9470
9134
  });
9471
9135
  return /*#__PURE__*/jsxRuntime.jsxs(ComboboxPositionerContext.Provider, {
9472
- value: contextValue,
9136
+ value: positioning,
9473
9137
  children: [mounted && modal && /*#__PURE__*/jsxRuntime.jsx(InternalBackdrop, {
9474
9138
  inert: inertValue(!open),
9475
9139
  cutout: inputGroupElement ?? inputElement ?? triggerElement
@@ -9485,11 +9149,14 @@ const stateAttributesMapping = {
9485
9149
  /**
9486
9150
  * A container for the list.
9487
9151
  * Renders a `<div>` element.
9152
+ *
9153
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
9488
9154
  */
9489
9155
  const ComboboxPopup = /*#__PURE__*/React__namespace.forwardRef(function ComboboxPopup(componentProps, forwardedRef) {
9490
9156
  const {
9491
9157
  render,
9492
9158
  className,
9159
+ style,
9493
9160
  initialFocus,
9494
9161
  finalFocus,
9495
9162
  ...elementProps
@@ -9582,6 +9249,7 @@ const ComboboxGroup$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
9582
9249
  const {
9583
9250
  render,
9584
9251
  className,
9252
+ style,
9585
9253
  items,
9586
9254
  ...elementProps
9587
9255
  } = componentProps;
@@ -9614,11 +9282,14 @@ const ComboboxGroup$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
9614
9282
  /**
9615
9283
  * An accessible label that is automatically associated with its parent group.
9616
9284
  * Renders a `<div>` element.
9285
+ *
9286
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
9617
9287
  */
9618
9288
  const ComboboxGroupLabel = /*#__PURE__*/React__namespace.forwardRef(function ComboboxGroupLabel(componentProps, forwardedRef) {
9619
9289
  const {
9620
9290
  render,
9621
9291
  className,
9292
+ style,
9622
9293
  id: idProp,
9623
9294
  ...elementProps
9624
9295
  } = componentProps;
@@ -9663,6 +9334,7 @@ const ComboboxItem$2 = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__na
9663
9334
  index: indexProp,
9664
9335
  disabled = false,
9665
9336
  nativeButton = false,
9337
+ style,
9666
9338
  ...elementProps
9667
9339
  } = componentProps;
9668
9340
  const didPointerDownRef = React__namespace.useRef(false);
@@ -9778,6 +9450,11 @@ const ComboboxItem$2 = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__na
9778
9450
  didPointerDownRef.current = true;
9779
9451
  event.preventDefault();
9780
9452
  },
9453
+ onMouseDown(event) {
9454
+ // iOS Safari can emit a synthetic mousedown for touch taps without a preceding
9455
+ // pointerdown. Prevent default here too so tapping an item does not blur the input.
9456
+ event.preventDefault();
9457
+ },
9781
9458
  onClick(event) {
9782
9459
  if (disabled || readOnly) {
9783
9460
  return;
@@ -9812,12 +9489,19 @@ const ComboboxItem$2 = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__na
9812
9489
  * Renders its children only when the list is empty.
9813
9490
  * Requires the `items` prop on the root component.
9814
9491
  * Announces changes politely to screen readers.
9492
+ * This component's root element must remain mounted in the DOM to announce
9493
+ * changes consistently across screen readers. Avoid hiding or removing the
9494
+ * component itself with `display: none`, `hidden`, `aria-hidden`, or conditional
9495
+ * rendering. Prefer updating or conditionally rendering its children instead.
9815
9496
  * Renders a `<div>` element.
9497
+ *
9498
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
9816
9499
  */
9817
9500
  const ComboboxEmpty$2 = /*#__PURE__*/React__namespace.forwardRef(function ComboboxEmpty(componentProps, forwardedRef) {
9818
9501
  const {
9819
9502
  render,
9820
9503
  className,
9504
+ style,
9821
9505
  children: childrenProp,
9822
9506
  ...elementProps
9823
9507
  } = componentProps;
@@ -9825,9 +9509,10 @@ const ComboboxEmpty$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
9825
9509
  filteredItems
9826
9510
  } = useComboboxDerivedItemsContext();
9827
9511
  const store = useComboboxRootContext();
9512
+ const emptyRef = useInitialLiveRegionTextMutation();
9828
9513
  const children = filteredItems.length === 0 ? childrenProp : null;
9829
9514
  return useRenderElement('div', componentProps, {
9830
- ref: [forwardedRef, store.state.emptyRef],
9515
+ ref: [forwardedRef, store.state.emptyRef, emptyRef],
9831
9516
  props: [{
9832
9517
  children,
9833
9518
  role: 'status',
@@ -9848,6 +9533,7 @@ const Separator = /*#__PURE__*/React__namespace.forwardRef(function SeparatorCom
9848
9533
  className,
9849
9534
  render,
9850
9535
  orientation = 'horizontal',
9536
+ style,
9851
9537
  ...elementProps
9852
9538
  } = componentProps;
9853
9539
  const state = {
@@ -9933,6 +9619,7 @@ const Inner = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__namespace.f
9933
9619
  const {
9934
9620
  render,
9935
9621
  className,
9622
+ style,
9936
9623
  keepMounted,
9937
9624
  ...elementProps
9938
9625
  } = componentProps;
@@ -9973,6 +9660,7 @@ const ComboboxChips$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
9973
9660
  const {
9974
9661
  render,
9975
9662
  className,
9663
+ style,
9976
9664
  ...elementProps
9977
9665
  } = componentProps;
9978
9666
  const store = useComboboxRootContext();
@@ -9989,7 +9677,11 @@ const ComboboxChips$2 = /*#__PURE__*/React__namespace.forwardRef(function Combob
9989
9677
  // arrow keys inside a container unless it has a toolbar role.
9990
9678
  props: [hasSelectionChips ? {
9991
9679
  role: 'toolbar'
9992
- } : EMPTY_OBJECT, elementProps]
9680
+ } : EMPTY_OBJECT, {
9681
+ onMouseDown(event) {
9682
+ handleInputPress(event, store, store.state.disabled, store.state.readOnly);
9683
+ }
9684
+ }, elementProps]
9993
9685
  });
9994
9686
  const contextValue = React__namespace.useMemo(() => ({
9995
9687
  highlightedChipIndex,
@@ -10018,6 +9710,7 @@ const ComboboxChip$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
10018
9710
  const {
10019
9711
  render,
10020
9712
  className,
9713
+ style,
10021
9714
  ...elementProps
10022
9715
  } = componentProps;
10023
9716
  const store = useComboboxRootContext();
@@ -10043,7 +9736,7 @@ const ComboboxChip$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
10043
9736
  }
10044
9737
  } else if (event.key === 'ArrowRight') {
10045
9738
  event.preventDefault();
10046
- if (index < selectedValue.length - 1) {
9739
+ if (index < chipsRef.current.length - 1) {
10047
9740
  nextIndex = index + 1;
10048
9741
  } else {
10049
9742
  nextIndex = undefined;
@@ -10095,16 +9788,6 @@ const ComboboxChip$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
10095
9788
  } else {
10096
9789
  chipsRef.current[nextIndex]?.focus();
10097
9790
  }
10098
- },
10099
- onMouseDown(event) {
10100
- if (readOnly) {
10101
- return;
10102
- }
10103
- event.preventDefault();
10104
- if (disabled) {
10105
- return;
10106
- }
10107
- store.state.inputRef.current?.focus();
10108
9791
  }
10109
9792
  }, elementProps]
10110
9793
  });
@@ -10120,6 +9803,8 @@ const ComboboxChip$2 = /*#__PURE__*/React__namespace.forwardRef(function Combobo
10120
9803
  /**
10121
9804
  * A button to remove a chip.
10122
9805
  * Renders a `<button>` element.
9806
+ *
9807
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
10123
9808
  */
10124
9809
  const ComboboxChipRemove = /*#__PURE__*/React__namespace.forwardRef(function ComboboxChipRemove(componentProps, forwardedRef) {
10125
9810
  const {
@@ -10127,6 +9812,7 @@ const ComboboxChipRemove = /*#__PURE__*/React__namespace.forwardRef(function Com
10127
9812
  className,
10128
9813
  disabled: disabledProp = false,
10129
9814
  nativeButton = true,
9815
+ style,
10130
9816
  ...elementProps
10131
9817
  } = componentProps;
10132
9818
  const store = useComboboxRootContext();
@@ -10178,6 +9864,9 @@ const ComboboxChipRemove = /*#__PURE__*/React__namespace.forwardRef(function Com
10178
9864
  state,
10179
9865
  props: [{
10180
9866
  tabIndex: -1,
9867
+ onMouseDown(event) {
9868
+ event.preventDefault();
9869
+ },
10181
9870
  onClick(event) {
10182
9871
  if (disabled || readOnly) {
10183
9872
  return;
@@ -10246,9 +9935,7 @@ function ComboboxChips$1({ className, ...props }) {
10246
9935
  function ComboboxChip$1({ className, children, showRemove = true, ...props }) {
10247
9936
  return (jsxRuntime.jsxs(ComboboxChip$2, { "data-slot": "combobox-chip", className: utils.cn("flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0", className), ...props, children: [children, showRemove && (jsxRuntime.jsx(ComboboxChipRemove, { render: jsxRuntime.jsx(button.Button, { variant: "ghost", size: "icon-xs" }), className: "-ms-1 opacity-50 hover:opacity-100", "data-slot": "combobox-chip-remove", children: jsxRuntime.jsx(x.X, { className: "pointer-events-none" }) }))] }));
10248
9937
  }
10249
- function ComboboxChipsInput$1({ className, ...props }) {
10250
- return (jsxRuntime.jsx(ComboboxInput$2, { "data-slot": "combobox-chip-input", className: utils.cn("min-w-16 flex-1 outline-none", className), ...props }));
10251
- }
9938
+ const ComboboxChipsInput$1 = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(ComboboxInput$2, { ref: ref, "data-slot": "combobox-chip-input", className: utils.cn("min-w-16 flex-1 outline-none", className), ...props })));
10252
9939
  function useComboboxAnchor() {
10253
9940
  return React__namespace.useRef(null);
10254
9941
  }
@@ -10265,7 +9952,7 @@ const ComboboxEmpty = (props) => jsxRuntime.jsx(ComboboxEmpty$1, { ...props });
10265
9952
  const ComboboxSeparator = (props) => jsxRuntime.jsx(ComboboxSeparator$1, { ...props });
10266
9953
  const ComboboxChips = (props) => jsxRuntime.jsx(ComboboxChips$1, { ...props });
10267
9954
  const ComboboxChip = (props) => jsxRuntime.jsx(ComboboxChip$1, { ...props });
10268
- const ComboboxChipsInput = (props) => jsxRuntime.jsx(ComboboxChipsInput$1, { ...props });
9955
+ const ComboboxChipsInput = React__namespace.default.forwardRef((props, ref) => jsxRuntime.jsx(ComboboxChipsInput$1, { ref: ref, ...props }));
10269
9956
  const ComboboxTrigger = (props) => jsxRuntime.jsx(ComboboxTrigger$1, { ...props });
10270
9957
  const ComboboxValue = (props) => jsxRuntime.jsx(ComboboxValue$1, { ...props });
10271
9958