@ariakit/react-core 0.2.10 → 0.2.12

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 (531) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/cjs/__chunks/{XLXQVPCB.cjs → 2UFB2Z36.cjs} +24 -24
  3. package/cjs/__chunks/{E7WI5NX3.cjs → 3OCFY7CV.cjs} +8 -8
  4. package/cjs/__chunks/{QNLWLTET.cjs → 5UCVOKTG.cjs} +10 -10
  5. package/cjs/__chunks/5VOPA6D3.cjs +17 -0
  6. package/cjs/__chunks/{FHX4GO67.cjs → 5WLTMVVQ.cjs} +5 -5
  7. package/cjs/__chunks/{7BSXU2OL.cjs → 622BTGVD.cjs} +6 -6
  8. package/cjs/__chunks/{F2RJFRP2.cjs → 63P5JKLZ.cjs} +6 -6
  9. package/cjs/__chunks/6MKUVCEN.cjs +36 -0
  10. package/cjs/__chunks/6OTNLVJI.cjs +185 -0
  11. package/cjs/__chunks/{2KYUOSJ4.cjs → 7WUTS26Y.cjs} +3 -3
  12. package/cjs/__chunks/{GET3PZI4.cjs → A764D2YK.cjs} +28 -28
  13. package/cjs/__chunks/{GLPDHAGY.cjs → AD4BY53T.cjs} +7 -7
  14. package/cjs/__chunks/{HP2YFIDE.cjs → AU2JPBQE.cjs} +69 -39
  15. package/cjs/__chunks/{C5W4YO2W.cjs → BEGWNNXK.cjs} +8 -8
  16. package/cjs/__chunks/{RHFHMA7V.cjs → BJRJETRD.cjs} +8 -8
  17. package/cjs/__chunks/{4D7KCBQD.cjs → BNTTY6EA.cjs} +8 -8
  18. package/cjs/__chunks/BQZLBPPT.cjs +33 -0
  19. package/cjs/__chunks/CWY2PHPR.cjs +84 -0
  20. package/cjs/__chunks/{NAE74ZUF.cjs → DGSPHMOA.cjs} +6 -6
  21. package/cjs/__chunks/{FO43SNUQ.cjs → DIRRJVY5.cjs} +6 -6
  22. package/cjs/__chunks/{4CQBSK3W.cjs → ELOQI33M.cjs} +2 -2
  23. package/cjs/__chunks/{KQYBSO76.cjs → EQO3IFY4.cjs} +23 -31
  24. package/cjs/__chunks/{VBCPMROZ.cjs → ESIBWLXM.cjs} +10 -10
  25. package/cjs/__chunks/{GQUXK6V2.cjs → F4UT5TWU.cjs} +3 -3
  26. package/cjs/__chunks/{6Y7OJ66S.cjs → FLQEWPZR.cjs} +18 -18
  27. package/cjs/__chunks/{GXCVLZ7W.cjs → G6F4DPHM.cjs} +8 -8
  28. package/cjs/__chunks/{DIUUZQDC.cjs → GD2R4HJS.cjs} +10 -10
  29. package/cjs/__chunks/{SDW7WM6J.cjs → GHDSJPDP.cjs} +14 -14
  30. package/cjs/__chunks/{LBYC2WX6.cjs → GTZQOSRG.cjs} +10 -10
  31. package/cjs/__chunks/{CEDXB2ML.cjs → H76HM4AM.cjs} +11 -11
  32. package/cjs/__chunks/{ZEJ6SJAQ.cjs → HSS2CWT5.cjs} +3 -3
  33. package/cjs/__chunks/{HTXMZNNP.cjs → HUVFPCMZ.cjs} +8 -8
  34. package/cjs/__chunks/{OKM7CARK.cjs → HZ3BY4NC.cjs} +18 -18
  35. package/cjs/__chunks/{EYNBXS3C.cjs → I4FGWKS7.cjs} +24 -24
  36. package/cjs/__chunks/{FIEVSSEV.cjs → I4JDDV3V.cjs} +17 -17
  37. package/cjs/__chunks/{QSYK4F2U.cjs → IXZRUZTM.cjs} +17 -17
  38. package/cjs/__chunks/{4JALWV3V.cjs → IY72JWXE.cjs} +8 -8
  39. package/cjs/__chunks/{PZBTPQEZ.cjs → JNS4G3MN.cjs} +49 -44
  40. package/cjs/__chunks/JPSESJ6Y.cjs +32 -0
  41. package/cjs/__chunks/{WKQDBSB7.cjs → KC75EM3D.cjs} +9 -9
  42. package/cjs/__chunks/{TEOWWOVH.cjs → LCJP3BHK.cjs} +15 -15
  43. package/cjs/__chunks/{DFJJN2WM.cjs → MAD3AOPL.cjs} +14 -14
  44. package/cjs/__chunks/MCXTUISZ.cjs +711 -0
  45. package/cjs/__chunks/{EE7FGSYL.cjs → N2KSMVA7.cjs} +11 -11
  46. package/cjs/__chunks/{GJ2WWSXI.cjs → NXDHPYNQ.cjs} +11 -11
  47. package/cjs/__chunks/{6AEXHJIC.cjs → OHQG6SR6.cjs} +9 -9
  48. package/cjs/__chunks/{6WLP7YXF.cjs → OSQTQ6OF.cjs} +16 -16
  49. package/cjs/__chunks/{ZEDBIWF2.cjs → P3RGUF6X.cjs} +43 -37
  50. package/cjs/__chunks/{DFOWRKWT.cjs → PH57JDIM.cjs} +12 -12
  51. package/cjs/__chunks/{XIQNHQGW.cjs → PHGHRT2Q.cjs} +14 -14
  52. package/cjs/__chunks/{TO7FN64N.cjs → Q5EWS32Z.cjs} +11 -11
  53. package/cjs/__chunks/{ZKPH2VTW.cjs → QR3ATHWU.cjs} +7 -7
  54. package/cjs/__chunks/{7KKRNI4T.cjs → RA27OSF6.cjs} +4 -4
  55. package/cjs/__chunks/{NTZOVT4I.cjs → RSID6YP2.cjs} +8 -8
  56. package/cjs/__chunks/{4AQRNZQ7.cjs → RXCUKHX3.cjs} +9 -9
  57. package/cjs/__chunks/{VQHQDEFP.cjs → SIVNE3PR.cjs} +24 -13
  58. package/cjs/__chunks/{RQ3E2DZB.cjs → SZTCN3SG.cjs} +13 -13
  59. package/cjs/__chunks/{OHOMAAYP.cjs → T23EIXNF.cjs} +8 -8
  60. package/cjs/__chunks/{DBGYOVEJ.cjs → TNMPOEZG.cjs} +6 -6
  61. package/cjs/__chunks/{HM3GZVEF.cjs → TQ2AADTY.cjs} +19 -19
  62. package/cjs/__chunks/{364WU3DX.cjs → UVTMAR7N.cjs} +14 -14
  63. package/cjs/__chunks/{ZH4AYXKM.cjs → VBRBBWCP.cjs} +15 -15
  64. package/cjs/__chunks/{UU6GKP2M.cjs → VDYEYEEN.cjs} +6 -6
  65. package/cjs/__chunks/{SG4GNYMD.cjs → VWNFXJXN.cjs} +23 -15
  66. package/cjs/__chunks/{MOOOVIIV.cjs → W6IHBXQD.cjs} +6 -6
  67. package/cjs/__chunks/{PCBWFI66.cjs → W7ZAKGYJ.cjs} +8 -8
  68. package/cjs/__chunks/{N6LDQVMC.cjs → WWIZUBSB.cjs} +14 -14
  69. package/cjs/__chunks/{Z3TKBZHL.cjs → X3SZBNVV.cjs} +19 -19
  70. package/cjs/__chunks/{YMIV6HNY.cjs → X44H72BI.cjs} +5 -5
  71. package/cjs/__chunks/{WZI5KRRI.cjs → XE2DJMCI.cjs} +3 -3
  72. package/cjs/__chunks/{G2UKCWYO.cjs → YMZPP75I.cjs} +8 -8
  73. package/cjs/__chunks/{UNFAA7SH.cjs → YPXV3X22.cjs} +19 -19
  74. package/cjs/__chunks/ZECYRUVH.cjs +33 -0
  75. package/cjs/button/button.cjs +8 -8
  76. package/cjs/checkbox/checkbox-check.cjs +6 -6
  77. package/cjs/checkbox/checkbox-checked-context.cjs +1 -1
  78. package/cjs/checkbox/checkbox-store.cjs +6 -6
  79. package/cjs/checkbox/checkbox.cjs +9 -9
  80. package/cjs/collection/collection-context.cjs +1 -1
  81. package/cjs/collection/collection-item.cjs +6 -6
  82. package/cjs/collection/collection-renderer.cjs +18 -0
  83. package/cjs/collection/collection-renderer.d.ts +449 -0
  84. package/cjs/collection/collection-store.cjs +6 -6
  85. package/cjs/collection/collection.cjs +9 -9
  86. package/cjs/combobox/combobox-cancel.cjs +14 -14
  87. package/cjs/combobox/combobox-context.cjs +1 -1
  88. package/cjs/combobox/combobox-disclosure.cjs +17 -17
  89. package/cjs/combobox/combobox-group-label.cjs +10 -10
  90. package/cjs/combobox/combobox-group.cjs +10 -10
  91. package/cjs/combobox/combobox-item-value.cjs +9 -9
  92. package/cjs/combobox/combobox-item.cjs +25 -25
  93. package/cjs/combobox/combobox-list.cjs +8 -8
  94. package/cjs/combobox/combobox-popover.cjs +30 -30
  95. package/cjs/combobox/combobox-row.cjs +12 -12
  96. package/cjs/combobox/combobox-separator.cjs +12 -12
  97. package/cjs/combobox/combobox-store.cjs +15 -15
  98. package/cjs/combobox/combobox.cjs +68 -61
  99. package/cjs/command/command.cjs +7 -7
  100. package/cjs/composite/composite-container.cjs +8 -8
  101. package/cjs/composite/composite-context.cjs +3 -3
  102. package/cjs/composite/composite-context.d.ts +8 -4
  103. package/cjs/composite/composite-group-label.cjs +7 -7
  104. package/cjs/composite/composite-group.cjs +7 -7
  105. package/cjs/composite/composite-hover.cjs +7 -7
  106. package/cjs/composite/composite-input.cjs +6 -6
  107. package/cjs/composite/composite-item.cjs +11 -11
  108. package/cjs/composite/composite-overflow-disclosure.cjs +25 -25
  109. package/cjs/composite/composite-overflow-store.cjs +11 -11
  110. package/cjs/composite/composite-overflow.cjs +33 -33
  111. package/cjs/composite/composite-renderer.cjs +21 -0
  112. package/cjs/composite/composite-renderer.d.ts +317 -0
  113. package/cjs/composite/composite-row.cjs +7 -7
  114. package/cjs/composite/composite-separator.cjs +8 -8
  115. package/cjs/composite/composite-store.cjs +7 -7
  116. package/cjs/composite/composite-typeahead.cjs +7 -7
  117. package/cjs/composite/composite.cjs +8 -8
  118. package/cjs/composite/utils.cjs +1 -1
  119. package/cjs/dialog/dialog-backdrop.cjs +10 -10
  120. package/cjs/dialog/dialog-context.cjs +1 -1
  121. package/cjs/dialog/dialog-description.cjs +6 -6
  122. package/cjs/dialog/dialog-disclosure.cjs +10 -10
  123. package/cjs/dialog/dialog-dismiss.cjs +9 -9
  124. package/cjs/dialog/dialog-heading.cjs +7 -7
  125. package/cjs/dialog/dialog-store.cjs +7 -7
  126. package/cjs/dialog/dialog.cjs +23 -23
  127. package/cjs/dialog/utils/disable-accessibility-tree-outside.cjs +1 -1
  128. package/cjs/dialog/utils/disable-tree-outside.cjs +4 -4
  129. package/cjs/dialog/utils/is-backdrop.cjs +1 -1
  130. package/cjs/dialog/utils/mark-tree-outside.cjs +1 -1
  131. package/cjs/dialog/utils/orchestrate.cjs +1 -1
  132. package/cjs/dialog/utils/prepend-hidden-dismiss.cjs +1 -1
  133. package/cjs/dialog/utils/supports-inert.cjs +1 -1
  134. package/cjs/dialog/utils/use-hide-on-interact-outside.cjs +6 -6
  135. package/cjs/dialog/utils/use-nested-dialogs.cjs +5 -5
  136. package/cjs/dialog/utils/use-prevent-body-scroll.cjs +6 -6
  137. package/cjs/dialog/utils/use-previous-mouse-down-ref.cjs +1 -1
  138. package/cjs/dialog/utils/use-root-dialog.cjs +5 -5
  139. package/cjs/dialog/utils/walk-tree-outside.cjs +1 -1
  140. package/cjs/disclosure/disclosure-content.cjs +6 -6
  141. package/cjs/disclosure/disclosure-store.cjs +6 -6
  142. package/cjs/disclosure/disclosure.cjs +9 -9
  143. package/cjs/focus-trap/focus-trap-region.cjs +14 -14
  144. package/cjs/focus-trap/focus-trap.cjs +7 -7
  145. package/cjs/focusable/focusable-container.cjs +6 -6
  146. package/cjs/focusable/focusable-context.cjs +1 -1
  147. package/cjs/focusable/focusable.cjs +6 -6
  148. package/cjs/form/form-checkbox.cjs +18 -18
  149. package/cjs/form/form-context.cjs +1 -1
  150. package/cjs/form/form-description.cjs +14 -14
  151. package/cjs/form/form-error.cjs +14 -14
  152. package/cjs/form/form-field.cjs +7 -7
  153. package/cjs/form/form-group-label.cjs +10 -10
  154. package/cjs/form/form-group.cjs +7 -7
  155. package/cjs/form/form-input.cjs +15 -15
  156. package/cjs/form/form-label.cjs +18 -18
  157. package/cjs/form/form-push.cjs +17 -17
  158. package/cjs/form/form-radio-group.cjs +12 -12
  159. package/cjs/form/form-radio.cjs +20 -20
  160. package/cjs/form/form-remove.cjs +14 -14
  161. package/cjs/form/form-reset.cjs +13 -13
  162. package/cjs/form/form-store.cjs +14 -14
  163. package/cjs/form/form-submit.cjs +13 -13
  164. package/cjs/form/form.cjs +17 -17
  165. package/cjs/group/group-label-context.cjs +1 -1
  166. package/cjs/group/group-label.cjs +6 -6
  167. package/cjs/group/group.cjs +6 -6
  168. package/cjs/heading/heading-context.cjs +1 -1
  169. package/cjs/heading/heading-level.cjs +1 -1
  170. package/cjs/heading/heading.cjs +6 -6
  171. package/cjs/hovercard/hovercard-anchor.cjs +7 -7
  172. package/cjs/hovercard/hovercard-arrow.cjs +9 -9
  173. package/cjs/hovercard/hovercard-description.cjs +8 -8
  174. package/cjs/hovercard/hovercard-disclosure.cjs +22 -22
  175. package/cjs/hovercard/hovercard-dismiss.cjs +11 -11
  176. package/cjs/hovercard/hovercard-heading.cjs +9 -9
  177. package/cjs/hovercard/hovercard-store.cjs +9 -9
  178. package/cjs/hovercard/hovercard.cjs +25 -25
  179. package/cjs/hovercard/utils/debug-polygon.cjs +1 -1
  180. package/cjs/hovercard/utils/polygon.cjs +1 -1
  181. package/cjs/index.cjs +1 -1
  182. package/cjs/menu/menu-arrow.cjs +9 -9
  183. package/cjs/menu/menu-bar-store.cjs +10 -10
  184. package/cjs/menu/menu-bar.cjs +14 -14
  185. package/cjs/menu/menu-button-arrow.cjs +10 -10
  186. package/cjs/menu/menu-button.cjs +32 -32
  187. package/cjs/menu/menu-context.cjs +1 -1
  188. package/cjs/menu/menu-description.cjs +11 -11
  189. package/cjs/menu/menu-dismiss.cjs +14 -14
  190. package/cjs/menu/menu-group-label.cjs +10 -10
  191. package/cjs/menu/menu-group.cjs +10 -10
  192. package/cjs/menu/menu-heading.cjs +12 -12
  193. package/cjs/menu/menu-item-check.cjs +10 -10
  194. package/cjs/menu/menu-item-checkbox.cjs +23 -23
  195. package/cjs/menu/menu-item-radio.cjs +22 -22
  196. package/cjs/menu/menu-item.cjs +14 -14
  197. package/cjs/menu/menu-list.cjs +12 -12
  198. package/cjs/menu/menu-separator.cjs +11 -11
  199. package/cjs/menu/menu-store.cjs +17 -17
  200. package/cjs/menu/menu.cjs +42 -42
  201. package/cjs/menu/utils.cjs +1 -1
  202. package/cjs/popover/popover-anchor.cjs +6 -6
  203. package/cjs/popover/popover-arrow-path.cjs +1 -1
  204. package/cjs/popover/popover-arrow.cjs +6 -6
  205. package/cjs/popover/popover-context.cjs +1 -1
  206. package/cjs/popover/popover-description.cjs +7 -7
  207. package/cjs/popover/popover-disclosure-arrow.cjs +6 -6
  208. package/cjs/popover/popover-disclosure.cjs +12 -12
  209. package/cjs/popover/popover-dismiss.cjs +10 -10
  210. package/cjs/popover/popover-heading.cjs +8 -8
  211. package/cjs/popover/popover-store.cjs +8 -8
  212. package/cjs/popover/popover.cjs +24 -24
  213. package/cjs/portal/portal-context.cjs +1 -1
  214. package/cjs/portal/portal.cjs +8 -8
  215. package/cjs/radio/radio-context.cjs +1 -1
  216. package/cjs/radio/radio-group.cjs +14 -14
  217. package/cjs/radio/radio-store.cjs +10 -10
  218. package/cjs/radio/radio.cjs +12 -12
  219. package/cjs/role/role.cjs +6 -6
  220. package/cjs/select/select-arrow.cjs +7 -7
  221. package/cjs/select/select-context.cjs +1 -1
  222. package/cjs/select/select-group-label.cjs +10 -10
  223. package/cjs/select/select-group.cjs +10 -10
  224. package/cjs/select/select-item-check.cjs +10 -10
  225. package/cjs/select/select-item.cjs +39 -38
  226. package/cjs/select/select-label.cjs +13 -13
  227. package/cjs/select/select-list.cjs +11 -11
  228. package/cjs/select/select-popover.cjs +33 -33
  229. package/cjs/select/select-renderer.cjs +110 -0
  230. package/cjs/select/select-renderer.d.ts +32 -0
  231. package/cjs/select/select-row.cjs +12 -12
  232. package/cjs/select/select-separator.cjs +11 -11
  233. package/cjs/select/select-store.cjs +15 -15
  234. package/cjs/select/select.cjs +31 -31
  235. package/cjs/separator/separator.cjs +6 -6
  236. package/cjs/tab/tab-context.cjs +1 -1
  237. package/cjs/tab/tab-list.cjs +14 -14
  238. package/cjs/tab/tab-panel.cjs +21 -21
  239. package/cjs/tab/tab-store.cjs +13 -13
  240. package/cjs/tab/tab.cjs +19 -19
  241. package/cjs/toolbar/toolbar-container.cjs +18 -18
  242. package/cjs/toolbar/toolbar-context.cjs +1 -1
  243. package/cjs/toolbar/toolbar-input.cjs +18 -18
  244. package/cjs/toolbar/toolbar-item.cjs +12 -12
  245. package/cjs/toolbar/toolbar-separator.cjs +11 -11
  246. package/cjs/toolbar/toolbar-store.cjs +10 -10
  247. package/cjs/toolbar/toolbar.cjs +14 -14
  248. package/cjs/tooltip/tooltip-anchor.cjs +14 -14
  249. package/cjs/tooltip/tooltip-arrow.cjs +10 -10
  250. package/cjs/tooltip/tooltip-context.cjs +1 -1
  251. package/cjs/tooltip/tooltip-store.cjs +14 -14
  252. package/cjs/tooltip/tooltip.cjs +31 -31
  253. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  254. package/cjs/utils/hooks.cjs +4 -4
  255. package/cjs/utils/misc.cjs +3 -3
  256. package/cjs/utils/store.cjs +5 -5
  257. package/cjs/utils/system.cjs +9 -5
  258. package/cjs/utils/system.d.ts +13 -4
  259. package/cjs/visually-hidden/visually-hidden.cjs +6 -6
  260. package/collection/collection-renderer/package.json +8 -0
  261. package/composite/composite-renderer/package.json +8 -0
  262. package/esm/__chunks/{WYH7HZPL.js → 2NIRKFVH.js} +3 -3
  263. package/esm/__chunks/{LC6BW35W.js → 37OBPWF6.js} +2 -2
  264. package/esm/__chunks/{RU5SBKR3.js → 3LAWLNOX.js} +3 -3
  265. package/esm/__chunks/{OYQC776W.js → 43VDSLJP.js} +3 -3
  266. package/esm/__chunks/{TQ2K6WFI.js → 4GZAUH66.js} +4 -4
  267. package/esm/__chunks/{TZIIKRHF.js → 4PKIGBPJ.js} +1 -1
  268. package/esm/__chunks/{VV72RDTD.js → 4XWTU3WN.js} +5 -5
  269. package/esm/__chunks/{LIFXUQPU.js → 53MSBYTF.js} +5 -5
  270. package/esm/__chunks/{2XOPWNSQ.js → 54LBRJ55.js} +2 -2
  271. package/esm/__chunks/{KF3PP2P3.js → 5I6BQS7D.js} +3 -3
  272. package/esm/__chunks/{ZTW46EPJ.js → 5QJYOWLQ.js} +3 -3
  273. package/esm/__chunks/{VSM5JGQO.js → 5WJWIOBD.js} +2 -2
  274. package/esm/__chunks/{KQUSQ6BH.js → 6DS7ZDWX.js} +2 -2
  275. package/esm/__chunks/{JQVGLAS2.js → 6FAQA4RZ.js} +3 -3
  276. package/esm/__chunks/{N2JKXTRW.js → 6FRHNZA6.js} +3 -3
  277. package/esm/__chunks/{5AXDCOCY.js → 6YH4Z35H.js} +3 -3
  278. package/esm/__chunks/{5NQLWI7E.js → 7PHM3O7I.js} +3 -3
  279. package/esm/__chunks/{ZZBJOUY4.js → AAVDGJD5.js} +10 -10
  280. package/esm/__chunks/{Y72RMTFY.js → AUUE7U2H.js} +3 -3
  281. package/esm/__chunks/{N36XUJ4I.js → BB7NHN6A.js} +4 -4
  282. package/esm/__chunks/{FYZCYWPI.js → BHLCYMUN.js} +5 -5
  283. package/esm/__chunks/{77C2ITJF.js → BO7WPTZZ.js} +5 -5
  284. package/esm/__chunks/{PYB45PRS.js → CJI67A3R.js} +1 -1
  285. package/esm/__chunks/{UWUL6FFR.js → CP3U4HPL.js} +1 -1
  286. package/esm/__chunks/{P3IT4SS7.js → CTVLGQZG.js} +3 -3
  287. package/esm/__chunks/{QLHYK3GC.js → D3IXN5NP.js} +2 -2
  288. package/esm/__chunks/{XECTFJQS.js → DTAO6DRL.js} +21 -16
  289. package/esm/__chunks/{B2QL7O62.js → EJ3GIT5B.js} +3 -3
  290. package/esm/__chunks/{SQCQXOYX.js → EQKKLUXV.js} +9 -9
  291. package/esm/__chunks/{ZSRI7KJ2.js → F4XABKPL.js} +4 -4
  292. package/esm/__chunks/{USB5JBON.js → FHQZ2KRN.js} +2 -2
  293. package/esm/__chunks/{K4NEG23J.js → FL2AU7YJ.js} +2 -2
  294. package/esm/__chunks/{5OP64YHR.js → GMWLPVWD.js} +1 -1
  295. package/esm/__chunks/{EJLZ2L22.js → HGFTMLQ7.js} +18 -7
  296. package/esm/__chunks/{UGE3SLMW.js → HIJMOAZK.js} +15 -7
  297. package/esm/__chunks/{MO5Q5FB7.js → HRXPFA6C.js} +2 -2
  298. package/esm/__chunks/{QTPMBYCP.js → I3PXTXPI.js} +4 -4
  299. package/esm/__chunks/{GKH7N3JM.js → IYNN2ZO5.js} +3 -3
  300. package/esm/__chunks/{TAQP627X.js → IZVL3EAG.js} +2 -2
  301. package/esm/__chunks/{SN2N5P2D.js → J7Q2EO23.js} +2 -2
  302. package/esm/__chunks/{QDYEK6IR.js → JFHRFFJJ.js} +3 -3
  303. package/esm/__chunks/{OTMCQXXR.js → LDJKN2ZV.js} +4 -4
  304. package/esm/__chunks/{ENZR4N3P.js → LL3AE4N4.js} +5 -5
  305. package/esm/__chunks/{IZJZD7LX.js → LOJQ7RPL.js} +3 -3
  306. package/esm/__chunks/{WMY7U3GW.js → LVMO37QD.js} +2 -2
  307. package/esm/__chunks/{HE7AYLA4.js → MEP5WKMB.js} +4 -4
  308. package/esm/__chunks/{YNUPNUID.js → MYID4V27.js} +3 -3
  309. package/esm/__chunks/{7GCARSHZ.js → NQJBHION.js} +20 -8
  310. package/esm/__chunks/{DJLHFG5J.js → NRNLVKYP.js} +7 -7
  311. package/esm/__chunks/{EUD77B6Z.js → O6CV6VRM.js} +4 -4
  312. package/esm/__chunks/{J4BKICPJ.js → OEA63YXU.js} +1 -1
  313. package/esm/__chunks/{ACET4OGQ.js → OK4RCQBZ.js} +3 -3
  314. package/esm/__chunks/{WQIYBPAY.js → P4RGQGTG.js} +4 -4
  315. package/esm/__chunks/{2NDM3R77.js → P634EF77.js} +5 -5
  316. package/esm/__chunks/PE45DLWW.js +711 -0
  317. package/esm/__chunks/{5DAYRSML.js → QHXLY5NM.js} +4 -4
  318. package/esm/__chunks/{NW5OKUH5.js → ROOVOZJF.js} +2 -2
  319. package/esm/__chunks/{FK3LYGHG.js → RY6ZOIHR.js} +4 -4
  320. package/esm/__chunks/{XJM2RD5W.js → SAES3ZFU.js} +27 -21
  321. package/esm/__chunks/{B3A7CWGN.js → SRHDWRFI.js} +2 -2
  322. package/esm/__chunks/{XGUNEAFA.js → SWPAMWUW.js} +3 -3
  323. package/esm/__chunks/{TWSODZ43.js → TALTYI5G.js} +3 -3
  324. package/esm/__chunks/TLXPUO3M.js +185 -0
  325. package/esm/__chunks/{VTOOL4S4.js → W5P7IKOU.js} +4 -4
  326. package/esm/__chunks/{E32RAHMA.js → WFK3YK7D.js} +46 -16
  327. package/esm/__chunks/{WFPVIVLA.js → WHEEIXMF.js} +3 -3
  328. package/esm/__chunks/{Z3X3QN6P.js → WJ37OVG2.js} +7 -3
  329. package/esm/__chunks/{3O3K4H2I.js → WW4JQU6W.js} +2 -2
  330. package/esm/__chunks/{EL4DJS34.js → X2PAO7C6.js} +5 -5
  331. package/esm/__chunks/{3NSZ5Q7K.js → X3U3KZAU.js} +7 -15
  332. package/esm/__chunks/{SHUCKX4V.js → YAQX4NUA.js} +3 -3
  333. package/esm/__chunks/{AF6MSKOW.js → YSASCXX3.js} +3 -3
  334. package/esm/__chunks/{XPRWPHQV.js → YUYDGNXZ.js} +5 -5
  335. package/esm/button/button.js +7 -7
  336. package/esm/checkbox/checkbox-check.js +5 -5
  337. package/esm/checkbox/checkbox-checked-context.js +1 -1
  338. package/esm/checkbox/checkbox-store.js +5 -5
  339. package/esm/checkbox/checkbox.js +8 -8
  340. package/esm/collection/collection-context.js +1 -1
  341. package/esm/collection/collection-item.js +5 -5
  342. package/esm/collection/collection-renderer.d.ts +449 -0
  343. package/esm/collection/collection-renderer.js +18 -0
  344. package/esm/collection/collection-store.js +5 -5
  345. package/esm/collection/collection.js +4 -4
  346. package/esm/combobox/combobox-cancel.js +7 -7
  347. package/esm/combobox/combobox-context.js +1 -1
  348. package/esm/combobox/combobox-disclosure.js +9 -9
  349. package/esm/combobox/combobox-group-label.js +6 -6
  350. package/esm/combobox/combobox-group.js +6 -6
  351. package/esm/combobox/combobox-item-value.js +4 -4
  352. package/esm/combobox/combobox-item.js +11 -11
  353. package/esm/combobox/combobox-list.js +7 -7
  354. package/esm/combobox/combobox-popover.js +24 -24
  355. package/esm/combobox/combobox-row.js +6 -6
  356. package/esm/combobox/combobox-separator.js +7 -7
  357. package/esm/combobox/combobox-store.js +9 -9
  358. package/esm/combobox/combobox.js +42 -35
  359. package/esm/command/command.js +6 -6
  360. package/esm/composite/composite-container.js +7 -7
  361. package/esm/composite/composite-context.d.ts +8 -4
  362. package/esm/composite/composite-context.js +2 -2
  363. package/esm/composite/composite-group-label.js +6 -6
  364. package/esm/composite/composite-group.js +6 -6
  365. package/esm/composite/composite-hover.js +6 -6
  366. package/esm/composite/composite-input.js +5 -5
  367. package/esm/composite/composite-item.js +10 -10
  368. package/esm/composite/composite-overflow-disclosure.js +15 -15
  369. package/esm/composite/composite-overflow-store.js +7 -7
  370. package/esm/composite/composite-overflow.js +23 -23
  371. package/esm/composite/composite-renderer.d.ts +317 -0
  372. package/esm/composite/composite-renderer.js +21 -0
  373. package/esm/composite/composite-row.js +6 -6
  374. package/esm/composite/composite-separator.js +7 -7
  375. package/esm/composite/composite-store.js +6 -6
  376. package/esm/composite/composite-typeahead.js +6 -6
  377. package/esm/composite/composite.js +7 -7
  378. package/esm/composite/utils.js +1 -1
  379. package/esm/dialog/dialog-backdrop.js +9 -9
  380. package/esm/dialog/dialog-context.js +1 -1
  381. package/esm/dialog/dialog-description.js +5 -5
  382. package/esm/dialog/dialog-disclosure.js +9 -9
  383. package/esm/dialog/dialog-dismiss.js +8 -8
  384. package/esm/dialog/dialog-heading.js +6 -6
  385. package/esm/dialog/dialog-store.js +6 -6
  386. package/esm/dialog/dialog.js +22 -22
  387. package/esm/dialog/utils/disable-accessibility-tree-outside.js +1 -1
  388. package/esm/dialog/utils/disable-tree-outside.js +3 -3
  389. package/esm/dialog/utils/is-backdrop.js +1 -1
  390. package/esm/dialog/utils/mark-tree-outside.js +1 -1
  391. package/esm/dialog/utils/orchestrate.js +1 -1
  392. package/esm/dialog/utils/prepend-hidden-dismiss.js +1 -1
  393. package/esm/dialog/utils/supports-inert.js +1 -1
  394. package/esm/dialog/utils/use-hide-on-interact-outside.js +5 -5
  395. package/esm/dialog/utils/use-nested-dialogs.js +4 -4
  396. package/esm/dialog/utils/use-prevent-body-scroll.js +5 -5
  397. package/esm/dialog/utils/use-previous-mouse-down-ref.js +1 -1
  398. package/esm/dialog/utils/use-root-dialog.js +4 -4
  399. package/esm/dialog/utils/walk-tree-outside.js +1 -1
  400. package/esm/disclosure/disclosure-content.js +5 -5
  401. package/esm/disclosure/disclosure-store.js +5 -5
  402. package/esm/disclosure/disclosure.js +8 -8
  403. package/esm/focus-trap/focus-trap-region.js +6 -6
  404. package/esm/focus-trap/focus-trap.js +6 -6
  405. package/esm/focusable/focusable-container.js +5 -5
  406. package/esm/focusable/focusable-context.js +1 -1
  407. package/esm/focusable/focusable.js +5 -5
  408. package/esm/form/form-checkbox.js +11 -11
  409. package/esm/form/form-context.js +1 -1
  410. package/esm/form/form-description.js +5 -5
  411. package/esm/form/form-error.js +5 -5
  412. package/esm/form/form-field.js +6 -6
  413. package/esm/form/form-group-label.js +5 -5
  414. package/esm/form/form-group.js +6 -6
  415. package/esm/form/form-input.js +7 -7
  416. package/esm/form/form-label.js +5 -5
  417. package/esm/form/form-push.js +8 -8
  418. package/esm/form/form-radio-group.js +6 -6
  419. package/esm/form/form-radio.js +12 -12
  420. package/esm/form/form-remove.js +7 -7
  421. package/esm/form/form-reset.js +7 -7
  422. package/esm/form/form-store.js +5 -5
  423. package/esm/form/form-submit.js +7 -7
  424. package/esm/form/form.js +4 -4
  425. package/esm/group/group-label-context.js +1 -1
  426. package/esm/group/group-label.js +5 -5
  427. package/esm/group/group.js +5 -5
  428. package/esm/heading/heading-context.js +1 -1
  429. package/esm/heading/heading-level.js +1 -1
  430. package/esm/heading/heading.js +5 -5
  431. package/esm/hovercard/hovercard-anchor.js +6 -6
  432. package/esm/hovercard/hovercard-arrow.js +5 -5
  433. package/esm/hovercard/hovercard-description.js +7 -7
  434. package/esm/hovercard/hovercard-disclosure.js +10 -10
  435. package/esm/hovercard/hovercard-dismiss.js +10 -10
  436. package/esm/hovercard/hovercard-heading.js +8 -8
  437. package/esm/hovercard/hovercard-store.js +8 -8
  438. package/esm/hovercard/hovercard.js +24 -24
  439. package/esm/hovercard/utils/debug-polygon.js +1 -1
  440. package/esm/hovercard/utils/polygon.js +1 -1
  441. package/esm/index.js +1 -1
  442. package/esm/menu/menu-arrow.js +5 -5
  443. package/esm/menu/menu-bar-store.js +6 -6
  444. package/esm/menu/menu-bar.js +7 -7
  445. package/esm/menu/menu-button-arrow.js +5 -5
  446. package/esm/menu/menu-button.js +18 -18
  447. package/esm/menu/menu-context.js +1 -1
  448. package/esm/menu/menu-description.js +7 -7
  449. package/esm/menu/menu-dismiss.js +10 -10
  450. package/esm/menu/menu-group-label.js +6 -6
  451. package/esm/menu/menu-group.js +6 -6
  452. package/esm/menu/menu-heading.js +8 -8
  453. package/esm/menu/menu-item-check.js +5 -5
  454. package/esm/menu/menu-item-checkbox.js +15 -15
  455. package/esm/menu/menu-item-radio.js +14 -14
  456. package/esm/menu/menu-item.js +13 -13
  457. package/esm/menu/menu-list.js +11 -11
  458. package/esm/menu/menu-separator.js +7 -7
  459. package/esm/menu/menu-store.js +10 -10
  460. package/esm/menu/menu.js +29 -29
  461. package/esm/menu/utils.js +1 -1
  462. package/esm/popover/popover-anchor.js +5 -5
  463. package/esm/popover/popover-arrow-path.js +1 -1
  464. package/esm/popover/popover-arrow.js +5 -5
  465. package/esm/popover/popover-context.js +1 -1
  466. package/esm/popover/popover-description.js +6 -6
  467. package/esm/popover/popover-disclosure-arrow.js +5 -5
  468. package/esm/popover/popover-disclosure.js +11 -11
  469. package/esm/popover/popover-dismiss.js +9 -9
  470. package/esm/popover/popover-heading.js +7 -7
  471. package/esm/popover/popover-store.js +7 -7
  472. package/esm/popover/popover.js +23 -23
  473. package/esm/portal/portal-context.js +1 -1
  474. package/esm/portal/portal.js +7 -7
  475. package/esm/radio/radio-context.js +1 -1
  476. package/esm/radio/radio-group.js +7 -7
  477. package/esm/radio/radio-store.js +6 -6
  478. package/esm/radio/radio.js +11 -11
  479. package/esm/role/role.js +5 -5
  480. package/esm/select/select-arrow.js +6 -6
  481. package/esm/select/select-context.js +1 -1
  482. package/esm/select/select-group-label.js +6 -6
  483. package/esm/select/select-group.js +6 -6
  484. package/esm/select/select-item-check.js +5 -5
  485. package/esm/select/select-item.js +26 -25
  486. package/esm/select/select-label.js +4 -4
  487. package/esm/select/select-list.js +10 -10
  488. package/esm/select/select-popover.js +27 -27
  489. package/esm/select/select-renderer.d.ts +32 -0
  490. package/esm/select/select-renderer.js +110 -0
  491. package/esm/select/select-row.js +6 -6
  492. package/esm/select/select-separator.js +7 -7
  493. package/esm/select/select-store.js +9 -9
  494. package/esm/select/select.js +15 -15
  495. package/esm/separator/separator.js +5 -5
  496. package/esm/tab/tab-context.js +1 -1
  497. package/esm/tab/tab-list.js +7 -7
  498. package/esm/tab/tab-panel.js +9 -9
  499. package/esm/tab/tab-store.js +6 -6
  500. package/esm/tab/tab.js +10 -10
  501. package/esm/toolbar/toolbar-container.js +12 -12
  502. package/esm/toolbar/toolbar-context.js +1 -1
  503. package/esm/toolbar/toolbar-input.js +12 -12
  504. package/esm/toolbar/toolbar-item.js +11 -11
  505. package/esm/toolbar/toolbar-separator.js +7 -7
  506. package/esm/toolbar/toolbar-store.js +6 -6
  507. package/esm/toolbar/toolbar.js +7 -7
  508. package/esm/tooltip/tooltip-anchor.js +6 -6
  509. package/esm/tooltip/tooltip-arrow.js +5 -5
  510. package/esm/tooltip/tooltip-context.js +1 -1
  511. package/esm/tooltip/tooltip-store.js +8 -8
  512. package/esm/tooltip/tooltip.js +24 -24
  513. package/esm/tsconfig.build.tsbuildinfo +1 -1
  514. package/esm/utils/hooks.js +3 -3
  515. package/esm/utils/misc.js +2 -2
  516. package/esm/utils/store.js +4 -4
  517. package/esm/utils/system.d.ts +13 -4
  518. package/esm/utils/system.js +10 -6
  519. package/esm/visually-hidden/visually-hidden.js +5 -5
  520. package/package.json +14 -2
  521. package/select/select-renderer/package.json +8 -0
  522. package/cjs/__chunks/B4IMQMNP.cjs +0 -36
  523. package/cjs/__chunks/N6BZRQWT.cjs +0 -32
  524. package/cjs/__chunks/NVMBKFRB.cjs +0 -13
  525. package/cjs/__chunks/O3Z4C76T.cjs +0 -72
  526. package/cjs/__chunks/V4OMCLAW.cjs +0 -33
  527. package/cjs/__chunks/XI6W2T6N.cjs +0 -33
  528. package/cjs/__chunks/{6455U47T.cjs → 72I2GWXF.cjs} +0 -0
  529. package/cjs/__chunks/{S2VSVWFY.cjs → ZWMVFMQY.cjs} +2 -2
  530. package/esm/__chunks/{QLHUIPVK.js → AR6DTI3S.js} +3 -3
  531. /package/esm/__chunks/{4BKCJXBM.js → PNRLI7OV.js} +0 -0
@@ -0,0 +1,711 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _ZQAFJQIScjs = require('./ZQAFJQIS.cjs');
4
+
5
+
6
+
7
+ var _CWY2PHPRcjs = require('./CWY2PHPR.cjs');
8
+
9
+
10
+ var _BEGWNNXKcjs = require('./BEGWNNXK.cjs');
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+ var _5WLTMVVQcjs = require('./5WLTMVVQ.cjs');
19
+
20
+
21
+
22
+
23
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
24
+
25
+ // src/collection/collection-renderer.tsx
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+ var _react = require('react');
35
+ var _dom = require('@ariakit/core/utils/dom');
36
+ var _misc = require('@ariakit/core/utils/misc');
37
+ var _reactdom = require('react-dom');
38
+ var _jsxruntime = require('react/jsx-runtime');
39
+ var CollectionRendererContext = _react.createContext.call(void 0, null);
40
+ function createTask() {
41
+ let raf = 0;
42
+ const run = (cb) => {
43
+ if (raf)
44
+ return;
45
+ raf = requestAnimationFrame(() => {
46
+ raf = 0;
47
+ cb();
48
+ });
49
+ };
50
+ const cancel = () => {
51
+ cancelAnimationFrame(raf);
52
+ raf = 0;
53
+ };
54
+ return { run, cancel };
55
+ }
56
+ function findNearestIndex(items, target, getValue) {
57
+ let left = 0;
58
+ let right = getItemsLength(items) - 1;
59
+ while (left <= right) {
60
+ const index = (left + right) / 2 | 0;
61
+ const value = getValue(index);
62
+ if (value === target)
63
+ return index;
64
+ else if (value < target)
65
+ left = index + 1;
66
+ else
67
+ right = index - 1;
68
+ }
69
+ if (left > 0)
70
+ return left - 1;
71
+ return 0;
72
+ }
73
+ function getItemsLength(items) {
74
+ return typeof items === "number" ? items : items.length;
75
+ }
76
+ function getItemObject(item) {
77
+ if (!item || typeof item !== "object") {
78
+ return { value: item };
79
+ }
80
+ return item;
81
+ }
82
+ function getItemId(item, index, baseId) {
83
+ var _a;
84
+ _misc.invariant.call(void 0, baseId, "CollectionRenderer must be given an `id` prop.");
85
+ const defaultId = `${baseId}/${index}`;
86
+ return (_a = getItemObject(item).id) != null ? _a : defaultId;
87
+ }
88
+ function getItem(items, index) {
89
+ if (typeof items === "number") {
90
+ if (index >= items)
91
+ return null;
92
+ return {};
93
+ }
94
+ const item = items[index];
95
+ if (!item)
96
+ return null;
97
+ if (typeof item === "object")
98
+ return item;
99
+ return { value: item };
100
+ }
101
+ function getItemSize(item, horizontal, fallbackElement) {
102
+ var _a, _b, _c, _d, _e;
103
+ const itemObject = getItemObject(item);
104
+ horizontal = itemObject.orientation === "horizontal";
105
+ const prop = horizontal ? "width" : "height";
106
+ const style = itemObject.style;
107
+ if (style) {
108
+ const size = style[prop];
109
+ if (typeof size === "number")
110
+ return size;
111
+ }
112
+ const items = itemObject.items;
113
+ if (items == null ? void 0 : items.length) {
114
+ const hasSameOrientation = !itemObject.orientation || horizontal && itemObject.orientation === "horizontal" || !horizontal && itemObject.orientation === "vertical";
115
+ const paddingStart = (_b = (_a = itemObject.paddingStart) != null ? _a : itemObject.padding) != null ? _b : 0;
116
+ const paddingEnd = (_d = (_c = itemObject.paddingEnd) != null ? _c : itemObject.padding) != null ? _d : 0;
117
+ const padding = hasSameOrientation ? paddingStart + paddingEnd : 0;
118
+ const initialSize = ((_e = itemObject.gap) != null ? _e : 0) * (items.length - 1) + padding;
119
+ if (hasSameOrientation && itemObject.itemSize) {
120
+ return initialSize + itemObject.itemSize * items.length;
121
+ }
122
+ const totalSize = items.reduce(
123
+ (sum, item2) => sum + getItemSize(item2, horizontal),
124
+ initialSize
125
+ );
126
+ if (totalSize !== initialSize)
127
+ return totalSize;
128
+ }
129
+ const element = fallbackElement !== false ? itemObject.element || fallbackElement : null;
130
+ if (element == null ? void 0 : element.isConnected) {
131
+ return element.getBoundingClientRect()[prop];
132
+ }
133
+ return 0;
134
+ }
135
+ function getAverageSize(props) {
136
+ const length = getItemsLength(props.items);
137
+ let currentIndex = 0;
138
+ let averageSize = props.estimatedItemSize;
139
+ const setAverageSize = (size) => {
140
+ const prevIndex = currentIndex;
141
+ currentIndex = currentIndex + 1;
142
+ averageSize = (averageSize * prevIndex + size) / currentIndex;
143
+ };
144
+ for (let index = 0; index < length; index += 1) {
145
+ const item = getItem(props.items, index);
146
+ const itemId = getItemId(item, index, props.baseId);
147
+ const itemData = props.data.get(itemId);
148
+ const fallbackElement = props.elements.get(itemId);
149
+ const size = getItemSize(item, props.horizontal, fallbackElement);
150
+ if (size) {
151
+ setAverageSize(size);
152
+ } else if (itemData == null ? void 0 : itemData.rendered) {
153
+ setAverageSize(itemData.end - itemData.start);
154
+ }
155
+ }
156
+ return averageSize;
157
+ }
158
+ function getScrollOffset(scroller, horizontal) {
159
+ if ("scrollX" in scroller) {
160
+ return horizontal ? scroller.scrollX : scroller.scrollY;
161
+ }
162
+ return horizontal ? scroller.scrollLeft : scroller.scrollTop;
163
+ }
164
+ function getViewport(scroller) {
165
+ const { defaultView, documentElement } = scroller.ownerDocument;
166
+ if (scroller === documentElement)
167
+ return defaultView;
168
+ return scroller;
169
+ }
170
+ function useScroller(rendererRef) {
171
+ const [scroller, setScroller] = _react.useState.call(void 0, null);
172
+ _react.useEffect.call(void 0, () => {
173
+ const renderer = rendererRef == null ? void 0 : rendererRef.current;
174
+ if (!renderer)
175
+ return;
176
+ const scroller2 = _dom.getScrollingElement.call(void 0, renderer);
177
+ if (!scroller2)
178
+ return;
179
+ setScroller(scroller2);
180
+ }, [rendererRef]);
181
+ return scroller;
182
+ }
183
+ function getRendererOffset(renderer, scroller, horizontal) {
184
+ const win = _dom.getWindow.call(void 0, renderer);
185
+ const htmlElement = win == null ? void 0 : win.document.documentElement;
186
+ const rendererRect = renderer.getBoundingClientRect();
187
+ const rendererOffset = horizontal ? rendererRect.left : rendererRect.top;
188
+ if (scroller === htmlElement) {
189
+ const scrollOffset2 = getScrollOffset(win, horizontal);
190
+ return scrollOffset2 + rendererOffset;
191
+ }
192
+ const scrollerRect = scroller.getBoundingClientRect();
193
+ const scrollerOffset = horizontal ? scrollerRect.left : scrollerRect.top;
194
+ const scrollOffset = getScrollOffset(scroller, horizontal);
195
+ return rendererOffset - scrollerOffset + scrollOffset;
196
+ }
197
+ function getOffsets(renderer, scroller, horizontal) {
198
+ const scrollOffset = getScrollOffset(scroller, horizontal);
199
+ const rendererOffset = getRendererOffset(renderer, scroller, horizontal);
200
+ const scrollSize = horizontal ? scroller.clientWidth : scroller.clientHeight;
201
+ const start = scrollOffset - rendererOffset;
202
+ const end = start + scrollSize;
203
+ return { start, end };
204
+ }
205
+ function getItemsEnd(props) {
206
+ const length = getItemsLength(props.items);
207
+ const totalPadding = props.paddingStart + props.paddingEnd;
208
+ if (!length)
209
+ return totalPadding;
210
+ const lastIndex = length - 1;
211
+ const totalGap = lastIndex * props.gap;
212
+ if (props.itemSize != null) {
213
+ return length * props.itemSize + totalGap + totalPadding;
214
+ }
215
+ const defaultEnd = length * props.estimatedItemSize + totalGap + totalPadding;
216
+ if (!props.baseId)
217
+ return defaultEnd;
218
+ const lastItem = getItem(props.items, lastIndex);
219
+ const lastItemId = getItemId(lastItem, lastIndex, props.baseId);
220
+ const lastItemData = props.data.get(lastItemId);
221
+ if (lastItemData == null ? void 0 : lastItemData.end)
222
+ return lastItemData.end + props.paddingEnd;
223
+ if (!Array.isArray(props.items))
224
+ return defaultEnd;
225
+ const end = props.items.reduce(
226
+ (sum, item) => sum + getItemSize(item, props.horizontal, false),
227
+ 0
228
+ );
229
+ if (!end)
230
+ return defaultEnd;
231
+ return end + totalGap + totalPadding;
232
+ }
233
+ function getData(props) {
234
+ var _a;
235
+ const length = getItemsLength(props.items);
236
+ let nextData;
237
+ let start = props.paddingStart;
238
+ const avgSize = getAverageSize(props);
239
+ for (let index = 0; index < length; index += 1) {
240
+ const item = getItem(props.items, index);
241
+ const itemId = getItemId(item, index, props.baseId);
242
+ const itemData = props.data.get(itemId);
243
+ const prevRendered = (_a = itemData == null ? void 0 : itemData.rendered) != null ? _a : false;
244
+ const setSize = (size2, rendered = prevRendered) => {
245
+ start = start ? start + props.gap : start;
246
+ const end = start + size2;
247
+ const nextItemData = { index, rendered, start, end };
248
+ if (!_misc.shallowEqual.call(void 0, itemData, nextItemData)) {
249
+ if (!nextData) {
250
+ nextData = new Map(props.data);
251
+ }
252
+ nextData.set(itemId, { index, rendered, start, end });
253
+ }
254
+ start = end;
255
+ };
256
+ const size = getItemSize(
257
+ item,
258
+ props.horizontal,
259
+ props.elements.get(itemId)
260
+ );
261
+ if (size) {
262
+ setSize(size, true);
263
+ } else if (itemData == null ? void 0 : itemData.rendered) {
264
+ setSize(itemData.end - itemData.start, true);
265
+ } else {
266
+ setSize(avgSize);
267
+ }
268
+ }
269
+ return nextData;
270
+ }
271
+ function useCollectionRenderer(_a) {
272
+ var _b = _a, {
273
+ store,
274
+ items: itemsProp,
275
+ initialItems = 0,
276
+ gap = 0,
277
+ itemSize,
278
+ estimatedItemSize = 40,
279
+ overscan: overscanProp,
280
+ orientation: orientationProp,
281
+ padding = 0,
282
+ paddingStart = padding,
283
+ paddingEnd = padding,
284
+ persistentIndices,
285
+ renderOnScroll = true,
286
+ renderOnResize = !!renderOnScroll,
287
+ children: renderItem
288
+ } = _b, props = _72I2GWXFcjs.__objRest.call(void 0, _b, [
289
+ "store",
290
+ "items",
291
+ "initialItems",
292
+ "gap",
293
+ "itemSize",
294
+ "estimatedItemSize",
295
+ "overscan",
296
+ "orientation",
297
+ "padding",
298
+ "paddingStart",
299
+ "paddingEnd",
300
+ "persistentIndices",
301
+ "renderOnScroll",
302
+ "renderOnResize",
303
+ "children"
304
+ ]);
305
+ var _a2, _b2;
306
+ const context = _react.useContext.call(void 0, _ZQAFJQIScjs.CollectionContext);
307
+ store = store || context;
308
+ const items = _BEGWNNXKcjs.useStoreState.call(void 0, store, (state) => itemsProp != null ? itemsProp : state.items) || itemsProp;
309
+ _misc.invariant.call(void 0,
310
+ items != null,
311
+ process.env.NODE_ENV !== "production" && "CollectionRenderer must be either wrapped in a Collection component or be given an `items` prop."
312
+ );
313
+ let parent = _react.useContext.call(void 0, CollectionRendererContext);
314
+ if (store && (parent == null ? void 0 : parent.store) !== store) {
315
+ parent = null;
316
+ }
317
+ const parentData = parent == null ? void 0 : parent.childrenData;
318
+ const orientation = (_a2 = orientationProp != null ? orientationProp : parent == null ? void 0 : parent.orientation) != null ? _a2 : "vertical";
319
+ const overscan = (_b2 = overscanProp != null ? overscanProp : parent == null ? void 0 : parent.overscan) != null ? _b2 : 1;
320
+ const ref = _react.useRef.call(void 0, null);
321
+ const baseId = _5WLTMVVQcjs.useId.call(void 0, props.id);
322
+ const horizontal = orientation === "horizontal";
323
+ const elements = _react.useMemo.call(void 0, () => /* @__PURE__ */ new Map(), []);
324
+ const [elementsUpdated, updateElements] = _5WLTMVVQcjs.useForceUpdate.call(void 0, );
325
+ const [defaultVisibleIndices, setVisibleIndices] = _react.useState.call(void 0, () => {
326
+ if (!initialItems)
327
+ return [];
328
+ const length = getItemsLength(items);
329
+ const initialLength = Math.min(length, Math.abs(initialItems));
330
+ return Array.from({ length: initialLength }, (_, index) => {
331
+ if (initialItems < 0)
332
+ return length - index - 1;
333
+ return index;
334
+ });
335
+ });
336
+ const visibleIndices = _react.useMemo.call(void 0, () => {
337
+ if (!persistentIndices)
338
+ return defaultVisibleIndices;
339
+ const nextIndices = defaultVisibleIndices.slice();
340
+ persistentIndices.forEach((index) => {
341
+ if (index < 0)
342
+ return;
343
+ if (nextIndices.includes(index))
344
+ return;
345
+ nextIndices.push(index);
346
+ });
347
+ nextIndices.sort((a, b) => a - b);
348
+ if (_misc.shallowEqual.call(void 0, defaultVisibleIndices, nextIndices)) {
349
+ return defaultVisibleIndices;
350
+ }
351
+ return nextIndices;
352
+ }, [defaultVisibleIndices, persistentIndices]);
353
+ const [data, setData] = _react.useState.call(void 0, () => {
354
+ if (!baseId)
355
+ return /* @__PURE__ */ new Map();
356
+ const data2 = (parentData == null ? void 0 : parentData.get(baseId)) || /* @__PURE__ */ new Map();
357
+ if (itemSize != null)
358
+ return data2;
359
+ if (!items)
360
+ return data2;
361
+ const nextData = getData({
362
+ baseId,
363
+ items,
364
+ data: data2,
365
+ gap,
366
+ elements,
367
+ horizontal,
368
+ paddingStart,
369
+ itemSize,
370
+ estimatedItemSize
371
+ });
372
+ return nextData || data2;
373
+ });
374
+ const totalSize = _react.useMemo.call(void 0, () => {
375
+ return getItemsEnd({
376
+ baseId,
377
+ items,
378
+ data,
379
+ gap,
380
+ horizontal,
381
+ itemSize,
382
+ estimatedItemSize,
383
+ paddingStart,
384
+ paddingEnd
385
+ });
386
+ }, [
387
+ baseId,
388
+ items,
389
+ data,
390
+ gap,
391
+ horizontal,
392
+ itemSize,
393
+ estimatedItemSize,
394
+ paddingStart,
395
+ paddingEnd
396
+ ]);
397
+ _react.useEffect.call(void 0, () => {
398
+ if (!baseId)
399
+ return;
400
+ parentData == null ? void 0 : parentData.set(baseId, data);
401
+ }, [baseId, parentData, data]);
402
+ _react.useEffect.call(void 0, () => {
403
+ if (itemSize != null)
404
+ return;
405
+ if (!baseId)
406
+ return;
407
+ if (!items)
408
+ return;
409
+ const nextData = getData({
410
+ baseId,
411
+ items,
412
+ data,
413
+ gap,
414
+ elements,
415
+ horizontal,
416
+ paddingStart,
417
+ itemSize,
418
+ estimatedItemSize
419
+ });
420
+ if (nextData) {
421
+ setData(nextData);
422
+ }
423
+ }, [
424
+ elementsUpdated,
425
+ itemSize,
426
+ baseId,
427
+ items,
428
+ data,
429
+ gap,
430
+ elements,
431
+ horizontal,
432
+ paddingStart,
433
+ estimatedItemSize
434
+ ]);
435
+ const scroller = useScroller(items ? ref : null);
436
+ const offsetsRef = _react.useRef.call(void 0, { start: 0, end: 0 });
437
+ const processVisibleIndices = _react.useCallback.call(void 0, () => {
438
+ const offsets = offsetsRef.current;
439
+ if (!items)
440
+ return;
441
+ if (!baseId)
442
+ return;
443
+ if (!offsets.end)
444
+ return;
445
+ if (!data.size && !itemSize)
446
+ return;
447
+ const length = getItemsLength(items);
448
+ const getItemOffset = (index, prop = "start") => {
449
+ var _a3;
450
+ if (itemSize) {
451
+ const start2 = itemSize * index + gap * index + paddingStart;
452
+ if (prop === "start")
453
+ return start2;
454
+ return start2 + itemSize;
455
+ }
456
+ const item = getItem(items, index);
457
+ const itemId = getItemId(item, index, baseId);
458
+ const itemData = data.get(itemId);
459
+ return (_a3 = itemData == null ? void 0 : itemData[prop]) != null ? _a3 : 0;
460
+ };
461
+ const initialStart = findNearestIndex(items, offsets.start, getItemOffset);
462
+ let initialEnd = initialStart;
463
+ while (initialEnd < length && getItemOffset(initialEnd) < offsets.end) {
464
+ initialEnd += 1;
465
+ }
466
+ const finalOverscan = initialEnd - initialStart ? overscan : 0;
467
+ const start = Math.max(initialStart - finalOverscan, 0);
468
+ const end = Math.min(initialEnd + finalOverscan, length);
469
+ const indices = Array.from(
470
+ { length: end - start },
471
+ (_, index) => index + start
472
+ );
473
+ setVisibleIndices((prevIndices) => {
474
+ if (_misc.shallowEqual.call(void 0, prevIndices, indices))
475
+ return prevIndices;
476
+ return indices;
477
+ });
478
+ }, [
479
+ elementsUpdated,
480
+ items,
481
+ baseId,
482
+ data,
483
+ itemSize,
484
+ gap,
485
+ paddingStart,
486
+ overscan
487
+ ]);
488
+ _react.useEffect.call(void 0, processVisibleIndices, [processVisibleIndices]);
489
+ const processVisibleIndicesEvent = _5WLTMVVQcjs.useEvent.call(void 0, processVisibleIndices);
490
+ _react.useEffect.call(void 0, () => {
491
+ const renderer = ref.current;
492
+ if (!renderer)
493
+ return;
494
+ if (!scroller)
495
+ return;
496
+ offsetsRef.current = getOffsets(renderer, scroller, horizontal);
497
+ processVisibleIndicesEvent();
498
+ }, [scroller, horizontal, processVisibleIndicesEvent]);
499
+ const mayRenderOnScroll = !!renderOnScroll;
500
+ const renderOnScrollProp = _5WLTMVVQcjs.useBooleanEvent.call(void 0, renderOnScroll);
501
+ _react.useEffect.call(void 0, () => {
502
+ if (!mayRenderOnScroll)
503
+ return;
504
+ const renderer = ref.current;
505
+ if (!renderer)
506
+ return;
507
+ if (!scroller)
508
+ return;
509
+ const viewport = getViewport(scroller);
510
+ if (!viewport)
511
+ return;
512
+ const task = createTask();
513
+ const onScroll = (event) => {
514
+ task.run(() => {
515
+ if (!renderOnScrollProp(event))
516
+ return;
517
+ offsetsRef.current = getOffsets(renderer, scroller, horizontal);
518
+ processVisibleIndicesEvent();
519
+ });
520
+ };
521
+ viewport.addEventListener("scroll", onScroll, { passive: true });
522
+ return () => {
523
+ task.cancel();
524
+ viewport.removeEventListener("scroll", onScroll);
525
+ };
526
+ }, [
527
+ mayRenderOnScroll,
528
+ scroller,
529
+ renderOnScrollProp,
530
+ horizontal,
531
+ processVisibleIndicesEvent
532
+ ]);
533
+ const mayRenderOnResize = !!renderOnResize;
534
+ const renderOnResizeProp = _5WLTMVVQcjs.useBooleanEvent.call(void 0, renderOnResize);
535
+ _react.useEffect.call(void 0, () => {
536
+ if (!mayRenderOnResize)
537
+ return;
538
+ const renderer = ref.current;
539
+ if (!renderer)
540
+ return;
541
+ if (!scroller)
542
+ return;
543
+ const viewport = getViewport(scroller);
544
+ if (!viewport)
545
+ return;
546
+ const task = createTask();
547
+ if (viewport === scroller) {
548
+ if (typeof ResizeObserver !== "function")
549
+ return;
550
+ let firstRun = true;
551
+ const observer = new ResizeObserver(() => {
552
+ if (firstRun) {
553
+ firstRun = false;
554
+ return;
555
+ }
556
+ task.run(() => {
557
+ if (!renderOnResizeProp(scroller))
558
+ return;
559
+ offsetsRef.current = getOffsets(renderer, scroller, horizontal);
560
+ processVisibleIndicesEvent();
561
+ });
562
+ });
563
+ observer.observe(scroller);
564
+ return () => {
565
+ task.cancel();
566
+ observer.disconnect();
567
+ };
568
+ }
569
+ const onResize = () => {
570
+ task.run(() => {
571
+ if (!renderOnResizeProp(scroller))
572
+ return;
573
+ offsetsRef.current = getOffsets(renderer, scroller, horizontal);
574
+ processVisibleIndicesEvent();
575
+ });
576
+ };
577
+ viewport.addEventListener("resize", onResize, { passive: true });
578
+ return () => {
579
+ task.cancel();
580
+ viewport.removeEventListener("resize", onResize);
581
+ };
582
+ }, [
583
+ mayRenderOnResize,
584
+ scroller,
585
+ renderOnResizeProp,
586
+ horizontal,
587
+ processVisibleIndicesEvent
588
+ ]);
589
+ _react.useEffect.call(void 0, () => {
590
+ if (typeof IntersectionObserver !== "function")
591
+ return;
592
+ const renderer = ref.current;
593
+ if (!renderer)
594
+ return;
595
+ if (!scroller)
596
+ return;
597
+ const viewport = getViewport(scroller);
598
+ if (!viewport)
599
+ return;
600
+ const observer = new IntersectionObserver(
601
+ () => {
602
+ offsetsRef.current = getOffsets(renderer, scroller, horizontal);
603
+ processVisibleIndicesEvent();
604
+ },
605
+ { root: scroller === viewport ? scroller : null }
606
+ );
607
+ observer.observe(renderer);
608
+ return () => {
609
+ observer.disconnect();
610
+ };
611
+ }, [scroller, processVisibleIndicesEvent]);
612
+ const elementObserver = _react.useMemo.call(void 0, () => {
613
+ if (typeof ResizeObserver !== "function")
614
+ return;
615
+ return new ResizeObserver(() => {
616
+ _reactdom.flushSync.call(void 0, updateElements);
617
+ });
618
+ }, [updateElements]);
619
+ const itemRef = _react.useCallback.call(void 0,
620
+ (element) => {
621
+ if (!element)
622
+ return;
623
+ if (itemSize)
624
+ return;
625
+ updateElements();
626
+ elements.set(element.id, element);
627
+ elementObserver == null ? void 0 : elementObserver.observe(element);
628
+ },
629
+ [itemSize, elements, updateElements, elementObserver]
630
+ );
631
+ const getItemProps = _react.useCallback.call(void 0,
632
+ (item, index) => {
633
+ var _a3, _b3;
634
+ const itemId = getItemId(item, index, baseId);
635
+ const offset = itemSize ? paddingStart + itemSize * index + gap * index : (_b3 = (_a3 = data.get(itemId)) == null ? void 0 : _a3.start) != null ? _b3 : 0;
636
+ const baseItemProps = {
637
+ id: itemId,
638
+ ref: itemRef,
639
+ index,
640
+ style: {
641
+ position: "absolute",
642
+ left: horizontal ? offset : 0,
643
+ top: horizontal ? 0 : offset
644
+ }
645
+ };
646
+ if (itemSize) {
647
+ baseItemProps.style[horizontal ? "width" : "height"] = itemSize;
648
+ }
649
+ if (item == null)
650
+ return baseItemProps;
651
+ const itemProps = getItemObject(item);
652
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, itemProps), baseItemProps), {
653
+ style: _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, itemProps.style), baseItemProps.style)
654
+ });
655
+ },
656
+ [baseId, data, itemSize, paddingStart, gap, horizontal, itemRef]
657
+ );
658
+ const itemsProps = _react.useMemo.call(void 0, () => {
659
+ return visibleIndices.map((index) => {
660
+ if (index < 0)
661
+ return;
662
+ const item = getItem(items, index);
663
+ if (!item)
664
+ return;
665
+ return getItemProps(item, index);
666
+ }).filter((value) => value != null);
667
+ }, [items, visibleIndices, getItemProps]);
668
+ const children = itemsProps == null ? void 0 : itemsProps.map((itemProps) => {
669
+ return renderItem == null ? void 0 : renderItem(itemProps);
670
+ });
671
+ const styleProp = props.style;
672
+ const sizeProperty = horizontal ? "width" : "height";
673
+ const style = _react.useMemo.call(void 0,
674
+ () => _72I2GWXFcjs.__spreadValues.call(void 0, {
675
+ flex: "none",
676
+ position: "relative",
677
+ [sizeProperty]: totalSize
678
+ }, styleProp),
679
+ [styleProp, sizeProperty, totalSize]
680
+ );
681
+ const childrenData = _react.useMemo.call(void 0, () => /* @__PURE__ */ new Map(), []);
682
+ const providerValue = _react.useMemo.call(void 0,
683
+ () => ({ store, orientation, overscan, childrenData }),
684
+ [store, orientation, overscan, childrenData]
685
+ );
686
+ props = _5WLTMVVQcjs.useWrapElement.call(void 0,
687
+ props,
688
+ (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CollectionRendererContext.Provider, { value: providerValue, children: element }),
689
+ [providerValue]
690
+ );
691
+ props = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {
692
+ id: baseId
693
+ }, props), {
694
+ style,
695
+ ref: _5WLTMVVQcjs.useMergeRefs.call(void 0, ref, props.ref)
696
+ });
697
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), { children });
698
+ }
699
+ var CollectionRenderer = _CWY2PHPRcjs.forwardRef.call(void 0, function CollectionRenderer2(props) {
700
+ const htmlProps = useCollectionRenderer(props);
701
+ return _CWY2PHPRcjs.createElement.call(void 0, "div", htmlProps);
702
+ });
703
+ var getCollectionRendererItem = getItem;
704
+ var getCollectionRendererItemId = getItemId;
705
+
706
+
707
+
708
+
709
+
710
+
711
+ exports.useCollectionRenderer = useCollectionRenderer; exports.CollectionRenderer = CollectionRenderer; exports.getCollectionRendererItem = getCollectionRendererItem; exports.getCollectionRendererItemId = getCollectionRendererItemId;