@ariakit/react-components 0.1.0 → 0.1.2

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 (500) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/button/button.d.ts +1 -1
  3. package/dist/{button-Cp853csH.d.ts → button-CVWcOgxs.d.ts} +3 -3
  4. package/dist/{button-Cp853csH.d.ts.map → button-CVWcOgxs.d.ts.map} +1 -1
  5. package/dist/checkbox/checkbox-check.d.ts +1 -1
  6. package/dist/checkbox/checkbox-check.d.ts.map +1 -1
  7. package/dist/checkbox/checkbox.d.ts +2 -2
  8. package/dist/checkbox/checkbox.d.ts.map +1 -1
  9. package/dist/collection/collection-item-offscreen.d.ts +1 -1
  10. package/dist/collection/collection-item-offscreen.js +1 -1
  11. package/dist/collection/collection-item-offscreen.js.map +1 -1
  12. package/dist/collection/collection-item.d.ts +1 -1
  13. package/dist/collection/collection-renderer.d.ts +1 -1
  14. package/dist/collection/collection-renderer.js +1 -1
  15. package/dist/collection/collection-renderer.js.map +1 -1
  16. package/dist/collection/collection.d.ts +1 -1
  17. package/dist/collection/collection.d.ts.map +1 -1
  18. package/dist/{collection-item-offscreen-DyXa-sqj.d.ts → collection-item-offscreen-B5E5vNFi.d.ts} +2 -2
  19. package/dist/{collection-item-offscreen-DyXa-sqj.d.ts.map → collection-item-offscreen-B5E5vNFi.d.ts.map} +1 -1
  20. package/dist/{collection-item-C-g2BwVF.d.ts → collection-item-pvEWNoNs.d.ts} +2 -2
  21. package/dist/{collection-item-C-g2BwVF.d.ts.map → collection-item-pvEWNoNs.d.ts.map} +1 -1
  22. package/dist/{collection-renderer-DsPD9ksD.d.ts → collection-renderer-BhzF21Du.d.ts} +29 -15
  23. package/dist/collection-renderer-BhzF21Du.d.ts.map +1 -0
  24. package/dist/combobox/combobox-cancel.d.ts +2 -2
  25. package/dist/combobox/combobox-cancel.d.ts.map +1 -1
  26. package/dist/combobox/combobox-cancel.js +1 -1
  27. package/dist/combobox/combobox-cancel.js.map +1 -1
  28. package/dist/combobox/combobox-disclosure.d.ts +2 -2
  29. package/dist/combobox/combobox-disclosure.d.ts.map +1 -1
  30. package/dist/combobox/combobox-disclosure.js +1 -1
  31. package/dist/combobox/combobox-disclosure.js.map +1 -1
  32. package/dist/combobox/combobox-group-label.d.ts +1 -1
  33. package/dist/combobox/combobox-group-label.d.ts.map +1 -1
  34. package/dist/combobox/combobox-group.d.ts +1 -1
  35. package/dist/combobox/combobox-group.d.ts.map +1 -1
  36. package/dist/combobox/combobox-group.js +1 -1
  37. package/dist/combobox/combobox-group.js.map +1 -1
  38. package/dist/combobox/combobox-item-check.d.ts +1 -1
  39. package/dist/combobox/combobox-item-check.d.ts.map +1 -1
  40. package/dist/combobox/combobox-item-value.d.ts +1 -1
  41. package/dist/combobox/combobox-item-value.d.ts.map +1 -1
  42. package/dist/combobox/combobox-item.d.ts +3 -3
  43. package/dist/combobox/combobox-item.d.ts.map +1 -1
  44. package/dist/combobox/combobox-item.js +1 -1
  45. package/dist/combobox/combobox-item.js.map +1 -1
  46. package/dist/combobox/combobox-label.d.ts +1 -1
  47. package/dist/combobox/combobox-label.d.ts.map +1 -1
  48. package/dist/combobox/combobox-label.js +1 -1
  49. package/dist/combobox/combobox-label.js.map +1 -1
  50. package/dist/combobox/combobox-list.d.ts +1 -1
  51. package/dist/combobox/combobox-list.d.ts.map +1 -1
  52. package/dist/combobox/combobox-list.js +1 -1
  53. package/dist/combobox/combobox-list.js.map +1 -1
  54. package/dist/combobox/combobox-popover.d.ts +1 -1
  55. package/dist/combobox/combobox-popover.js +1 -1
  56. package/dist/combobox/combobox-popover.js.map +1 -1
  57. package/dist/combobox/combobox-row.d.ts +1 -1
  58. package/dist/combobox/combobox-row.d.ts.map +1 -1
  59. package/dist/combobox/combobox-row.js +1 -1
  60. package/dist/combobox/combobox-row.js.map +1 -1
  61. package/dist/combobox/combobox-separator.d.ts +1 -1
  62. package/dist/combobox/combobox-separator.d.ts.map +1 -1
  63. package/dist/combobox/combobox-separator.js +1 -1
  64. package/dist/combobox/combobox-separator.js.map +1 -1
  65. package/dist/combobox/combobox-value.js +1 -1
  66. package/dist/combobox/combobox-value.js.map +1 -1
  67. package/dist/combobox/combobox.d.ts +3 -3
  68. package/dist/combobox/combobox.d.ts.map +1 -1
  69. package/dist/combobox/combobox.js +16 -2
  70. package/dist/combobox/combobox.js.map +1 -1
  71. package/dist/command/command.d.ts +1 -1
  72. package/dist/{command-DckndCUK.d.ts → command-B9C8p3_S.d.ts} +3 -3
  73. package/dist/{command-DckndCUK.d.ts.map → command-B9C8p3_S.d.ts.map} +1 -1
  74. package/dist/composite/composite-container.d.ts +1 -1
  75. package/dist/composite/composite-container.d.ts.map +1 -1
  76. package/dist/composite/composite-container.js +2 -2
  77. package/dist/composite/composite-container.js.map +1 -1
  78. package/dist/composite/composite-group-label.d.ts +2 -2
  79. package/dist/composite/composite-group-label.d.ts.map +1 -1
  80. package/dist/composite/composite-group.d.ts +2 -2
  81. package/dist/composite/composite-group.d.ts.map +1 -1
  82. package/dist/composite/composite-hover.d.ts +1 -1
  83. package/dist/composite/composite-hover.js +9 -13
  84. package/dist/composite/composite-hover.js.map +1 -1
  85. package/dist/composite/composite-input.d.ts +1 -1
  86. package/dist/composite/composite-input.d.ts.map +1 -1
  87. package/dist/composite/composite-input.js +1 -1
  88. package/dist/composite/composite-input.js.map +1 -1
  89. package/dist/composite/composite-item-offscreen.d.ts +2 -2
  90. package/dist/composite/composite-item-offscreen.js +2 -2
  91. package/dist/composite/composite-item-offscreen.js.map +1 -1
  92. package/dist/composite/composite-item.d.ts +1 -1
  93. package/dist/composite/composite-item.js +2 -2
  94. package/dist/composite/composite-item.js.map +1 -1
  95. package/dist/composite/composite-overflow-disclosure.d.ts +2 -2
  96. package/dist/composite/composite-overflow-disclosure.d.ts.map +1 -1
  97. package/dist/composite/composite-overflow.d.ts +2 -2
  98. package/dist/composite/composite-overflow.d.ts.map +1 -1
  99. package/dist/composite/composite-renderer.d.ts +28 -14
  100. package/dist/composite/composite-renderer.d.ts.map +1 -1
  101. package/dist/composite/composite-renderer.js +2 -2
  102. package/dist/composite/composite-renderer.js.map +1 -1
  103. package/dist/composite/composite-row.d.ts +1 -1
  104. package/dist/composite/composite-row.d.ts.map +1 -1
  105. package/dist/composite/composite-row.js +3 -3
  106. package/dist/composite/composite-row.js.map +1 -1
  107. package/dist/composite/composite-separator.d.ts +2 -2
  108. package/dist/composite/composite-separator.d.ts.map +1 -1
  109. package/dist/composite/composite-separator.js +3 -3
  110. package/dist/composite/composite-separator.js.map +1 -1
  111. package/dist/composite/composite-typeahead.d.ts +1 -1
  112. package/dist/composite/composite-typeahead.js +3 -3
  113. package/dist/composite/composite-typeahead.js.map +1 -1
  114. package/dist/composite/composite.d.ts +1 -1
  115. package/dist/composite/composite.js +3 -3
  116. package/dist/composite/composite.js.map +1 -1
  117. package/dist/{composite-DLvyFHMq.d.ts → composite-KBhCGLEy.d.ts} +3 -3
  118. package/dist/{composite-DLvyFHMq.d.ts.map → composite-KBhCGLEy.d.ts.map} +1 -1
  119. package/dist/{composite-hover-C7ul163w.d.ts → composite-hover-BpXq3T8J.d.ts} +2 -2
  120. package/dist/{composite-hover-C7ul163w.d.ts.map → composite-hover-BpXq3T8J.d.ts.map} +1 -1
  121. package/dist/{composite-item-B4WTelVz.d.ts → composite-item-d4UXaZ84.d.ts} +4 -4
  122. package/dist/{composite-item-B4WTelVz.d.ts.map → composite-item-d4UXaZ84.d.ts.map} +1 -1
  123. package/dist/{composite-typeahead-DDhpyKqm.d.ts → composite-typeahead-0euW43GU.d.ts} +2 -2
  124. package/dist/{composite-typeahead-DDhpyKqm.d.ts.map → composite-typeahead-0euW43GU.d.ts.map} +1 -1
  125. package/dist/dialog/dialog-backdrop.d.ts +1 -1
  126. package/dist/dialog/dialog-description.d.ts +1 -1
  127. package/dist/dialog/dialog-disclosure.d.ts +1 -1
  128. package/dist/dialog/dialog-disclosure.js +1 -1
  129. package/dist/dialog/dialog-disclosure.js.map +1 -1
  130. package/dist/dialog/dialog-dismiss.d.ts +1 -1
  131. package/dist/dialog/dialog-heading.d.ts +1 -1
  132. package/dist/dialog/dialog.d.ts +1 -1
  133. package/dist/dialog/dialog.js +18 -6
  134. package/dist/dialog/dialog.js.map +1 -1
  135. package/dist/dialog/utils/disable-accessibility-tree-outside.d.ts +1 -3
  136. package/dist/dialog/utils/disable-accessibility-tree-outside.d.ts.map +1 -1
  137. package/dist/dialog/utils/disable-accessibility-tree-outside.js +1 -15
  138. package/dist/dialog/utils/disable-accessibility-tree-outside.js.map +1 -1
  139. package/dist/dialog/utils/use-hide-on-interact-outside.d.ts +1 -1
  140. package/dist/dialog/utils/use-hide-on-interact-outside.js +2 -2
  141. package/dist/dialog/utils/use-hide-on-interact-outside.js.map +1 -1
  142. package/dist/dialog/utils/use-prevent-body-scroll.js +2 -1
  143. package/dist/dialog/utils/use-prevent-body-scroll.js.map +1 -1
  144. package/dist/dialog/utils/use-previous-mouse-down-ref.d.ts +1 -1
  145. package/dist/dialog/utils/use-previous-mouse-down-ref.d.ts.map +1 -1
  146. package/dist/{dialog-C__C-zX2.d.ts → dialog-D23r2ZWj.d.ts} +4 -4
  147. package/dist/{dialog-C__C-zX2.d.ts.map → dialog-D23r2ZWj.d.ts.map} +1 -1
  148. package/dist/{dialog-description-BCZJ1Kyd.d.ts → dialog-description-CJGxnEvk.d.ts} +2 -2
  149. package/dist/{dialog-description-BCZJ1Kyd.d.ts.map → dialog-description-CJGxnEvk.d.ts.map} +1 -1
  150. package/dist/{dialog-disclosure-DLD10zlb.d.ts → dialog-disclosure-DSESk5pv.d.ts} +3 -3
  151. package/dist/{dialog-disclosure-DLD10zlb.d.ts.map → dialog-disclosure-DSESk5pv.d.ts.map} +1 -1
  152. package/dist/{dialog-dismiss-CnwEbzc6.d.ts → dialog-dismiss-DW3XQYvp.d.ts} +3 -3
  153. package/dist/{dialog-dismiss-CnwEbzc6.d.ts.map → dialog-dismiss-DW3XQYvp.d.ts.map} +1 -1
  154. package/dist/{dialog-heading-DQvnOfZH.d.ts → dialog-heading-DGA5d8VH.d.ts} +3 -3
  155. package/dist/{dialog-heading-DQvnOfZH.d.ts.map → dialog-heading-DGA5d8VH.d.ts.map} +1 -1
  156. package/dist/disclosure/disclosure-content.js +1 -1
  157. package/dist/disclosure/disclosure-content.js.map +1 -1
  158. package/dist/disclosure/disclosure.d.ts +1 -1
  159. package/dist/disclosure/disclosure.js +1 -1
  160. package/dist/disclosure/disclosure.js.map +1 -1
  161. package/dist/{disclosure-CQ37hPVP.d.ts → disclosure-C4F4sCVZ.d.ts} +3 -3
  162. package/dist/{disclosure-CQ37hPVP.d.ts.map → disclosure-C4F4sCVZ.d.ts.map} +1 -1
  163. package/dist/focus-trap/focus-trap-region.d.ts +1 -1
  164. package/dist/focus-trap/focus-trap-region.d.ts.map +1 -1
  165. package/dist/focus-trap/focus-trap.d.ts +1 -1
  166. package/dist/focus-trap/focus-trap.d.ts.map +1 -1
  167. package/dist/focusable/focusable-container.d.ts +1 -1
  168. package/dist/focusable/focusable-container.d.ts.map +1 -1
  169. package/dist/focusable/focusable.d.ts +1 -1
  170. package/dist/focusable/focusable.js +49 -8
  171. package/dist/focusable/focusable.js.map +1 -1
  172. package/dist/{focusable-B00tOxtB.d.ts → focusable-dBZH13-T.d.ts} +2 -2
  173. package/dist/{focusable-B00tOxtB.d.ts.map → focusable-dBZH13-T.d.ts.map} +1 -1
  174. package/dist/form/form-checkbox.d.ts +1 -1
  175. package/dist/form/form-checkbox.d.ts.map +1 -1
  176. package/dist/form/form-checkbox.js +1 -1
  177. package/dist/form/form-checkbox.js.map +1 -1
  178. package/dist/form/form-control.d.ts +2 -2
  179. package/dist/form/form-control.d.ts.map +1 -1
  180. package/dist/form/form-control.js +1 -1
  181. package/dist/form/form-control.js.map +1 -1
  182. package/dist/form/form-description.d.ts +2 -2
  183. package/dist/form/form-description.d.ts.map +1 -1
  184. package/dist/form/form-description.js +1 -1
  185. package/dist/form/form-description.js.map +1 -1
  186. package/dist/form/form-error.d.ts +2 -2
  187. package/dist/form/form-error.d.ts.map +1 -1
  188. package/dist/form/form-error.js +1 -1
  189. package/dist/form/form-error.js.map +1 -1
  190. package/dist/form/form-field.d.ts +1 -1
  191. package/dist/form/form-field.d.ts.map +1 -1
  192. package/dist/form/form-group-label.d.ts +2 -2
  193. package/dist/form/form-group-label.d.ts.map +1 -1
  194. package/dist/form/form-group.d.ts +2 -2
  195. package/dist/form/form-group.d.ts.map +1 -1
  196. package/dist/form/form-input.d.ts +2 -2
  197. package/dist/form/form-input.d.ts.map +1 -1
  198. package/dist/form/form-input.js +1 -1
  199. package/dist/form/form-input.js.map +1 -1
  200. package/dist/form/form-label.d.ts +2 -2
  201. package/dist/form/form-label.d.ts.map +1 -1
  202. package/dist/form/form-label.js +1 -1
  203. package/dist/form/form-label.js.map +1 -1
  204. package/dist/form/form-push.d.ts +3 -3
  205. package/dist/form/form-push.d.ts.map +1 -1
  206. package/dist/form/form-push.js +1 -1
  207. package/dist/form/form-push.js.map +1 -1
  208. package/dist/form/form-radio-group.d.ts +1 -1
  209. package/dist/form/form-radio-group.d.ts.map +1 -1
  210. package/dist/form/form-radio.d.ts +1 -1
  211. package/dist/form/form-radio.d.ts.map +1 -1
  212. package/dist/form/form-radio.js +1 -1
  213. package/dist/form/form-radio.js.map +1 -1
  214. package/dist/form/form-remove.d.ts +16 -12
  215. package/dist/form/form-remove.d.ts.map +1 -1
  216. package/dist/form/form-remove.js +15 -11
  217. package/dist/form/form-remove.js.map +1 -1
  218. package/dist/form/form-reset.d.ts +2 -2
  219. package/dist/form/form-reset.d.ts.map +1 -1
  220. package/dist/form/form-reset.js +1 -1
  221. package/dist/form/form-reset.js.map +1 -1
  222. package/dist/form/form-submit.d.ts +2 -2
  223. package/dist/form/form-submit.d.ts.map +1 -1
  224. package/dist/form/form-submit.js +1 -1
  225. package/dist/form/form-submit.js.map +1 -1
  226. package/dist/form/form.d.ts +1 -1
  227. package/dist/form/form.d.ts.map +1 -1
  228. package/dist/form/form.js +1 -1
  229. package/dist/form/form.js.map +1 -1
  230. package/dist/group/group-label.d.ts +1 -1
  231. package/dist/group/group.d.ts +1 -1
  232. package/dist/{group-label-C16IDs1b.d.ts → group-label-BKYqD4Sj.d.ts} +2 -2
  233. package/dist/{group-label-C16IDs1b.d.ts.map → group-label-BKYqD4Sj.d.ts.map} +1 -1
  234. package/dist/{group-CamegDJA.d.ts → group-nGD9e6Dj.d.ts} +2 -2
  235. package/dist/{group-CamegDJA.d.ts.map → group-nGD9e6Dj.d.ts.map} +1 -1
  236. package/dist/heading/heading.d.ts +1 -1
  237. package/dist/heading/heading.js +2 -2
  238. package/dist/heading/heading.js.map +1 -1
  239. package/dist/{heading-zY9g_9K-.d.ts → heading-D_AmeqL5.d.ts} +2 -2
  240. package/dist/{heading-zY9g_9K-.d.ts.map → heading-D_AmeqL5.d.ts.map} +1 -1
  241. package/dist/hovercard/hovercard-anchor.d.ts +2 -2
  242. package/dist/hovercard/hovercard-anchor.d.ts.map +1 -1
  243. package/dist/hovercard/hovercard-anchor.js +1 -1
  244. package/dist/hovercard/hovercard-anchor.js.map +1 -1
  245. package/dist/hovercard/hovercard-arrow.d.ts +1 -1
  246. package/dist/hovercard/hovercard-arrow.d.ts.map +1 -1
  247. package/dist/hovercard/hovercard-description.d.ts +2 -2
  248. package/dist/hovercard/hovercard-description.d.ts.map +1 -1
  249. package/dist/hovercard/hovercard-disclosure.d.ts +2 -2
  250. package/dist/hovercard/hovercard-disclosure.d.ts.map +1 -1
  251. package/dist/hovercard/hovercard-disclosure.js +4 -4
  252. package/dist/hovercard/hovercard-disclosure.js.map +1 -1
  253. package/dist/hovercard/hovercard-dismiss.d.ts +2 -2
  254. package/dist/hovercard/hovercard-dismiss.d.ts.map +1 -1
  255. package/dist/hovercard/hovercard-heading.d.ts +2 -2
  256. package/dist/hovercard/hovercard-heading.d.ts.map +1 -1
  257. package/dist/hovercard/hovercard.d.ts +1 -1
  258. package/dist/hovercard/hovercard.js +2 -2
  259. package/dist/hovercard/hovercard.js.map +1 -1
  260. package/dist/menu/menu-arrow.d.ts +2 -2
  261. package/dist/menu/menu-arrow.d.ts.map +1 -1
  262. package/dist/menu/menu-bar-provider.js +1 -1
  263. package/dist/menu/menu-bar-provider.js.map +1 -1
  264. package/dist/menu/menu-bar-store.d.ts +3 -3
  265. package/dist/menu/menu-bar-store.js +3 -3
  266. package/dist/menu/menu-bar-store.js.map +1 -1
  267. package/dist/menu/menu-bar.d.ts +1 -1
  268. package/dist/menu/menu-bar.d.ts.map +1 -1
  269. package/dist/menu/menu-bar.js +1 -1
  270. package/dist/menu/menu-bar.js.map +1 -1
  271. package/dist/menu/menu-button-arrow.d.ts +2 -2
  272. package/dist/menu/menu-button-arrow.d.ts.map +1 -1
  273. package/dist/menu/menu-button.d.ts +3 -3
  274. package/dist/menu/menu-button.d.ts.map +1 -1
  275. package/dist/menu/menu-button.js +1 -1
  276. package/dist/menu/menu-button.js.map +1 -1
  277. package/dist/menu/menu-context.d.ts +10 -3
  278. package/dist/menu/menu-context.d.ts.map +1 -1
  279. package/dist/menu/menu-context.js +8 -1
  280. package/dist/menu/menu-context.js.map +1 -1
  281. package/dist/menu/menu-description.d.ts +2 -2
  282. package/dist/menu/menu-description.d.ts.map +1 -1
  283. package/dist/menu/menu-dismiss.d.ts +2 -2
  284. package/dist/menu/menu-dismiss.d.ts.map +1 -1
  285. package/dist/menu/menu-group-label.d.ts +2 -2
  286. package/dist/menu/menu-group-label.d.ts.map +1 -1
  287. package/dist/menu/menu-group.d.ts +2 -2
  288. package/dist/menu/menu-group.d.ts.map +1 -1
  289. package/dist/menu/menu-heading.d.ts +2 -2
  290. package/dist/menu/menu-heading.d.ts.map +1 -1
  291. package/dist/menu/menu-item-check.d.ts +2 -2
  292. package/dist/menu/menu-item-check.d.ts.map +1 -1
  293. package/dist/menu/menu-item-checkbox.d.ts +2 -2
  294. package/dist/menu/menu-item-checkbox.d.ts.map +1 -1
  295. package/dist/menu/menu-item-checkbox.js +1 -1
  296. package/dist/menu/menu-item-checkbox.js.map +1 -1
  297. package/dist/menu/menu-item-radio.d.ts +2 -2
  298. package/dist/menu/menu-item-radio.d.ts.map +1 -1
  299. package/dist/menu/menu-item-radio.js +1 -1
  300. package/dist/menu/menu-item-radio.js.map +1 -1
  301. package/dist/menu/menu-item.d.ts +5 -5
  302. package/dist/menu/menu-item.d.ts.map +1 -1
  303. package/dist/menu/menu-item.js +8 -4
  304. package/dist/menu/menu-item.js.map +1 -1
  305. package/dist/menu/menu-list.d.ts +4 -4
  306. package/dist/menu/menu-list.d.ts.map +1 -1
  307. package/dist/menu/menu-list.js +6 -2
  308. package/dist/menu/menu-list.js.map +1 -1
  309. package/dist/menu/menu-provider.d.ts +1 -1
  310. package/dist/menu/menu-separator.d.ts +2 -2
  311. package/dist/menu/menu-separator.d.ts.map +1 -1
  312. package/dist/menu/menu-store.d.ts +1 -1
  313. package/dist/menu/menu.js +1 -1
  314. package/dist/menu/menu.js.map +1 -1
  315. package/dist/{menu-store-0CKKmNek.d.ts → menu-store-BpTJdcL8.d.ts} +2 -2
  316. package/dist/{menu-store-0CKKmNek.d.ts.map → menu-store-BpTJdcL8.d.ts.map} +1 -1
  317. package/dist/menubar/menubar-context.d.ts +2 -3
  318. package/dist/menubar/menubar-context.d.ts.map +1 -1
  319. package/dist/menubar/menubar-context.js +1 -3
  320. package/dist/menubar/menubar-context.js.map +1 -1
  321. package/dist/menubar/menubar-provider.d.ts +1 -1
  322. package/dist/menubar/menubar-store.d.ts +1 -1
  323. package/dist/menubar/menubar-store.js +2 -2
  324. package/dist/menubar/menubar-store.js.map +1 -1
  325. package/dist/menubar/menubar.d.ts +3 -3
  326. package/dist/menubar/menubar.d.ts.map +1 -1
  327. package/dist/{menubar-store-3h0eNIbS.d.ts → menubar-store-C553OKBw.d.ts} +3 -3
  328. package/dist/{menubar-store-3h0eNIbS.d.ts.map → menubar-store-C553OKBw.d.ts.map} +1 -1
  329. package/dist/popover/popover-anchor.d.ts +1 -1
  330. package/dist/popover/popover-arrow.d.ts +1 -1
  331. package/dist/popover/popover-arrow.d.ts.map +1 -1
  332. package/dist/popover/popover-arrow.js +4 -4
  333. package/dist/popover/popover-arrow.js.map +1 -1
  334. package/dist/popover/popover-description.d.ts +1 -1
  335. package/dist/popover/popover-disclosure-arrow.d.ts +1 -1
  336. package/dist/popover/popover-disclosure-arrow.d.ts.map +1 -1
  337. package/dist/popover/popover-disclosure-arrow.js +1 -1
  338. package/dist/popover/popover-disclosure-arrow.js.map +1 -1
  339. package/dist/popover/popover-disclosure.d.ts +3 -3
  340. package/dist/popover/popover-disclosure.d.ts.map +1 -1
  341. package/dist/popover/popover-disclosure.js +1 -1
  342. package/dist/popover/popover-disclosure.js.map +1 -1
  343. package/dist/popover/popover-dismiss.d.ts +1 -1
  344. package/dist/popover/popover-heading.d.ts +1 -1
  345. package/dist/popover/popover.d.ts +1 -1
  346. package/dist/popover/popover.js +2 -2
  347. package/dist/popover/popover.js.map +1 -1
  348. package/dist/{popover-CCqiRKqg.d.ts → popover-B9PxE5iP.d.ts} +10 -2
  349. package/dist/popover-B9PxE5iP.d.ts.map +1 -0
  350. package/dist/{popover-anchor-PgfeXyzs.d.ts → popover-anchor-W18KUmuM.d.ts} +2 -2
  351. package/dist/{popover-anchor-PgfeXyzs.d.ts.map → popover-anchor-W18KUmuM.d.ts.map} +1 -1
  352. package/dist/{popover-description-DU753dah.d.ts → popover-description-DbW4mVBb.d.ts} +3 -3
  353. package/dist/{popover-description-DU753dah.d.ts.map → popover-description-DbW4mVBb.d.ts.map} +1 -1
  354. package/dist/{popover-dismiss-DPeI6Zse.d.ts → popover-dismiss-CQFvuLzJ.d.ts} +3 -3
  355. package/dist/{popover-dismiss-DPeI6Zse.d.ts.map → popover-dismiss-CQFvuLzJ.d.ts.map} +1 -1
  356. package/dist/{popover-heading-DGsr6D5W.d.ts → popover-heading-DC8rYnwo.d.ts} +3 -3
  357. package/dist/{popover-heading-DGsr6D5W.d.ts.map → popover-heading-DC8rYnwo.d.ts.map} +1 -1
  358. package/dist/portal/portal.d.ts +1 -1
  359. package/dist/{portal-CMBWiayp.d.ts → portal-CKFTfCWH.d.ts} +2 -2
  360. package/dist/{portal-CMBWiayp.d.ts.map → portal-CKFTfCWH.d.ts.map} +1 -1
  361. package/dist/radio/radio-group.d.ts +2 -2
  362. package/dist/radio/radio-group.d.ts.map +1 -1
  363. package/dist/radio/radio-group.js +1 -1
  364. package/dist/radio/radio-group.js.map +1 -1
  365. package/dist/radio/radio.d.ts +2 -2
  366. package/dist/radio/radio.d.ts.map +1 -1
  367. package/dist/select/select-arrow.d.ts +1 -1
  368. package/dist/select/select-arrow.d.ts.map +1 -1
  369. package/dist/select/select-dismiss.d.ts +2 -2
  370. package/dist/select/select-dismiss.d.ts.map +1 -1
  371. package/dist/select/select-group-label.d.ts +1 -1
  372. package/dist/select/select-group-label.d.ts.map +1 -1
  373. package/dist/select/select-group.d.ts +1 -1
  374. package/dist/select/select-group.d.ts.map +1 -1
  375. package/dist/select/select-heading.d.ts +2 -2
  376. package/dist/select/select-heading.d.ts.map +1 -1
  377. package/dist/select/select-item-check.d.ts +1 -1
  378. package/dist/select/select-item-check.d.ts.map +1 -1
  379. package/dist/select/select-item.d.ts +3 -3
  380. package/dist/select/select-item.d.ts.map +1 -1
  381. package/dist/select/select-item.js +1 -1
  382. package/dist/select/select-item.js.map +1 -1
  383. package/dist/select/select-label.d.ts +1 -1
  384. package/dist/select/select-label.d.ts.map +1 -1
  385. package/dist/select/select-label.js +1 -1
  386. package/dist/select/select-label.js.map +1 -1
  387. package/dist/select/select-list.d.ts +3 -3
  388. package/dist/select/select-list.d.ts.map +1 -1
  389. package/dist/select/select-list.js +1 -1
  390. package/dist/select/select-list.js.map +1 -1
  391. package/dist/select/select-popover.d.ts +1 -1
  392. package/dist/select/select-renderer.d.ts +2 -2
  393. package/dist/select/select-renderer.d.ts.map +1 -1
  394. package/dist/select/select-row.d.ts +1 -1
  395. package/dist/select/select-row.d.ts.map +1 -1
  396. package/dist/select/select-row.js +1 -1
  397. package/dist/select/select-row.js.map +1 -1
  398. package/dist/select/select-separator.d.ts +1 -1
  399. package/dist/select/select-separator.d.ts.map +1 -1
  400. package/dist/select/select.d.ts +2 -2
  401. package/dist/select/select.d.ts.map +1 -1
  402. package/dist/select/select.js +1 -1
  403. package/dist/select/select.js.map +1 -1
  404. package/dist/separator/separator.d.ts +1 -1
  405. package/dist/{separator--ozQfMcK.d.ts → separator-BnvSVwBa.d.ts} +2 -2
  406. package/dist/{separator--ozQfMcK.d.ts.map → separator-BnvSVwBa.d.ts.map} +1 -1
  407. package/dist/tab/tab-list.d.ts +2 -2
  408. package/dist/tab/tab-list.d.ts.map +1 -1
  409. package/dist/tab/tab-list.js +1 -1
  410. package/dist/tab/tab-list.js.map +1 -1
  411. package/dist/tab/tab-panel.d.ts +3 -3
  412. package/dist/tab/tab-panel.d.ts.map +1 -1
  413. package/dist/tab/tab-panel.js +2 -3
  414. package/dist/tab/tab-panel.js.map +1 -1
  415. package/dist/tab/tab.d.ts +2 -2
  416. package/dist/tab/tab.d.ts.map +1 -1
  417. package/dist/tab/tab.js +1 -1
  418. package/dist/tab/tab.js.map +1 -1
  419. package/dist/tag/tag-input.d.ts +2 -2
  420. package/dist/tag/tag-input.d.ts.map +1 -1
  421. package/dist/tag/tag-input.js +1 -2
  422. package/dist/tag/tag-input.js.map +1 -1
  423. package/dist/tag/tag-list-label.d.ts +2 -2
  424. package/dist/tag/tag-list-label.d.ts.map +1 -1
  425. package/dist/tag/tag-list-label.js +1 -1
  426. package/dist/tag/tag-list-label.js.map +1 -1
  427. package/dist/tag/tag-list.d.ts +2 -2
  428. package/dist/tag/tag-list.d.ts.map +1 -1
  429. package/dist/tag/tag-list.js +1 -1
  430. package/dist/tag/tag-list.js.map +1 -1
  431. package/dist/tag/tag-remove.d.ts +1 -1
  432. package/dist/tag/tag-remove.d.ts.map +1 -1
  433. package/dist/tag/tag-remove.js +1 -2
  434. package/dist/tag/tag-remove.js.map +1 -1
  435. package/dist/tag/tag-value.js +1 -1
  436. package/dist/tag/tag-value.js.map +1 -1
  437. package/dist/tag/tag-values.js +1 -1
  438. package/dist/tag/tag-values.js.map +1 -1
  439. package/dist/tag/tag.d.ts +2 -2
  440. package/dist/tag/tag.d.ts.map +1 -1
  441. package/dist/tag/tag.js +1 -1
  442. package/dist/tag/tag.js.map +1 -1
  443. package/dist/toolbar/toolbar-container.d.ts +1 -1
  444. package/dist/toolbar/toolbar-container.d.ts.map +1 -1
  445. package/dist/toolbar/toolbar-input.d.ts +1 -1
  446. package/dist/toolbar/toolbar-input.d.ts.map +1 -1
  447. package/dist/toolbar/toolbar-item.d.ts +2 -2
  448. package/dist/toolbar/toolbar-item.d.ts.map +1 -1
  449. package/dist/toolbar/toolbar-separator.d.ts +1 -1
  450. package/dist/toolbar/toolbar-separator.d.ts.map +1 -1
  451. package/dist/toolbar/toolbar.d.ts +2 -2
  452. package/dist/toolbar/toolbar.d.ts.map +1 -1
  453. package/dist/tooltip/tooltip-anchor.d.ts +1 -1
  454. package/dist/tooltip/tooltip-anchor.d.ts.map +1 -1
  455. package/dist/tooltip/tooltip-anchor.js +15 -4
  456. package/dist/tooltip/tooltip-anchor.js.map +1 -1
  457. package/dist/tooltip/tooltip-arrow.d.ts +1 -1
  458. package/dist/tooltip/tooltip-arrow.d.ts.map +1 -1
  459. package/dist/tooltip/tooltip-arrow.js +1 -1
  460. package/dist/tooltip/tooltip-arrow.js.map +1 -1
  461. package/dist/tooltip/tooltip.js +1 -1
  462. package/dist/tooltip/tooltip.js.map +1 -1
  463. package/dist/visually-hidden/visually-hidden.d.ts +1 -1
  464. package/dist/visually-hidden/visually-hidden.d.ts.map +1 -1
  465. package/package.json +8 -8
  466. package/src/collection/collection-item-offscreen.tsx +1 -1
  467. package/src/combobox/combobox.tsx +47 -1
  468. package/src/composite/composite-container.tsx +2 -2
  469. package/src/composite/composite-hover.tsx +8 -14
  470. package/src/composite/composite-item-offscreen.tsx +2 -2
  471. package/src/composite/composite-item.tsx +2 -2
  472. package/src/composite/composite-renderer.tsx +2 -2
  473. package/src/composite/composite-row.tsx +2 -2
  474. package/src/composite/composite-separator.tsx +2 -2
  475. package/src/composite/composite-typeahead.tsx +2 -2
  476. package/src/composite/composite.tsx +3 -3
  477. package/src/dialog/dialog.tsx +33 -10
  478. package/src/dialog/utils/disable-accessibility-tree-outside.ts +0 -25
  479. package/src/dialog/utils/use-hide-on-interact-outside.ts +3 -2
  480. package/src/focusable/focusable.tsx +53 -10
  481. package/src/form/form-remove.tsx +14 -10
  482. package/src/form/form.tsx +3 -1
  483. package/src/heading/heading.tsx +2 -5
  484. package/src/hovercard/hovercard-disclosure.tsx +18 -4
  485. package/src/hovercard/hovercard.tsx +1 -1
  486. package/src/menu/menu-bar-store.ts +2 -2
  487. package/src/menu/menu-context.tsx +8 -0
  488. package/src/menu/menu-item.tsx +18 -1
  489. package/src/menu/menu-list.tsx +15 -0
  490. package/src/menubar/menubar-context.tsx +0 -5
  491. package/src/menubar/menubar-store.ts +2 -2
  492. package/src/popover/popover-arrow.tsx +3 -3
  493. package/src/popover/popover.tsx +8 -0
  494. package/src/tab/tab-panel.tsx +1 -1
  495. package/src/tag/tag-input.tsx +0 -1
  496. package/src/tag/tag-remove.tsx +0 -1
  497. package/src/tooltip/tooltip-anchor.tsx +23 -8
  498. package/dist/collection-renderer-DsPD9ksD.d.ts.map +0 -1
  499. package/dist/popover-CCqiRKqg.d.ts.map +0 -1
  500. package/src/hovercard/utils/__tests__/polygon-test.ts +0 -66
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-popover.js","names":[],"sources":["../../src/combobox/combobox-popover.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { getDocument, invariant, isFalsyBooleanCallback } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport { useRef } from \"react\";\nimport { createDialogComponent } from \"../dialog/dialog.tsx\";\nimport type { PopoverOptions } from \"../popover/popover.tsx\";\nimport { usePopover } from \"../popover/popover.tsx\";\nimport { useComboboxProviderContext } from \"./combobox-context.tsx\";\nimport type { ComboboxListOptions } from \"./combobox-list.tsx\";\nimport { useComboboxList } from \"./combobox-list.tsx\";\n\nconst TagName = \"div\" satisfies ElementType;\ntype TagName = typeof TagName;\n\nfunction isController(\n target: EventTarget | Element | null,\n ...ids: Array<string | undefined>\n) {\n if (!target) return false;\n if (\"id\" in target) {\n const selector = ids\n .filter(Boolean)\n .map((id) => `[aria-controls~=\"${id}\"]`)\n .join(\", \");\n if (!selector) return false;\n return target.matches(selector);\n }\n return false;\n}\n\n/**\n * Returns props to create a `ComboboxPopover` component.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useComboboxPopover({ store });\n * <Role {...props}>\n * <ComboboxItem value=\"Item 1\" />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </Role>\n * ```\n */\nexport const useComboboxPopover = createHook<TagName, ComboboxPopoverOptions>(\n function useComboboxPopover({\n store,\n modal,\n tabIndex,\n alwaysVisible,\n autoFocusOnHide = true,\n hideOnInteractOutside = true,\n ...props\n }) {\n const context = useComboboxProviderContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxPopover must receive a `store` prop or be wrapped in a ComboboxProvider component.\",\n );\n\n const baseElement = useStoreState(store, \"baseElement\");\n const hiddenByClickOutsideRef = useRef(false);\n\n // When new tags are rendered while the combobox popover is open, they will\n // be considered nested popups, and therefore the popover won't hide when\n // interacting with them. We use the treeSnapshotKey to force the popover to\n // take a new snapshot of the tree when new items are rendered.\n const treeSnapshotKey = useStoreState(\n store.tag,\n (state) => state?.renderedItems.length,\n );\n\n props = useComboboxList({ store, alwaysVisible, ...props });\n\n props = usePopover({\n store,\n modal,\n alwaysVisible,\n backdrop: false,\n autoFocusOnShow: false,\n finalFocus: baseElement,\n preserveTabOrderAnchor: null,\n unstable_treeSnapshotKey: treeSnapshotKey,\n ...props,\n // When the combobox popover is modal, we make sure to include the\n // combobox input and all the combobox controls (cancel, disclosure) in\n // the list of persistent elements so they make part of the modal context,\n // allowing users to tab through them.\n getPersistentElements() {\n const elements = props.getPersistentElements?.() || [];\n if (!modal) return elements;\n if (!store) return elements;\n const { contentElement, baseElement } = store.getState();\n if (!baseElement) return elements;\n const doc = getDocument(baseElement);\n const selectors: string[] = [];\n if (contentElement?.id) {\n selectors.push(`[aria-controls~=\"${contentElement.id}\"]`);\n }\n if (baseElement?.id) {\n selectors.push(`[aria-controls~=\"${baseElement.id}\"]`);\n }\n if (!selectors.length) return [...elements, baseElement];\n const selector = selectors.join(\",\");\n const controlElements = doc.querySelectorAll<HTMLElement>(selector);\n return [...elements, ...controlElements];\n },\n // The combobox popover should focus on the combobox input when it hides,\n // unless the event was triggered by a click outside the popover, in which\n // case the input shouldn't be re-focused.\n autoFocusOnHide(element) {\n if (isFalsyBooleanCallback(autoFocusOnHide, element)) return false;\n if (hiddenByClickOutsideRef.current) {\n hiddenByClickOutsideRef.current = false;\n return false;\n }\n return true;\n },\n // Make sure we don't hide the popover when the user interacts with the\n // combobox cancel or the combobox disclosure buttons. They will have the\n // aria-controls attribute pointing to either the combobox input or the\n // combobox popover elements.\n hideOnInteractOutside(event: Event) {\n const state = store?.getState();\n const contentId = state?.contentElement?.id;\n const baseId = state?.baseElement?.id;\n if (isController(event.target, contentId, baseId)) return false;\n const result =\n typeof hideOnInteractOutside === \"function\"\n ? hideOnInteractOutside(event)\n : hideOnInteractOutside;\n if (result) {\n hiddenByClickOutsideRef.current = event.type === \"click\";\n }\n return result;\n },\n });\n\n return props;\n },\n);\n\n/**\n * Renders a combobox popover. The `role` prop is set to `listbox` by default,\n * but can be overriden by any other valid combobox popup role (`listbox`,\n * `menu`, `tree`, `grid` or `dialog`).\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {3-7}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxItem value=\"Apple\" />\n * <ComboboxItem value=\"Banana\" />\n * <ComboboxItem value=\"Orange\" />\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const ComboboxPopover = createDialogComponent(\n forwardRef(function ComboboxPopover(props: ComboboxPopoverProps) {\n const htmlProps = useComboboxPopover(props);\n return createElement(TagName, htmlProps);\n }),\n useComboboxProviderContext,\n);\n\nexport interface ComboboxPopoverOptions<T extends ElementType = TagName>\n extends ComboboxListOptions<T>, Omit<PopoverOptions<T>, \"store\"> {}\n\nexport type ComboboxPopoverProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxPopoverOptions<T>\n>;\n"],"mappings":";;;;;;;;;;AAgBA,MAAA,UAAS;SAIF,aAAe,QAAA,GAAA,KAAA;CACpB,IAAI,CAAA,QAAQ,OAAQ;KAClB,QAAM,QAAW;EAIjB,MAAK,WAAU,IAAA,OAAO,OAAA,EAAA,KAAA,OAAA,oBAAA,GAAA,GAAA,EAAA,KAAA,IAAA;EACtB,IAAA,CAAA,UAAc,OAAQ;EACxB,OAAA,OAAA,QAAA,QAAA;CACA;CACF,OAAA;;;;;;;;;;;;;;;;MA0BI,qBAAgB,WAAA,SAA2B,mBAAA,EAAA,OAAA,OAAA,UAAA,eAAA,kBAAA,MAAA,wBAAA,MAAA,GAAA,SAAA;CAC3C,MAAA,UAAQ,2BAAS;CAEjB,QAAA,SAGI;CAGJ,UAAM,OAAA,4FAAgD;CACtD,MAAM,cAAA,cAA0B,OAAO,aAAK;CAM5C,MAAM,0BAAkB,OACtB,KAAM;CAIR,MAAA,kBAAwB,cAAA,MAAA,MAAA,UAAA,OAAA,cAAA,MAAA;SAAE,gBAAA;EAAO;EAAe;EAAU,GAAA;CAE1D,CAAA;SACE,WAAA;EACA;EACA;EACA;EACA,UAAA;EACA,iBAAY;EACZ,YAAA;EACA,wBAAA;EACA,0BAAG;EAKH,GAAA;0BACyB;GACvB,MAAK,WAAO,MAAO,wBAAA,KAAA,CAAA;GACnB,IAAI,CAAC,OAAO,OAAO;GACnB,IAAA,CAAA,OAAQ,OAAA;GACR,MAAK,EAAA,gBAAa,gBAAO,MAAA,SAAA;GACzB,IAAA,CAAA,aAAY,OAAY;GACxB,MAAM,MAAA,YAAuB,WAAA;GAC7B,MAAI,YAAA,CAAA;GAGJ,IAAI,gBAAa,IACf,UAAU,KAAK,oBAAoB,eAAkB,GAAA,GAAA;GAEvD,IAAI,aAAW,IAAA,UAAgB,KAAG,oBAAqB,YAAA,GAAA,GAAA;GACvD,IAAA,CAAA,UAAM,QAAW,OAAU,CAAA,GAAK,UAAG,WAAA;GACnC,MAAM,WAAA,UAAkB,KAAI,GAAA;GAC5B,MAAA,kBAAwB,IAAA,iBAAe,QAAA;GACzC,OAAA,CAAA,GAAA,UAAA,GAAA,eAAA;EAIA;kBACM,SAAA;GACJ,IAAI,uBAAA,iBAAiC,OAAA,GAAA,OAAA;OACnC,wBAAwB,SAAU;IAClC,wBAAO,UAAA;IACT,OAAA;GACA;GACF,OAAA;EAKA;wBACuB,OAAA;GACrB,MAAM,QAAA,OAAY,SAAO;GACzB,MAAM,YAAS,OAAO,gBAAa;GACnC,MAAI,SAAA,OAAa,aAAc;GAC/B,IAAA,aACE,MAAO,QAAA,WAAA,MAA0B,GAAA,OAAA;GAGnC,MAAI,SACF,OAAA,0BAAkC,aAAe,sBAAA,KAAA,IAAA;GAEnD,IAAA,QAAO,wBAAA,UAAA,MAAA,SAAA;GACT,OAAA;EACD;CAED,CAAA;CAEJ,OAAA;;;;;;;;;;;;;;;;;;;MAsBI,kBAAqB,sBADH,WACqB,SAAA,gBAAA,OAAA;CACxC,OACD,cAAA,SACF,mBAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"combobox-popover.js","names":[],"sources":["../../src/combobox/combobox-popover.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { getDocument, invariant, isFalsyBooleanCallback } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport { useRef } from \"react\";\nimport { createDialogComponent } from \"../dialog/dialog.tsx\";\nimport type { PopoverOptions } from \"../popover/popover.tsx\";\nimport { usePopover } from \"../popover/popover.tsx\";\nimport { useComboboxProviderContext } from \"./combobox-context.tsx\";\nimport type { ComboboxListOptions } from \"./combobox-list.tsx\";\nimport { useComboboxList } from \"./combobox-list.tsx\";\n\nconst TagName = \"div\" satisfies ElementType;\ntype TagName = typeof TagName;\n\nfunction isController(\n target: EventTarget | Element | null,\n ...ids: Array<string | undefined>\n) {\n if (!target) return false;\n if (\"id\" in target) {\n const selector = ids\n .filter(Boolean)\n .map((id) => `[aria-controls~=\"${id}\"]`)\n .join(\", \");\n if (!selector) return false;\n return target.matches(selector);\n }\n return false;\n}\n\n/**\n * Returns props to create a `ComboboxPopover` component.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useComboboxPopover({ store });\n * <Role {...props}>\n * <ComboboxItem value=\"Item 1\" />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </Role>\n * ```\n */\nexport const useComboboxPopover = createHook<TagName, ComboboxPopoverOptions>(\n function useComboboxPopover({\n store,\n modal,\n tabIndex,\n alwaysVisible,\n autoFocusOnHide = true,\n hideOnInteractOutside = true,\n ...props\n }) {\n const context = useComboboxProviderContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxPopover must receive a `store` prop or be wrapped in a ComboboxProvider component.\",\n );\n\n const baseElement = useStoreState(store, \"baseElement\");\n const hiddenByClickOutsideRef = useRef(false);\n\n // When new tags are rendered while the combobox popover is open, they will\n // be considered nested popups, and therefore the popover won't hide when\n // interacting with them. We use the treeSnapshotKey to force the popover to\n // take a new snapshot of the tree when new items are rendered.\n const treeSnapshotKey = useStoreState(\n store.tag,\n (state) => state?.renderedItems.length,\n );\n\n props = useComboboxList({ store, alwaysVisible, ...props });\n\n props = usePopover({\n store,\n modal,\n alwaysVisible,\n backdrop: false,\n autoFocusOnShow: false,\n finalFocus: baseElement,\n preserveTabOrderAnchor: null,\n unstable_treeSnapshotKey: treeSnapshotKey,\n ...props,\n // When the combobox popover is modal, we make sure to include the\n // combobox input and all the combobox controls (cancel, disclosure) in\n // the list of persistent elements so they make part of the modal context,\n // allowing users to tab through them.\n getPersistentElements() {\n const elements = props.getPersistentElements?.() || [];\n if (!modal) return elements;\n if (!store) return elements;\n const { contentElement, baseElement } = store.getState();\n if (!baseElement) return elements;\n const doc = getDocument(baseElement);\n const selectors: string[] = [];\n if (contentElement?.id) {\n selectors.push(`[aria-controls~=\"${contentElement.id}\"]`);\n }\n if (baseElement?.id) {\n selectors.push(`[aria-controls~=\"${baseElement.id}\"]`);\n }\n if (!selectors.length) return [...elements, baseElement];\n const selector = selectors.join(\",\");\n const controlElements = doc.querySelectorAll<HTMLElement>(selector);\n return [...elements, ...controlElements];\n },\n // The combobox popover should focus on the combobox input when it hides,\n // unless the event was triggered by a click outside the popover, in which\n // case the input shouldn't be re-focused.\n autoFocusOnHide(element) {\n if (isFalsyBooleanCallback(autoFocusOnHide, element)) return false;\n if (hiddenByClickOutsideRef.current) {\n hiddenByClickOutsideRef.current = false;\n return false;\n }\n return true;\n },\n // Make sure we don't hide the popover when the user interacts with the\n // combobox cancel or the combobox disclosure buttons. They will have the\n // aria-controls attribute pointing to either the combobox input or the\n // combobox popover elements.\n hideOnInteractOutside(event: Event) {\n const state = store?.getState();\n const contentId = state?.contentElement?.id;\n const baseId = state?.baseElement?.id;\n if (isController(event.target, contentId, baseId)) return false;\n const result =\n typeof hideOnInteractOutside === \"function\"\n ? hideOnInteractOutside(event)\n : hideOnInteractOutside;\n if (result) {\n hiddenByClickOutsideRef.current = event.type === \"click\";\n }\n return result;\n },\n });\n\n return props;\n },\n);\n\n/**\n * Renders a combobox popover. The `role` prop is set to `listbox` by default,\n * but can be overriden by any other valid combobox popup role (`listbox`,\n * `menu`, `tree`, `grid` or `dialog`).\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {3-7}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxItem value=\"Apple\" />\n * <ComboboxItem value=\"Banana\" />\n * <ComboboxItem value=\"Orange\" />\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const ComboboxPopover = createDialogComponent(\n forwardRef(function ComboboxPopover(props: ComboboxPopoverProps) {\n const htmlProps = useComboboxPopover(props);\n return createElement(TagName, htmlProps);\n }),\n useComboboxProviderContext,\n);\n\nexport interface ComboboxPopoverOptions<T extends ElementType = TagName>\n extends ComboboxListOptions<T>, Omit<PopoverOptions<T>, \"store\"> {}\n\nexport type ComboboxPopoverProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxPopoverOptions<T>\n>;\n"],"mappings":";;;;;;;;;;AAgBA,MAAA,UAAS;SAIF,aAAe,QAAA,GAAA,KAAA;CACpB,IAAI,CAAA,QAAQ,OAAQ;KAClB,QAAM,QAAW;EAIjB,MAAK,WAAU,IAAA,OAAO,OAAA,EAAA,KAAA,OAAA,oBAAA,GAAA,GAAA,EAAA,KAAA,IAAA;EACtB,IAAA,CAAA,UAAc,OAAQ;EACxB,OAAA,OAAA,QAAA,QAAA;CACA;CACF,OAAA;;;;;;;;;;;;;;;;MA0BI,qBAAgB,WAAA,SAA2B,mBAAA,EAAA,OAAA,OAAA,UAAA,eAAA,kBAAA,MAAA,wBAAA,MAAA,GAAA,SAAA;CAC3C,MAAA,UAAQ,2BAAS;CAEjB,QAAA,SAEE;CAIF,UAAM,OAAA,QAAc,IAAA,aAAqB,gBAAa,4FAAA;CACtD,MAAM,cAAA,cAA0B,OAAO,aAAK;CAM5C,MAAM,0BAAkB,OACtB,KAAM;CAIR,MAAA,kBAAwB,cAAA,MAAA,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AA;CACxC,OACD,cAAA,SACF,mBAAA,KAAA,CAAA"}
@@ -48,7 +48,7 @@ declare const useComboboxRow: import("@ariakit/react-utils").Hook<"div", Combobo
48
48
  * </ComboboxProvider>
49
49
  * ```
50
50
  */
51
- declare const ComboboxRow: (props: ComboboxRowProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
51
+ declare const ComboboxRow: (props: ComboboxRowProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
52
52
  interface ComboboxRowOptions<T extends ElementType = TagName> extends CompositeRowOptions<T> {
53
53
  /**
54
54
  * Object returned by the
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-row.d.ts","names":["Props","ElementType","CompositeRowOptions","ComboboxStore","TagName","useComboboxRow","ComboboxRowOptions","Hook","ComboboxRow","ComboboxRowProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/combobox/combobox-row.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF4B;;;;AACpC;AAAA;;;;AACQ;AAiB7B;;;;AAAkG;AA0BlG;AA7CyD,cAmBpCC,cAAAA,iCAA+CE,IAAAA,QAAYD,kBAAkB;;;;;;;;AA0B6C;AAC/I;;;;;;;;;;;;;;;;;cADqBE,WAAAA,GAAcE,KAAAA,EAAOD,gBAAgB,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACzGN,kBAAAA,WAA6BL,WAAAA,GAAcG,OAAAA,UAAiBF,mBAAAA,CAAoBW,CAAAA;EAWrFJ;;;;;;;;EAFRK,KAAAA,GAAQX,aAAAA;AAAAA;AAAAA,KAEAM,gBAAAA,WAA2BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,kBAAAA,CAAmBO,CAAAA"}
1
+ {"version":3,"file":"combobox-row.d.ts","names":["Props","ElementType","CompositeRowOptions","ComboboxStore","TagName","useComboboxRow","ComboboxRowOptions","Hook","ComboboxRow","ComboboxRowProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/combobox/combobox-row.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF4B;;;;AACpC;AAAA;;;;AACQ;AAiB7B;;;;AAAkG;AA0BlG;AA7CyD,cAmBpCC,cAAAA,iCAA+CE,IAAAA,QAAYD,kBAAkB;;;;;;;;AA0BiD;AACnJ;;;;;;;;;;;;;;;;;cADqBE,WAAAA,GAAcE,KAAAA,EAAOD,gBAAgB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC7GN,kBAAAA,WAA6BL,WAAAA,GAAcG,OAAAA,UAAiBF,mBAAAA,CAAoBW,CAAAA;EAWrFJ;;;;;;;;EAFRK,KAAAA,GAAQX,aAAAA;AAAAA;AAAAA,KAEAM,gBAAAA,WAA2BR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,kBAAAA,CAAmBO,CAAAA"}
@@ -25,7 +25,7 @@ const TagName = "div";
25
25
  const useComboboxRow = createHook(function useComboboxRow({ store, ...props }) {
26
26
  const context = useComboboxScopedContext();
27
27
  store = store || context;
28
- invariant(store, "ComboboxRow must be wrapped in a ComboboxList or ComboboxPopover component");
28
+ invariant(store, process.env.NODE_ENV !== "production" && "ComboboxRow must be wrapped in a ComboboxList or ComboboxPopover component");
29
29
  props = {
30
30
  role: getPopupRole(useStoreState(store, "contentElement")) === "grid" ? "row" : "presentation",
31
31
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-row.js","names":[],"sources":["../../src/combobox/combobox-row.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { getPopupRole, invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { CompositeRowOptions } from \"../composite/composite-row.tsx\";\nimport { useCompositeRow } from \"../composite/composite-row.tsx\";\nimport { useComboboxScopedContext } from \"./combobox-context.tsx\";\nimport type { ComboboxStore } from \"./combobox-store.ts\";\n\nconst TagName = \"div\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `ComboboxRow` component.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useComboboxRow({ store });\n * <ComboboxPopover store={store}>\n * <Role {...props}>\n * <ComboboxItem value=\"Item 1\" />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </Role>\n * </ComboboxPopover>\n * ```\n */\nexport const useComboboxRow = createHook<TagName, ComboboxRowOptions>(\n function useComboboxRow({ store, ...props }) {\n const context = useComboboxScopedContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxRow must be wrapped in a ComboboxList or ComboboxPopover component\",\n );\n\n const contentElement = useStoreState(store, \"contentElement\");\n const popupRole = getPopupRole(contentElement);\n const role = popupRole === \"grid\" ? \"row\" : \"presentation\";\n\n props = { role, ...props };\n\n props = useCompositeRow({ store, ...props });\n\n return props;\n },\n);\n\n/**\n * Renders a combobox row that allows two-dimensional arrow key navigation.\n * [`ComboboxItem`](https://ariakit.com/reference/combobox-item) elements\n * wrapped within this component will automatically receive a\n * [`rowId`](https://ariakit.com/reference/combobox-item#rowid) prop.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {4-13}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxRow>\n * <ComboboxItem value=\"Item 1.1\" />\n * <ComboboxItem value=\"Item 1.2\" />\n * <ComboboxItem value=\"Item 1.3\" />\n * </ComboboxRow>\n * <ComboboxRow>\n * <ComboboxItem value=\"Item 2.1\" />\n * <ComboboxItem value=\"Item 2.2\" />\n * <ComboboxItem value=\"Item 2.3\" />\n * </ComboboxRow>\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const ComboboxRow = forwardRef(function ComboboxRow(\n props: ComboboxRowProps,\n) {\n const htmlProps = useComboboxRow(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface ComboboxRowOptions<\n T extends ElementType = TagName,\n> extends CompositeRowOptions<T> {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxList`](https://ariakit.com/reference/combobox-list) or\n * [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components' context will be used.\n */\n store?: ComboboxStore;\n}\n\nexport type ComboboxRowProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxRowOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MA+BI,iBAAgB,WAAA,SAAyB,eAAA,EAAA,OAAA,GAAA,SAAA;CACzC,MAAA,UAAQ,yBAAS;CAEjB,QAAA,SAGI;CAOJ,UAAQ,OAAA,4EAAA;SAHU;EAGF,MAAG,aAAA,cAAA,OAAA,gBAAA,CAAA,MAAA,SAAA,QAAA;EAAM,GAAA;CAEzB;SAA0B,gBAAA;EAAO;EAAU,GAAA;CAE3C,CAAA;CAEJ,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE,cAAO,WADW,SAAA,YACqB,OAAA;CACxC,OAAA,cAAA,SAAA,eAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"combobox-row.js","names":[],"sources":["../../src/combobox/combobox-row.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { getPopupRole, invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { CompositeRowOptions } from \"../composite/composite-row.tsx\";\nimport { useCompositeRow } from \"../composite/composite-row.tsx\";\nimport { useComboboxScopedContext } from \"./combobox-context.tsx\";\nimport type { ComboboxStore } from \"./combobox-store.ts\";\n\nconst TagName = \"div\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `ComboboxRow` component.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useComboboxRow({ store });\n * <ComboboxPopover store={store}>\n * <Role {...props}>\n * <ComboboxItem value=\"Item 1\" />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </Role>\n * </ComboboxPopover>\n * ```\n */\nexport const useComboboxRow = createHook<TagName, ComboboxRowOptions>(\n function useComboboxRow({ store, ...props }) {\n const context = useComboboxScopedContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxRow must be wrapped in a ComboboxList or ComboboxPopover component\",\n );\n\n const contentElement = useStoreState(store, \"contentElement\");\n const popupRole = getPopupRole(contentElement);\n const role = popupRole === \"grid\" ? \"row\" : \"presentation\";\n\n props = { role, ...props };\n\n props = useCompositeRow({ store, ...props });\n\n return props;\n },\n);\n\n/**\n * Renders a combobox row that allows two-dimensional arrow key navigation.\n * [`ComboboxItem`](https://ariakit.com/reference/combobox-item) elements\n * wrapped within this component will automatically receive a\n * [`rowId`](https://ariakit.com/reference/combobox-item#rowid) prop.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {4-13}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxRow>\n * <ComboboxItem value=\"Item 1.1\" />\n * <ComboboxItem value=\"Item 1.2\" />\n * <ComboboxItem value=\"Item 1.3\" />\n * </ComboboxRow>\n * <ComboboxRow>\n * <ComboboxItem value=\"Item 2.1\" />\n * <ComboboxItem value=\"Item 2.2\" />\n * <ComboboxItem value=\"Item 2.3\" />\n * </ComboboxRow>\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const ComboboxRow = forwardRef(function ComboboxRow(\n props: ComboboxRowProps,\n) {\n const htmlProps = useComboboxRow(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface ComboboxRowOptions<\n T extends ElementType = TagName,\n> extends CompositeRowOptions<T> {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxList`](https://ariakit.com/reference/combobox-list) or\n * [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components' context will be used.\n */\n store?: ComboboxStore;\n}\n\nexport type ComboboxRowProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxRowOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MA+BI,iBAAgB,WAAA,SAAyB,eAAA,EAAA,OAAA,GAAA,SAAA;CACzC,MAAA,UAAQ,yBAAS;CAEjB,QAAA,SAEE;CAQF,UAAQ,OAAA,QAAA,IAAA,aAAA,gBAAA,4EAAA;SAHU;EAGF,MAAG,aAAA,cAAA,OAAA,gBAAA,CAAA,MAAA,SAAA,QAAA;EAAM,GAAA;CAEzB;SAA0B,gBAAA;EAAO;EAAU,GAAA;CAE3C,CAAA;CAEJ,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE,cAAO,WADW,SAAA,YACqB,OAAA;CACxC,OAAA,cAAA,SAAA,eAAA,KAAA,CAAA"}
@@ -43,7 +43,7 @@ declare const useComboboxSeparator: import("@ariakit/react-utils").Hook<"hr", Co
43
43
  * </ComboboxProvider>
44
44
  * ```
45
45
  */
46
- declare const ComboboxSeparator: (props: ComboboxSeparatorProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
46
+ declare const ComboboxSeparator: (props: ComboboxSeparatorProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
47
47
  interface ComboboxSeparatorOptions<T extends ElementType = TagName> extends CompositeSeparatorOptions<T> {
48
48
  /**
49
49
  * Object returned by the
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-separator.d.ts","names":["Props","ElementType","CompositeSeparatorOptions","ComboboxStore","TagName","useComboboxSeparator","ComboboxSeparatorOptions","Hook","ComboboxSeparator","ComboboxSeparatorProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/combobox/combobox-separator.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF4B;;;;AACpC;AAAA;;;;AACQ;AAiB7B;;;;AAA6G;AAqB7G;AAxCyD,cAmBpCC,oBAAAA,iCAAqDE,IAAAA,OAAWD,wBAAwB;;;;;;;;AAqB8C;AAC3J;;;;;;;;;;;;cADqBE,iBAAAA,GAAoBE,KAAAA,EAAOD,sBAAsB,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACrHN,wBAAAA,WAAmCL,WAAAA,GAAcG,OAAAA,UAAiBF,yBAAAA,CAA0BW,CAAAA;EAAAA;;;;AASpF;AAEzB;;;EAFIC,KAAAA,GAAQX,aAAAA;AAAAA;AAAAA,KAEAM,sBAAAA,WAAiCR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,wBAAAA,CAAyBO,CAAAA"}
1
+ {"version":3,"file":"combobox-separator.d.ts","names":["Props","ElementType","CompositeSeparatorOptions","ComboboxStore","TagName","useComboboxSeparator","ComboboxSeparatorOptions","Hook","ComboboxSeparator","ComboboxSeparatorProps","props","ReactElement","JSXElementConstructor","T","store"],"sources":["../../src/combobox/combobox-separator.d.ts"],"mappings":";;;;;;cAIcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF4B;;;;AACpC;AAAA;;;;AACQ;AAiB7B;;;;AAA6G;AAqB7G;AAxCyD,cAmBpCC,oBAAAA,iCAAqDE,IAAAA,OAAWD,wBAAwB;;;;;;;;AAqBkD;AAC/J;;;;;;;;;;;;cADqBE,iBAAAA,GAAoBE,KAAAA,EAAOD,sBAAsB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACzHN,wBAAAA,WAAmCL,WAAAA,GAAcG,OAAAA,UAAiBF,yBAAAA,CAA0BW,CAAAA;EAAAA;;;;AASpF;AAEzB;;;EAFIC,KAAAA,GAAQX,aAAAA;AAAAA;AAAAA,KAEAM,sBAAAA,WAAiCR,WAAAA,GAAcG,OAAAA,IAAWJ,KAAAA,CAAMa,CAAAA,EAAGP,wBAAAA,CAAyBO,CAAAA"}
@@ -24,7 +24,7 @@ const TagName = "hr";
24
24
  const useComboboxSeparator = createHook(function useComboboxSeparator({ store, ...props }) {
25
25
  const context = useComboboxScopedContext();
26
26
  store = store || context;
27
- invariant(store, "ComboboxSeparator must be wrapped in a ComboboxList or ComboboxPopover component.");
27
+ invariant(store, process.env.NODE_ENV !== "production" && "ComboboxSeparator must be wrapped in a ComboboxList or ComboboxPopover component.");
28
28
  props = useCompositeSeparator({
29
29
  store,
30
30
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-separator.js","names":[],"sources":["../../src/combobox/combobox-separator.tsx"],"sourcesContent":["import { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { CompositeSeparatorOptions } from \"../composite/composite-separator.tsx\";\nimport { useCompositeSeparator } from \"../composite/composite-separator.tsx\";\nimport { useComboboxScopedContext } from \"./combobox-context.tsx\";\nimport type { ComboboxStore } from \"./combobox-store.ts\";\n\nconst TagName = \"hr\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props a `ComboboxSeparator` component for combobox items.\n * @deprecated Use `useComboboxGroup` with CSS borders instead.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useComboboxSeparator({ store });\n * <ComboboxPopover store={store}>\n * <ComboboxItem value=\"Item 1\" />\n * <Role {...props} />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </ComboboxPopover>\n * ```\n */\nexport const useComboboxSeparator = createHook<\n TagName,\n ComboboxSeparatorOptions\n>(function useComboboxSeparator({ store, ...props }) {\n const context = useComboboxScopedContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxSeparator must be wrapped in a ComboboxList or ComboboxPopover component.\",\n );\n\n props = useCompositeSeparator({ store, ...props });\n return props;\n});\n\n/**\n * Renders a divider between\n * [`ComboboxItem`](https://ariakit.com/reference/combobox-item) elements.\n * @deprecated Use\n * [`ComboboxGroup`](https://ariakit.com/reference/combobox-group) with CSS\n * borders instead.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {5}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxItem value=\"Item 1\" />\n * <ComboboxSeparator />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const ComboboxSeparator = forwardRef(function ComboboxSeparator(\n props: ComboboxSeparatorProps,\n) {\n const htmlProps = useComboboxSeparator(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface ComboboxSeparatorOptions<\n T extends ElementType = TagName,\n> extends CompositeSeparatorOptions<T> {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxList`](https://ariakit.com/reference/combobox-list) or\n * [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components' context will be used.\n */\n store?: ComboboxStore;\n}\n\nexport type ComboboxSeparatorProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxSeparatorOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAgCE,uBAAgB,WAAA,SAAyB,qBAAA,EAAA,OAAA,GAAA,SAAA;CACzC,MAAA,UAAQ,yBAAS;CAEjB,QAAA,SAGI;CAGJ,UAAQ,OAAA,mFAAsB;SAAE,sBAAA;EAAO;EAAU,GAAA;CACjD,CAAA;CACD,OAAA;;;;;;;;;;;;;;;;;;;;;;MA0BC,oBAAqB,WADH,SAAA,kBACqB,OAAA;CACxC,OAAA,cAAA,SAAA,qBAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"combobox-separator.js","names":[],"sources":["../../src/combobox/combobox-separator.tsx"],"sourcesContent":["import { createElement, createHook, forwardRef } from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ElementType } from \"react\";\nimport type { CompositeSeparatorOptions } from \"../composite/composite-separator.tsx\";\nimport { useCompositeSeparator } from \"../composite/composite-separator.tsx\";\nimport { useComboboxScopedContext } from \"./combobox-context.tsx\";\nimport type { ComboboxStore } from \"./combobox-store.ts\";\n\nconst TagName = \"hr\" satisfies ElementType;\ntype TagName = typeof TagName;\n\n/**\n * Returns props a `ComboboxSeparator` component for combobox items.\n * @deprecated Use `useComboboxGroup` with CSS borders instead.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useComboboxSeparator({ store });\n * <ComboboxPopover store={store}>\n * <ComboboxItem value=\"Item 1\" />\n * <Role {...props} />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </ComboboxPopover>\n * ```\n */\nexport const useComboboxSeparator = createHook<\n TagName,\n ComboboxSeparatorOptions\n>(function useComboboxSeparator({ store, ...props }) {\n const context = useComboboxScopedContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxSeparator must be wrapped in a ComboboxList or ComboboxPopover component.\",\n );\n\n props = useCompositeSeparator({ store, ...props });\n return props;\n});\n\n/**\n * Renders a divider between\n * [`ComboboxItem`](https://ariakit.com/reference/combobox-item) elements.\n * @deprecated Use\n * [`ComboboxGroup`](https://ariakit.com/reference/combobox-group) with CSS\n * borders instead.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {5}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxItem value=\"Item 1\" />\n * <ComboboxSeparator />\n * <ComboboxItem value=\"Item 2\" />\n * <ComboboxItem value=\"Item 3\" />\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const ComboboxSeparator = forwardRef(function ComboboxSeparator(\n props: ComboboxSeparatorProps,\n) {\n const htmlProps = useComboboxSeparator(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface ComboboxSeparatorOptions<\n T extends ElementType = TagName,\n> extends CompositeSeparatorOptions<T> {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxList`](https://ariakit.com/reference/combobox-list) or\n * [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components' context will be used.\n */\n store?: ComboboxStore;\n}\n\nexport type ComboboxSeparatorProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxSeparatorOptions<T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAgCE,uBAAgB,WAAA,SAAyB,qBAAA,EAAA,OAAA,GAAA,SAAA;CACzC,MAAA,UAAQ,yBAAS;CAEjB,QAAA,SAEE;CAIF,UAAQ,OAAA,QAAA,IAAA,aAAsB,gBAAA,mFAAA;SAAE,sBAAA;EAAO;EAAU,GAAA;CACjD,CAAA;CACD,OAAA;;;;;;;;;;;;;;;;;;;;;;MA0BC,oBAAqB,WADH,SAAA,kBACqB,OAAA;CACxC,OAAA,cAAA,SAAA,qBAAA,KAAA,CAAA"}
@@ -29,7 +29,7 @@ import { useStoreState } from "@ariakit/react-store";
29
29
  function ComboboxValue({ store, children } = {}) {
30
30
  const context = useComboboxContext();
31
31
  store = store || context;
32
- invariant(store, "ComboboxValue must receive a `store` prop or be wrapped in a ComboboxProvider component.");
32
+ invariant(store, process.env.NODE_ENV !== "production" && "ComboboxValue must receive a `store` prop or be wrapped in a ComboboxProvider component.");
33
33
  const value = useStoreState(store, "value");
34
34
  if (children) return children(value);
35
35
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-value.js","names":[],"sources":["../../src/combobox/combobox-value.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ReactNode } from \"react\";\nimport { useComboboxContext } from \"./combobox-context.tsx\";\nimport type { ComboboxStore, ComboboxStoreState } from \"./combobox-store.ts\";\n\n/**\n * Renders the current\n * [`value`](https://ariakit.com/reference/use-combobox-store#value) state in\n * the [combobox store](https://ariakit.com/reference/use-combobox-store).\n *\n * As a value component, it doesn't render any DOM elements and therefore\n * doesn't accept HTML props.\n *\n * It takes a\n * [`children`](https://ariakit.com/reference/combobox-value#children) function\n * that gets called with the current value as an argument. This can be used as\n * an uncontrolled API to render the combobox value in a custom way.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {3-5}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxValue>\n * {(value) => `Current value: ${value}`}\n * </ComboboxValue>\n * </ComboboxProvider>\n * ```\n */\nexport function ComboboxValue({ store, children }: ComboboxValueProps = {}) {\n const context = useComboboxContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxValue must receive a `store` prop or be wrapped in a ComboboxProvider component.\",\n );\n\n const value = useStoreState(store, \"value\");\n\n if (children) {\n return children(value);\n }\n\n return value;\n}\n\nexport interface ComboboxValueProps {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxProvider`](https://ariakit.com/reference/combobox-provider)\n * component's context will be used.\n */\n store?: ComboboxStore;\n /**\n * A function that gets called with the current value as an argument. It can\n * be used to render the combobox value in a custom way.\n */\n children?: (value: ComboboxStoreState[\"value\"]) => ReactNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;SA8BQ,cAAU,EAAA,OAAA,aAAmB,CAAA,GAAA;CACnC,MAAA,UAAQ,mBAAS;CAEjB,QAAA,SAGI;CAGJ,UAAM,OAAQ,0FAA4B;CAE1C,MAAI,QACF,cAAO,OAAc,OAAA;CAGvB,IAAA,UAAO,OAAA,SAAA,KAAA;CACT,OAAA"}
1
+ {"version":3,"file":"combobox-value.js","names":[],"sources":["../../src/combobox/combobox-value.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport { invariant } from \"@ariakit/utils\";\nimport type { ReactNode } from \"react\";\nimport { useComboboxContext } from \"./combobox-context.tsx\";\nimport type { ComboboxStore, ComboboxStoreState } from \"./combobox-store.ts\";\n\n/**\n * Renders the current\n * [`value`](https://ariakit.com/reference/use-combobox-store#value) state in\n * the [combobox store](https://ariakit.com/reference/use-combobox-store).\n *\n * As a value component, it doesn't render any DOM elements and therefore\n * doesn't accept HTML props.\n *\n * It takes a\n * [`children`](https://ariakit.com/reference/combobox-value#children) function\n * that gets called with the current value as an argument. This can be used as\n * an uncontrolled API to render the combobox value in a custom way.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {3-5}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxValue>\n * {(value) => `Current value: ${value}`}\n * </ComboboxValue>\n * </ComboboxProvider>\n * ```\n */\nexport function ComboboxValue({ store, children }: ComboboxValueProps = {}) {\n const context = useComboboxContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"ComboboxValue must receive a `store` prop or be wrapped in a ComboboxProvider component.\",\n );\n\n const value = useStoreState(store, \"value\");\n\n if (children) {\n return children(value);\n }\n\n return value;\n}\n\nexport interface ComboboxValueProps {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxProvider`](https://ariakit.com/reference/combobox-provider)\n * component's context will be used.\n */\n store?: ComboboxStore;\n /**\n * A function that gets called with the current value as an argument. It can\n * be used to render the combobox value in a custom way.\n */\n children?: (value: ComboboxStoreState[\"value\"]) => ReactNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;SA8BQ,cAAU,EAAA,OAAA,aAAmB,CAAA,GAAA;CACnC,MAAA,UAAQ,mBAAS;CAEjB,QAAA,SAEE;CAIF,UAAM,OAAQ,QAAA,IAAc,aAAc,gBAAA,0FAAA;CAE1C,MAAI,QACF,cAAO,OAAc,OAAA;CAGvB,IAAA,UAAO,OAAA,SAAA,KAAA;CACT,OAAA"}
@@ -1,6 +1,6 @@
1
1
  import { s as ComboboxStoreState, t as ComboboxStore } from "../combobox-store-DEVQ45mZ.js";
2
- import { n as CompositeOptions } from "../composite-DLvyFHMq.js";
3
- import { n as PopoverAnchorOptions } from "../popover-anchor-PgfeXyzs.js";
2
+ import { n as CompositeOptions } from "../composite-KBhCGLEy.js";
3
+ import { n as PopoverAnchorOptions } from "../popover-anchor-W18KUmuM.js";
4
4
  import { Props } from "@ariakit/react-utils";
5
5
  import { AriaAttributes, ChangeEvent, ElementType, KeyboardEvent, MouseEvent } from "react";
6
6
  import { BooleanOrCallback, StringWithValue } from "@ariakit/utils";
@@ -39,7 +39,7 @@ declare const useCombobox: import("@ariakit/react-utils").Hook<"input", Combobox
39
39
  * </ComboboxProvider>
40
40
  * ```
41
41
  */
42
- declare const Combobox: (props: ComboboxProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
42
+ declare const Combobox: (props: ComboboxProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
43
43
  interface ComboboxOptions<T extends ElementType = TagName> extends CompositeOptions<T>, PopoverAnchorOptions<T> {
44
44
  /**
45
45
  * Object returned by the
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.d.ts","names":["Props","BooleanOrCallback","StringWithValue","AriaAttributes","ChangeEvent","ElementType","MouseEvent","KeyboardEvent","ReactKeyboardEvent","CompositeOptions","PopoverAnchorOptions","ComboboxStore","ComboboxStoreState","TagName","useCombobox","ComboboxOptions","Hook","Combobox","ComboboxProps","props","ReactElement","JSXElementConstructor","T","Required","HTMLElement","store","autoSelect","getAutoSelectId","renderedItems","autoComplete","blurActiveItemOnClick","showMinLength","showOnChange","showOnMouseDown","showOnClick","showOnKeyDown","showOnKeyPress","setValueOnChange","setValueOnClick"],"sources":["../../src/combobox/combobox.d.ts"],"mappings":";;;;;;;;cAMca,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFgD;;;;AACxD;AAAA;;;;AACQ;AAgB7B;;;;AAA8F;AAlBjB,cAkBxDC,WAAAA,iCAA4CE,IAAAA,UAAcD,eAAe;;;;;;;;;AAgB2C;AACzI;;;;;;cADqBE,QAAAA,GAAWE,KAAAA,EAAOD,aAAa,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACnGN,eAAAA,WAA0BV,WAAAA,GAAcQ,OAAAA,UAAiBJ,gBAAAA,CAAiBa,CAAAA,GAAIZ,oBAAAA,CAAqBY,CAAAA;EAoE9EV;;;;;;;EA5DlCa,KAAAA,GAAQd,aAAAA;EAqIyBP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAnGjCsB,UAAAA;EA0BAC;;;;;;;;;;;;;;;;;;;;;;;;;EAAAA,eAAAA,IAAmBC,aAAAA,EAAehB,kBAAAA;EA6GAJ;;;;;;;;;;;;;;;AA2CwB;AAE9D;;;;;;;;;;;;;EA5HIqB,YAAAA,GAAe3B,eAAAA,CAAgBqB,QAAAA,CAASpB,cAAAA;EA4HiBH;;;;;AAA0B;;EApHnF8B,qBAAAA,GAAwB7B,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;;;;;;;;;;;;;;;;;;;;EAoBrDO,aAAAA;;;;;;;;;;;;;;;EAeAC,YAAAA,GAAe/B,iBAAAA,CAAkBG,WAAAA,CAAYoB,WAAAA;;;;;;;;;;EAU7CS,eAAAA,GAAkBhC,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;;;;;;;;;;;;;;;EAe/CU,WAAAA,GAAcjC,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;;;;;;;;;;;EAW3CW,aAAAA,GAAgBlC,iBAAAA,CAAkBO,aAAAA,CAAmBgB,WAAAA;;;;;;;;;;;;;;;;EAgBrDY,cAAAA,GAAiBnC,iBAAAA,CAAkBO,aAAAA,CAAmBgB,WAAAA;;;;;;;;;;;;;;EActDa,gBAAAA,GAAmBpC,iBAAAA,CAAkBG,WAAAA,CAAYoB,WAAAA;;;;;;;;;;;;;EAajDc,eAAAA,GAAkBrC,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;AAAAA;AAAAA,KAEvCN,aAAAA,WAAwBb,WAAAA,GAAcQ,OAAAA,IAAWb,KAAAA,CAAMsB,CAAAA,EAAGP,eAAAA,CAAgBO,CAAAA"}
1
+ {"version":3,"file":"combobox.d.ts","names":["Props","BooleanOrCallback","StringWithValue","AriaAttributes","ChangeEvent","ElementType","MouseEvent","KeyboardEvent","ReactKeyboardEvent","CompositeOptions","PopoverAnchorOptions","ComboboxStore","ComboboxStoreState","TagName","useCombobox","ComboboxOptions","Hook","Combobox","ComboboxProps","props","ReactElement","JSXElementConstructor","T","Required","HTMLElement","store","autoSelect","getAutoSelectId","renderedItems","autoComplete","blurActiveItemOnClick","showMinLength","showOnChange","showOnMouseDown","showOnClick","showOnKeyDown","showOnKeyPress","setValueOnChange","setValueOnClick"],"sources":["../../src/combobox/combobox.d.ts"],"mappings":";;;;;;;;cAMca,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFgD;;;;AACxD;AAAA;;;;AACQ;AAgB7B;;;;AAA8F;AAlBjB,cAkBxDC,WAAAA,iCAA4CE,IAAAA,UAAcD,eAAe;;;;;;;;;AAgB+C;AAC7I;;;;;;cADqBE,QAAAA,GAAWE,KAAAA,EAAOD,aAAa,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACvGN,eAAAA,WAA0BV,WAAAA,GAAcQ,OAAAA,UAAiBJ,gBAAAA,CAAiBa,CAAAA,GAAIZ,oBAAAA,CAAqBY,CAAAA;EAoE9EV;;;;;;;EA5DlCa,KAAAA,GAAQd,aAAAA;EAqIyBP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAnGjCsB,UAAAA;EA0BAC;;;;;;;;;;;;;;;;;;;;;;;;;EAAAA,eAAAA,IAAmBC,aAAAA,EAAehB,kBAAAA;EA6GAJ;;;;;;;;;;;;;;;AA2CwB;AAE9D;;;;;;;;;;;;;EA5HIqB,YAAAA,GAAe3B,eAAAA,CAAgBqB,QAAAA,CAASpB,cAAAA;EA4HiBH;;;;;AAA0B;;EApHnF8B,qBAAAA,GAAwB7B,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;;;;;;;;;;;;;;;;;;;;EAoBrDO,aAAAA;;;;;;;;;;;;;;;EAeAC,YAAAA,GAAe/B,iBAAAA,CAAkBG,WAAAA,CAAYoB,WAAAA;;;;;;;;;;EAU7CS,eAAAA,GAAkBhC,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;;;;;;;;;;;;;;;EAe/CU,WAAAA,GAAcjC,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;;;;;;;;;;;EAW3CW,aAAAA,GAAgBlC,iBAAAA,CAAkBO,aAAAA,CAAmBgB,WAAAA;;;;;;;;;;;;;;;;EAgBrDY,cAAAA,GAAiBnC,iBAAAA,CAAkBO,aAAAA,CAAmBgB,WAAAA;;;;;;;;;;;;;;EActDa,gBAAAA,GAAmBpC,iBAAAA,CAAkBG,WAAAA,CAAYoB,WAAAA;;;;;;;;;;;;;EAajDc,eAAAA,GAAkBrC,iBAAAA,CAAkBK,UAAAA,CAAWkB,WAAAA;AAAAA;AAAAA,KAEvCN,aAAAA,WAAwBb,WAAAA,GAAcQ,OAAAA,IAAWb,KAAAA,CAAMsB,CAAAA,EAAGP,eAAAA,CAAgBO,CAAAA"}
@@ -49,7 +49,7 @@ function getDefaultAutoSelectId(items) {
49
49
  const useCombobox = createHook(function useCombobox({ store, focusable = true, autoSelect: autoSelectProp = false, getAutoSelectId, setValueOnChange, showMinLength = 0, showOnChange, showOnMouseDown, showOnClick = showOnMouseDown, showOnKeyDown, showOnKeyPress = showOnKeyDown, blurActiveItemOnClick, setValueOnClick = true, moveOnKeyPress = true, autoComplete = "list", ...props }) {
50
50
  const context = useComboboxProviderContext();
51
51
  store = store || context;
52
- invariant(store, "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component.");
52
+ invariant(store, process.env.NODE_ENV !== "production" && "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component.");
53
53
  const ref = useRef(null);
54
54
  const [valueUpdated, forceValueUpdate] = useForceUpdate();
55
55
  const canAutoSelectRef = useRef(false);
@@ -140,6 +140,7 @@ const useCombobox = createHook(function useCombobox({ store, focusable = true, a
140
140
  const scrollingElementRef = useRef(null);
141
141
  const getAutoSelectIdProp = useEvent(getAutoSelectId);
142
142
  const autoSelectIdRef = useRef(null);
143
+ const autoSelectMovedRef = useRef(void 0);
143
144
  const userScrolledRef = useRef(false);
144
145
  const isAutoScrollingRef = useRef(false);
145
146
  useEffect(() => {
@@ -188,6 +189,10 @@ const useCombobox = createHook(function useCombobox({ store, focusable = true, a
188
189
  if (autoSelect !== "always" && open) return;
189
190
  canAutoSelectRef.current = open;
190
191
  }, [autoSelect, open]);
192
+ useSafeLayoutEffect(() => {
193
+ if (open) return;
194
+ autoSelectMovedRef.current = void 0;
195
+ }, [open]);
191
196
  const resetValueOnSelect = useStoreState(store, "resetValueOnSelect");
192
197
  useUpdateEffect(() => {
193
198
  const canAutoSelect = canAutoSelectRef.current;
@@ -205,7 +210,16 @@ const useCombobox = createHook(function useCombobox({ store, focusable = true, a
205
210
  const userAutoSelectId = getAutoSelectIdProp(items);
206
211
  const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : getDefaultAutoSelectId(items) ?? store.first();
207
212
  autoSelectIdRef.current = autoSelectId;
208
- store.move(autoSelectId ?? null);
213
+ const nextActiveId = autoSelectId ?? null;
214
+ const nextActiveValue = store.item(nextActiveId)?.value;
215
+ const moved = autoSelectMovedRef.current;
216
+ if (nextActiveId !== activeId || moved?.id !== nextActiveId || moved?.value !== nextActiveValue) {
217
+ autoSelectMovedRef.current = {
218
+ id: nextActiveId,
219
+ value: nextActiveValue
220
+ };
221
+ store.move(nextActiveId);
222
+ } else store.setState("activeValue", nextActiveValue);
209
223
  } else {
210
224
  const element = store.item(activeId || store.first())?.element;
211
225
  if (element && "scrollIntoView" in element) {
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.js","names":[],"sources":["../../src/combobox/combobox.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport {\n useBooleanEvent,\n useEvent,\n useForceUpdate,\n useId,\n useMergeRefs,\n useSafeLayoutEffect,\n useUpdateEffect,\n useUpdateLayoutEffect,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { sync } from \"@ariakit/store\";\nimport {\n getPopupRole,\n getScrollingElement,\n getTextboxSelection,\n setSelectionRange,\n isFocusEventOutside,\n queueBeforeEvent,\n hasFocus,\n invariant,\n isFalsyBooleanCallback,\n noop,\n normalizeString,\n} from \"@ariakit/utils\";\nimport type { BooleanOrCallback, StringWithValue } from \"@ariakit/utils\";\nimport type {\n AriaAttributes,\n ChangeEvent,\n CompositionEvent,\n ElementType,\n MouseEvent,\n FocusEvent as ReactFocusEvent,\n KeyboardEvent as ReactKeyboardEvent,\n SyntheticEvent,\n} from \"react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { CompositeOptions } from \"../composite/composite.tsx\";\nimport { useComposite } from \"../composite/composite.tsx\";\nimport type { PopoverAnchorOptions } from \"../popover/popover-anchor.tsx\";\nimport { usePopoverAnchor } from \"../popover/popover-anchor.tsx\";\nimport { useComboboxProviderContext } from \"./combobox-context.tsx\";\nimport type {\n ComboboxStore,\n ComboboxStoreSelectedValue,\n ComboboxStoreState,\n} from \"./combobox-store.ts\";\n\nconst TagName = \"input\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nfunction isFirstItemAutoSelected(\n items: ComboboxStoreState[\"items\"],\n activeValue: ComboboxStoreState[\"activeValue\"],\n autoSelect: ComboboxProps[\"autoSelect\"],\n) {\n if (!autoSelect) return false;\n const firstItem = items.find((item) => !item.disabled && item.value);\n return firstItem?.value === activeValue;\n}\n\nfunction hasCompletionString(value?: string, activeValue?: string) {\n if (!activeValue) return false;\n if (value == null) return false;\n value = normalizeString(value);\n return (\n activeValue.length > value.length &&\n activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0\n );\n}\n\nfunction isInputEvent(event: Event): event is InputEvent {\n return event.type === \"input\";\n}\n\nfunction isAriaAutoCompleteValue(\n value: string,\n): value is Required<AriaAttributes>[\"aria-autocomplete\"] {\n return (\n value === \"inline\" ||\n value === \"list\" ||\n value === \"both\" ||\n value === \"none\"\n );\n}\n\nfunction getDefaultAutoSelectId(items: ComboboxStoreState[\"items\"]) {\n const item = items.find((item) => {\n if (item.disabled) return false;\n // When rendering tabs in a combobox widget, we ignore them and auto select\n // the first item that's not a tab instead.\n return item.element?.getAttribute(\"role\") !== \"tab\";\n });\n return item?.id;\n}\n\n/**\n * Returns props to create a `Combobox` component.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useCombobox({ store });\n * <Role {...props} />\n * <ComboboxPopover store={store}>\n * <ComboboxItem value=\"Apple\" />\n * <ComboboxItem value=\"Banana\" />\n * <ComboboxItem value=\"Orange\" />\n * </ComboboxPopover>\n * ```\n */\nexport const useCombobox = createHook<TagName, ComboboxOptions>(\n function useCombobox({\n store,\n focusable = true,\n autoSelect: autoSelectProp = false,\n getAutoSelectId,\n setValueOnChange,\n showMinLength = 0,\n showOnChange,\n showOnMouseDown,\n showOnClick = showOnMouseDown,\n showOnKeyDown,\n showOnKeyPress = showOnKeyDown,\n blurActiveItemOnClick,\n setValueOnClick = true,\n moveOnKeyPress = true,\n autoComplete = \"list\",\n ...props\n }) {\n const context = useComboboxProviderContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component.\",\n );\n\n const ref = useRef<HTMLType>(null);\n const [valueUpdated, forceValueUpdate] = useForceUpdate();\n const canAutoSelectRef = useRef(false);\n const composingRef = useRef(false);\n\n // We can only allow auto select when the combobox focus is handled via the\n // aria-activedescendant attribute. Othwerwise, the focus would move to the\n // first item on every keypress.\n const autoSelect = useStoreState(\n store,\n (state) => state.virtualFocus && autoSelectProp,\n );\n\n const inline = autoComplete === \"inline\" || autoComplete === \"both\";\n // The inline autocomplete should only happen in certain circumstances. We\n // control this state here.\n const [canInline, setCanInline] = useState(inline);\n\n // If the inline autocomplete is enabled in a update, we need to update the\n // canInline state to reflect this. TODO: Try derived state.\n useUpdateLayoutEffect(() => {\n if (!inline) return;\n setCanInline(true);\n }, [inline]);\n\n const storeValue = useStoreState(store, \"value\");\n\n // Keep track of the previous selected values so we can set the\n // inlineActiveValue below only when the current activeValue isn't already\n // selected and isn't one of the previously selected values. See\n // tag-combobox test named \"deselecting a tag should not highlight the input\n // text if it is not the first combobox item\".\n const prevSelectedValueRef = useRef<ComboboxStoreSelectedValue>(undefined);\n useEffect(() => {\n return sync(store, [\"selectedValue\", \"activeId\"], (_, prev) => {\n prevSelectedValueRef.current = prev.selectedValue;\n });\n }, [store]);\n\n const inlineActiveValue = useStoreState(store, (state) => {\n if (!inline) return;\n if (!canInline) return;\n // It doesn't make sense to inline the active value if it's already\n // selected or just got deselected. Inlining the value typically implies\n // an addition, but if the value is already selected, the action actually\n // becomes a deletion. If the value was just deselected, pressing Enter\n // again would reselect it, but it's not the usual path, so we also take\n // into account the previously selected values. See tag-combobox test\n // named \"deselecting a tag should not highlight the input text if it is\n // not the first combobox item\".\n if (state.activeValue && Array.isArray(state.selectedValue)) {\n if (state.selectedValue.includes(state.activeValue)) return;\n if (prevSelectedValueRef.current?.includes(state.activeValue)) return;\n }\n return state.activeValue;\n });\n\n const items = useStoreState(store, \"renderedItems\");\n const open = useStoreState(store, \"open\");\n const contentElement = useStoreState(store, \"contentElement\");\n\n // The current input value may differ from state.value when\n // autoComplete is either \"both\" or \"inline\", in which case it will be\n // the active item value or a combination of the input value and the active\n // item value if it's the first item and it's been auto selected. This will\n // only affect the element's value, not the combobox state.\n const value = useMemo(() => {\n if (!inline) return storeValue;\n if (!canInline) return storeValue;\n const firstItemAutoSelected = isFirstItemAutoSelected(\n items,\n inlineActiveValue,\n autoSelect,\n );\n if (firstItemAutoSelected) {\n // If the first item is auto selected, we should append the completion\n // string to the end of the value. This will be highlited in the effect\n // below.\n if (hasCompletionString(storeValue, inlineActiveValue)) {\n const slice = inlineActiveValue?.slice(storeValue.length) || \"\";\n return storeValue + slice;\n }\n return storeValue;\n }\n return inlineActiveValue || storeValue;\n }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]);\n\n // Listen to the combobox-item-move event that's dispacthed the ComboboxItem\n // component so we can enable the inline autocomplete when the user moves\n // the focus to an item using the keyboard.\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const onCompositeItemMove = () => setCanInline(true);\n element.addEventListener(\"combobox-item-move\", onCompositeItemMove);\n return () => {\n element.removeEventListener(\"combobox-item-move\", onCompositeItemMove);\n };\n }, []);\n\n // Highlights the completion string\n useEffect(() => {\n if (!inline) return;\n if (!canInline) return;\n if (!inlineActiveValue) return;\n const firstItemAutoSelected = isFirstItemAutoSelected(\n items,\n inlineActiveValue,\n autoSelect,\n );\n if (!firstItemAutoSelected) return;\n if (!hasCompletionString(storeValue, inlineActiveValue)) return;\n let cleanup = noop;\n // For some reason, this setSelectionRange may run before the value is\n // updated in the DOM. We're using a microtask to make sure it runs after\n // the value is updated so we don't lose the selection. See combobox-group\n // test-browser file.\n queueMicrotask(() => {\n const element = ref.current;\n if (!element) return;\n const { start: prevStart, end: prevEnd } = getTextboxSelection(element);\n const nextStart = storeValue.length;\n const nextEnd = inlineActiveValue.length;\n setSelectionRange(element, nextStart, nextEnd);\n cleanup = () => {\n // This effect may run after the value is updated and the completion\n // string is highlighted, for example, when the items are updated\n // asynchronously or in a React transition in a multi-selectable\n // combobox. In this case, we must restore the previous selection\n // range if it hasn't changed. TODO: Test this.\n if (!hasFocus(element)) return;\n const { start, end } = getTextboxSelection(element);\n if (start !== nextStart) return;\n if (end !== nextEnd) return;\n setSelectionRange(element, prevStart, prevEnd);\n };\n });\n return () => cleanup();\n }, [\n valueUpdated,\n inline,\n canInline,\n inlineActiveValue,\n items,\n autoSelect,\n storeValue,\n ]);\n\n const scrollingElementRef = useRef<Element | null>(null);\n const getAutoSelectIdProp = useEvent(getAutoSelectId);\n const autoSelectIdRef = useRef<string | null | undefined>(null);\n const userScrolledRef = useRef(false);\n const isAutoScrollingRef = useRef(false);\n\n // Disable the autoSelect behavior when the user scrolls the combobox\n // content. This prevents the focus from moving to the first item on\n // virtualized and infinite lists.\n useEffect(() => {\n if (!open) return;\n if (!contentElement) return;\n const scrollingElement = getScrollingElement(contentElement);\n if (!scrollingElement) return;\n scrollingElementRef.current = scrollingElement;\n const onUserScroll = () => {\n // A wheel event is always initiated by the user, so we can disable the\n // autoSelect behavior without any additional checks.\n canAutoSelectRef.current = false;\n userScrolledRef.current = true;\n };\n const onScroll = () => {\n // Mark any non-programmatic scroll as user-initiated so we don't\n // reset the scroll position when new items load (e.g., infinite\n // scroll, scrollbar drag). Programmatic scrolls from scrollIntoView\n // set isAutoScrollingRef to avoid false positives.\n if (!isAutoScrollingRef.current) {\n userScrolledRef.current = true;\n }\n if (!store) return;\n if (!canAutoSelectRef.current) return;\n // We won't disable the autoSelect behavior if the autoSelect item is\n // still focused.\n const { activeId } = store.getState();\n if (activeId === null) return;\n if (activeId === autoSelectIdRef.current) return;\n canAutoSelectRef.current = false;\n };\n const options = { passive: true, capture: true };\n scrollingElement.addEventListener(\"wheel\", onUserScroll, options);\n scrollingElement.addEventListener(\"touchmove\", onUserScroll, options);\n scrollingElement.addEventListener(\"scroll\", onScroll, options);\n return () => {\n scrollingElement.removeEventListener(\"wheel\", onUserScroll, true);\n scrollingElement.removeEventListener(\"touchmove\", onUserScroll, true);\n scrollingElement.removeEventListener(\"scroll\", onScroll, true);\n };\n }, [open, contentElement, store]);\n\n // Reset the user-scrolled flag and set the changed flag to true whenever\n // the combobox value changes and is not empty. We're doing this here in\n // addition to in the onChange handler because the value may change\n // programmatically.\n useSafeLayoutEffect(() => {\n userScrolledRef.current = false;\n if (!storeValue) return;\n if (composingRef.current) return;\n canAutoSelectRef.current = true;\n }, [storeValue]);\n\n // Reset the changed flag when the popover is not open so we don't try to\n // auto select an item after the popover closes (for example, in the middle\n // of an animation).\n useSafeLayoutEffect(() => {\n if (autoSelect !== \"always\" && open) return;\n canAutoSelectRef.current = open;\n }, [autoSelect, open]);\n\n const resetValueOnSelect = useStoreState(store, \"resetValueOnSelect\");\n\n // Auto select the first item on type. This effect runs both when the value\n // changes and when the items change so we also catch async items.\n useUpdateEffect(() => {\n const canAutoSelect = canAutoSelectRef.current;\n if (!store) return;\n if (!open) return;\n if (!canAutoSelect && (!resetValueOnSelect || userScrolledRef.current))\n return;\n const { baseElement, contentElement, activeId } = store.getState();\n if (baseElement && !hasFocus(baseElement)) return;\n // The data-placing attribute is an internal state added by the Popover\n // component. We can observe it to know when the popover is done placing\n // itself. This is to prevent the focus from moving to the first item\n // while the popover is still calculating its position, which could cause\n // a scroll jump. See combobox-group test-browser file.\n if (contentElement?.hasAttribute(\"data-placing\")) {\n const observer = new MutationObserver(forceValueUpdate);\n observer.observe(contentElement, { attributeFilter: [\"data-placing\"] });\n return () => observer.disconnect();\n }\n if (autoSelect && canAutoSelect) {\n const userAutoSelectId = getAutoSelectIdProp(items);\n const autoSelectId =\n userAutoSelectId !== undefined\n ? userAutoSelectId\n : (getDefaultAutoSelectId(items) ?? store.first());\n autoSelectIdRef.current = autoSelectId;\n // If there's no first item (that is, there are no items or all items\n // are disabled), we should move the focus to the input (null),\n // otherwise, with async items, the activeValue won't be reset. TODO:\n // Test this.\n store.move(autoSelectId ?? null);\n } else {\n // Reset the scroll position to the active item when an item is selected\n // and the combobox value is reset, which might move the active item\n // offscreen. Otherwise, if no item is selected, reset to the first\n // item, such as when `autoSelect` is false.\n const element = store.item(activeId || store.first())?.element;\n if (element && \"scrollIntoView\" in element) {\n isAutoScrollingRef.current = true;\n element.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n // Clear after the browser dispatches the scroll event. Scroll\n // events fire during the \"scroll steps\" of the rendering update,\n // which run before requestAnimationFrame callbacks.\n requestAnimationFrame(() => {\n isAutoScrollingRef.current = false;\n });\n }\n }\n return;\n }, [\n store,\n open,\n valueUpdated,\n storeValue,\n autoSelect,\n resetValueOnSelect,\n getAutoSelectIdProp,\n items,\n ]);\n\n // If it has inline auto completion, set the store value when the combobox\n // input or the combobox list lose focus.\n useEffect(() => {\n if (!inline) return;\n const combobox = ref.current;\n if (!combobox) return;\n const elements = [combobox, contentElement].filter(\n (value): value is HTMLElement => !!value,\n );\n const onBlur = (event: FocusEvent) => {\n if (elements.every((el) => isFocusEventOutside(event, el))) {\n store?.setValue(value);\n }\n };\n for (const element of elements) {\n element.addEventListener(\"focusout\", onBlur);\n }\n return () => {\n for (const element of elements) {\n element.removeEventListener(\"focusout\", onBlur);\n }\n };\n }, [inline, contentElement, store, value]);\n\n const canShow = (event: SyntheticEvent) => {\n const currentTarget = event.currentTarget as HTMLType;\n return currentTarget.value.length >= showMinLength;\n };\n\n const onChangeProp = props.onChange;\n const showOnChangeProp = useBooleanEvent(showOnChange ?? canShow);\n const setValueOnChangeProp = useBooleanEvent(\n // If the combobox is combined with tags, the value will be set by the tag\n // input component.\n setValueOnChange ?? !store.tag,\n );\n\n const onChange = useEvent((event: ChangeEvent<HTMLType>) => {\n onChangeProp?.(event);\n if (event.defaultPrevented) return;\n if (!store) return;\n const currentTarget = event.currentTarget;\n const { value, selectionStart, selectionEnd } = currentTarget;\n const nativeEvent = event.nativeEvent;\n canAutoSelectRef.current = true;\n if (isInputEvent(nativeEvent)) {\n if (nativeEvent.isComposing) {\n canAutoSelectRef.current = false;\n composingRef.current = true;\n }\n if (inline) {\n const textInserted =\n nativeEvent.inputType === \"insertText\" ||\n nativeEvent.inputType === \"insertCompositionText\";\n const caretAtEnd = selectionStart === value.length;\n setCanInline(textInserted && caretAtEnd);\n }\n }\n if (setValueOnChangeProp(event)) {\n const isSameValue = value === store.getState().value;\n store.setValue(value);\n // When the value is not set synchronously, the selection range may be\n // lost. See combobox-group \"keep caret position when typing\" test.\n queueMicrotask(() => {\n setSelectionRange(currentTarget, selectionStart, selectionEnd);\n });\n if (inline && autoSelect && isSameValue) {\n // The store.setValue(event.target.value) above may not trigger a\n // state update. For example, say the first item starts with \"t\". The\n // user starts typing \"t\", then the first item is auto selected and\n // the inline completion string is appended and highlited. The user\n // then selects all the text and type \"t\" again. This change will\n // produce the same value as the store value, and therefore the state\n // update will not trigger a re-render. We need to force a re-render\n // here so the inline completion effect will be fired.\n forceValueUpdate();\n }\n }\n if (showOnChangeProp(event)) {\n store.show();\n }\n if (!autoSelect || !canAutoSelectRef.current) {\n // If autoSelect is not set or it's not an insertion of text, focus on\n // the combobox input after changing the value.\n store.setActiveId(null);\n }\n });\n\n const onCompositionEndProp = props.onCompositionEnd;\n\n // When dealing with composition text (for example, when the user is typing\n // in accents or chinese characters), we need to set canAutoSelectRef to\n // true when the composition ends. This is because the native input event\n // that's passed to the change event above will not produce a consistent\n // inputType value across browsers, so we can't rely on that there.\n const onCompositionEnd = useEvent((event: CompositionEvent<HTMLType>) => {\n canAutoSelectRef.current = true;\n composingRef.current = false;\n onCompositionEndProp?.(event);\n if (event.defaultPrevented) return;\n if (!autoSelect) return;\n forceValueUpdate();\n });\n\n const onMouseDownProp = props.onMouseDown;\n const blurActiveItemOnClickProp = useBooleanEvent(\n blurActiveItemOnClick ?? (() => store.getState().includesBaseElement),\n );\n const setValueOnClickProp = useBooleanEvent(setValueOnClick);\n const showOnClickProp = useBooleanEvent(showOnClick ?? canShow);\n\n const onMouseDown = useEvent((event: MouseEvent<HTMLType>) => {\n onMouseDownProp?.(event);\n if (event.defaultPrevented) return;\n if (event.button) return;\n if (event.ctrlKey) return;\n if (!store) return;\n if (blurActiveItemOnClickProp(event)) {\n store.setActiveId(null);\n }\n if (setValueOnClickProp(event)) {\n store.setValue(value);\n }\n if (showOnClickProp(event)) {\n queueBeforeEvent(event.currentTarget, \"mouseup\", store.show);\n }\n });\n\n const onKeyDownProp = props.onKeyDown;\n const showOnKeyPressProp = useBooleanEvent(showOnKeyPress ?? canShow);\n\n const onKeyDown = useEvent((event: ReactKeyboardEvent<HTMLType>) => {\n onKeyDownProp?.(event);\n if (!event.repeat) {\n // Run combobox-tabs and combobox-group (browser) tests.\n canAutoSelectRef.current = false;\n }\n if (event.defaultPrevented) return;\n if (!store) return;\n const { open } = store.getState();\n // When the popover is open, prevent Enter (with or without modifiers)\n // from triggering the default behavior (submitting a parent form). If\n // there's an active item, the keyboard event proxy on Composite will\n // dispatch Enter to the item, which handles selection. If there's no\n // active item (e.g., all items are filtered out, or activeId is stale\n // after a React transition), Enter should be a no-op rather than\n // submitting a form.\n if (open && event.key === \"Enter\") {\n event.preventDefault();\n return;\n }\n if (event.ctrlKey) return;\n if (event.altKey) return;\n if (event.shiftKey) return;\n if (event.metaKey) return;\n if (open) return;\n // Up and Down arrow keys should open the combobox popover.\n if (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n if (showOnKeyPressProp(event)) {\n event.preventDefault();\n store.show();\n }\n }\n });\n\n const onBlurProp = props.onBlur;\n\n const onBlur = useEvent((event: ReactFocusEvent<HTMLType>) => {\n // If we don't reset the canAutoSelectRef here, the combobox will keep the\n // first item selected when the combobox loses focus and its value gets\n // cleared. See combobox-cancel tests.\n canAutoSelectRef.current = false;\n onBlurProp?.(event);\n if (event.defaultPrevented) return;\n });\n\n // This is necessary so other components like ComboboxCancel can reference\n // the combobox input in their aria-controls attribute. It's also used by\n // ComboboxLabel.\n const id = useId(props.id);\n\n const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete)\n ? autoComplete\n : undefined;\n\n const isActiveItem = useStoreState(\n store,\n (state) => state.activeId === null,\n );\n\n props = {\n role: \"combobox\",\n \"aria-autocomplete\": ariaAutoComplete,\n \"aria-haspopup\": getPopupRole(contentElement, \"listbox\"),\n \"aria-expanded\": open,\n \"aria-controls\": contentElement?.id,\n \"data-active-item\": isActiveItem || undefined,\n value,\n ...props,\n id,\n ref: useMergeRefs(ref, props.ref),\n onChange,\n onCompositionEnd,\n onMouseDown,\n onKeyDown,\n onBlur,\n };\n\n props = useComposite<TagName>({\n store,\n focusable,\n ...props,\n // Enable inline autocomplete when the user moves from the combobox input\n // to an item.\n moveOnKeyPress: (event) => {\n if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;\n if (inline) setCanInline(true);\n return true;\n },\n });\n\n props = usePopoverAnchor<TagName>({ store, ...props });\n\n return { autoComplete: \"off\", ...props };\n },\n);\n\n/**\n * Renders a combobox input element that can be used to filter a list of items.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {2}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxItem value=\"Apple\" />\n * <ComboboxItem value=\"Banana\" />\n * <ComboboxItem value=\"Orange\" />\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const Combobox = forwardRef(function Combobox(props: ComboboxProps) {\n const htmlProps = useCombobox(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface ComboboxOptions<T extends ElementType = TagName>\n extends CompositeOptions<T>, PopoverAnchorOptions<T> {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxProvider`](https://ariakit.com/reference/combobox-provider)\n * component's context will be used.\n */\n store?: ComboboxStore;\n /**\n * Determines if the first enabled item will be automatically focused when the\n * combobox input value changes. If set to `true` or `\"always\"`, the exact\n * behavior hinges on the value of the\n * [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete) prop:\n * - If [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete)\n * is `both` or `inline`, the first enabled item is automatically focused as\n * the user types in the input. The value gets appended with the completion\n * string if it matches. The inline completion string will be highlighted\n * and selected.\n * - If [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete)\n * is `list` or `none`, the first enabled item is automatically focused as\n * the user types in the input, but the input value is not appended with the\n * item value.\n *\n * If set to `\"always\"`, the first enabled item is auto-highlighted when the\n * combobox list opens, not just when the input value changes.\n *\n * To change which item gets auto-selected, use the\n * [`getAutoSelectId`](https://ariakit.com/reference/combobox#getautoselectid)\n * prop.\n *\n * Live examples:\n * - [Command Menu with\n * Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)\n * - [ComboboxGroup](https://ariakit.com/examples/combobox-group)\n * - [Combobox with links](https://ariakit.com/examples/combobox-links)\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * - [Menu with Combobox](https://ariakit.com/examples/menu-combobox)\n * - [Select with Combobox](https://ariakit.com/examples/select-combobox)\n * @default false\n */\n autoSelect?: boolean | \"always\";\n /**\n * Function that takes the currently rendered items and returns the id of the\n * item to be auto selected when the\n * [`autoSelect`](https://ariakit.com/reference/combobox#autoselect) prop is\n * `true`.\n *\n * By default, the first enabled item is auto selected. This function is handy\n * if you prefer a different item to be auto selected. Returning `undefined`\n * from this function will result in the default behavior.\n * @example\n * ```jsx\n * <Combobox\n * autoSelect\n * getAutoSelectId={(items) => {\n * // Auto select the first enabled item with a value\n * const item = items.find((item) => {\n * if (item.disabled) return false;\n * if (!item.value) return false;\n * return true;\n * });\n * return item?.id;\n * }}\n * />\n * ```\n */\n getAutoSelectId?: (\n renderedItems: ComboboxStoreState[\"renderedItems\"],\n ) => string | null | undefined;\n /**\n * Whether the items will be filtered based on\n * [`value`](https://ariakit.com/reference/combobox-provider#value) and\n * whether the input value will temporarily change based on the active item.\n *\n * This prop is based on the standard\n * [`aria-autocomplete`](https://w3c.github.io/aria/#aria-autocomplete)\n * attribute, accepting the same values:\n * - `list` (default): indicates that the items will be dynamically rendered\n * based on [`value`](https://ariakit.com/reference/combobox-provider#value)\n * and the input value will _not_ change based on the active item. The\n * filtering logic must be implemented by the consumer of this component.\n * - `inline`: indicates that the items are static, that is, they won't be\n * filtered, but the input value will temporarily change based on the active\n * item. Ariakit will automatically provide the inline autocompletion\n * behavior.\n * - `both`: indicates that the items will be dynamically rendered based on\n * [`value`](https://ariakit.com/reference/combobox-provider#value) and the\n * input value will temporarily change based on the active item. The\n * filtering logic must be implemented by the consumer of this component,\n * whereas Ariakit will automatically provide the inline autocompletion\n * behavior.\n * - `none`: the items are static and the input value will _not_ change based\n * on the active item.\n *\n * Live examples:\n * - [ComboboxGroup](https://ariakit.com/examples/combobox-group)\n * @default \"list\"\n */\n autoComplete?: StringWithValue<Required<AriaAttributes>[\"aria-autocomplete\"]>;\n /**\n * Determines if the highlighted item should lose focus when the user clicks\n * on the combobox input element. By default, this prop's value is set\n * according to the\n * [`includesBaseElement`](https://ariakit.com/reference/combobox-provider#includesbaseelement)\n * value.\n */\n blurActiveItemOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n /**\n * Specifies the minimum character count the input value should have before\n * the [`ComboboxList`](https://ariakit.com/reference/combobox-list) or\n * [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components are displayed.\n *\n * The [`showOnChange`](https://ariakit.com/reference/combobox#showonchange),\n * [`showOnClick`](https://ariakit.com/reference/combobox#showonclick), and\n * [`showOnKeyPress`](https://ariakit.com/reference/combobox#showonkeypress)\n * props allow you to tailor the behavior for each unique event.\n * @default 0\n * @example\n * In the following example, the combobox list will be shown when the input\n * value has at least one character. However, if the user presses the arrow\n * keys, the list will be shown regardless of the input value length.\n * ```jsx\n * <Combobox showMinLength={1} showOnKeyPress />\n * ```\n */\n showMinLength?: number;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the input value changes.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n * @example\n * ```jsx\n * <Combobox showOnChange={(event) => event.target.value.length > 1} />\n * ```\n */\n showOnChange?: BooleanOrCallback<ChangeEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the input is clicked.\n * @deprecated Use\n * [`showOnClick`](https://ariakit.com/reference/combobox#showonclick)\n * instead.\n * @default true\n */\n showOnMouseDown?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the input is clicked.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n * @example\n * ```jsx\n * <Combobox showOnClick={value.length > 1} />\n * ```\n */\n showOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the user presses the arrow up or down keys\n * while focusing on the combobox input element.\n * @deprecated Use\n * [`showOnKeyPress`](https://ariakit.com/reference/combobox#showonkeypress)\n * instead.\n * @default true\n */\n showOnKeyDown?: BooleanOrCallback<ReactKeyboardEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the user presses the arrow up or down keys\n * while focusing on the combobox input element.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n * @example\n * ```jsx\n * <Combobox showOnKeyPress={value.length > 1} />\n * ```\n */\n showOnKeyPress?: BooleanOrCallback<ReactKeyboardEvent<HTMLElement>>;\n /**\n * Whether the combobox\n * [`value`](https://ariakit.com/reference/combobox-provider#value) state\n * should be updated when the input value changes. This is useful if you want\n * to customize how the store\n * [`value`](https://ariakit.com/reference/combobox-provider#value) is updated\n * based on the input element's value.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n */\n setValueOnChange?: BooleanOrCallback<ChangeEvent<HTMLElement>>;\n /**\n * Whether the combobox\n * [`value`](https://ariakit.com/reference/combobox-provider#value) state\n * should be updated when the combobox input element gets clicked. This\n * usually only applies when\n * [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete) is\n * `both` or `inline`, because the input value will temporarily change based\n * on the active item and the store\n * [`value`](https://ariakit.com/reference/combobox-provider#value) will not\n * be updated until the user confirms the selection.\n * @default true\n */\n setValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n}\n\nexport type ComboboxProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxOptions<T>\n>;\n"],"mappings":";;;;;;;;;;AAwDA,MAAA,UAAS;SAKF,wBAAmB,OAAA,aAAA,YAAA;CAExB,IAAA,CAAA,YADwB,OAAM;CAEhC,OAAA,MAAA,MAAA,SAAA,CAAA,KAAA,YAAA,KAAA,KAAA,GAAA,UAAA;AAEA;SACO,oBAAoB,OAAA,aAAA;CACzB,IAAI,CAAA,aAAS,OAAM;CACnB,IAAA,SAAQ,MAAA,OAAgB;CACxB,QACE,gBAAY,KAAS;CAGzB,OAAA,YAAA,SAAA,MAAA,UAAA,YAAA,YAAA,EAAA,QAAA,MAAA,YAAA,CAAA,MAAA;AAEA;SACS,aAAM,OAAS;CACxB,OAAA,MAAA,SAAA;AAEA;SAII,wBACA,OAAU;CAId,OAAA,UAAA,YAAA,UAAA,UAAA,UAAA,UAAA,UAAA;AAEA;SACe,uBAAqB,OA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BAAA,gBAAoB;EACpB,oBAAA,gBAAA,KAAA;EACA;EACA,GAAA;EACA;EACA,KAAA,aAAA,KAAA,MAAA,GAAA;EACA;EACA;EACA;EACA;EACF;CAEA;SACE,aAAA;EACA;EACA;EAGA,GAAA;mBACM,UAAA;GACJ,IAAI,uBAAqB,gBAAI,KAAA,GAAA,OAAA;GAC7B,IAAA,QAAO,aAAA,IAAA;GACT,OAAA;EACD;CAED,CAAA;SAAoC,iBAAA;EAAO;EAAU,GAAA;CAErD,CAAA;QAAS;EAAqB,cAAG;EAAM,GAAA;CAE3C;;;;;;;;;;;;;;;;;MAmBE,WAAO,WAAc,SADH,SAAY,OACS;CACxC,OAAA,cAAA,SAAA,YAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"combobox.js","names":[],"sources":["../../src/combobox/combobox.tsx"],"sourcesContent":["import { useStoreState } from \"@ariakit/react-store\";\nimport {\n useBooleanEvent,\n useEvent,\n useForceUpdate,\n useId,\n useMergeRefs,\n useSafeLayoutEffect,\n useUpdateEffect,\n useUpdateLayoutEffect,\n createElement,\n createHook,\n forwardRef,\n} from \"@ariakit/react-utils\";\nimport type { Props } from \"@ariakit/react-utils\";\nimport { sync } from \"@ariakit/store\";\nimport {\n getPopupRole,\n getScrollingElement,\n getTextboxSelection,\n setSelectionRange,\n isFocusEventOutside,\n queueBeforeEvent,\n hasFocus,\n invariant,\n isFalsyBooleanCallback,\n noop,\n normalizeString,\n} from \"@ariakit/utils\";\nimport type { BooleanOrCallback, StringWithValue } from \"@ariakit/utils\";\nimport type {\n AriaAttributes,\n ChangeEvent,\n CompositionEvent,\n ElementType,\n MouseEvent,\n FocusEvent as ReactFocusEvent,\n KeyboardEvent as ReactKeyboardEvent,\n SyntheticEvent,\n} from \"react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { CompositeOptions } from \"../composite/composite.tsx\";\nimport { useComposite } from \"../composite/composite.tsx\";\nimport type { PopoverAnchorOptions } from \"../popover/popover-anchor.tsx\";\nimport { usePopoverAnchor } from \"../popover/popover-anchor.tsx\";\nimport { useComboboxProviderContext } from \"./combobox-context.tsx\";\nimport type {\n ComboboxStore,\n ComboboxStoreSelectedValue,\n ComboboxStoreState,\n} from \"./combobox-store.ts\";\n\nconst TagName = \"input\" satisfies ElementType;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\nfunction isFirstItemAutoSelected(\n items: ComboboxStoreState[\"items\"],\n activeValue: ComboboxStoreState[\"activeValue\"],\n autoSelect: ComboboxProps[\"autoSelect\"],\n) {\n if (!autoSelect) return false;\n const firstItem = items.find((item) => !item.disabled && item.value);\n return firstItem?.value === activeValue;\n}\n\nfunction hasCompletionString(value?: string, activeValue?: string) {\n if (!activeValue) return false;\n if (value == null) return false;\n value = normalizeString(value);\n return (\n activeValue.length > value.length &&\n activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0\n );\n}\n\nfunction isInputEvent(event: Event): event is InputEvent {\n return event.type === \"input\";\n}\n\nfunction isAriaAutoCompleteValue(\n value: string,\n): value is Required<AriaAttributes>[\"aria-autocomplete\"] {\n return (\n value === \"inline\" ||\n value === \"list\" ||\n value === \"both\" ||\n value === \"none\"\n );\n}\n\nfunction getDefaultAutoSelectId(items: ComboboxStoreState[\"items\"]) {\n const item = items.find((item) => {\n if (item.disabled) return false;\n // When rendering tabs in a combobox widget, we ignore them and auto select\n // the first item that's not a tab instead.\n return item.element?.getAttribute(\"role\") !== \"tab\";\n });\n return item?.id;\n}\n\n/**\n * Returns props to create a `Combobox` component.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx\n * const store = useComboboxStore();\n * const props = useCombobox({ store });\n * <Role {...props} />\n * <ComboboxPopover store={store}>\n * <ComboboxItem value=\"Apple\" />\n * <ComboboxItem value=\"Banana\" />\n * <ComboboxItem value=\"Orange\" />\n * </ComboboxPopover>\n * ```\n */\nexport const useCombobox = createHook<TagName, ComboboxOptions>(\n function useCombobox({\n store,\n focusable = true,\n autoSelect: autoSelectProp = false,\n getAutoSelectId,\n setValueOnChange,\n showMinLength = 0,\n showOnChange,\n showOnMouseDown,\n showOnClick = showOnMouseDown,\n showOnKeyDown,\n showOnKeyPress = showOnKeyDown,\n blurActiveItemOnClick,\n setValueOnClick = true,\n moveOnKeyPress = true,\n autoComplete = \"list\",\n ...props\n }) {\n const context = useComboboxProviderContext();\n store = store || context;\n\n invariant(\n store,\n process.env.NODE_ENV !== \"production\" &&\n \"Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component.\",\n );\n\n const ref = useRef<HTMLType>(null);\n const [valueUpdated, forceValueUpdate] = useForceUpdate();\n const canAutoSelectRef = useRef(false);\n const composingRef = useRef(false);\n\n // We can only allow auto select when the combobox focus is handled via the\n // aria-activedescendant attribute. Othwerwise, the focus would move to the\n // first item on every keypress.\n const autoSelect = useStoreState(\n store,\n (state) => state.virtualFocus && autoSelectProp,\n );\n\n const inline = autoComplete === \"inline\" || autoComplete === \"both\";\n // The inline autocomplete should only happen in certain circumstances. We\n // control this state here.\n const [canInline, setCanInline] = useState(inline);\n\n // If the inline autocomplete is enabled in a update, we need to update the\n // canInline state to reflect this. TODO: Try derived state.\n useUpdateLayoutEffect(() => {\n if (!inline) return;\n setCanInline(true);\n }, [inline]);\n\n const storeValue = useStoreState(store, \"value\");\n\n // Keep track of the previous selected values so we can set the\n // inlineActiveValue below only when the current activeValue isn't already\n // selected and isn't one of the previously selected values. See\n // tag-combobox test named \"deselecting a tag should not highlight the input\n // text if it is not the first combobox item\".\n const prevSelectedValueRef = useRef<ComboboxStoreSelectedValue>(undefined);\n useEffect(() => {\n return sync(store, [\"selectedValue\", \"activeId\"], (_, prev) => {\n prevSelectedValueRef.current = prev.selectedValue;\n });\n }, [store]);\n\n const inlineActiveValue = useStoreState(store, (state) => {\n if (!inline) return;\n if (!canInline) return;\n // It doesn't make sense to inline the active value if it's already\n // selected or just got deselected. Inlining the value typically implies\n // an addition, but if the value is already selected, the action actually\n // becomes a deletion. If the value was just deselected, pressing Enter\n // again would reselect it, but it's not the usual path, so we also take\n // into account the previously selected values. See tag-combobox test\n // named \"deselecting a tag should not highlight the input text if it is\n // not the first combobox item\".\n if (state.activeValue && Array.isArray(state.selectedValue)) {\n if (state.selectedValue.includes(state.activeValue)) return;\n if (prevSelectedValueRef.current?.includes(state.activeValue)) return;\n }\n return state.activeValue;\n });\n\n const items = useStoreState(store, \"renderedItems\");\n const open = useStoreState(store, \"open\");\n const contentElement = useStoreState(store, \"contentElement\");\n\n // The current input value may differ from state.value when\n // autoComplete is either \"both\" or \"inline\", in which case it will be\n // the active item value or a combination of the input value and the active\n // item value if it's the first item and it's been auto selected. This will\n // only affect the element's value, not the combobox state.\n const value = useMemo(() => {\n if (!inline) return storeValue;\n if (!canInline) return storeValue;\n const firstItemAutoSelected = isFirstItemAutoSelected(\n items,\n inlineActiveValue,\n autoSelect,\n );\n if (firstItemAutoSelected) {\n // If the first item is auto selected, we should append the completion\n // string to the end of the value. This will be highlited in the effect\n // below.\n if (hasCompletionString(storeValue, inlineActiveValue)) {\n const slice = inlineActiveValue?.slice(storeValue.length) || \"\";\n return storeValue + slice;\n }\n return storeValue;\n }\n return inlineActiveValue || storeValue;\n }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]);\n\n // Listen to the combobox-item-move event that's dispacthed the ComboboxItem\n // component so we can enable the inline autocomplete when the user moves\n // the focus to an item using the keyboard.\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const onCompositeItemMove = () => setCanInline(true);\n element.addEventListener(\"combobox-item-move\", onCompositeItemMove);\n return () => {\n element.removeEventListener(\"combobox-item-move\", onCompositeItemMove);\n };\n }, []);\n\n // Highlights the completion string\n useEffect(() => {\n if (!inline) return;\n if (!canInline) return;\n if (!inlineActiveValue) return;\n const firstItemAutoSelected = isFirstItemAutoSelected(\n items,\n inlineActiveValue,\n autoSelect,\n );\n if (!firstItemAutoSelected) return;\n if (!hasCompletionString(storeValue, inlineActiveValue)) return;\n let cleanup = noop;\n // For some reason, this setSelectionRange may run before the value is\n // updated in the DOM. We're using a microtask to make sure it runs after\n // the value is updated so we don't lose the selection. See combobox-group\n // test-browser file.\n queueMicrotask(() => {\n const element = ref.current;\n if (!element) return;\n const { start: prevStart, end: prevEnd } = getTextboxSelection(element);\n const nextStart = storeValue.length;\n const nextEnd = inlineActiveValue.length;\n setSelectionRange(element, nextStart, nextEnd);\n cleanup = () => {\n // This effect may run after the value is updated and the completion\n // string is highlighted, for example, when the items are updated\n // asynchronously or in a React transition in a multi-selectable\n // combobox. In this case, we must restore the previous selection\n // range if it hasn't changed. TODO: Test this.\n if (!hasFocus(element)) return;\n const { start, end } = getTextboxSelection(element);\n if (start !== nextStart) return;\n if (end !== nextEnd) return;\n setSelectionRange(element, prevStart, prevEnd);\n };\n });\n return () => cleanup();\n }, [\n valueUpdated,\n inline,\n canInline,\n inlineActiveValue,\n items,\n autoSelect,\n storeValue,\n ]);\n\n const scrollingElementRef = useRef<Element | null>(null);\n const getAutoSelectIdProp = useEvent(getAutoSelectId);\n const autoSelectIdRef = useRef<string | null | undefined>(null);\n // Tracks the item (id and value) the autoSelect behavior last moved focus\n // to, so we can tell an already-focused item apart from one that only looks\n // the same, such as a different value under the same id (e.g. an index-keyed\n // list after filtering) or an item that became active without focus. This is\n // distinct from autoSelectIdRef above, which tracks the current target for\n // the scroll guard. Reset when the popover closes so reopening re-focuses.\n const autoSelectMovedRef = useRef<{\n id: string | null;\n value?: string;\n }>(undefined);\n const userScrolledRef = useRef(false);\n const isAutoScrollingRef = useRef(false);\n\n // Disable the autoSelect behavior when the user scrolls the combobox\n // content. This prevents the focus from moving to the first item on\n // virtualized and infinite lists.\n useEffect(() => {\n if (!open) return;\n if (!contentElement) return;\n const scrollingElement = getScrollingElement(contentElement);\n if (!scrollingElement) return;\n scrollingElementRef.current = scrollingElement;\n const onUserScroll = () => {\n // A wheel event is always initiated by the user, so we can disable the\n // autoSelect behavior without any additional checks.\n canAutoSelectRef.current = false;\n userScrolledRef.current = true;\n };\n const onScroll = () => {\n // Mark any non-programmatic scroll as user-initiated so we don't\n // reset the scroll position when new items load (e.g., infinite\n // scroll, scrollbar drag). Programmatic scrolls from scrollIntoView\n // set isAutoScrollingRef to avoid false positives.\n if (!isAutoScrollingRef.current) {\n userScrolledRef.current = true;\n }\n if (!store) return;\n if (!canAutoSelectRef.current) return;\n // We won't disable the autoSelect behavior if the autoSelect item is\n // still focused.\n const { activeId } = store.getState();\n if (activeId === null) return;\n if (activeId === autoSelectIdRef.current) return;\n canAutoSelectRef.current = false;\n };\n const options = { passive: true, capture: true };\n scrollingElement.addEventListener(\"wheel\", onUserScroll, options);\n scrollingElement.addEventListener(\"touchmove\", onUserScroll, options);\n scrollingElement.addEventListener(\"scroll\", onScroll, options);\n return () => {\n scrollingElement.removeEventListener(\"wheel\", onUserScroll, true);\n scrollingElement.removeEventListener(\"touchmove\", onUserScroll, true);\n scrollingElement.removeEventListener(\"scroll\", onScroll, true);\n };\n }, [open, contentElement, store]);\n\n // Reset the user-scrolled flag and set the changed flag to true whenever\n // the combobox value changes and is not empty. We're doing this here in\n // addition to in the onChange handler because the value may change\n // programmatically.\n useSafeLayoutEffect(() => {\n userScrolledRef.current = false;\n if (!storeValue) return;\n if (composingRef.current) return;\n canAutoSelectRef.current = true;\n }, [storeValue]);\n\n // Reset the changed flag when the popover is not open so we don't try to\n // auto select an item after the popover closes (for example, in the middle\n // of an animation).\n useSafeLayoutEffect(() => {\n if (autoSelect !== \"always\" && open) return;\n canAutoSelectRef.current = open;\n }, [autoSelect, open]);\n\n // Reset the auto-moved item when the popover closes so reopening re-focuses\n // the auto-selected item.\n useSafeLayoutEffect(() => {\n if (open) return;\n autoSelectMovedRef.current = undefined;\n }, [open]);\n\n const resetValueOnSelect = useStoreState(store, \"resetValueOnSelect\");\n\n // Auto select the first item on type. This effect runs both when the value\n // changes and when the items change so we also catch async items.\n useUpdateEffect(() => {\n const canAutoSelect = canAutoSelectRef.current;\n if (!store) return;\n if (!open) return;\n if (!canAutoSelect && (!resetValueOnSelect || userScrolledRef.current))\n return;\n const { baseElement, contentElement, activeId } = store.getState();\n if (baseElement && !hasFocus(baseElement)) return;\n // The data-placing attribute is an internal state added by the Popover\n // component. We can observe it to know when the popover is done placing\n // itself. This is to prevent the focus from moving to the first item\n // while the popover is still calculating its position, which could cause\n // a scroll jump. See combobox-group test-browser file.\n if (contentElement?.hasAttribute(\"data-placing\")) {\n const observer = new MutationObserver(forceValueUpdate);\n observer.observe(contentElement, { attributeFilter: [\"data-placing\"] });\n return () => observer.disconnect();\n }\n if (autoSelect && canAutoSelect) {\n const userAutoSelectId = getAutoSelectIdProp(items);\n const autoSelectId =\n userAutoSelectId !== undefined\n ? userAutoSelectId\n : (getDefaultAutoSelectId(items) ?? store.first());\n autoSelectIdRef.current = autoSelectId;\n // If there's no first item (that is, there are no items or all items\n // are disabled), we should move the focus to the input (null),\n // otherwise, with async items, the activeValue won't be reset. TODO:\n // Test this.\n const nextActiveId = autoSelectId ?? null;\n const nextActiveValue = store.item(nextActiveId)?.value;\n const moved = autoSelectMovedRef.current;\n // Move when the auto-select target changes: a different active item, a\n // different target id, or the same id now holding a different value\n // (for example, a list keyed by index whose first item's value changes\n // after filtering, or asynchronously loaded items). We avoid re-moving\n // to the exact item we already moved to, because store.move() always\n // increments the `moves` counter, which makes the Composite component\n // re-focus the active item. Re-focusing when only the rendered items\n // changed (for example, a virtualized list resizing because a mobile\n // keyboard's autocomplete bar changed the available height) would bounce\n // focus off the input and back and drop characters as the user types.\n // See https://github.com/ariakit/ariakit/issues/3837\n if (\n nextActiveId !== activeId ||\n moved?.id !== nextActiveId ||\n moved?.value !== nextActiveValue\n ) {\n autoSelectMovedRef.current = {\n id: nextActiveId,\n value: nextActiveValue,\n };\n store.move(nextActiveId);\n } else {\n // The same item is already the focused active item, so we skip the\n // move to avoid re-focusing it. Keep activeValue in sync (a no-op\n // here since the value is unchanged) the way store.move() would.\n store.setState(\"activeValue\", nextActiveValue);\n }\n } else {\n // Reset the scroll position to the active item when an item is selected\n // and the combobox value is reset, which might move the active item\n // offscreen. Otherwise, if no item is selected, reset to the first\n // item, such as when `autoSelect` is false.\n const element = store.item(activeId || store.first())?.element;\n if (element && \"scrollIntoView\" in element) {\n isAutoScrollingRef.current = true;\n element.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n // Clear after the browser dispatches the scroll event. Scroll\n // events fire during the \"scroll steps\" of the rendering update,\n // which run before requestAnimationFrame callbacks.\n requestAnimationFrame(() => {\n isAutoScrollingRef.current = false;\n });\n }\n }\n return;\n }, [\n store,\n open,\n valueUpdated,\n storeValue,\n autoSelect,\n resetValueOnSelect,\n getAutoSelectIdProp,\n items,\n ]);\n\n // If it has inline auto completion, set the store value when the combobox\n // input or the combobox list lose focus.\n useEffect(() => {\n if (!inline) return;\n const combobox = ref.current;\n if (!combobox) return;\n const elements = [combobox, contentElement].filter(\n (value): value is HTMLElement => !!value,\n );\n const onBlur = (event: FocusEvent) => {\n if (elements.every((el) => isFocusEventOutside(event, el))) {\n store?.setValue(value);\n }\n };\n for (const element of elements) {\n element.addEventListener(\"focusout\", onBlur);\n }\n return () => {\n for (const element of elements) {\n element.removeEventListener(\"focusout\", onBlur);\n }\n };\n }, [inline, contentElement, store, value]);\n\n const canShow = (event: SyntheticEvent) => {\n const currentTarget = event.currentTarget as HTMLType;\n return currentTarget.value.length >= showMinLength;\n };\n\n const onChangeProp = props.onChange;\n const showOnChangeProp = useBooleanEvent(showOnChange ?? canShow);\n const setValueOnChangeProp = useBooleanEvent(\n // If the combobox is combined with tags, the value will be set by the tag\n // input component.\n setValueOnChange ?? !store.tag,\n );\n\n const onChange = useEvent((event: ChangeEvent<HTMLType>) => {\n onChangeProp?.(event);\n if (event.defaultPrevented) return;\n if (!store) return;\n const currentTarget = event.currentTarget;\n const { value, selectionStart, selectionEnd } = currentTarget;\n const nativeEvent = event.nativeEvent;\n canAutoSelectRef.current = true;\n if (isInputEvent(nativeEvent)) {\n if (nativeEvent.isComposing) {\n canAutoSelectRef.current = false;\n composingRef.current = true;\n }\n if (inline) {\n const textInserted =\n nativeEvent.inputType === \"insertText\" ||\n nativeEvent.inputType === \"insertCompositionText\";\n const caretAtEnd = selectionStart === value.length;\n setCanInline(textInserted && caretAtEnd);\n }\n }\n if (setValueOnChangeProp(event)) {\n const isSameValue = value === store.getState().value;\n store.setValue(value);\n // When the value is not set synchronously, the selection range may be\n // lost. See combobox-group \"keep caret position when typing\" test.\n queueMicrotask(() => {\n setSelectionRange(currentTarget, selectionStart, selectionEnd);\n });\n if (inline && autoSelect && isSameValue) {\n // The store.setValue(event.target.value) above may not trigger a\n // state update. For example, say the first item starts with \"t\". The\n // user starts typing \"t\", then the first item is auto selected and\n // the inline completion string is appended and highlited. The user\n // then selects all the text and type \"t\" again. This change will\n // produce the same value as the store value, and therefore the state\n // update will not trigger a re-render. We need to force a re-render\n // here so the inline completion effect will be fired.\n forceValueUpdate();\n }\n }\n if (showOnChangeProp(event)) {\n store.show();\n }\n if (!autoSelect || !canAutoSelectRef.current) {\n // If autoSelect is not set or it's not an insertion of text, focus on\n // the combobox input after changing the value.\n store.setActiveId(null);\n }\n });\n\n const onCompositionEndProp = props.onCompositionEnd;\n\n // When dealing with composition text (for example, when the user is typing\n // in accents or chinese characters), we need to set canAutoSelectRef to\n // true when the composition ends. This is because the native input event\n // that's passed to the change event above will not produce a consistent\n // inputType value across browsers, so we can't rely on that there.\n const onCompositionEnd = useEvent((event: CompositionEvent<HTMLType>) => {\n canAutoSelectRef.current = true;\n composingRef.current = false;\n onCompositionEndProp?.(event);\n if (event.defaultPrevented) return;\n if (!autoSelect) return;\n forceValueUpdate();\n });\n\n const onMouseDownProp = props.onMouseDown;\n const blurActiveItemOnClickProp = useBooleanEvent(\n blurActiveItemOnClick ?? (() => store.getState().includesBaseElement),\n );\n const setValueOnClickProp = useBooleanEvent(setValueOnClick);\n const showOnClickProp = useBooleanEvent(showOnClick ?? canShow);\n\n const onMouseDown = useEvent((event: MouseEvent<HTMLType>) => {\n onMouseDownProp?.(event);\n if (event.defaultPrevented) return;\n if (event.button) return;\n if (event.ctrlKey) return;\n if (!store) return;\n if (blurActiveItemOnClickProp(event)) {\n store.setActiveId(null);\n }\n if (setValueOnClickProp(event)) {\n store.setValue(value);\n }\n if (showOnClickProp(event)) {\n queueBeforeEvent(event.currentTarget, \"mouseup\", store.show);\n }\n });\n\n const onKeyDownProp = props.onKeyDown;\n const showOnKeyPressProp = useBooleanEvent(showOnKeyPress ?? canShow);\n\n const onKeyDown = useEvent((event: ReactKeyboardEvent<HTMLType>) => {\n onKeyDownProp?.(event);\n if (!event.repeat) {\n // Run combobox-tabs and combobox-group (browser) tests.\n canAutoSelectRef.current = false;\n }\n if (event.defaultPrevented) return;\n if (!store) return;\n const { open } = store.getState();\n // When the popover is open, prevent Enter (with or without modifiers)\n // from triggering the default behavior (submitting a parent form). If\n // there's an active item, the keyboard event proxy on Composite will\n // dispatch Enter to the item, which handles selection. If there's no\n // active item (e.g., all items are filtered out, or activeId is stale\n // after a React transition), Enter should be a no-op rather than\n // submitting a form.\n if (open && event.key === \"Enter\") {\n event.preventDefault();\n return;\n }\n if (event.ctrlKey) return;\n if (event.altKey) return;\n if (event.shiftKey) return;\n if (event.metaKey) return;\n if (open) return;\n // Up and Down arrow keys should open the combobox popover.\n if (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n if (showOnKeyPressProp(event)) {\n event.preventDefault();\n store.show();\n }\n }\n });\n\n const onBlurProp = props.onBlur;\n\n const onBlur = useEvent((event: ReactFocusEvent<HTMLType>) => {\n // If we don't reset the canAutoSelectRef here, the combobox will keep the\n // first item selected when the combobox loses focus and its value gets\n // cleared. See combobox-cancel tests.\n canAutoSelectRef.current = false;\n onBlurProp?.(event);\n if (event.defaultPrevented) return;\n });\n\n // This is necessary so other components like ComboboxCancel can reference\n // the combobox input in their aria-controls attribute. It's also used by\n // ComboboxLabel.\n const id = useId(props.id);\n\n const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete)\n ? autoComplete\n : undefined;\n\n const isActiveItem = useStoreState(\n store,\n (state) => state.activeId === null,\n );\n\n props = {\n role: \"combobox\",\n \"aria-autocomplete\": ariaAutoComplete,\n \"aria-haspopup\": getPopupRole(contentElement, \"listbox\"),\n \"aria-expanded\": open,\n \"aria-controls\": contentElement?.id,\n \"data-active-item\": isActiveItem || undefined,\n value,\n ...props,\n id,\n ref: useMergeRefs(ref, props.ref),\n onChange,\n onCompositionEnd,\n onMouseDown,\n onKeyDown,\n onBlur,\n };\n\n props = useComposite<TagName>({\n store,\n focusable,\n ...props,\n // Enable inline autocomplete when the user moves from the combobox input\n // to an item.\n moveOnKeyPress: (event) => {\n if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;\n if (inline) setCanInline(true);\n return true;\n },\n });\n\n props = usePopoverAnchor<TagName>({ store, ...props });\n\n return { autoComplete: \"off\", ...props };\n },\n);\n\n/**\n * Renders a combobox input element that can be used to filter a list of items.\n * @see https://ariakit.com/components/combobox\n * @example\n * ```jsx {2}\n * <ComboboxProvider>\n * <Combobox />\n * <ComboboxPopover>\n * <ComboboxItem value=\"Apple\" />\n * <ComboboxItem value=\"Banana\" />\n * <ComboboxItem value=\"Orange\" />\n * </ComboboxPopover>\n * </ComboboxProvider>\n * ```\n */\nexport const Combobox = forwardRef(function Combobox(props: ComboboxProps) {\n const htmlProps = useCombobox(props);\n return createElement(TagName, htmlProps);\n});\n\nexport interface ComboboxOptions<T extends ElementType = TagName>\n extends CompositeOptions<T>, PopoverAnchorOptions<T> {\n /**\n * Object returned by the\n * [`useComboboxStore`](https://ariakit.com/reference/use-combobox-store)\n * hook. If not provided, the closest\n * [`ComboboxProvider`](https://ariakit.com/reference/combobox-provider)\n * component's context will be used.\n */\n store?: ComboboxStore;\n /**\n * Determines if the first enabled item will be automatically focused when the\n * combobox input value changes. If set to `true` or `\"always\"`, the exact\n * behavior hinges on the value of the\n * [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete) prop:\n * - If [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete)\n * is `both` or `inline`, the first enabled item is automatically focused as\n * the user types in the input. The value gets appended with the completion\n * string if it matches. The inline completion string will be highlighted\n * and selected.\n * - If [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete)\n * is `list` or `none`, the first enabled item is automatically focused as\n * the user types in the input, but the input value is not appended with the\n * item value.\n *\n * If set to `\"always\"`, the first enabled item is auto-highlighted when the\n * combobox list opens, not just when the input value changes.\n *\n * To change which item gets auto-selected, use the\n * [`getAutoSelectId`](https://ariakit.com/reference/combobox#getautoselectid)\n * prop.\n *\n * Live examples:\n * - [Command Menu with\n * Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)\n * - [ComboboxGroup](https://ariakit.com/examples/combobox-group)\n * - [Combobox with links](https://ariakit.com/examples/combobox-links)\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * - [Menu with Combobox](https://ariakit.com/examples/menu-combobox)\n * - [Select with Combobox](https://ariakit.com/examples/select-combobox)\n * @default false\n */\n autoSelect?: boolean | \"always\";\n /**\n * Function that takes the currently rendered items and returns the id of the\n * item to be auto selected when the\n * [`autoSelect`](https://ariakit.com/reference/combobox#autoselect) prop is\n * `true`.\n *\n * By default, the first enabled item is auto selected. This function is handy\n * if you prefer a different item to be auto selected. Returning `undefined`\n * from this function will result in the default behavior.\n * @example\n * ```jsx\n * <Combobox\n * autoSelect\n * getAutoSelectId={(items) => {\n * // Auto select the first enabled item with a value\n * const item = items.find((item) => {\n * if (item.disabled) return false;\n * if (!item.value) return false;\n * return true;\n * });\n * return item?.id;\n * }}\n * />\n * ```\n */\n getAutoSelectId?: (\n renderedItems: ComboboxStoreState[\"renderedItems\"],\n ) => string | null | undefined;\n /**\n * Whether the items will be filtered based on\n * [`value`](https://ariakit.com/reference/combobox-provider#value) and\n * whether the input value will temporarily change based on the active item.\n *\n * This prop is based on the standard\n * [`aria-autocomplete`](https://w3c.github.io/aria/#aria-autocomplete)\n * attribute, accepting the same values:\n * - `list` (default): indicates that the items will be dynamically rendered\n * based on [`value`](https://ariakit.com/reference/combobox-provider#value)\n * and the input value will _not_ change based on the active item. The\n * filtering logic must be implemented by the consumer of this component.\n * - `inline`: indicates that the items are static, that is, they won't be\n * filtered, but the input value will temporarily change based on the active\n * item. Ariakit will automatically provide the inline autocompletion\n * behavior.\n * - `both`: indicates that the items will be dynamically rendered based on\n * [`value`](https://ariakit.com/reference/combobox-provider#value) and the\n * input value will temporarily change based on the active item. The\n * filtering logic must be implemented by the consumer of this component,\n * whereas Ariakit will automatically provide the inline autocompletion\n * behavior.\n * - `none`: the items are static and the input value will _not_ change based\n * on the active item.\n *\n * Live examples:\n * - [ComboboxGroup](https://ariakit.com/examples/combobox-group)\n * @default \"list\"\n */\n autoComplete?: StringWithValue<Required<AriaAttributes>[\"aria-autocomplete\"]>;\n /**\n * Determines if the highlighted item should lose focus when the user clicks\n * on the combobox input element. By default, this prop's value is set\n * according to the\n * [`includesBaseElement`](https://ariakit.com/reference/combobox-provider#includesbaseelement)\n * value.\n */\n blurActiveItemOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n /**\n * Specifies the minimum character count the input value should have before\n * the [`ComboboxList`](https://ariakit.com/reference/combobox-list) or\n * [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components are displayed.\n *\n * The [`showOnChange`](https://ariakit.com/reference/combobox#showonchange),\n * [`showOnClick`](https://ariakit.com/reference/combobox#showonclick), and\n * [`showOnKeyPress`](https://ariakit.com/reference/combobox#showonkeypress)\n * props allow you to tailor the behavior for each unique event.\n * @default 0\n * @example\n * In the following example, the combobox list will be shown when the input\n * value has at least one character. However, if the user presses the arrow\n * keys, the list will be shown regardless of the input value length.\n * ```jsx\n * <Combobox showMinLength={1} showOnKeyPress />\n * ```\n */\n showMinLength?: number;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the input value changes.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n * @example\n * ```jsx\n * <Combobox showOnChange={(event) => event.target.value.length > 1} />\n * ```\n */\n showOnChange?: BooleanOrCallback<ChangeEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the input is clicked.\n * @deprecated Use\n * [`showOnClick`](https://ariakit.com/reference/combobox#showonclick)\n * instead.\n * @default true\n */\n showOnMouseDown?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the input is clicked.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n * @example\n * ```jsx\n * <Combobox showOnClick={value.length > 1} />\n * ```\n */\n showOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the user presses the arrow up or down keys\n * while focusing on the combobox input element.\n * @deprecated Use\n * [`showOnKeyPress`](https://ariakit.com/reference/combobox#showonkeypress)\n * instead.\n * @default true\n */\n showOnKeyDown?: BooleanOrCallback<ReactKeyboardEvent<HTMLElement>>;\n /**\n * Whether the [`ComboboxList`](https://ariakit.com/reference/combobox-list)\n * or [`ComboboxPopover`](https://ariakit.com/reference/combobox-popover)\n * components should be shown when the user presses the arrow up or down keys\n * while focusing on the combobox input element.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n * @example\n * ```jsx\n * <Combobox showOnKeyPress={value.length > 1} />\n * ```\n */\n showOnKeyPress?: BooleanOrCallback<ReactKeyboardEvent<HTMLElement>>;\n /**\n * Whether the combobox\n * [`value`](https://ariakit.com/reference/combobox-provider#value) state\n * should be updated when the input value changes. This is useful if you want\n * to customize how the store\n * [`value`](https://ariakit.com/reference/combobox-provider#value) is updated\n * based on the input element's value.\n *\n * Live examples:\n * - [Textarea with inline\n * Combobox](https://ariakit.com/examples/combobox-textarea)\n * @default true\n */\n setValueOnChange?: BooleanOrCallback<ChangeEvent<HTMLElement>>;\n /**\n * Whether the combobox\n * [`value`](https://ariakit.com/reference/combobox-provider#value) state\n * should be updated when the combobox input element gets clicked. This\n * usually only applies when\n * [`autoComplete`](https://ariakit.com/reference/combobox#autocomplete) is\n * `both` or `inline`, because the input value will temporarily change based\n * on the active item and the store\n * [`value`](https://ariakit.com/reference/combobox-provider#value) will not\n * be updated until the user confirms the selection.\n * @default true\n */\n setValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;\n}\n\nexport type ComboboxProps<T extends ElementType = TagName> = Props<\n T,\n ComboboxOptions<T>\n>;\n"],"mappings":";;;;;;;;;;AAwDA,MAAA,UAAS;SAKF,wBAAmB,OAAA,aAAA,YAAA;CAExB,IAAA,CAAA,YADwB,OAAM;CAEhC,OAAA,MAAA,MAAA,SAAA,CAAA,KAAA,YAAA,KAAA,KAAA,GAAA,UAAA;AAEA;SACO,oBAAoB,OAAA,aAAA;CACzB,IAAI,CAAA,aAAS,OAAM;CACnB,IAAA,SAAQ,MAAA,OAAgB;CACxB,QACE,gBAAY,KAAS;CAGzB,OAAA,YAAA,SAAA,MAAA,UAAA,YAAA,YAAA,EAAA,QAAA,MAAA,YAAA,CAAA,MAAA;AAEA;SACS,aAAM,OAAS;CACxB,OAAA,MAAA,SAAA;AAEA;SAII,wBACA,OAAU;CAId,OAAA,UAAA,YAAA,UAAA,UAAA,UAAA,UAAA,UAAA;AAEA;SACe,uBAAqB,OAAA;QAC5B,MAAK,MAAA,SAAiB;EAG1B,IAAA,KAAO,UAAK,OAAS;EAEb,OAAG,KAAA,SAAA,aAAA,MA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AAA;EACX,IAAA,MAAA,kBAAA;CAKD,CAAA;CAEA,MAAM,KAAA,MAAA,MAAA,EAAmB;CAIzB,MAAM,mBAAe,wBAElB,YAAgB,IAAA,eACnB,KAAA;CAEA,MAAA,eAAQ,cAAA,QAAA,UAAA,MAAA,aAAA,IAAA;SACA;EACN,MAAA;EACA,qBAAiB;EACjB,iBAAiB,aAAA,gBAAA,SAAA;EACjB,iBAAiB;EACjB,iBAAA,gBAAoB;EACpB,oBAAA,gBAAA,KAAA;EACA;EACA,GAAA;EACA;EACA,KAAA,aAAA,KAAA,MAAA,GAAA;EACA;EACA;EACA;EACA;EACF;CAEA;SACE,aAAA;EACA;EACA;EAGA,GAAA;mBACM,UAAA;GACJ,IAAI,uBAAqB,gBAAI,KAAA,GAAA,OAAA;GAC7B,IAAA,QAAO,aAAA,IAAA;GACT,OAAA;EACD;CAED,CAAA;SAAoC,iBAAA;EAAO;EAAU,GAAA;CAErD,CAAA;QAAS;EAAqB,cAAG;EAAM,GAAA;CAE3C;;;;;;;;;;;;;;;;;MAmBE,WAAO,WAAc,SADH,SAAY,OACS;CACxC,OAAA,cAAA,SAAA,YAAA,KAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import { i as useCommand, n as CommandOptions, r as CommandProps, t as Command } from "../command-DckndCUK.js";
1
+ import { i as useCommand, n as CommandOptions, r as CommandProps, t as Command } from "../command-B9C8p3_S.js";
2
2
  export { Command, CommandOptions, CommandProps, useCommand };
@@ -1,4 +1,4 @@
1
- import { n as FocusableOptions } from "./focusable-B00tOxtB.js";
1
+ import { n as FocusableOptions } from "./focusable-dBZH13-T.js";
2
2
  import { Props } from "@ariakit/react-utils";
3
3
  import { ElementType } from "react";
4
4
 
@@ -34,7 +34,7 @@ declare const useCommand: import("@ariakit/react-utils").Hook<"button", CommandO
34
34
  * <Command>Button</Command>
35
35
  * ```
36
36
  */
37
- declare const Command: (props: CommandProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
37
+ declare const Command: (props: CommandProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
38
38
  interface CommandOptions<T extends ElementType = TagName> extends FocusableOptions<T> {
39
39
  /**
40
40
  * If set to `true`, pressing the enter key while this element is focused will
@@ -56,4 +56,4 @@ interface CommandOptions<T extends ElementType = TagName> extends FocusableOptio
56
56
  type CommandProps<T extends ElementType = TagName> = Props<T, CommandOptions<T>>;
57
57
  //#endregion
58
58
  export { useCommand as i, CommandOptions as n, CommandProps as r, Command as t };
59
- //# sourceMappingURL=command-DckndCUK.d.ts.map
59
+ //# sourceMappingURL=command-B9C8p3_S.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-DckndCUK.d.ts","names":["Props","ElementType","FocusableOptions","TagName","useCommand","CommandOptions","Hook","Command","CommandProps","props","ReactElement","JSXElementConstructor","T","clickOnEnter","clickOnSpace"],"sources":["../src/command/command.d.ts"],"mappings":";;;;;cAGcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFsC;;;;AAC9C;AAAA;;;;AACQ;AAY7B;AAdmE,cAc9CC,UAAAA,iCAA2CE,IAAAA,WAAeD,cAAc;;;AAAA;AAkB7F;;;;;;;;;AAAuI;AACvI;;;;cADqBE,OAAAA,GAAUE,KAAAA,EAAOD,YAAY,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACjGN,cAAAA,WAAyBJ,WAAAA,GAAcE,OAAAA,UAAiBD,gBAAAA,CAAiBU,CAAAA;EAAjBV;;;;;;;EAQrEW,YAAAA;EAAAA;;;AAQY;AAEhB;;;EAFIC,YAAAA;AAAAA;AAAAA,KAEQN,YAAAA,WAAuBP,WAAAA,GAAcE,OAAAA,IAAWH,KAAAA,CAAMY,CAAAA,EAAGP,cAAAA,CAAeO,CAAAA"}
1
+ {"version":3,"file":"command-B9C8p3_S.d.ts","names":["Props","ElementType","FocusableOptions","TagName","useCommand","CommandOptions","Hook","Command","CommandProps","props","ReactElement","JSXElementConstructor","T","clickOnEnter","clickOnSpace"],"sources":["../src/command/command.d.ts"],"mappings":";;;;;cAGcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFsC;;;;AAC9C;AAAA;;;;AACQ;AAY7B;AAdmE,cAc9CC,UAAAA,iCAA2CE,IAAAA,WAAeD,cAAc;;;AAAA;AAkB7F;;;;;;;;;AAA2I;AAC3I;;;;cADqBE,OAAAA,GAAUE,KAAAA,EAAOD,YAAY,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UACrGN,cAAAA,WAAyBJ,WAAAA,GAAcE,OAAAA,UAAiBD,gBAAAA,CAAiBU,CAAAA;EAAjBV;;;;;;;EAQrEW,YAAAA;EAAAA;;;AAQY;AAEhB;;;EAFIC,YAAAA;AAAAA;AAAAA,KAEQN,YAAAA,WAAuBP,WAAAA,GAAcE,OAAAA,IAAWH,KAAAA,CAAMY,CAAAA,EAAGP,cAAAA,CAAeO,CAAAA"}
@@ -41,7 +41,7 @@ declare const useCompositeContainer: import("@ariakit/react-utils").Hook<"div",
41
41
  * </CompositeProvider>
42
42
  * ```
43
43
  */
44
- declare const CompositeContainer: (props: CompositeContainerProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
44
+ declare const CompositeContainer: (props: CompositeContainerProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
45
45
  interface CompositeContainerOptions<_T extends ElementType = TagName> extends Options {
46
46
  /**
47
47
  * Object returned by the
@@ -1 +1 @@
1
- {"version":3,"file":"composite-container.d.ts","names":["Options","Props","ElementType","CompositeStore","TagName","useCompositeContainer","CompositeContainerOptions","Hook","CompositeContainer","CompositeContainerProps","props","ReactElement","JSXElementConstructor","_T","store","T"],"sources":["../../src/composite/composite-container.d.ts"],"mappings":";;;;;cAGcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAkB7B;;;;AAAgH;AAmBhH;;AAvC2D,cAoBtCC,qBAAAA,iCAAsDE,IAAAA,QAAYD,yBAAyB;;;;;;;AAmB6C;AAC7J;;;;;;;;;;;cADqBE,kBAAAA,GAAqBE,KAAAA,EAAOD,uBAAuB,qBAAqBE,YAAAA,+BAA2CC,qBAAAA;AAAAA,UACvHN,yBAAAA,YAAqCJ,WAAAA,GAAcE,OAAAA,UAAiBJ,OAAAA;EASjFc;;;AAAsB;AAE1B;;;;EAFIA,KAAAA,GAAQX,cAAAA;AAAAA;AAAAA,KAEAM,uBAAAA,WAAkCP,WAAAA,GAAcE,OAAAA,IAAWH,KAAAA,CAAMc,CAAAA,EAAGT,yBAAAA,CAA0BS,CAAAA"}
1
+ {"version":3,"file":"composite-container.d.ts","names":["Options","Props","ElementType","CompositeStore","TagName","useCompositeContainer","CompositeContainerOptions","Hook","CompositeContainer","CompositeContainerProps","props","ReactElement","JSXElementConstructor","_T","store","T"],"sources":["../../src/composite/composite-container.d.ts"],"mappings":";;;;;cAGcI,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAF8B;;;;AACtC;AAAA;;;;AACQ;AAkB7B;;;;AAAgH;AAmBhH;;AAvC2D,cAoBtCC,qBAAAA,iCAAsDE,IAAAA,QAAYD,yBAAyB;;;;;;;AAmBiD;AACjK;;;;;;;;;;;cADqBE,kBAAAA,GAAqBE,KAAAA,EAAOD,uBAAuB,qBAAqBE,YAAAA,mCAA+CC,qBAAAA;AAAAA,UAC3HN,yBAAAA,YAAqCJ,WAAAA,GAAcE,OAAAA,UAAiBJ,OAAAA;EASjFc;;;AAAsB;AAE1B;;;;EAFIA,KAAAA,GAAQX,cAAAA;AAAAA;AAAAA,KAEAM,uBAAAA,WAAkCP,WAAAA,GAAcE,OAAAA,IAAWH,KAAAA,CAAMc,CAAAA,EAAGT,yBAAAA,CAA0BS,CAAAA"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useCompositeContext } from "./composite-context.js";
2
+ import { useCompositeScopedContext } from "./composite-context.js";
3
3
  import { selectTextField } from "./utils.js";
4
4
  import { createElement, createHook, forwardRef, useEvent, useMergeRefs } from "@ariakit/react-utils";
5
5
  import { disableFocusIn, getFirstTabbableIn, isButton, isFocusEventOutside, isSelfTarget, isTextField, removeUndefinedValues, restoreFocusIn } from "@ariakit/utils";
@@ -31,7 +31,7 @@ function getFirstTabbable(container) {
31
31
  * ```
32
32
  */
33
33
  const useCompositeContainer = createHook(function useCompositeContainer({ store, ...props }) {
34
- const context = useCompositeContext();
34
+ const context = useCompositeScopedContext();
35
35
  store = store || context;
36
36
  const ref = useRef(null);
37
37
  const isOpenRef = useRef(false);