@stevederico/skateboard-ui 3.12.0 → 4.1.0

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 (339) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +37 -31
  3. package/dist/components/core/Command.js +33 -7
  4. package/dist/shadcn/ui/accordion.d.ts +1 -6
  5. package/dist/shadcn/ui/accordion.js +3 -17
  6. package/dist/shadcn/ui/alert-dialog.d.ts +1 -18
  7. package/dist/shadcn/ui/alert-dialog.js +3 -43
  8. package/dist/shadcn/ui/alert.d.ts +1 -13
  9. package/dist/shadcn/ui/alert.js +3 -28
  10. package/dist/shadcn/ui/aspect-ratio.d.ts +1 -4
  11. package/dist/shadcn/ui/aspect-ratio.js +3 -8
  12. package/dist/shadcn/ui/avatar.d.ts +1 -11
  13. package/dist/shadcn/ui/avatar.js +3 -24
  14. package/dist/shadcn/ui/badge.d.ts +1 -14
  15. package/dist/shadcn/ui/badge.js +3 -33
  16. package/dist/shadcn/ui/breadcrumb.d.ts +1 -10
  17. package/dist/shadcn/ui/breadcrumb.js +3 -37
  18. package/dist/shadcn/ui/button-group.d.ts +1 -13
  19. package/dist/shadcn/ui/button-group.js +3 -36
  20. package/dist/shadcn/ui/button.d.ts +1 -34
  21. package/dist/shadcn/ui/button.js +3 -53
  22. package/dist/shadcn/ui/calendar.d.ts +1 -13
  23. package/dist/shadcn/ui/calendar.js +3 -75
  24. package/dist/shadcn/ui/card.d.ts +1 -11
  25. package/dist/shadcn/ui/card.js +3 -25
  26. package/dist/shadcn/ui/checkbox.d.ts +1 -3
  27. package/dist/shadcn/ui/checkbox.js +3 -9
  28. package/dist/shadcn/ui/collapsible.d.ts +1 -5
  29. package/dist/shadcn/ui/collapsible.js +3 -13
  30. package/dist/shadcn/ui/command.d.ts +1 -19
  31. package/dist/shadcn/ui/command.js +3 -35
  32. package/dist/shadcn/ui/context-menu.d.ts +1 -29
  33. package/dist/shadcn/ui/context-menu.js +3 -52
  34. package/dist/shadcn/ui/dialog.d.ts +1 -17
  35. package/dist/shadcn/ui/dialog.js +3 -38
  36. package/dist/shadcn/ui/drawer.d.ts +1 -13
  37. package/dist/shadcn/ui/drawer.js +3 -196
  38. package/dist/shadcn/ui/dropdown-menu.d.ts +1 -29
  39. package/dist/shadcn/ui/dropdown-menu.js +3 -52
  40. package/dist/shadcn/ui/empty.d.ts +1 -14
  41. package/dist/shadcn/ui/empty.js +3 -33
  42. package/dist/shadcn/ui/field.d.ts +1 -28
  43. package/dist/shadcn/ui/field.js +3 -68
  44. package/dist/shadcn/ui/hover-card.d.ts +1 -5
  45. package/dist/shadcn/ui/hover-card.js +3 -14
  46. package/dist/shadcn/ui/input-group.d.ts +1 -28
  47. package/dist/shadcn/ui/input-group.js +3 -58
  48. package/dist/shadcn/ui/input.d.ts +1 -3
  49. package/dist/shadcn/ui/input.js +3 -8
  50. package/dist/shadcn/ui/item.d.ts +1 -34
  51. package/dist/shadcn/ui/item.js +3 -79
  52. package/dist/shadcn/ui/kbd.d.ts +1 -3
  53. package/dist/shadcn/ui/kbd.js +3 -9
  54. package/dist/shadcn/ui/label.d.ts +1 -3
  55. package/dist/shadcn/ui/label.js +3 -8
  56. package/dist/shadcn/ui/menubar.d.ts +1 -29
  57. package/dist/shadcn/ui/menubar.js +3 -57
  58. package/dist/shadcn/ui/navigation-menu.d.ts +1 -13
  59. package/dist/shadcn/ui/navigation-menu.js +3 -31
  60. package/dist/shadcn/ui/pagination.d.ts +1 -17
  61. package/dist/shadcn/ui/pagination.js +3 -27
  62. package/dist/shadcn/ui/popover.d.ts +1 -9
  63. package/dist/shadcn/ui/popover.js +3 -24
  64. package/dist/shadcn/ui/progress.d.ts +1 -7
  65. package/dist/shadcn/ui/progress.js +3 -20
  66. package/dist/shadcn/ui/radio-group.d.ts +1 -5
  67. package/dist/shadcn/ui/radio-group.js +3 -12
  68. package/dist/shadcn/ui/scroll-area.d.ts +1 -5
  69. package/dist/shadcn/ui/scroll-area.js +3 -12
  70. package/dist/shadcn/ui/select.d.ts +1 -15
  71. package/dist/shadcn/ui/select.js +3 -35
  72. package/dist/shadcn/ui/separator.d.ts +1 -3
  73. package/dist/shadcn/ui/separator.js +3 -8
  74. package/dist/shadcn/ui/sheet.d.ts +1 -14
  75. package/dist/shadcn/ui/sheet.js +3 -38
  76. package/dist/shadcn/ui/sidebar.d.ts +1 -70
  77. package/dist/shadcn/ui/sidebar.js +3 -256
  78. package/dist/shadcn/ui/skeleton.d.ts +1 -2
  79. package/dist/shadcn/ui/skeleton.js +3 -6
  80. package/dist/shadcn/ui/slider.d.ts +1 -3
  81. package/dist/shadcn/ui/slider.js +3 -12
  82. package/dist/shadcn/ui/spinner.d.ts +1 -2
  83. package/dist/shadcn/ui/spinner.js +3 -7
  84. package/dist/shadcn/ui/switch.d.ts +1 -5
  85. package/dist/shadcn/ui/switch.js +3 -8
  86. package/dist/shadcn/ui/table.d.ts +1 -10
  87. package/dist/shadcn/ui/table.js +3 -29
  88. package/dist/shadcn/ui/tabs.d.ts +1 -13
  89. package/dist/shadcn/ui/tabs.js +3 -29
  90. package/dist/shadcn/ui/textarea.d.ts +1 -3
  91. package/dist/shadcn/ui/textarea.js +3 -7
  92. package/dist/shadcn/ui/toggle-group.d.ts +1 -11
  93. package/dist/shadcn/ui/toggle-group.js +3 -25
  94. package/dist/shadcn/ui/toggle.d.ts +1 -15
  95. package/dist/shadcn/ui/toggle.js +3 -26
  96. package/dist/shadcn/ui/tooltip.d.ts +1 -6
  97. package/dist/shadcn/ui/tooltip.js +3 -17
  98. package/dist/ui/accordion.d.ts +21 -0
  99. package/dist/ui/accordion.js +67 -0
  100. package/dist/ui/alert-dialog.d.ts +32 -0
  101. package/dist/ui/alert-dialog.js +102 -0
  102. package/dist/ui/alert.d.ts +13 -0
  103. package/dist/ui/alert.js +28 -0
  104. package/dist/ui/aspect-ratio.d.ts +5 -0
  105. package/dist/ui/aspect-ratio.js +9 -0
  106. package/dist/ui/avatar.d.ts +14 -0
  107. package/dist/ui/avatar.js +49 -0
  108. package/dist/ui/badge.d.ts +22 -0
  109. package/dist/ui/badge.js +26 -0
  110. package/dist/ui/breadcrumb.d.ts +13 -0
  111. package/dist/ui/breadcrumb.js +29 -0
  112. package/dist/ui/button-group.d.ts +21 -0
  113. package/dist/ui/button-group.js +29 -0
  114. package/dist/ui/button.d.ts +38 -0
  115. package/dist/ui/button.js +49 -0
  116. package/dist/ui/calendar.d.ts +13 -0
  117. package/dist/ui/calendar.js +75 -0
  118. package/dist/ui/card.d.ts +11 -0
  119. package/dist/ui/card.js +25 -0
  120. package/dist/ui/checkbox.d.ts +17 -0
  121. package/dist/ui/checkbox.js +25 -0
  122. package/dist/ui/collapsible.d.ts +11 -0
  123. package/dist/ui/collapsible.js +40 -0
  124. package/dist/ui/command.d.ts +19 -0
  125. package/dist/ui/command.js +35 -0
  126. package/dist/ui/context-menu.d.ts +53 -0
  127. package/dist/ui/context-menu.js +372 -0
  128. package/dist/ui/dialog.d.ts +40 -0
  129. package/dist/ui/dialog.js +109 -0
  130. package/dist/ui/drawer.d.ts +36 -0
  131. package/dist/ui/drawer.js +243 -0
  132. package/dist/ui/dropdown-menu.d.ts +61 -0
  133. package/dist/ui/dropdown-menu.js +347 -0
  134. package/dist/ui/empty.d.ts +14 -0
  135. package/dist/ui/empty.js +33 -0
  136. package/dist/ui/field.d.ts +28 -0
  137. package/dist/ui/field.js +68 -0
  138. package/dist/ui/hover-card.d.ts +32 -0
  139. package/dist/ui/hover-card.js +119 -0
  140. package/dist/ui/input-group.d.ts +28 -0
  141. package/dist/ui/input-group.js +58 -0
  142. package/dist/ui/input.d.ts +3 -0
  143. package/dist/ui/input.js +7 -0
  144. package/dist/ui/item.d.ts +41 -0
  145. package/dist/ui/item.js +69 -0
  146. package/dist/ui/kbd.d.ts +4 -0
  147. package/dist/ui/kbd.js +10 -0
  148. package/dist/ui/label.d.ts +3 -0
  149. package/dist/ui/label.js +8 -0
  150. package/dist/ui/menubar.d.ts +59 -0
  151. package/dist/ui/menubar.js +397 -0
  152. package/dist/ui/navigation-menu.d.ts +24 -0
  153. package/dist/ui/navigation-menu.js +203 -0
  154. package/dist/ui/pagination.d.ts +17 -0
  155. package/dist/ui/pagination.js +36 -0
  156. package/dist/ui/popover.d.ts +25 -0
  157. package/dist/ui/popover.js +126 -0
  158. package/dist/ui/portal.d.ts +7 -0
  159. package/dist/ui/portal.js +12 -0
  160. package/dist/ui/progress.d.ts +15 -0
  161. package/dist/ui/progress.js +36 -0
  162. package/dist/ui/radio-group.d.ts +17 -0
  163. package/dist/ui/radio-group.js +66 -0
  164. package/dist/ui/scroll-area.d.ts +9 -0
  165. package/dist/ui/scroll-area.js +72 -0
  166. package/dist/ui/select.d.ts +37 -0
  167. package/dist/ui/select.js +226 -0
  168. package/dist/ui/separator.d.ts +14 -0
  169. package/dist/ui/separator.js +13 -0
  170. package/dist/ui/sheet.d.ts +31 -0
  171. package/dist/ui/sheet.js +121 -0
  172. package/dist/ui/sidebar.d.ts +86 -0
  173. package/dist/ui/sidebar.js +211 -0
  174. package/dist/ui/skeleton.d.ts +3 -0
  175. package/dist/ui/skeleton.js +7 -0
  176. package/dist/ui/slider.d.ts +18 -0
  177. package/dist/ui/slider.js +94 -0
  178. package/dist/ui/slot.d.ts +27 -0
  179. package/dist/ui/slot.js +62 -0
  180. package/dist/ui/spinner.d.ts +3 -0
  181. package/dist/ui/spinner.js +8 -0
  182. package/dist/ui/switch.d.ts +17 -0
  183. package/dist/ui/switch.js +23 -0
  184. package/dist/ui/table.d.ts +10 -0
  185. package/dist/ui/table.js +29 -0
  186. package/dist/ui/tabs.d.ts +29 -0
  187. package/dist/ui/tabs.js +96 -0
  188. package/dist/ui/textarea.d.ts +3 -0
  189. package/dist/ui/textarea.js +7 -0
  190. package/dist/ui/toggle-group.d.ts +23 -0
  191. package/dist/ui/toggle-group.js +52 -0
  192. package/dist/ui/toggle.d.ts +25 -0
  193. package/dist/ui/toggle.js +41 -0
  194. package/dist/ui/tooltip.d.ts +25 -0
  195. package/dist/ui/tooltip.js +90 -0
  196. package/dist/ui/use-controllable-state.d.ts +10 -0
  197. package/dist/ui/use-controllable-state.js +17 -0
  198. package/dist/ui/use-dismiss.d.ts +10 -0
  199. package/dist/ui/use-dismiss.js +51 -0
  200. package/dist/ui/use-floating.d.ts +42 -0
  201. package/dist/ui/use-floating.js +136 -0
  202. package/dist/ui/use-presence.d.ts +8 -0
  203. package/dist/ui/use-presence.js +48 -0
  204. package/dist/ui/use-typeahead.d.ts +19 -0
  205. package/dist/ui/use-typeahead.js +64 -0
  206. package/package.json +6 -1
  207. package/dist/shadcn/lib/base-ui/LICENSE +0 -21
  208. package/dist/shadcn/lib/base-ui/_chunk-000kmre8.js +0 -150
  209. package/dist/shadcn/lib/base-ui/_chunk-1vw45v38.js +0 -64
  210. package/dist/shadcn/lib/base-ui/_chunk-23rx7haq.js +0 -81
  211. package/dist/shadcn/lib/base-ui/_chunk-242gh8ph.js +0 -230
  212. package/dist/shadcn/lib/base-ui/_chunk-26cc610z.js +0 -6
  213. package/dist/shadcn/lib/base-ui/_chunk-2z044bba.js +0 -5890
  214. package/dist/shadcn/lib/base-ui/_chunk-3cpd1vjz.js +0 -13
  215. package/dist/shadcn/lib/base-ui/_chunk-3enq1vat.js +0 -82
  216. package/dist/shadcn/lib/base-ui/_chunk-3xpke33f.js +0 -23
  217. package/dist/shadcn/lib/base-ui/_chunk-451nqgsa.js +0 -6
  218. package/dist/shadcn/lib/base-ui/_chunk-4maf6pas.js +0 -11
  219. package/dist/shadcn/lib/base-ui/_chunk-4zhfq4d3.js +0 -16
  220. package/dist/shadcn/lib/base-ui/_chunk-5gaqyne5.js +0 -21
  221. package/dist/shadcn/lib/base-ui/_chunk-5tt5hk59.js +0 -4
  222. package/dist/shadcn/lib/base-ui/_chunk-5tze5c8q.js +0 -13
  223. package/dist/shadcn/lib/base-ui/_chunk-5xmdvndx.js +0 -225
  224. package/dist/shadcn/lib/base-ui/_chunk-6adaer33.js +0 -435
  225. package/dist/shadcn/lib/base-ui/_chunk-6ejf1z1r.js +0 -9
  226. package/dist/shadcn/lib/base-ui/_chunk-6kqramh9.js +0 -27
  227. package/dist/shadcn/lib/base-ui/_chunk-7b9dc493.js +0 -14
  228. package/dist/shadcn/lib/base-ui/_chunk-8a9vv8am.js +0 -89
  229. package/dist/shadcn/lib/base-ui/_chunk-8ctgmf06.js +0 -129
  230. package/dist/shadcn/lib/base-ui/_chunk-8ganmsbg.js +0 -54
  231. package/dist/shadcn/lib/base-ui/_chunk-8xaqxgck.js +0 -15
  232. package/dist/shadcn/lib/base-ui/_chunk-95tf2rxq.js +0 -62
  233. package/dist/shadcn/lib/base-ui/_chunk-9x63vfqj.js +0 -70
  234. package/dist/shadcn/lib/base-ui/_chunk-ase0ydtt.js +0 -9
  235. package/dist/shadcn/lib/base-ui/_chunk-b0nc8wq7.js +0 -34
  236. package/dist/shadcn/lib/base-ui/_chunk-b5ya6xds.js +0 -10
  237. package/dist/shadcn/lib/base-ui/_chunk-b6dkjkbw.js +0 -43
  238. package/dist/shadcn/lib/base-ui/_chunk-c2bz952e.js +0 -19
  239. package/dist/shadcn/lib/base-ui/_chunk-cdgfsr3q.js +0 -15
  240. package/dist/shadcn/lib/base-ui/_chunk-cdj8cpx5.js +0 -347
  241. package/dist/shadcn/lib/base-ui/_chunk-cgptgywc.js +0 -104
  242. package/dist/shadcn/lib/base-ui/_chunk-cwvtvwc7.js +0 -35
  243. package/dist/shadcn/lib/base-ui/_chunk-dan0mva4.js +0 -23
  244. package/dist/shadcn/lib/base-ui/_chunk-dzvjwv25.js +0 -0
  245. package/dist/shadcn/lib/base-ui/_chunk-e13rsb6b.js +0 -184
  246. package/dist/shadcn/lib/base-ui/_chunk-e56mpvk1.js +0 -118
  247. package/dist/shadcn/lib/base-ui/_chunk-e6k2ecs7.js +0 -48
  248. package/dist/shadcn/lib/base-ui/_chunk-ebyxgtb4.js +0 -29
  249. package/dist/shadcn/lib/base-ui/_chunk-f2wttwrf.js +0 -39
  250. package/dist/shadcn/lib/base-ui/_chunk-fdzctasg.js +0 -38
  251. package/dist/shadcn/lib/base-ui/_chunk-ffpjy0ta.js +0 -39
  252. package/dist/shadcn/lib/base-ui/_chunk-fqry7pew.js +0 -603
  253. package/dist/shadcn/lib/base-ui/_chunk-ghn1tzt8.js +0 -84
  254. package/dist/shadcn/lib/base-ui/_chunk-gy0bpkmx.js +0 -12
  255. package/dist/shadcn/lib/base-ui/_chunk-hm5h9vsk.js +0 -16
  256. package/dist/shadcn/lib/base-ui/_chunk-htdj1jps.js +0 -833
  257. package/dist/shadcn/lib/base-ui/_chunk-j29xjete.js +0 -146
  258. package/dist/shadcn/lib/base-ui/_chunk-j3qkyd10.js +0 -50
  259. package/dist/shadcn/lib/base-ui/_chunk-ktvsd5k6.js +0 -2386
  260. package/dist/shadcn/lib/base-ui/_chunk-kw8nnq00.js +0 -546
  261. package/dist/shadcn/lib/base-ui/_chunk-m307wpdj.js +0 -18
  262. package/dist/shadcn/lib/base-ui/_chunk-mnd0j7v9.js +0 -15
  263. package/dist/shadcn/lib/base-ui/_chunk-n11h505c.js +0 -32
  264. package/dist/shadcn/lib/base-ui/_chunk-p0e2qacz.js +0 -26
  265. package/dist/shadcn/lib/base-ui/_chunk-pv7b791x.js +0 -106
  266. package/dist/shadcn/lib/base-ui/_chunk-q5cg71p7.js +0 -83
  267. package/dist/shadcn/lib/base-ui/_chunk-qbezxj1g.js +0 -385
  268. package/dist/shadcn/lib/base-ui/_chunk-qmsqz6nt.js +0 -15
  269. package/dist/shadcn/lib/base-ui/_chunk-rrh8rt4v.js +0 -65
  270. package/dist/shadcn/lib/base-ui/_chunk-s5pwkz8v.js +0 -25
  271. package/dist/shadcn/lib/base-ui/_chunk-svxv97ph.js +0 -218
  272. package/dist/shadcn/lib/base-ui/_chunk-t7ppm3t0.js +0 -68
  273. package/dist/shadcn/lib/base-ui/_chunk-vg16xxmb.js +0 -52
  274. package/dist/shadcn/lib/base-ui/_chunk-vgkfmtbe.js +0 -21
  275. package/dist/shadcn/lib/base-ui/_chunk-watha94s.js +0 -14
  276. package/dist/shadcn/lib/base-ui/_chunk-wdqynnjf.js +0 -35
  277. package/dist/shadcn/lib/base-ui/_chunk-wx2nxg0p.js +0 -15
  278. package/dist/shadcn/lib/base-ui/_chunk-x11e1k9r.js +0 -0
  279. package/dist/shadcn/lib/base-ui/_chunk-x8xehj6d.js +0 -302
  280. package/dist/shadcn/lib/base-ui/_chunk-xcqbtm2f.js +0 -28
  281. package/dist/shadcn/lib/base-ui/_chunk-ytnp24gq.js +0 -328
  282. package/dist/shadcn/lib/base-ui/_chunk-yzr7eg4b.js +0 -6
  283. package/dist/shadcn/lib/base-ui/_chunk-zk4mtm9m.js +0 -9
  284. package/dist/shadcn/lib/base-ui/accordion.d.ts +0 -447
  285. package/dist/shadcn/lib/base-ui/accordion.js +0 -630
  286. package/dist/shadcn/lib/base-ui/alert-dialog.d.ts +0 -1467
  287. package/dist/shadcn/lib/base-ui/alert-dialog.js +0 -98
  288. package/dist/shadcn/lib/base-ui/avatar.d.ts +0 -123
  289. package/dist/shadcn/lib/base-ui/avatar.js +0 -235
  290. package/dist/shadcn/lib/base-ui/button.d.ts +0 -84
  291. package/dist/shadcn/lib/base-ui/button.js +0 -51
  292. package/dist/shadcn/lib/base-ui/checkbox.d.ts +0 -341
  293. package/dist/shadcn/lib/base-ui/checkbox.js +0 -501
  294. package/dist/shadcn/lib/base-ui/collapsible.d.ts +0 -291
  295. package/dist/shadcn/lib/base-ui/collapsible.js +0 -264
  296. package/dist/shadcn/lib/base-ui/context-menu.d.ts +0 -2213
  297. package/dist/shadcn/lib/base-ui/context-menu.js +0 -323
  298. package/dist/shadcn/lib/base-ui/dialog.d.ts +0 -1448
  299. package/dist/shadcn/lib/base-ui/dialog.js +0 -79
  300. package/dist/shadcn/lib/base-ui/input.d.ts +0 -506
  301. package/dist/shadcn/lib/base-ui/input.js +0 -1027
  302. package/dist/shadcn/lib/base-ui/menu.d.ts +0 -2275
  303. package/dist/shadcn/lib/base-ui/menu.js +0 -60
  304. package/dist/shadcn/lib/base-ui/menubar.d.ts +0 -48
  305. package/dist/shadcn/lib/base-ui/menubar.js +0 -156
  306. package/dist/shadcn/lib/base-ui/merge-props.d.ts +0 -70
  307. package/dist/shadcn/lib/base-ui/merge-props.js +0 -15
  308. package/dist/shadcn/lib/base-ui/navigation-menu.d.ts +0 -825
  309. package/dist/shadcn/lib/base-ui/navigation-menu.js +0 -1849
  310. package/dist/shadcn/lib/base-ui/popover.d.ts +0 -1743
  311. package/dist/shadcn/lib/base-ui/popover.js +0 -1089
  312. package/dist/shadcn/lib/base-ui/preview-card.d.ts +0 -1608
  313. package/dist/shadcn/lib/base-ui/preview-card.js +0 -919
  314. package/dist/shadcn/lib/base-ui/progress.d.ts +0 -172
  315. package/dist/shadcn/lib/base-ui/progress.js +0 -272
  316. package/dist/shadcn/lib/base-ui/radio-group.d.ts +0 -260
  317. package/dist/shadcn/lib/base-ui/radio-group.js +0 -239
  318. package/dist/shadcn/lib/base-ui/radio.d.ts +0 -176
  319. package/dist/shadcn/lib/base-ui/radio.js +0 -387
  320. package/dist/shadcn/lib/base-ui/scroll-area.d.ts +0 -241
  321. package/dist/shadcn/lib/base-ui/scroll-area.js +0 -1055
  322. package/dist/shadcn/lib/base-ui/select.d.ts +0 -1266
  323. package/dist/shadcn/lib/base-ui/select.js +0 -2450
  324. package/dist/shadcn/lib/base-ui/separator.d.ts +0 -76
  325. package/dist/shadcn/lib/base-ui/separator.js +0 -11
  326. package/dist/shadcn/lib/base-ui/slider.d.ts +0 -551
  327. package/dist/shadcn/lib/base-ui/slider.js +0 -1583
  328. package/dist/shadcn/lib/base-ui/switch.d.ts +0 -313
  329. package/dist/shadcn/lib/base-ui/switch.js +0 -326
  330. package/dist/shadcn/lib/base-ui/tabs.d.ts +0 -406
  331. package/dist/shadcn/lib/base-ui/tabs.js +0 -915
  332. package/dist/shadcn/lib/base-ui/toggle-group.d.ts +0 -235
  333. package/dist/shadcn/lib/base-ui/toggle-group.js +0 -145
  334. package/dist/shadcn/lib/base-ui/toggle.d.ts +0 -224
  335. package/dist/shadcn/lib/base-ui/toggle.js +0 -127
  336. package/dist/shadcn/lib/base-ui/tooltip.d.ts +0 -1656
  337. package/dist/shadcn/lib/base-ui/tooltip.js +0 -920
  338. package/dist/shadcn/lib/base-ui/use-render.d.ts +0 -87
  339. package/dist/shadcn/lib/base-ui/use-render.js +0 -15
@@ -1,2450 +0,0 @@
1
- /* @base-ui/react 1.5.0 — vendored (MIT — MUI Inc).
2
- * Refresh: scripts/vendor-base-ui.js (see header for instructions).
3
- * Do not edit by hand. */
4
- import {
5
- serializeValue
6
- } from "./_chunk-4zhfq4d3.js";
7
- import {
8
- SCROLL_EDGE_TOLERANCE_PX,
9
- getMaxScrollOffset,
10
- normalizeScrollOffset,
11
- styleDisableScrollbar
12
- } from "./_chunk-e6k2ecs7.js";
13
- import {
14
- getDefaultLabelId,
15
- resolveAriaLabelledBy
16
- } from "./_chunk-b5ya6xds.js";
17
- import {
18
- clamp
19
- } from "./_chunk-yzr7eg4b.js";
20
- import {
21
- useCSPContext
22
- } from "./_chunk-watha94s.js";
23
- import {
24
- useLabel
25
- } from "./_chunk-ghn1tzt8.js";
26
- import {
27
- useLabelableId
28
- } from "./_chunk-23rx7haq.js";
29
- import"./_chunk-vgkfmtbe.js";
30
- import {
31
- useFormContext,
32
- useRegisterFieldControl
33
- } from "./_chunk-95tf2rxq.js";
34
- import {
35
- fieldValidityMapping,
36
- useFieldRootContext,
37
- useLabelableContext
38
- } from "./_chunk-8ctgmf06.js";
39
- import"./_chunk-dzvjwv25.js";
40
- import {
41
- getPseudoElementBounds
42
- } from "./_chunk-b0nc8wq7.js";
43
- import {
44
- Separator
45
- } from "./_chunk-n11h505c.js";
46
- import {
47
- useAnchoredPopupScrollLock
48
- } from "./_chunk-ebyxgtb4.js";
49
- import {
50
- useToolbarRootContext
51
- } from "./_chunk-mnd0j7v9.js";
52
- import {
53
- usePreviousValue
54
- } from "./_chunk-m307wpdj.js";
55
- import {
56
- getDisabledMountTransitionStyles,
57
- useAnchorPositioning,
58
- usePositioner
59
- } from "./_chunk-fqry7pew.js";
60
- import {
61
- IndexGuessBehavior,
62
- useCompositeListItem
63
- } from "./_chunk-3enq1vat.js";
64
- import {
65
- CompositeList
66
- } from "./_chunk-j29xjete.js";
67
- import"./_chunk-3xpke33f.js";
68
- import {
69
- useDirection
70
- } from "./_chunk-gy0bpkmx.js";
71
- import {
72
- useControlled
73
- } from "./_chunk-9x63vfqj.js";
74
- import {
75
- InternalBackdrop,
76
- useOpenInteractionType
77
- } from "./_chunk-ytnp24gq.js";
78
- import {
79
- FOCUSABLE_POPUP_PROPS,
80
- useOnFirstRender
81
- } from "./_chunk-242gh8ph.js";
82
- import {
83
- popupStateMapping,
84
- pressableTriggerOpenStateMapping,
85
- triggerOpenStateMapping
86
- } from "./_chunk-t7ppm3t0.js";
87
- import {
88
- inertValue
89
- } from "./_chunk-3cpd1vjz.js";
90
- import {
91
- DROPDOWN_COLLISION_AVOIDANCE,
92
- FloatingFocusManager,
93
- FloatingPortal,
94
- Store,
95
- createSelector,
96
- platform,
97
- useClick,
98
- useDismiss,
99
- useFloatingRootContext,
100
- useListNavigation,
101
- useStore,
102
- useTypeahead
103
- } from "./_chunk-2z044bba.js";
104
- import"./_chunk-1vw45v38.js";
105
- import {
106
- contains,
107
- getFloatingFocusElement
108
- } from "./_chunk-cgptgywc.js";
109
- import {
110
- COMPOSITE_KEYS
111
- } from "./_chunk-pv7b791x.js";
112
- import {
113
- isVirtualClick,
114
- rectToClientRect
115
- } from "./_chunk-kw8nnq00.js";
116
- import {
117
- isWebKit
118
- } from "./_chunk-rrh8rt4v.js";
119
- import {
120
- useTimeout
121
- } from "./_chunk-b6dkjkbw.js";
122
- import {
123
- useValueChanged
124
- } from "./_chunk-s5pwkz8v.js";
125
- import {
126
- visuallyHidden,
127
- visuallyHiddenInput
128
- } from "./_chunk-dan0mva4.js";
129
- import"./_chunk-x11e1k9r.js";
130
- import {
131
- addEventListener
132
- } from "./_chunk-ase0ydtt.js";
133
- import {
134
- useValueAsRef
135
- } from "./_chunk-6kqramh9.js";
136
- import {
137
- ownerDocument
138
- } from "./_chunk-451nqgsa.js";
139
- import {
140
- createChangeEventDetails,
141
- exports_reason_parts
142
- } from "./_chunk-e56mpvk1.js";
143
- import {
144
- useBaseUiId
145
- } from "./_chunk-wdqynnjf.js";
146
- import {
147
- transitionStatusMapping,
148
- useOpenChangeComplete,
149
- useTransitionStatus
150
- } from "./_chunk-e13rsb6b.js";
151
- import"./_chunk-zk4mtm9m.js";
152
- import {
153
- useAnimationFrame
154
- } from "./_chunk-8a9vv8am.js";
155
- import"./_chunk-6ejf1z1r.js";
156
- import {
157
- useButton
158
- } from "./_chunk-5xmdvndx.js";
159
- import"./_chunk-hm5h9vsk.js";
160
- import"./_chunk-cdgfsr3q.js";
161
- import {
162
- getWindow
163
- } from "./_chunk-000kmre8.js";
164
- import {
165
- useStableCallback
166
- } from "./_chunk-cwvtvwc7.js";
167
- import {
168
- useIsoLayoutEffect
169
- } from "./_chunk-5tze5c8q.js";
170
- import {
171
- EMPTY_ARRAY,
172
- EMPTY_OBJECT,
173
- useMergedRefs,
174
- useRefWithInit,
175
- useRenderElement
176
- } from "./_chunk-x8xehj6d.js";
177
- import {
178
- __export,
179
- mergeProps
180
- } from "./_chunk-svxv97ph.js";
181
-
182
- // node_modules/@base-ui/react/esm/select/index.parts.js
183
- var exports_index_parts = {};
184
- __export(exports_index_parts, {
185
- Value: () => SelectValue,
186
- Trigger: () => SelectTrigger,
187
- Separator: () => Separator,
188
- ScrollUpArrow: () => SelectScrollUpArrow,
189
- ScrollDownArrow: () => SelectScrollDownArrow,
190
- Root: () => SelectRoot,
191
- Positioner: () => SelectPositioner,
192
- Portal: () => SelectPortal,
193
- Popup: () => SelectPopup,
194
- List: () => SelectList,
195
- Label: () => SelectLabel,
196
- ItemText: () => SelectItemText,
197
- ItemIndicator: () => SelectItemIndicator,
198
- Item: () => SelectItem,
199
- Icon: () => SelectIcon,
200
- GroupLabel: () => SelectGroupLabel,
201
- Group: () => SelectGroup,
202
- Backdrop: () => SelectBackdrop,
203
- Arrow: () => SelectArrow
204
- });
205
-
206
- // node_modules/@base-ui/react/esm/select/root/SelectRoot.js
207
- import * as React3 from "react";
208
-
209
- // node_modules/@base-ui/react/esm/select/root/SelectRootContext.js
210
- import * as React from "react";
211
- "use client";
212
- var SelectRootContext = /* @__PURE__ */ React.createContext(null);
213
- if (true)
214
- SelectRootContext.displayName = "SelectRootContext";
215
- var SelectFloatingContext = /* @__PURE__ */ React.createContext(null);
216
- if (true)
217
- SelectFloatingContext.displayName = "SelectFloatingContext";
218
- function useSelectRootContext() {
219
- const context = React.useContext(SelectRootContext);
220
- if (context === null) {
221
- throw new Error("Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.");
222
- }
223
- return context;
224
- }
225
- function useSelectFloatingContext() {
226
- const context = React.useContext(SelectFloatingContext);
227
- if (context === null) {
228
- throw new Error("Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.");
229
- }
230
- return context;
231
- }
232
-
233
- // node_modules/@base-ui/react/esm/internals/itemEquality.js
234
- var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
235
- function compareItemEquality(itemValue, selectedValue, comparer) {
236
- if (itemValue == null || selectedValue == null) {
237
- return Object.is(itemValue, selectedValue);
238
- }
239
- return comparer(itemValue, selectedValue);
240
- }
241
- function selectedValueIncludes(selectedValues, itemValue, comparer) {
242
- if (!selectedValues || selectedValues.length === 0) {
243
- return false;
244
- }
245
- return selectedValues.some((selectedValue) => {
246
- if (selectedValue === undefined) {
247
- return false;
248
- }
249
- return compareItemEquality(itemValue, selectedValue, comparer);
250
- });
251
- }
252
- function findItemIndex(itemValues, selectedValue, comparer) {
253
- if (!itemValues || itemValues.length === 0) {
254
- return -1;
255
- }
256
- return itemValues.findIndex((itemValue) => {
257
- if (itemValue === undefined) {
258
- return false;
259
- }
260
- return compareItemEquality(itemValue, selectedValue, comparer);
261
- });
262
- }
263
- function removeItem(selectedValues, itemValue, comparer) {
264
- return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer));
265
- }
266
-
267
- // node_modules/@base-ui/react/esm/internals/resolveValueLabel.js
268
- import * as React2 from "react";
269
- import { jsx as _jsx } from "react/jsx-runtime";
270
- "use client";
271
- function isGroupedItems(items) {
272
- return items != null && items.length > 0 && typeof items[0] === "object" && items[0] != null && "items" in items[0];
273
- }
274
- function hasNullItemLabel(items) {
275
- if (!Array.isArray(items)) {
276
- return items != null && "null" in items;
277
- }
278
- const arrayItems = items;
279
- if (isGroupedItems(arrayItems)) {
280
- for (const group of arrayItems) {
281
- for (const item of group.items) {
282
- if (item && item.value == null && item.label != null) {
283
- return true;
284
- }
285
- }
286
- }
287
- return false;
288
- }
289
- for (const item of arrayItems) {
290
- if (item && item.value == null && item.label != null) {
291
- return true;
292
- }
293
- }
294
- return false;
295
- }
296
- function stringifyAsLabel(item, itemToStringLabel) {
297
- if (itemToStringLabel && item != null) {
298
- return itemToStringLabel(item) ?? "";
299
- }
300
- if (item && typeof item === "object") {
301
- if ("label" in item && item.label != null) {
302
- return String(item.label);
303
- }
304
- if ("value" in item) {
305
- return String(item.value);
306
- }
307
- }
308
- return serializeValue(item);
309
- }
310
- function stringifyAsValue(item, itemToStringValue) {
311
- if (itemToStringValue && item != null) {
312
- return itemToStringValue(item) ?? "";
313
- }
314
- if (item && typeof item === "object" && "value" in item && "label" in item) {
315
- return serializeValue(item.value);
316
- }
317
- return serializeValue(item);
318
- }
319
- function resolveSelectedLabel(value, items, itemToStringLabel) {
320
- function fallback() {
321
- return stringifyAsLabel(value, itemToStringLabel);
322
- }
323
- if (itemToStringLabel && value != null) {
324
- return itemToStringLabel(value);
325
- }
326
- if (value && typeof value === "object" && "label" in value && value.label != null) {
327
- return value.label;
328
- }
329
- if (items && !Array.isArray(items)) {
330
- return items[value] ?? fallback();
331
- }
332
- if (Array.isArray(items)) {
333
- const arrayItems = items;
334
- const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap((group) => group.items) : arrayItems;
335
- if (value == null || typeof value !== "object") {
336
- const match = flatItems.find((item) => item.value === value);
337
- if (match && match.label != null) {
338
- return match.label;
339
- }
340
- return fallback();
341
- }
342
- if ("value" in value) {
343
- const match = flatItems.find((item) => item && item.value === value.value);
344
- if (match && match.label != null) {
345
- return match.label;
346
- }
347
- }
348
- }
349
- return fallback();
350
- }
351
- function resolveMultipleLabels(values, items, itemToStringLabel) {
352
- return values.reduce((acc, value, index) => {
353
- if (index > 0) {
354
- acc.push(", ");
355
- }
356
- acc.push(/* @__PURE__ */ _jsx(React2.Fragment, {
357
- children: resolveSelectedLabel(value, items, itemToStringLabel)
358
- }, index));
359
- return acc;
360
- }, []);
361
- }
362
-
363
- // node_modules/@base-ui/react/esm/select/store.js
364
- var selectors = {
365
- id: createSelector((state) => state.id),
366
- labelId: createSelector((state) => state.labelId),
367
- modal: createSelector((state) => state.modal),
368
- multiple: createSelector((state) => state.multiple),
369
- items: createSelector((state) => state.items),
370
- itemToStringLabel: createSelector((state) => state.itemToStringLabel),
371
- itemToStringValue: createSelector((state) => state.itemToStringValue),
372
- isItemEqualToValue: createSelector((state) => state.isItemEqualToValue),
373
- value: createSelector((state) => state.value),
374
- hasSelectedValue: createSelector((state) => {
375
- const {
376
- value,
377
- multiple,
378
- itemToStringValue
379
- } = state;
380
- if (value == null) {
381
- return false;
382
- }
383
- if (multiple && Array.isArray(value)) {
384
- return value.length > 0;
385
- }
386
- return stringifyAsValue(value, itemToStringValue) !== "";
387
- }),
388
- hasNullItemLabel: createSelector((state, enabled) => {
389
- return enabled ? hasNullItemLabel(state.items) : false;
390
- }),
391
- open: createSelector((state) => state.open),
392
- mounted: createSelector((state) => state.mounted),
393
- forceMount: createSelector((state) => state.forceMount),
394
- transitionStatus: createSelector((state) => state.transitionStatus),
395
- openMethod: createSelector((state) => state.openMethod),
396
- activeIndex: createSelector((state) => state.activeIndex),
397
- selectedIndex: createSelector((state) => state.selectedIndex),
398
- isActive: createSelector((state, index) => state.activeIndex === index),
399
- isSelected: createSelector((state, index, itemValue) => {
400
- const comparer = state.isItemEqualToValue;
401
- const storeValue = state.value;
402
- if (state.multiple) {
403
- return Array.isArray(storeValue) && storeValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer));
404
- }
405
- if (state.selectedIndex === index && state.selectedIndex !== null) {
406
- return true;
407
- }
408
- return compareItemEquality(itemValue, storeValue, comparer);
409
- }),
410
- isSelectedByFocus: createSelector((state, index) => {
411
- return state.selectedIndex === index;
412
- }),
413
- popupProps: createSelector((state) => state.popupProps),
414
- triggerProps: createSelector((state) => state.triggerProps),
415
- triggerElement: createSelector((state) => state.triggerElement),
416
- positionerElement: createSelector((state) => state.positionerElement),
417
- listElement: createSelector((state) => state.listElement),
418
- popupSide: createSelector((state) => state.popupSide),
419
- scrollUpArrowVisible: createSelector((state) => state.scrollUpArrowVisible),
420
- scrollDownArrowVisible: createSelector((state) => state.scrollDownArrowVisible),
421
- hasScrollArrows: createSelector((state) => state.hasScrollArrows)
422
- };
423
-
424
- // node_modules/@base-ui/react/esm/select/root/SelectRoot.js
425
- import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
426
- "use client";
427
- function SelectRoot(props) {
428
- const {
429
- id,
430
- value: valueProp,
431
- defaultValue = null,
432
- onValueChange,
433
- open: openProp,
434
- defaultOpen = false,
435
- onOpenChange,
436
- name: nameProp,
437
- form,
438
- autoComplete,
439
- disabled: disabledProp = false,
440
- readOnly = false,
441
- required = false,
442
- modal = true,
443
- actionsRef,
444
- inputRef,
445
- onOpenChangeComplete,
446
- items,
447
- multiple = false,
448
- itemToStringLabel,
449
- itemToStringValue,
450
- isItemEqualToValue = defaultItemEquality,
451
- highlightItemOnHover = true,
452
- children
453
- } = props;
454
- const {
455
- clearErrors
456
- } = useFormContext();
457
- const {
458
- setDirty,
459
- setTouched,
460
- setFocused,
461
- shouldValidateOnChange,
462
- validityData,
463
- setFilled,
464
- name: fieldName,
465
- disabled: fieldDisabled,
466
- validation,
467
- validationMode
468
- } = useFieldRootContext();
469
- const generatedId = useLabelableId({
470
- id
471
- });
472
- const disabled = fieldDisabled || disabledProp;
473
- const name = fieldName ?? nameProp;
474
- const [value, setValueUnwrapped] = useControlled({
475
- controlled: valueProp,
476
- default: multiple ? defaultValue ?? EMPTY_ARRAY : defaultValue,
477
- name: "Select",
478
- state: "value"
479
- });
480
- const [open, setOpenUnwrapped] = useControlled({
481
- controlled: openProp,
482
- default: defaultOpen,
483
- name: "Select",
484
- state: "open"
485
- });
486
- const listRef = React3.useRef([]);
487
- const labelsRef = React3.useRef([]);
488
- const popupRef = React3.useRef(null);
489
- const scrollHandlerRef = React3.useRef(null);
490
- const scrollArrowsMountedCountRef = React3.useRef(0);
491
- const valueRef = React3.useRef(null);
492
- const valuesRef = React3.useRef([]);
493
- const typingRef = React3.useRef(false);
494
- const keyboardActiveRef = React3.useRef(false);
495
- const firstItemTextRef = React3.useRef(null);
496
- const selectedItemTextRef = React3.useRef(null);
497
- const selectionRef = React3.useRef({
498
- allowSelectedMouseUp: false,
499
- allowUnselectedMouseUp: false,
500
- dragY: 0
501
- });
502
- const alignItemWithTriggerActiveRef = React3.useRef(false);
503
- const {
504
- mounted,
505
- setMounted,
506
- transitionStatus
507
- } = useTransitionStatus(open);
508
- const {
509
- openMethod,
510
- triggerProps: interactionTypeProps
511
- } = useOpenInteractionType(open);
512
- const store = useRefWithInit(() => new Store({
513
- id: generatedId,
514
- labelId: undefined,
515
- modal,
516
- multiple,
517
- itemToStringLabel,
518
- itemToStringValue,
519
- isItemEqualToValue,
520
- value,
521
- open,
522
- mounted,
523
- transitionStatus,
524
- items,
525
- forceMount: false,
526
- openMethod: null,
527
- activeIndex: null,
528
- selectedIndex: null,
529
- popupProps: {},
530
- triggerProps: {},
531
- triggerElement: null,
532
- positionerElement: null,
533
- listElement: null,
534
- popupSide: null,
535
- scrollUpArrowVisible: false,
536
- scrollDownArrowVisible: false,
537
- hasScrollArrows: false
538
- })).current;
539
- const activeIndex = useStore(store, selectors.activeIndex);
540
- const selectedIndex = useStore(store, selectors.selectedIndex);
541
- const triggerElement = useStore(store, selectors.triggerElement);
542
- const positionerElement = useStore(store, selectors.positionerElement);
543
- const previousOpenMethod = usePreviousValue(openMethod);
544
- const renderedOpenMethod = openMethod ?? previousOpenMethod;
545
- const serializedValue = React3.useMemo(() => {
546
- if (multiple && Array.isArray(value) && value.length === 0) {
547
- return "";
548
- }
549
- return stringifyAsValue(value, itemToStringValue);
550
- }, [multiple, value, itemToStringValue]);
551
- const fieldStringValue = React3.useMemo(() => {
552
- if (multiple && Array.isArray(value)) {
553
- return value.map((currentValue) => stringifyAsValue(currentValue, itemToStringValue));
554
- }
555
- return stringifyAsValue(value, itemToStringValue);
556
- }, [multiple, value, itemToStringValue]);
557
- const controlRef = useValueAsRef(store.state.triggerElement);
558
- const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);
559
- useRegisterFieldControl(controlRef, generatedId, value, getStringifiedValueForForm);
560
- const initialValueRef = React3.useRef(value);
561
- const hasSelectedValue = multiple ? Array.isArray(value) && value.length > 0 : value != null;
562
- useIsoLayoutEffect(() => {
563
- if (value !== initialValueRef.current) {
564
- store.set("forceMount", true);
565
- }
566
- }, [store, value]);
567
- useIsoLayoutEffect(() => {
568
- setFilled(hasSelectedValue);
569
- }, [hasSelectedValue, setFilled]);
570
- useIsoLayoutEffect(function syncSelectedIndex() {
571
- const registry = valuesRef.current;
572
- let nextIndex;
573
- if (multiple) {
574
- const currentValue = Array.isArray(value) ? value : [];
575
- if (currentValue.length === 0) {
576
- nextIndex = null;
577
- } else {
578
- const lastValue = currentValue[currentValue.length - 1];
579
- const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);
580
- nextIndex = lastIndex === -1 ? null : lastIndex;
581
- }
582
- } else {
583
- const index = findItemIndex(registry, value, isItemEqualToValue);
584
- nextIndex = index === -1 ? null : index;
585
- }
586
- if (nextIndex === null) {
587
- selectedItemTextRef.current = null;
588
- }
589
- if (open) {
590
- return;
591
- }
592
- store.set("selectedIndex", nextIndex);
593
- }, [hasSelectedValue, multiple, open, value, valuesRef, isItemEqualToValue, store, selectedItemTextRef]);
594
- useValueChanged(value, () => {
595
- clearErrors(name);
596
- setDirty(value !== validityData.initialValue);
597
- if (shouldValidateOnChange()) {
598
- validation.commit(value);
599
- } else {
600
- validation.commit(value, true);
601
- }
602
- });
603
- const setOpen = useStableCallback((nextOpen, eventDetails) => {
604
- onOpenChange?.(nextOpen, eventDetails);
605
- if (eventDetails.isCanceled) {
606
- return;
607
- }
608
- setOpenUnwrapped(nextOpen);
609
- if (!nextOpen && (eventDetails.reason === exports_reason_parts.focusOut || eventDetails.reason === exports_reason_parts.outsidePress)) {
610
- setTouched(true);
611
- setFocused(false);
612
- if (validationMode === "onBlur") {
613
- validation.commit(value);
614
- }
615
- }
616
- if (!nextOpen && store.state.activeIndex !== null) {
617
- const activeOption = listRef.current[store.state.activeIndex];
618
- queueMicrotask(() => {
619
- activeOption?.setAttribute("tabindex", "-1");
620
- });
621
- }
622
- });
623
- const handleUnmount = useStableCallback(() => {
624
- setMounted(false);
625
- store.update({
626
- activeIndex: null,
627
- openMethod: null
628
- });
629
- onOpenChangeComplete?.(false);
630
- });
631
- useOpenChangeComplete({
632
- enabled: !actionsRef,
633
- open,
634
- ref: popupRef,
635
- onComplete() {
636
- if (!open) {
637
- handleUnmount();
638
- }
639
- }
640
- });
641
- React3.useImperativeHandle(actionsRef, () => ({
642
- unmount: handleUnmount
643
- }), [handleUnmount]);
644
- const setValue = useStableCallback((nextValue, eventDetails) => {
645
- onValueChange?.(nextValue, eventDetails);
646
- if (eventDetails.isCanceled) {
647
- return;
648
- }
649
- setValueUnwrapped(nextValue);
650
- });
651
- const handleScrollArrowVisibility = useStableCallback(() => {
652
- const scroller = store.state.listElement || popupRef.current;
653
- if (!scroller) {
654
- return;
655
- }
656
- const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
657
- const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);
658
- const shouldShowUp = scrollTop > 0;
659
- const shouldShowDown = scrollTop < maxScrollTop;
660
- if (store.state.scrollUpArrowVisible !== shouldShowUp) {
661
- store.set("scrollUpArrowVisible", shouldShowUp);
662
- }
663
- if (store.state.scrollDownArrowVisible !== shouldShowDown) {
664
- store.set("scrollDownArrowVisible", shouldShowDown);
665
- }
666
- });
667
- const floatingContext = useFloatingRootContext({
668
- open,
669
- onOpenChange: setOpen,
670
- elements: {
671
- reference: triggerElement,
672
- floating: positionerElement
673
- }
674
- });
675
- const click = useClick(floatingContext, {
676
- enabled: !readOnly && !disabled,
677
- event: "mousedown"
678
- });
679
- const dismiss = useDismiss(floatingContext);
680
- const listNavigation = useListNavigation(floatingContext, {
681
- enabled: !readOnly && !disabled,
682
- listRef,
683
- activeIndex,
684
- selectedIndex,
685
- disabledIndices: EMPTY_ARRAY,
686
- onNavigate(nextActiveIndex) {
687
- if (nextActiveIndex === null && !open) {
688
- return;
689
- }
690
- store.set("activeIndex", nextActiveIndex);
691
- },
692
- focusItemOnHover: highlightItemOnHover
693
- });
694
- const typeahead = useTypeahead(floatingContext, {
695
- enabled: !readOnly && !disabled && (open || !multiple),
696
- listRef: labelsRef,
697
- activeIndex,
698
- selectedIndex,
699
- onMatch(index) {
700
- if (open) {
701
- store.set("activeIndex", index);
702
- } else {
703
- setValue(valuesRef.current[index], createChangeEventDetails("none"));
704
- }
705
- },
706
- onTyping(typing) {
707
- typingRef.current = typing;
708
- }
709
- });
710
- const mergedTriggerProps = React3.useMemo(() => {
711
- const triggerInteractionProps = mergeProps(typeahead.reference, listNavigation.reference, dismiss.reference, click.reference, interactionTypeProps);
712
- if (generatedId) {
713
- triggerInteractionProps.id = generatedId;
714
- }
715
- return triggerInteractionProps;
716
- }, [click.reference, typeahead.reference, listNavigation.reference, dismiss.reference, interactionTypeProps, generatedId]);
717
- const popupProps = React3.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, typeahead.floating, listNavigation.floating, dismiss.floating), [typeahead.floating, listNavigation.floating, dismiss.floating]);
718
- const itemProps = listNavigation.item ?? EMPTY_OBJECT;
719
- useOnFirstRender(() => {
720
- store.update({
721
- popupProps,
722
- triggerProps: mergedTriggerProps
723
- });
724
- });
725
- useIsoLayoutEffect(() => {
726
- store.update({
727
- id: generatedId,
728
- modal,
729
- multiple,
730
- value,
731
- open,
732
- mounted,
733
- transitionStatus,
734
- popupProps,
735
- triggerProps: mergedTriggerProps,
736
- items,
737
- itemToStringLabel,
738
- itemToStringValue,
739
- isItemEqualToValue,
740
- openMethod: renderedOpenMethod
741
- });
742
- }, [store, generatedId, modal, multiple, value, open, mounted, transitionStatus, popupProps, mergedTriggerProps, items, itemToStringLabel, itemToStringValue, isItemEqualToValue, renderedOpenMethod]);
743
- const contextValue = React3.useMemo(() => ({
744
- store,
745
- name,
746
- required,
747
- disabled,
748
- readOnly,
749
- multiple,
750
- highlightItemOnHover,
751
- setValue,
752
- setOpen,
753
- listRef,
754
- popupRef,
755
- scrollHandlerRef,
756
- handleScrollArrowVisibility,
757
- scrollArrowsMountedCountRef,
758
- itemProps,
759
- events: floatingContext.context.events,
760
- valueRef,
761
- valuesRef,
762
- labelsRef,
763
- typingRef,
764
- selectionRef,
765
- firstItemTextRef,
766
- selectedItemTextRef,
767
- validation,
768
- onOpenChangeComplete,
769
- keyboardActiveRef,
770
- alignItemWithTriggerActiveRef,
771
- initialValueRef
772
- }), [store, name, required, disabled, readOnly, multiple, highlightItemOnHover, setValue, setOpen, itemProps, floatingContext.context.events, validation, onOpenChangeComplete, handleScrollArrowVisibility]);
773
- const ref = useMergedRefs(inputRef, validation.inputRef);
774
- const hasMultipleSelection = multiple && Array.isArray(value) && value.length > 0;
775
- const hiddenInputName = multiple ? undefined : name;
776
- const hiddenInputs = React3.useMemo(() => {
777
- if (!multiple || !Array.isArray(value) || !name) {
778
- return null;
779
- }
780
- return value.map((v) => {
781
- const currentSerializedValue = stringifyAsValue(v, itemToStringValue);
782
- return /* @__PURE__ */ _jsx2("input", {
783
- type: "hidden",
784
- form,
785
- name,
786
- value: currentSerializedValue
787
- }, currentSerializedValue);
788
- });
789
- }, [multiple, value, form, name, itemToStringValue]);
790
- return /* @__PURE__ */ _jsx2(SelectRootContext.Provider, {
791
- value: contextValue,
792
- children: /* @__PURE__ */ _jsxs(SelectFloatingContext.Provider, {
793
- value: floatingContext,
794
- children: [children, /* @__PURE__ */ _jsx2("input", {
795
- ...validation.getInputValidationProps({
796
- onFocus() {
797
- store.state.triggerElement?.focus({
798
- focusVisible: true
799
- });
800
- },
801
- onChange(event) {
802
- if (event.nativeEvent.defaultPrevented || disabled || readOnly) {
803
- event.preventBaseUIHandler?.();
804
- return;
805
- }
806
- const nextValue = event.currentTarget.value;
807
- const details = createChangeEventDetails(exports_reason_parts.none, event.nativeEvent);
808
- function handleChange() {
809
- if (multiple) {
810
- return;
811
- }
812
- const matchingValue = valuesRef.current.find((v) => {
813
- const candidateValue = stringifyAsValue(v, itemToStringValue);
814
- if (candidateValue.toLowerCase() === nextValue.toLowerCase()) {
815
- return true;
816
- }
817
- const candidateLabel = stringifyAsLabel(v, itemToStringLabel);
818
- if (candidateLabel.toLowerCase() === nextValue.toLowerCase()) {
819
- return true;
820
- }
821
- return false;
822
- });
823
- if (matchingValue != null) {
824
- setDirty(matchingValue !== validityData.initialValue);
825
- setValue(matchingValue, details);
826
- if (shouldValidateOnChange()) {
827
- validation.commit(matchingValue);
828
- }
829
- }
830
- }
831
- store.set("forceMount", true);
832
- queueMicrotask(handleChange);
833
- }
834
- }),
835
- id: generatedId && hiddenInputName == null ? `${generatedId}-hidden-input` : undefined,
836
- form,
837
- name: hiddenInputName,
838
- autoComplete,
839
- value: serializedValue,
840
- disabled,
841
- required: required && !hasMultipleSelection,
842
- readOnly,
843
- ref,
844
- style: name ? visuallyHiddenInput : visuallyHidden,
845
- tabIndex: -1,
846
- "aria-hidden": true,
847
- suppressHydrationWarning: true
848
- }), hiddenInputs]
849
- })
850
- });
851
- }
852
- // node_modules/@base-ui/react/esm/select/label/SelectLabel.js
853
- import * as React4 from "react";
854
- "use client";
855
- var SelectLabel = /* @__PURE__ */ React4.forwardRef(function SelectLabel2(componentProps, forwardedRef) {
856
- const {
857
- render,
858
- className,
859
- style,
860
- ...elementProps
861
- } = componentProps;
862
- const elementPropsWithoutId = elementProps;
863
- delete elementPropsWithoutId.id;
864
- const fieldRootContext = useFieldRootContext();
865
- const {
866
- store
867
- } = useSelectRootContext();
868
- const triggerElement = useStore(store, selectors.triggerElement);
869
- const rootId = useStore(store, selectors.id);
870
- const defaultLabelId = getDefaultLabelId(rootId);
871
- const labelProps = useLabel({
872
- id: defaultLabelId,
873
- fallbackControlId: triggerElement?.id ?? rootId,
874
- setLabelId(nextLabelId) {
875
- store.set("labelId", nextLabelId);
876
- }
877
- });
878
- return useRenderElement("div", componentProps, {
879
- ref: forwardedRef,
880
- state: fieldRootContext.state,
881
- props: [labelProps, elementProps],
882
- stateAttributesMapping: fieldValidityMapping
883
- });
884
- });
885
- if (true)
886
- SelectLabel.displayName = "SelectLabel";
887
- // node_modules/@base-ui/react/esm/select/trigger/SelectTrigger.js
888
- import * as React5 from "react";
889
- "use client";
890
- var BOUNDARY_OFFSET = 2;
891
- var SELECTED_DELAY = 400;
892
- var stateAttributesMapping = {
893
- ...pressableTriggerOpenStateMapping,
894
- ...fieldValidityMapping,
895
- popupSide: (side) => side ? {
896
- "data-popup-side": side
897
- } : null,
898
- value: () => null
899
- };
900
- var SelectTrigger = /* @__PURE__ */ React5.forwardRef(function SelectTrigger2(componentProps, forwardedRef) {
901
- const {
902
- render,
903
- className,
904
- id: idProp,
905
- disabled: disabledProp = false,
906
- nativeButton = true,
907
- style,
908
- ...elementProps
909
- } = componentProps;
910
- const {
911
- setTouched,
912
- setFocused,
913
- validationMode,
914
- state: fieldState,
915
- disabled: fieldDisabled
916
- } = useFieldRootContext();
917
- const {
918
- labelId: fieldLabelId
919
- } = useLabelableContext();
920
- const {
921
- store,
922
- setOpen,
923
- selectionRef,
924
- validation,
925
- readOnly,
926
- required,
927
- alignItemWithTriggerActiveRef,
928
- disabled: selectDisabled,
929
- keyboardActiveRef
930
- } = useSelectRootContext();
931
- const disabled = fieldDisabled || selectDisabled || disabledProp;
932
- const open = useStore(store, selectors.open);
933
- const mounted = useStore(store, selectors.mounted);
934
- const value = useStore(store, selectors.value);
935
- const triggerProps = useStore(store, selectors.triggerProps);
936
- const positionerElement = useStore(store, selectors.positionerElement);
937
- const listElement = useStore(store, selectors.listElement);
938
- const popupSideValue = useStore(store, selectors.popupSide);
939
- const rootId = useStore(store, selectors.id);
940
- const selectLabelId = useStore(store, selectors.labelId);
941
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
942
- const popupSide = mounted && positionerElement ? popupSideValue : null;
943
- const id = idProp ?? rootId;
944
- const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, selectLabelId);
945
- useLabelableId({
946
- id
947
- });
948
- const positionerRef = useValueAsRef(positionerElement);
949
- const triggerRef = React5.useRef(null);
950
- const {
951
- getButtonProps,
952
- buttonRef
953
- } = useButton({
954
- disabled,
955
- native: nativeButton
956
- });
957
- const setTriggerElement = useStableCallback((element) => {
958
- store.set("triggerElement", element);
959
- });
960
- const mergedRef = useMergedRefs(forwardedRef, triggerRef, buttonRef, setTriggerElement);
961
- const timeoutFocus = useTimeout();
962
- const timeoutMouseDown = useTimeout();
963
- const selectedDelayTimeout = useTimeout();
964
- React5.useEffect(() => {
965
- if (open) {
966
- selectedDelayTimeout.start(SELECTED_DELAY, () => {
967
- selectionRef.current.allowUnselectedMouseUp = true;
968
- selectionRef.current.allowSelectedMouseUp = true;
969
- });
970
- return () => {
971
- selectedDelayTimeout.clear();
972
- };
973
- }
974
- selectionRef.current = {
975
- allowSelectedMouseUp: false,
976
- allowUnselectedMouseUp: false,
977
- dragY: 0
978
- };
979
- timeoutMouseDown.clear();
980
- return;
981
- }, [open, selectionRef, timeoutMouseDown, selectedDelayTimeout]);
982
- const props = mergeProps(triggerProps, {
983
- id,
984
- role: "combobox",
985
- "aria-expanded": open ? "true" : "false",
986
- "aria-haspopup": "listbox",
987
- "aria-controls": open ? listElement?.id ?? getFloatingFocusElement(positionerElement)?.id : undefined,
988
- "aria-labelledby": ariaLabelledBy,
989
- "aria-readonly": readOnly || undefined,
990
- "aria-required": required || undefined,
991
- tabIndex: disabled ? -1 : 0,
992
- ref: mergedRef,
993
- onFocus(event) {
994
- setFocused(true);
995
- if (open && alignItemWithTriggerActiveRef.current) {
996
- setOpen(false, createChangeEventDetails(exports_reason_parts.none, event.nativeEvent));
997
- }
998
- timeoutFocus.start(0, () => {
999
- store.set("forceMount", true);
1000
- });
1001
- },
1002
- onBlur(event) {
1003
- if (contains(positionerElement, event.relatedTarget)) {
1004
- return;
1005
- }
1006
- setTouched(true);
1007
- setFocused(false);
1008
- if (validationMode === "onBlur") {
1009
- validation.commit(value);
1010
- }
1011
- },
1012
- onPointerMove() {
1013
- keyboardActiveRef.current = false;
1014
- },
1015
- onKeyDown() {
1016
- keyboardActiveRef.current = true;
1017
- },
1018
- onMouseDown(event) {
1019
- if (open) {
1020
- return;
1021
- }
1022
- const doc = ownerDocument(event.currentTarget);
1023
- function handleMouseUp(mouseEvent) {
1024
- if (!triggerRef.current) {
1025
- return;
1026
- }
1027
- const mouseUpTarget = mouseEvent.target;
1028
- if (contains(triggerRef.current, mouseUpTarget) || contains(positionerRef.current, mouseUpTarget) || mouseUpTarget === triggerRef.current) {
1029
- return;
1030
- }
1031
- const bounds = getPseudoElementBounds(triggerRef.current);
1032
- if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET) {
1033
- return;
1034
- }
1035
- setOpen(false, createChangeEventDetails(exports_reason_parts.cancelOpen, mouseEvent));
1036
- }
1037
- timeoutMouseDown.start(0, () => {
1038
- doc.addEventListener("mouseup", handleMouseUp, {
1039
- once: true
1040
- });
1041
- });
1042
- }
1043
- }, validation.getValidationProps, elementProps, getButtonProps);
1044
- props.role = "combobox";
1045
- const state = {
1046
- ...fieldState,
1047
- open,
1048
- disabled,
1049
- value,
1050
- readOnly,
1051
- popupSide,
1052
- placeholder: !hasSelectedValue
1053
- };
1054
- return useRenderElement("button", componentProps, {
1055
- ref: [forwardedRef, triggerRef],
1056
- state,
1057
- stateAttributesMapping,
1058
- props
1059
- });
1060
- });
1061
- if (true)
1062
- SelectTrigger.displayName = "SelectTrigger";
1063
- // node_modules/@base-ui/react/esm/select/value/SelectValue.js
1064
- import * as React6 from "react";
1065
- "use client";
1066
- var stateAttributesMapping2 = {
1067
- value: () => null
1068
- };
1069
- var SelectValue = /* @__PURE__ */ React6.forwardRef(function SelectValue2(componentProps, forwardedRef) {
1070
- const {
1071
- className,
1072
- render,
1073
- children: childrenProp,
1074
- placeholder,
1075
- style,
1076
- ...elementProps
1077
- } = componentProps;
1078
- const {
1079
- store,
1080
- valueRef
1081
- } = useSelectRootContext();
1082
- const value = useStore(store, selectors.value);
1083
- const items = useStore(store, selectors.items);
1084
- const itemToStringLabel = useStore(store, selectors.itemToStringLabel);
1085
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
1086
- const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;
1087
- const hasNullLabel = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
1088
- const state = {
1089
- value,
1090
- placeholder: !hasSelectedValue
1091
- };
1092
- let children = null;
1093
- if (typeof childrenProp === "function") {
1094
- children = childrenProp(value);
1095
- } else if (childrenProp != null) {
1096
- children = childrenProp;
1097
- } else if (!hasSelectedValue && placeholder != null && !hasNullLabel) {
1098
- children = placeholder;
1099
- } else if (Array.isArray(value)) {
1100
- children = resolveMultipleLabels(value, items, itemToStringLabel);
1101
- } else {
1102
- children = resolveSelectedLabel(value, items, itemToStringLabel);
1103
- }
1104
- const element = useRenderElement("span", componentProps, {
1105
- state,
1106
- ref: [forwardedRef, valueRef],
1107
- props: [{
1108
- children
1109
- }, elementProps],
1110
- stateAttributesMapping: stateAttributesMapping2
1111
- });
1112
- return element;
1113
- });
1114
- if (true)
1115
- SelectValue.displayName = "SelectValue";
1116
- // node_modules/@base-ui/react/esm/select/icon/SelectIcon.js
1117
- import * as React7 from "react";
1118
- "use client";
1119
- var SelectIcon = /* @__PURE__ */ React7.forwardRef(function SelectIcon2(componentProps, forwardedRef) {
1120
- const {
1121
- render,
1122
- className,
1123
- style,
1124
- ...elementProps
1125
- } = componentProps;
1126
- const {
1127
- store
1128
- } = useSelectRootContext();
1129
- const open = useStore(store, selectors.open);
1130
- const state = {
1131
- open
1132
- };
1133
- const element = useRenderElement("span", componentProps, {
1134
- state,
1135
- ref: forwardedRef,
1136
- props: [{
1137
- "aria-hidden": true,
1138
- children: "▼"
1139
- }, elementProps],
1140
- stateAttributesMapping: triggerOpenStateMapping
1141
- });
1142
- return element;
1143
- });
1144
- if (true)
1145
- SelectIcon.displayName = "SelectIcon";
1146
- // node_modules/@base-ui/react/esm/select/portal/SelectPortal.js
1147
- import * as React9 from "react";
1148
-
1149
- // node_modules/@base-ui/react/esm/select/portal/SelectPortalContext.js
1150
- import * as React8 from "react";
1151
- "use client";
1152
- var SelectPortalContext = /* @__PURE__ */ React8.createContext(undefined);
1153
- if (true)
1154
- SelectPortalContext.displayName = "SelectPortalContext";
1155
-
1156
- // node_modules/@base-ui/react/esm/select/portal/SelectPortal.js
1157
- import { jsx as _jsx3 } from "react/jsx-runtime";
1158
- "use client";
1159
- var SelectPortal = /* @__PURE__ */ React9.forwardRef(function SelectPortal2(portalProps, forwardedRef) {
1160
- const {
1161
- store
1162
- } = useSelectRootContext();
1163
- const mounted = useStore(store, selectors.mounted);
1164
- const forceMount = useStore(store, selectors.forceMount);
1165
- const shouldRender = mounted || forceMount;
1166
- if (!shouldRender) {
1167
- return null;
1168
- }
1169
- return /* @__PURE__ */ _jsx3(SelectPortalContext.Provider, {
1170
- value: true,
1171
- children: /* @__PURE__ */ _jsx3(FloatingPortal, {
1172
- ref: forwardedRef,
1173
- ...portalProps
1174
- })
1175
- });
1176
- });
1177
- if (true)
1178
- SelectPortal.displayName = "SelectPortal";
1179
- // node_modules/@base-ui/react/esm/select/backdrop/SelectBackdrop.js
1180
- import * as React10 from "react";
1181
- "use client";
1182
- var stateAttributesMapping3 = {
1183
- ...popupStateMapping,
1184
- ...transitionStatusMapping
1185
- };
1186
- var SelectBackdrop = /* @__PURE__ */ React10.forwardRef(function SelectBackdrop2(componentProps, forwardedRef) {
1187
- const {
1188
- render,
1189
- className,
1190
- style,
1191
- ...elementProps
1192
- } = componentProps;
1193
- const {
1194
- store
1195
- } = useSelectRootContext();
1196
- const open = useStore(store, selectors.open);
1197
- const mounted = useStore(store, selectors.mounted);
1198
- const transitionStatus = useStore(store, selectors.transitionStatus);
1199
- const state = {
1200
- open,
1201
- transitionStatus
1202
- };
1203
- const element = useRenderElement("div", componentProps, {
1204
- state,
1205
- ref: forwardedRef,
1206
- props: [{
1207
- role: "presentation",
1208
- hidden: !mounted,
1209
- style: {
1210
- userSelect: "none",
1211
- WebkitUserSelect: "none"
1212
- }
1213
- }, elementProps],
1214
- stateAttributesMapping: stateAttributesMapping3
1215
- });
1216
- return element;
1217
- });
1218
- if (true)
1219
- SelectBackdrop.displayName = "SelectBackdrop";
1220
- // node_modules/@base-ui/react/esm/select/positioner/SelectPositioner.js
1221
- import * as React12 from "react";
1222
-
1223
- // node_modules/@base-ui/react/esm/select/positioner/SelectPositionerContext.js
1224
- import * as React11 from "react";
1225
- "use client";
1226
- var SelectPositionerContext = /* @__PURE__ */ React11.createContext(undefined);
1227
- if (true)
1228
- SelectPositionerContext.displayName = "SelectPositionerContext";
1229
- function useSelectPositionerContext() {
1230
- const context = React11.useContext(SelectPositionerContext);
1231
- if (!context) {
1232
- throw new Error("Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.");
1233
- }
1234
- return context;
1235
- }
1236
-
1237
- // node_modules/@base-ui/react/esm/select/popup/utils.js
1238
- function clearStyles(element, originalStyles) {
1239
- if (element) {
1240
- Object.assign(element.style, originalStyles);
1241
- }
1242
- }
1243
- var LIST_FUNCTIONAL_STYLES = {
1244
- position: "relative",
1245
- maxHeight: "100%",
1246
- overflowX: "hidden",
1247
- overflowY: "auto"
1248
- };
1249
-
1250
- // node_modules/@base-ui/react/esm/select/positioner/SelectPositioner.js
1251
- import { jsx as _jsx4, jsxs as _jsxs2 } from "react/jsx-runtime";
1252
- "use client";
1253
- var FIXED = {
1254
- position: "fixed"
1255
- };
1256
- var SelectPositioner = /* @__PURE__ */ React12.forwardRef(function SelectPositioner2(componentProps, forwardedRef) {
1257
- const {
1258
- anchor,
1259
- positionMethod = "absolute",
1260
- className,
1261
- render,
1262
- side = "bottom",
1263
- align = "center",
1264
- sideOffset = 0,
1265
- alignOffset = 0,
1266
- collisionBoundary = "clipping-ancestors",
1267
- collisionPadding,
1268
- arrowPadding = 5,
1269
- sticky = false,
1270
- disableAnchorTracking,
1271
- alignItemWithTrigger = true,
1272
- collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE,
1273
- style,
1274
- ...elementProps
1275
- } = componentProps;
1276
- const {
1277
- store,
1278
- listRef,
1279
- labelsRef,
1280
- alignItemWithTriggerActiveRef,
1281
- selectedItemTextRef,
1282
- valuesRef,
1283
- initialValueRef,
1284
- popupRef,
1285
- setValue
1286
- } = useSelectRootContext();
1287
- const floatingRootContext = useSelectFloatingContext();
1288
- const open = useStore(store, selectors.open);
1289
- const mounted = useStore(store, selectors.mounted);
1290
- const modal = useStore(store, selectors.modal);
1291
- const value = useStore(store, selectors.value);
1292
- const openMethod = useStore(store, selectors.openMethod);
1293
- const positionerElement = useStore(store, selectors.positionerElement);
1294
- const triggerElement = useStore(store, selectors.triggerElement);
1295
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
1296
- const transitionStatus = useStore(store, selectors.transitionStatus);
1297
- const scrollUpArrowRef = React12.useRef(null);
1298
- const scrollDownArrowRef = React12.useRef(null);
1299
- const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] = React12.useState(alignItemWithTrigger);
1300
- const alignItemWithTriggerActive = mounted && controlledAlignItemWithTrigger && openMethod !== "touch";
1301
- if (!mounted && controlledAlignItemWithTrigger !== alignItemWithTrigger) {
1302
- setControlledAlignItemWithTrigger(alignItemWithTrigger);
1303
- }
1304
- useIsoLayoutEffect(() => {
1305
- if (!mounted) {
1306
- if (selectors.scrollUpArrowVisible(store.state)) {
1307
- store.set("scrollUpArrowVisible", false);
1308
- }
1309
- if (selectors.scrollDownArrowVisible(store.state)) {
1310
- store.set("scrollDownArrowVisible", false);
1311
- }
1312
- }
1313
- }, [store, mounted]);
1314
- React12.useImperativeHandle(alignItemWithTriggerActiveRef, () => alignItemWithTriggerActive);
1315
- useAnchoredPopupScrollLock((alignItemWithTriggerActive || modal) && open, openMethod === "touch", positionerElement, triggerElement);
1316
- const positioning = useAnchorPositioning({
1317
- anchor,
1318
- floatingRootContext,
1319
- positionMethod,
1320
- mounted,
1321
- side,
1322
- sideOffset,
1323
- align,
1324
- alignOffset,
1325
- arrowPadding,
1326
- collisionBoundary,
1327
- collisionPadding,
1328
- sticky,
1329
- disableAnchorTracking: disableAnchorTracking ?? alignItemWithTriggerActive,
1330
- collisionAvoidance,
1331
- keepMounted: true
1332
- });
1333
- const renderedSide = alignItemWithTriggerActive ? "none" : positioning.side;
1334
- const positionerStyles = alignItemWithTriggerActive ? FIXED : positioning.positionerStyles;
1335
- const state = {
1336
- open,
1337
- side: renderedSide,
1338
- align: positioning.align,
1339
- anchorHidden: positioning.anchorHidden
1340
- };
1341
- useIsoLayoutEffect(() => {
1342
- store.set("popupSide", positioning.side);
1343
- }, [store, positioning.side]);
1344
- const setPositionerElement = useStableCallback((element2) => {
1345
- store.set("positionerElement", element2);
1346
- });
1347
- const element = usePositioner(componentProps, state, {
1348
- styles: positionerStyles,
1349
- transitionStatus,
1350
- props: elementProps,
1351
- refs: [forwardedRef, setPositionerElement],
1352
- hidden: !mounted,
1353
- inert: !open
1354
- });
1355
- const prevMapSizeRef = React12.useRef(0);
1356
- const onMapChange = useStableCallback((map) => {
1357
- if (map.size === 0 && prevMapSizeRef.current === 0) {
1358
- return;
1359
- }
1360
- if (valuesRef.current.length === 0) {
1361
- return;
1362
- }
1363
- const prevSize = prevMapSizeRef.current;
1364
- prevMapSizeRef.current = map.size;
1365
- if (map.size === prevSize) {
1366
- return;
1367
- }
1368
- const eventDetails = createChangeEventDetails(exports_reason_parts.none);
1369
- if (prevSize !== 0 && !store.state.multiple && value !== null) {
1370
- const selectedValueIndex = findItemIndex(valuesRef.current, value, isItemEqualToValue);
1371
- if (selectedValueIndex === -1) {
1372
- const initialSelectedValue = initialValueRef.current;
1373
- const hasInitial = initialSelectedValue != null && findItemIndex(valuesRef.current, initialSelectedValue, isItemEqualToValue) !== -1;
1374
- const nextValue = hasInitial ? initialSelectedValue : null;
1375
- setValue(nextValue, eventDetails);
1376
- if (nextValue === null) {
1377
- store.set("selectedIndex", null);
1378
- selectedItemTextRef.current = null;
1379
- }
1380
- }
1381
- }
1382
- if (prevSize !== 0 && store.state.multiple && Array.isArray(value)) {
1383
- const hasVisibleItem = (selectedItemValue) => findItemIndex(valuesRef.current, selectedItemValue, isItemEqualToValue) !== -1;
1384
- const nextValue = value.filter((selectedItemValue) => hasVisibleItem(selectedItemValue));
1385
- if (nextValue.length !== value.length || nextValue.some((selectedItemValue) => !selectedValueIncludes(value, selectedItemValue, isItemEqualToValue))) {
1386
- setValue(nextValue, eventDetails);
1387
- if (nextValue.length === 0) {
1388
- store.set("selectedIndex", null);
1389
- selectedItemTextRef.current = null;
1390
- }
1391
- }
1392
- }
1393
- if (open && alignItemWithTriggerActive) {
1394
- store.update({
1395
- scrollUpArrowVisible: false,
1396
- scrollDownArrowVisible: false
1397
- });
1398
- const stylesToClear = {
1399
- height: ""
1400
- };
1401
- clearStyles(positionerElement, stylesToClear);
1402
- clearStyles(popupRef.current, stylesToClear);
1403
- }
1404
- });
1405
- const contextValue = React12.useMemo(() => ({
1406
- ...positioning,
1407
- side: renderedSide,
1408
- alignItemWithTriggerActive,
1409
- setControlledAlignItemWithTrigger,
1410
- scrollUpArrowRef,
1411
- scrollDownArrowRef
1412
- }), [positioning, renderedSide, alignItemWithTriggerActive, setControlledAlignItemWithTrigger]);
1413
- return /* @__PURE__ */ _jsx4(CompositeList, {
1414
- elementsRef: listRef,
1415
- labelsRef,
1416
- onMapChange,
1417
- children: /* @__PURE__ */ _jsxs2(SelectPositionerContext.Provider, {
1418
- value: contextValue,
1419
- children: [mounted && modal && /* @__PURE__ */ _jsx4(InternalBackdrop, {
1420
- inert: inertValue(!open),
1421
- cutout: triggerElement
1422
- }), element]
1423
- })
1424
- });
1425
- });
1426
- if (true)
1427
- SelectPositioner.displayName = "SelectPositioner";
1428
- // node_modules/@base-ui/react/esm/select/popup/SelectPopup.js
1429
- import * as React13 from "react";
1430
- import { jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
1431
- "use client";
1432
- var stateAttributesMapping4 = {
1433
- ...popupStateMapping,
1434
- ...transitionStatusMapping
1435
- };
1436
- var SelectPopup = /* @__PURE__ */ React13.forwardRef(function SelectPopup2(componentProps, forwardedRef) {
1437
- const {
1438
- render,
1439
- className,
1440
- style,
1441
- finalFocus,
1442
- ...elementProps
1443
- } = componentProps;
1444
- const {
1445
- store,
1446
- popupRef,
1447
- onOpenChangeComplete,
1448
- setOpen,
1449
- valueRef,
1450
- firstItemTextRef,
1451
- selectedItemTextRef,
1452
- keyboardActiveRef,
1453
- multiple,
1454
- handleScrollArrowVisibility,
1455
- scrollHandlerRef,
1456
- listRef,
1457
- highlightItemOnHover
1458
- } = useSelectRootContext();
1459
- const {
1460
- side,
1461
- align,
1462
- alignItemWithTriggerActive,
1463
- isPositioned,
1464
- setControlledAlignItemWithTrigger,
1465
- scrollDownArrowRef,
1466
- scrollUpArrowRef
1467
- } = useSelectPositionerContext();
1468
- const insideToolbar = useToolbarRootContext(true) != null;
1469
- const floatingRootContext = useSelectFloatingContext();
1470
- const direction = useDirection();
1471
- const {
1472
- nonce,
1473
- disableStyleElements
1474
- } = useCSPContext();
1475
- const id = useStore(store, selectors.id);
1476
- const open = useStore(store, selectors.open);
1477
- const mounted = useStore(store, selectors.mounted);
1478
- const popupProps = useStore(store, selectors.popupProps);
1479
- const transitionStatus = useStore(store, selectors.transitionStatus);
1480
- const triggerElement = useStore(store, selectors.triggerElement);
1481
- const positionerElement = useStore(store, selectors.positionerElement);
1482
- const listElement = useStore(store, selectors.listElement);
1483
- const reachedMaxHeightRef = React13.useRef(false);
1484
- const initialPlacedRef = React13.useRef(false);
1485
- const originalPositionerStylesRef = React13.useRef({});
1486
- const scrollArrowFrame = useAnimationFrame();
1487
- const handleScroll = useStableCallback((scroller) => {
1488
- if (!positionerElement || !popupRef.current || !initialPlacedRef.current) {
1489
- return;
1490
- }
1491
- if (reachedMaxHeightRef.current || !alignItemWithTriggerActive) {
1492
- handleScrollArrowVisibility();
1493
- return;
1494
- }
1495
- const isTopPositioned = positionerElement.style.top === "0px";
1496
- const isBottomPositioned = positionerElement.style.bottom === "0px";
1497
- if (!isTopPositioned && !isBottomPositioned) {
1498
- handleScrollArrowVisibility();
1499
- return;
1500
- }
1501
- const scale = getScale(positionerElement);
1502
- const currentHeight = normalizeSize(positionerElement.getBoundingClientRect().height, "y", scale);
1503
- const doc = ownerDocument(positionerElement);
1504
- const positionerStyles = getComputedStyle(positionerElement);
1505
- const marginTop = parseFloat(positionerStyles.marginTop);
1506
- const marginBottom = parseFloat(positionerStyles.marginBottom);
1507
- const maxPopupHeight = getMaxPopupHeight(getComputedStyle(popupRef.current));
1508
- const maxAvailableHeight = Math.min(doc.documentElement.clientHeight - marginTop - marginBottom, maxPopupHeight);
1509
- const scrollTop = scroller.scrollTop;
1510
- const maxScrollTop = getMaxScrollTop(scroller);
1511
- let nextPositionerHeight = 0;
1512
- let nextScrollTop = null;
1513
- let setReachedMax = false;
1514
- let scrollToMax = false;
1515
- const setHeight = (height) => {
1516
- positionerElement.style.height = `${height}px`;
1517
- };
1518
- const handleSmallDiff = (diff2, targetScrollTop) => {
1519
- const heightDelta = clamp(diff2, 0, maxAvailableHeight - currentHeight);
1520
- if (heightDelta > 0) {
1521
- setHeight(currentHeight + heightDelta);
1522
- }
1523
- scroller.scrollTop = targetScrollTop;
1524
- if (maxAvailableHeight - (currentHeight + heightDelta) <= SCROLL_EDGE_TOLERANCE_PX) {
1525
- reachedMaxHeightRef.current = true;
1526
- }
1527
- handleScrollArrowVisibility();
1528
- };
1529
- const diff = isTopPositioned ? maxScrollTop - scrollTop : scrollTop;
1530
- const nextHeight = Math.min(currentHeight + diff, maxAvailableHeight);
1531
- nextPositionerHeight = nextHeight;
1532
- if (diff <= SCROLL_EDGE_TOLERANCE_PX) {
1533
- handleSmallDiff(diff, isTopPositioned ? maxScrollTop : 0);
1534
- return;
1535
- }
1536
- if (maxAvailableHeight - nextHeight > SCROLL_EDGE_TOLERANCE_PX) {
1537
- if (isTopPositioned) {
1538
- scrollToMax = true;
1539
- } else {
1540
- nextScrollTop = 0;
1541
- }
1542
- } else {
1543
- setReachedMax = true;
1544
- if (isBottomPositioned && scrollTop < maxScrollTop) {
1545
- const overshoot = currentHeight + diff - maxAvailableHeight;
1546
- nextScrollTop = scrollTop - (diff - overshoot);
1547
- }
1548
- }
1549
- nextPositionerHeight = Math.ceil(nextPositionerHeight);
1550
- if (nextPositionerHeight !== 0) {
1551
- setHeight(nextPositionerHeight);
1552
- }
1553
- if (scrollToMax || nextScrollTop != null) {
1554
- const nextMaxScrollTop = getMaxScrollTop(scroller);
1555
- const target = scrollToMax ? nextMaxScrollTop : clamp(nextScrollTop, 0, nextMaxScrollTop);
1556
- if (Math.abs(scroller.scrollTop - target) > SCROLL_EDGE_TOLERANCE_PX) {
1557
- scroller.scrollTop = target;
1558
- }
1559
- }
1560
- if (setReachedMax || nextPositionerHeight >= maxAvailableHeight - SCROLL_EDGE_TOLERANCE_PX) {
1561
- reachedMaxHeightRef.current = true;
1562
- }
1563
- handleScrollArrowVisibility();
1564
- });
1565
- React13.useImperativeHandle(scrollHandlerRef, () => handleScroll, [handleScroll]);
1566
- useOpenChangeComplete({
1567
- open,
1568
- ref: popupRef,
1569
- onComplete() {
1570
- if (open) {
1571
- onOpenChangeComplete?.(true);
1572
- }
1573
- }
1574
- });
1575
- const state = {
1576
- open,
1577
- transitionStatus,
1578
- side,
1579
- align
1580
- };
1581
- useIsoLayoutEffect(() => {
1582
- if (!positionerElement || !popupRef.current || Object.keys(originalPositionerStylesRef.current).length) {
1583
- return;
1584
- }
1585
- originalPositionerStylesRef.current = {
1586
- top: positionerElement.style.top || "0",
1587
- left: positionerElement.style.left || "0",
1588
- right: positionerElement.style.right,
1589
- height: positionerElement.style.height,
1590
- bottom: positionerElement.style.bottom,
1591
- minHeight: positionerElement.style.minHeight,
1592
- maxHeight: positionerElement.style.maxHeight,
1593
- marginTop: positionerElement.style.marginTop,
1594
- marginBottom: positionerElement.style.marginBottom
1595
- };
1596
- }, [popupRef, positionerElement]);
1597
- useIsoLayoutEffect(() => {
1598
- if (open || alignItemWithTriggerActive) {
1599
- return;
1600
- }
1601
- initialPlacedRef.current = false;
1602
- reachedMaxHeightRef.current = false;
1603
- clearStyles(positionerElement, originalPositionerStylesRef.current);
1604
- }, [open, alignItemWithTriggerActive, positionerElement, popupRef]);
1605
- useIsoLayoutEffect(() => {
1606
- const popupElement = popupRef.current;
1607
- if (!open || !triggerElement || !positionerElement || !popupElement || alignItemWithTriggerActive && !isPositioned || store.state.transitionStatus === "ending") {
1608
- return;
1609
- }
1610
- if (!alignItemWithTriggerActive) {
1611
- initialPlacedRef.current = true;
1612
- scrollArrowFrame.request(handleScrollArrowVisibility);
1613
- popupElement.style.removeProperty("--transform-origin");
1614
- return;
1615
- }
1616
- const restoreTransformStyles = unsetTransformStyles(popupElement);
1617
- popupElement.style.removeProperty("--transform-origin");
1618
- try {
1619
- let textElement = selectedItemTextRef.current;
1620
- if (!textElement?.isConnected) {
1621
- const hasSelectedValue = selectors.hasSelectedValue(store.state);
1622
- textElement = !hasSelectedValue && firstItemTextRef.current?.isConnected ? firstItemTextRef.current : null;
1623
- }
1624
- const valueElement = valueRef.current;
1625
- const positionerStyles = getComputedStyle(positionerElement);
1626
- const popupStyles = getComputedStyle(popupElement);
1627
- const doc = ownerDocument(triggerElement);
1628
- const win = getWindow(positionerElement);
1629
- const scale = getScale(triggerElement);
1630
- const triggerRect = normalizeRect(triggerElement.getBoundingClientRect(), scale);
1631
- const positionerRect = normalizeRect(positionerElement.getBoundingClientRect(), scale);
1632
- const triggerHeight = triggerRect.height;
1633
- const scroller = listElement || popupElement;
1634
- const scrollHeight = scroller.scrollHeight;
1635
- const borderBottom = parseFloat(popupStyles.borderBottomWidth);
1636
- const marginTop = parseFloat(positionerStyles.marginTop) || 10;
1637
- const marginBottom = parseFloat(positionerStyles.marginBottom) || 10;
1638
- const minHeight = parseFloat(positionerStyles.minHeight) || 100;
1639
- const maxPopupHeight = getMaxPopupHeight(popupStyles);
1640
- const paddingLeft = 5;
1641
- const paddingRight = 5;
1642
- const triggerCollisionThreshold = 20;
1643
- const viewportHeight = doc.documentElement.clientHeight - marginTop - marginBottom;
1644
- const viewportWidth = doc.documentElement.clientWidth;
1645
- const availableSpaceBeneathTrigger = viewportHeight - triggerRect.bottom + triggerHeight;
1646
- let textRect;
1647
- let alignedLeft = direction === "rtl" ? triggerRect.right - positionerRect.width : triggerRect.left;
1648
- let offsetY = 0;
1649
- if (textElement && valueElement) {
1650
- const valueRect = normalizeRect(valueElement.getBoundingClientRect(), scale);
1651
- textRect = normalizeRect(textElement.getBoundingClientRect(), scale);
1652
- alignedLeft = positionerRect.left + (direction === "rtl" ? valueRect.right - textRect.right : valueRect.left - textRect.left);
1653
- const valueCenterFromTriggerTop = valueRect.top - triggerRect.top + valueRect.height / 2;
1654
- const textCenterFromPositionerTop = textRect.top - positionerRect.top + textRect.height / 2;
1655
- offsetY = textCenterFromPositionerTop - valueCenterFromTriggerTop;
1656
- }
1657
- const idealHeight = availableSpaceBeneathTrigger + offsetY + marginBottom + borderBottom;
1658
- let height = Math.min(viewportHeight, idealHeight);
1659
- const maxHeight = viewportHeight - marginTop - marginBottom;
1660
- const scrollTop = idealHeight - height;
1661
- const maxRight = viewportWidth - paddingRight;
1662
- positionerElement.style.left = `${clamp(alignedLeft, paddingLeft, maxRight - positionerRect.width)}px`;
1663
- positionerElement.style.height = `${height}px`;
1664
- positionerElement.style.maxHeight = "auto";
1665
- positionerElement.style.marginTop = `${marginTop}px`;
1666
- positionerElement.style.marginBottom = `${marginBottom}px`;
1667
- popupElement.style.height = "100%";
1668
- const maxScrollTop = getMaxScrollTop(scroller);
1669
- const isTopPositioned = scrollTop >= maxScrollTop - SCROLL_EDGE_TOLERANCE_PX;
1670
- if (isTopPositioned) {
1671
- height = Math.min(viewportHeight, positionerRect.height) - (scrollTop - maxScrollTop);
1672
- }
1673
- const fallbackToAlignPopupToTrigger = triggerRect.top < triggerCollisionThreshold || triggerRect.bottom > viewportHeight - triggerCollisionThreshold || Math.ceil(height) + SCROLL_EDGE_TOLERANCE_PX < Math.min(scrollHeight, minHeight);
1674
- const isPinchZoomed = (win.visualViewport?.scale ?? 1) !== 1 && isWebKit;
1675
- if (fallbackToAlignPopupToTrigger || isPinchZoomed) {
1676
- initialPlacedRef.current = true;
1677
- clearStyles(positionerElement, originalPositionerStylesRef.current);
1678
- setControlledAlignItemWithTrigger(false);
1679
- return;
1680
- }
1681
- const initialHeight = Math.max(minHeight, height);
1682
- if (isTopPositioned) {
1683
- const topOffset = Math.max(0, viewportHeight - idealHeight);
1684
- positionerElement.style.top = positionerRect.height >= maxHeight ? "0" : `${topOffset}px`;
1685
- positionerElement.style.height = `${height}px`;
1686
- scroller.scrollTop = getMaxScrollTop(scroller);
1687
- } else {
1688
- positionerElement.style.bottom = "0";
1689
- scroller.scrollTop = scrollTop;
1690
- }
1691
- if (textRect) {
1692
- const popupTop = positionerRect.top;
1693
- const popupHeight = positionerRect.height;
1694
- const textCenterY = textRect.top + textRect.height / 2;
1695
- const transformOriginY = popupHeight > 0 ? (textCenterY - popupTop) / popupHeight * 100 : 50;
1696
- const clampedY = clamp(transformOriginY, 0, 100);
1697
- popupElement.style.setProperty("--transform-origin", `50% ${clampedY}%`);
1698
- }
1699
- if (initialHeight === viewportHeight || height >= maxPopupHeight) {
1700
- reachedMaxHeightRef.current = true;
1701
- }
1702
- handleScrollArrowVisibility();
1703
- if (highlightItemOnHover && store.state.selectedIndex === null && store.state.activeIndex === null && listRef.current[0] != null) {
1704
- store.set("activeIndex", 0);
1705
- }
1706
- initialPlacedRef.current = true;
1707
- } finally {
1708
- restoreTransformStyles();
1709
- }
1710
- }, [store, open, positionerElement, triggerElement, valueRef, firstItemTextRef, selectedItemTextRef, popupRef, handleScrollArrowVisibility, alignItemWithTriggerActive, setControlledAlignItemWithTrigger, scrollArrowFrame, scrollDownArrowRef, scrollUpArrowRef, listElement, listRef, highlightItemOnHover, direction, isPositioned]);
1711
- React13.useEffect(() => {
1712
- if (!alignItemWithTriggerActive || !positionerElement || !open) {
1713
- return;
1714
- }
1715
- const win = getWindow(positionerElement);
1716
- function handleResize(event) {
1717
- setOpen(false, createChangeEventDetails(exports_reason_parts.windowResize, event));
1718
- }
1719
- return addEventListener(win, "resize", handleResize);
1720
- }, [setOpen, alignItemWithTriggerActive, positionerElement, open]);
1721
- const defaultProps = {
1722
- ...listElement ? {
1723
- role: "presentation",
1724
- "aria-orientation": undefined
1725
- } : {
1726
- role: "listbox",
1727
- "aria-multiselectable": multiple || undefined,
1728
- id: `${id}-list`
1729
- },
1730
- onKeyDown(event) {
1731
- keyboardActiveRef.current = true;
1732
- if (insideToolbar && COMPOSITE_KEYS.has(event.key)) {
1733
- event.stopPropagation();
1734
- }
1735
- },
1736
- onMouseMove() {
1737
- keyboardActiveRef.current = false;
1738
- },
1739
- onScroll(event) {
1740
- if (listElement) {
1741
- return;
1742
- }
1743
- handleScroll(event.currentTarget);
1744
- },
1745
- ...alignItemWithTriggerActive && {
1746
- style: listElement ? {
1747
- height: "100%"
1748
- } : LIST_FUNCTIONAL_STYLES
1749
- }
1750
- };
1751
- const element = useRenderElement("div", componentProps, {
1752
- ref: [forwardedRef, popupRef],
1753
- state,
1754
- stateAttributesMapping: stateAttributesMapping4,
1755
- props: [popupProps, defaultProps, getDisabledMountTransitionStyles(transitionStatus), {
1756
- className: !listElement && alignItemWithTriggerActive ? styleDisableScrollbar.className : undefined
1757
- }, elementProps]
1758
- });
1759
- return /* @__PURE__ */ _jsxs3(React13.Fragment, {
1760
- children: [!disableStyleElements && styleDisableScrollbar.getElement(nonce), /* @__PURE__ */ _jsx5(FloatingFocusManager, {
1761
- context: floatingRootContext,
1762
- modal: false,
1763
- disabled: !mounted,
1764
- returnFocus: finalFocus,
1765
- restoreFocus: true,
1766
- children: element
1767
- })]
1768
- });
1769
- });
1770
- if (true)
1771
- SelectPopup.displayName = "SelectPopup";
1772
- function getMaxPopupHeight(popupStyles) {
1773
- const maxHeightStyle = popupStyles.maxHeight || "";
1774
- return maxHeightStyle.endsWith("px") ? parseFloat(maxHeightStyle) || Infinity : Infinity;
1775
- }
1776
- function getMaxScrollTop(scroller) {
1777
- return getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
1778
- }
1779
- function getScale(element) {
1780
- return platform.getScale(element);
1781
- }
1782
- function normalizeSize(size, axis, scale) {
1783
- return size / scale[axis];
1784
- }
1785
- function normalizeRect(rect, scale) {
1786
- return rectToClientRect({
1787
- x: normalizeSize(rect.x, "x", scale),
1788
- y: normalizeSize(rect.y, "y", scale),
1789
- width: normalizeSize(rect.width, "x", scale),
1790
- height: normalizeSize(rect.height, "y", scale)
1791
- });
1792
- }
1793
- var TRANSFORM_STYLE_RESETS = [["transform", "none"], ["scale", "1"], ["translate", "0 0"]];
1794
- function unsetTransformStyles(popupElement) {
1795
- const {
1796
- style
1797
- } = popupElement;
1798
- const originalStyles = {};
1799
- for (const [property, value] of TRANSFORM_STYLE_RESETS) {
1800
- originalStyles[property] = style.getPropertyValue(property);
1801
- style.setProperty(property, value, "important");
1802
- }
1803
- return () => {
1804
- for (const [property] of TRANSFORM_STYLE_RESETS) {
1805
- const originalValue = originalStyles[property];
1806
- if (originalValue) {
1807
- style.setProperty(property, originalValue);
1808
- } else {
1809
- style.removeProperty(property);
1810
- }
1811
- }
1812
- };
1813
- }
1814
- // node_modules/@base-ui/react/esm/select/list/SelectList.js
1815
- import * as React14 from "react";
1816
- "use client";
1817
- var SelectList = /* @__PURE__ */ React14.forwardRef(function SelectList2(componentProps, forwardedRef) {
1818
- const {
1819
- render,
1820
- className,
1821
- style,
1822
- ...elementProps
1823
- } = componentProps;
1824
- const {
1825
- store,
1826
- scrollHandlerRef
1827
- } = useSelectRootContext();
1828
- const {
1829
- alignItemWithTriggerActive
1830
- } = useSelectPositionerContext();
1831
- const hasScrollArrows = useStore(store, selectors.hasScrollArrows);
1832
- const openMethod = useStore(store, selectors.openMethod);
1833
- const multiple = useStore(store, selectors.multiple);
1834
- const id = useStore(store, selectors.id);
1835
- const defaultProps = {
1836
- id: `${id}-list`,
1837
- role: "listbox",
1838
- "aria-multiselectable": multiple || undefined,
1839
- onScroll(event) {
1840
- scrollHandlerRef.current?.(event.currentTarget);
1841
- },
1842
- ...alignItemWithTriggerActive && {
1843
- style: LIST_FUNCTIONAL_STYLES
1844
- },
1845
- className: hasScrollArrows && openMethod !== "touch" ? styleDisableScrollbar.className : undefined
1846
- };
1847
- const setListElement = useStableCallback((element) => {
1848
- store.set("listElement", element);
1849
- });
1850
- return useRenderElement("div", componentProps, {
1851
- ref: [forwardedRef, setListElement],
1852
- props: [defaultProps, elementProps]
1853
- });
1854
- });
1855
- if (true)
1856
- SelectList.displayName = "SelectList";
1857
- // node_modules/@base-ui/react/esm/select/item/SelectItem.js
1858
- import * as React16 from "react";
1859
-
1860
- // node_modules/@base-ui/react/esm/select/item/SelectItemContext.js
1861
- import * as React15 from "react";
1862
- "use client";
1863
- var SelectItemContext = /* @__PURE__ */ React15.createContext(undefined);
1864
- if (true)
1865
- SelectItemContext.displayName = "SelectItemContext";
1866
- function useSelectItemContext() {
1867
- const context = React15.useContext(SelectItemContext);
1868
- if (!context) {
1869
- throw new Error("Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.");
1870
- }
1871
- return context;
1872
- }
1873
-
1874
- // node_modules/@base-ui/react/esm/select/item/SelectItem.js
1875
- import { jsx as _jsx6 } from "react/jsx-runtime";
1876
- "use client";
1877
- var SelectItem = /* @__PURE__ */ React16.memo(/* @__PURE__ */ React16.forwardRef(function SelectItem2(componentProps, forwardedRef) {
1878
- const {
1879
- render,
1880
- className,
1881
- style,
1882
- value: itemValue = null,
1883
- label,
1884
- disabled = false,
1885
- nativeButton = false,
1886
- ...elementProps
1887
- } = componentProps;
1888
- const textRef = React16.useRef(null);
1889
- const listItem = useCompositeListItem({
1890
- label,
1891
- textRef,
1892
- indexGuessBehavior: IndexGuessBehavior.GuessFromOrder
1893
- });
1894
- const {
1895
- store,
1896
- itemProps,
1897
- setOpen,
1898
- setValue,
1899
- selectionRef,
1900
- typingRef,
1901
- valuesRef,
1902
- multiple,
1903
- selectedItemTextRef
1904
- } = useSelectRootContext();
1905
- const highlighted = useStore(store, selectors.isActive, listItem.index);
1906
- const selected = useStore(store, selectors.isSelected, listItem.index, itemValue);
1907
- const selectedByFocus = useStore(store, selectors.isSelectedByFocus, listItem.index);
1908
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
1909
- const index = listItem.index;
1910
- const hasRegistered = index !== -1;
1911
- const itemRef = React16.useRef(null);
1912
- useIsoLayoutEffect(() => {
1913
- if (!hasRegistered) {
1914
- return;
1915
- }
1916
- const values = valuesRef.current;
1917
- values[index] = itemValue;
1918
- return () => {
1919
- delete values[index];
1920
- };
1921
- }, [hasRegistered, index, itemValue, valuesRef]);
1922
- useIsoLayoutEffect(() => {
1923
- if (!hasRegistered) {
1924
- return;
1925
- }
1926
- const selectedValue = store.state.value;
1927
- let selectedCandidate = selectedValue;
1928
- if (multiple && Array.isArray(selectedValue) && selectedValue.length > 0) {
1929
- selectedCandidate = selectedValue[selectedValue.length - 1];
1930
- }
1931
- if (selectedCandidate !== undefined && compareItemEquality(itemValue, selectedCandidate, isItemEqualToValue)) {
1932
- store.set("selectedIndex", index);
1933
- if (textRef.current) {
1934
- selectedItemTextRef.current = textRef.current;
1935
- }
1936
- }
1937
- }, [hasRegistered, index, multiple, isItemEqualToValue, store, itemValue, selectedItemTextRef]);
1938
- const lastKeyRef = React16.useRef(null);
1939
- const pointerTypeRef = React16.useRef("mouse");
1940
- const allowMouseSelectionRef = React16.useRef(false);
1941
- const {
1942
- getButtonProps,
1943
- buttonRef
1944
- } = useButton({
1945
- disabled,
1946
- focusableWhenDisabled: true,
1947
- native: nativeButton,
1948
- composite: true
1949
- });
1950
- const state = {
1951
- disabled,
1952
- selected,
1953
- highlighted
1954
- };
1955
- function commitSelection(event) {
1956
- const selectedValue = store.state.value;
1957
- if (multiple) {
1958
- const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
1959
- const nextValue = selected ? removeItem(currentValue, itemValue, isItemEqualToValue) : [...currentValue, itemValue];
1960
- setValue(nextValue, createChangeEventDetails(exports_reason_parts.itemPress, event));
1961
- } else {
1962
- setValue(itemValue, createChangeEventDetails(exports_reason_parts.itemPress, event));
1963
- setOpen(false, createChangeEventDetails(exports_reason_parts.itemPress, event));
1964
- }
1965
- }
1966
- function resetDragMovement() {
1967
- selectionRef.current.dragY = 0;
1968
- }
1969
- const defaultProps = {
1970
- role: "option",
1971
- "aria-selected": selected,
1972
- tabIndex: highlighted ? 0 : -1,
1973
- onKeyDown(event) {
1974
- lastKeyRef.current = event.key;
1975
- store.set("activeIndex", index);
1976
- if (event.key === " " && typingRef.current) {
1977
- event.preventDefault();
1978
- }
1979
- },
1980
- onClick(event) {
1981
- const isMouseClick = event.type === "click" && pointerTypeRef.current !== "touch";
1982
- const clickPointerType = event.nativeEvent.pointerType;
1983
- const isVirtualMouseClick = isMouseClick && isVirtualClick(event.nativeEvent) && (clickPointerType !== undefined || highlighted);
1984
- const isInvalidMouseClick = isMouseClick && !isVirtualMouseClick && !allowMouseSelectionRef.current;
1985
- allowMouseSelectionRef.current = false;
1986
- if (event.type === "keydown" && lastKeyRef.current === null) {
1987
- return;
1988
- }
1989
- if (disabled || event.type === "keydown" && lastKeyRef.current === " " && typingRef.current || isInvalidMouseClick) {
1990
- return;
1991
- }
1992
- lastKeyRef.current = null;
1993
- commitSelection(event.nativeEvent);
1994
- },
1995
- onPointerEnter(event) {
1996
- pointerTypeRef.current = event.pointerType;
1997
- },
1998
- onPointerMove(event) {
1999
- if (event.pointerType === "mouse" && event.buttons === 1) {
2000
- const selection = selectionRef.current;
2001
- selection.dragY += event.movementY;
2002
- if (selection.dragY ** 2 >= 64) {
2003
- selection.allowUnselectedMouseUp = true;
2004
- }
2005
- }
2006
- },
2007
- onPointerDown(event) {
2008
- pointerTypeRef.current = event.pointerType;
2009
- allowMouseSelectionRef.current = true;
2010
- resetDragMovement();
2011
- },
2012
- onMouseUp() {
2013
- resetDragMovement();
2014
- if (disabled || pointerTypeRef.current === "touch") {
2015
- return;
2016
- }
2017
- if (allowMouseSelectionRef.current) {
2018
- return;
2019
- }
2020
- const disallowSelectedMouseUp = !selectionRef.current.allowSelectedMouseUp && selected;
2021
- const disallowUnselectedMouseUp = !selectionRef.current.allowUnselectedMouseUp && !selected;
2022
- if (disallowSelectedMouseUp || disallowUnselectedMouseUp) {
2023
- return;
2024
- }
2025
- allowMouseSelectionRef.current = true;
2026
- itemRef.current?.click();
2027
- allowMouseSelectionRef.current = false;
2028
- }
2029
- };
2030
- const element = useRenderElement("div", componentProps, {
2031
- ref: [buttonRef, forwardedRef, listItem.ref, itemRef],
2032
- state,
2033
- props: [itemProps, defaultProps, elementProps, getButtonProps]
2034
- });
2035
- const contextValue = React16.useMemo(() => ({
2036
- selected,
2037
- index,
2038
- textRef,
2039
- selectedByFocus,
2040
- hasRegistered
2041
- }), [selected, index, textRef, selectedByFocus, hasRegistered]);
2042
- return /* @__PURE__ */ _jsx6(SelectItemContext.Provider, {
2043
- value: contextValue,
2044
- children: element
2045
- });
2046
- }));
2047
- if (true)
2048
- SelectItem.displayName = "SelectItem";
2049
- // node_modules/@base-ui/react/esm/select/item-indicator/SelectItemIndicator.js
2050
- import * as React17 from "react";
2051
- import { jsx as _jsx7 } from "react/jsx-runtime";
2052
- "use client";
2053
- var SelectItemIndicator = /* @__PURE__ */ React17.forwardRef(function SelectItemIndicator2(componentProps, forwardedRef) {
2054
- const keepMounted = componentProps.keepMounted ?? false;
2055
- const {
2056
- selected
2057
- } = useSelectItemContext();
2058
- const shouldRender = keepMounted || selected;
2059
- if (!shouldRender) {
2060
- return null;
2061
- }
2062
- return /* @__PURE__ */ _jsx7(Inner, {
2063
- ...componentProps,
2064
- ref: forwardedRef
2065
- });
2066
- });
2067
- if (true)
2068
- SelectItemIndicator.displayName = "SelectItemIndicator";
2069
- var Inner = /* @__PURE__ */ React17.memo(/* @__PURE__ */ React17.forwardRef((componentProps, forwardedRef) => {
2070
- const {
2071
- render,
2072
- className,
2073
- style,
2074
- keepMounted,
2075
- ...elementProps
2076
- } = componentProps;
2077
- const {
2078
- selected
2079
- } = useSelectItemContext();
2080
- const indicatorRef = React17.useRef(null);
2081
- const {
2082
- transitionStatus,
2083
- setMounted
2084
- } = useTransitionStatus(selected);
2085
- const state = {
2086
- selected,
2087
- transitionStatus
2088
- };
2089
- const element = useRenderElement("span", componentProps, {
2090
- ref: [forwardedRef, indicatorRef],
2091
- state,
2092
- props: [{
2093
- "aria-hidden": true,
2094
- children: "✔️"
2095
- }, elementProps],
2096
- stateAttributesMapping: transitionStatusMapping
2097
- });
2098
- useOpenChangeComplete({
2099
- open: selected,
2100
- ref: indicatorRef,
2101
- onComplete() {
2102
- if (!selected) {
2103
- setMounted(false);
2104
- }
2105
- }
2106
- });
2107
- return element;
2108
- }));
2109
- if (true)
2110
- Inner.displayName = "Inner";
2111
- // node_modules/@base-ui/react/esm/select/item-text/SelectItemText.js
2112
- import * as React18 from "react";
2113
- "use client";
2114
- var SelectItemText = /* @__PURE__ */ React18.memo(/* @__PURE__ */ React18.forwardRef(function SelectItemText2(componentProps, forwardedRef) {
2115
- const {
2116
- index,
2117
- textRef,
2118
- selectedByFocus,
2119
- hasRegistered
2120
- } = useSelectItemContext();
2121
- const {
2122
- firstItemTextRef,
2123
- selectedItemTextRef
2124
- } = useSelectRootContext();
2125
- const {
2126
- render,
2127
- className,
2128
- style,
2129
- ...elementProps
2130
- } = componentProps;
2131
- const localRef = React18.useCallback((node) => {
2132
- if (!node) {
2133
- return;
2134
- }
2135
- if (hasRegistered && index === 0) {
2136
- firstItemTextRef.current = node;
2137
- }
2138
- if (hasRegistered && selectedByFocus) {
2139
- selectedItemTextRef.current = node;
2140
- }
2141
- }, [firstItemTextRef, selectedItemTextRef, index, selectedByFocus, hasRegistered]);
2142
- const element = useRenderElement("div", componentProps, {
2143
- ref: [localRef, forwardedRef, textRef],
2144
- props: elementProps
2145
- });
2146
- return element;
2147
- }));
2148
- if (true)
2149
- SelectItemText.displayName = "SelectItemText";
2150
- // node_modules/@base-ui/react/esm/select/arrow/SelectArrow.js
2151
- import * as React19 from "react";
2152
- "use client";
2153
- var stateAttributesMapping5 = {
2154
- ...popupStateMapping,
2155
- ...transitionStatusMapping
2156
- };
2157
- var SelectArrow = /* @__PURE__ */ React19.forwardRef(function SelectArrow2(componentProps, forwardedRef) {
2158
- const {
2159
- render,
2160
- className,
2161
- style,
2162
- ...elementProps
2163
- } = componentProps;
2164
- const {
2165
- store
2166
- } = useSelectRootContext();
2167
- const {
2168
- side,
2169
- align,
2170
- arrowRef,
2171
- arrowStyles,
2172
- arrowUncentered,
2173
- alignItemWithTriggerActive
2174
- } = useSelectPositionerContext();
2175
- const open = useStore(store, selectors.open, true);
2176
- const state = {
2177
- open,
2178
- side,
2179
- align,
2180
- uncentered: arrowUncentered
2181
- };
2182
- const element = useRenderElement("div", componentProps, {
2183
- state,
2184
- ref: [arrowRef, forwardedRef],
2185
- props: [{
2186
- style: arrowStyles,
2187
- "aria-hidden": true
2188
- }, elementProps],
2189
- stateAttributesMapping: stateAttributesMapping5
2190
- });
2191
- if (alignItemWithTriggerActive) {
2192
- return null;
2193
- }
2194
- return element;
2195
- });
2196
- if (true)
2197
- SelectArrow.displayName = "SelectArrow";
2198
- // node_modules/@base-ui/react/esm/select/scroll-down-arrow/SelectScrollDownArrow.js
2199
- import * as React21 from "react";
2200
-
2201
- // node_modules/@base-ui/react/esm/select/scroll-arrow/SelectScrollArrow.js
2202
- import * as React20 from "react";
2203
- "use client";
2204
- var SelectScrollArrow = /* @__PURE__ */ React20.forwardRef(function SelectScrollArrow2(componentProps, forwardedRef) {
2205
- const {
2206
- render,
2207
- className,
2208
- style,
2209
- direction,
2210
- keepMounted = false,
2211
- ...elementProps
2212
- } = componentProps;
2213
- const isUp = direction === "up";
2214
- const {
2215
- store,
2216
- popupRef,
2217
- listRef,
2218
- handleScrollArrowVisibility,
2219
- scrollArrowsMountedCountRef
2220
- } = useSelectRootContext();
2221
- const {
2222
- side,
2223
- scrollDownArrowRef,
2224
- scrollUpArrowRef
2225
- } = useSelectPositionerContext();
2226
- const visibleSelector = isUp ? selectors.scrollUpArrowVisible : selectors.scrollDownArrowVisible;
2227
- const stateVisible = useStore(store, visibleSelector);
2228
- const openMethod = useStore(store, selectors.openMethod);
2229
- const visible = stateVisible && openMethod !== "touch";
2230
- const timeout = useTimeout();
2231
- const scrollArrowRef = isUp ? scrollUpArrowRef : scrollDownArrowRef;
2232
- const {
2233
- transitionStatus,
2234
- setMounted
2235
- } = useTransitionStatus(visible);
2236
- useIsoLayoutEffect(() => {
2237
- scrollArrowsMountedCountRef.current += 1;
2238
- if (!store.state.hasScrollArrows) {
2239
- store.set("hasScrollArrows", true);
2240
- }
2241
- return () => {
2242
- scrollArrowsMountedCountRef.current = Math.max(0, scrollArrowsMountedCountRef.current - 1);
2243
- if (scrollArrowsMountedCountRef.current === 0 && store.state.hasScrollArrows) {
2244
- store.set("hasScrollArrows", false);
2245
- }
2246
- };
2247
- }, [store, scrollArrowsMountedCountRef]);
2248
- useOpenChangeComplete({
2249
- open: visible,
2250
- ref: scrollArrowRef,
2251
- onComplete() {
2252
- if (!visible) {
2253
- setMounted(false);
2254
- }
2255
- }
2256
- });
2257
- const state = {
2258
- direction,
2259
- visible,
2260
- side,
2261
- transitionStatus
2262
- };
2263
- const defaultProps = {
2264
- "aria-hidden": true,
2265
- children: isUp ? "▲" : "▼",
2266
- style: {
2267
- position: "absolute"
2268
- },
2269
- onMouseMove(event) {
2270
- if (event.movementX === 0 && event.movementY === 0 || timeout.isStarted()) {
2271
- return;
2272
- }
2273
- store.set("activeIndex", null);
2274
- function scrollNextItem() {
2275
- const scroller = store.state.listElement ?? popupRef.current;
2276
- if (!scroller) {
2277
- return;
2278
- }
2279
- store.set("activeIndex", null);
2280
- handleScrollArrowVisibility();
2281
- const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
2282
- const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);
2283
- const isScrolledToEdge = scrollTop === (isUp ? 0 : maxScrollTop);
2284
- const items = listRef.current;
2285
- if (scrollTop !== scroller.scrollTop) {
2286
- scroller.scrollTop = scrollTop;
2287
- }
2288
- if (items.length === 0) {
2289
- store.set(isUp ? "scrollUpArrowVisible" : "scrollDownArrowVisible", !isScrolledToEdge);
2290
- }
2291
- if (isScrolledToEdge) {
2292
- timeout.clear();
2293
- return;
2294
- }
2295
- if (items.length > 0) {
2296
- const scrollArrowHeight = scrollArrowRef.current?.offsetHeight || 0;
2297
- scroller.scrollTop = getTargetScrollTop(items, isUp, scrollTop, scroller.clientHeight, scrollArrowHeight, maxScrollTop);
2298
- }
2299
- timeout.start(40, scrollNextItem);
2300
- }
2301
- timeout.start(40, scrollNextItem);
2302
- },
2303
- onMouseLeave() {
2304
- timeout.clear();
2305
- }
2306
- };
2307
- const element = useRenderElement("div", componentProps, {
2308
- ref: [forwardedRef, scrollArrowRef],
2309
- state,
2310
- props: [defaultProps, elementProps]
2311
- });
2312
- const shouldRender = visible || keepMounted;
2313
- if (!shouldRender) {
2314
- return null;
2315
- }
2316
- return element;
2317
- });
2318
- if (true)
2319
- SelectScrollArrow.displayName = "SelectScrollArrow";
2320
- function getTargetScrollTop(items, isUp, scrollTop, clientHeight, scrollArrowHeight, maxScrollTop) {
2321
- if (isUp) {
2322
- let firstVisibleIndex = 0;
2323
- const visibleTop = scrollTop + scrollArrowHeight - SCROLL_EDGE_TOLERANCE_PX;
2324
- for (let i = 0;i < items.length; i += 1) {
2325
- const item = items[i];
2326
- if (item && item.offsetTop >= visibleTop) {
2327
- firstVisibleIndex = i;
2328
- break;
2329
- }
2330
- }
2331
- const targetIndex2 = Math.max(0, firstVisibleIndex - 1);
2332
- const targetItem2 = items[targetIndex2];
2333
- return targetIndex2 < firstVisibleIndex && targetItem2 ? normalizeScrollOffset(targetItem2.offsetTop - scrollArrowHeight, maxScrollTop) : 0;
2334
- }
2335
- let lastVisibleIndex = items.length - 1;
2336
- const visibleBottom = scrollTop + clientHeight - scrollArrowHeight + SCROLL_EDGE_TOLERANCE_PX;
2337
- for (let i = 0;i < items.length; i += 1) {
2338
- const item = items[i];
2339
- if (item && item.offsetTop + item.offsetHeight > visibleBottom) {
2340
- lastVisibleIndex = Math.max(0, i - 1);
2341
- break;
2342
- }
2343
- }
2344
- const targetIndex = Math.min(items.length - 1, lastVisibleIndex + 1);
2345
- const targetItem = items[targetIndex];
2346
- return targetIndex > lastVisibleIndex && targetItem ? normalizeScrollOffset(targetItem.offsetTop + targetItem.offsetHeight - clientHeight + scrollArrowHeight, maxScrollTop) : maxScrollTop;
2347
- }
2348
-
2349
- // node_modules/@base-ui/react/esm/select/scroll-down-arrow/SelectScrollDownArrow.js
2350
- import { jsx as _jsx8 } from "react/jsx-runtime";
2351
- "use client";
2352
- var SelectScrollDownArrow = /* @__PURE__ */ React21.forwardRef(function SelectScrollDownArrow2(props, forwardedRef) {
2353
- return /* @__PURE__ */ _jsx8(SelectScrollArrow, {
2354
- ...props,
2355
- ref: forwardedRef,
2356
- direction: "down"
2357
- });
2358
- });
2359
- if (true)
2360
- SelectScrollDownArrow.displayName = "SelectScrollDownArrow";
2361
- // node_modules/@base-ui/react/esm/select/scroll-up-arrow/SelectScrollUpArrow.js
2362
- import * as React22 from "react";
2363
- import { jsx as _jsx9 } from "react/jsx-runtime";
2364
- "use client";
2365
- var SelectScrollUpArrow = /* @__PURE__ */ React22.forwardRef(function SelectScrollUpArrow2(props, forwardedRef) {
2366
- return /* @__PURE__ */ _jsx9(SelectScrollArrow, {
2367
- ...props,
2368
- ref: forwardedRef,
2369
- direction: "up"
2370
- });
2371
- });
2372
- if (true)
2373
- SelectScrollUpArrow.displayName = "SelectScrollUpArrow";
2374
- // node_modules/@base-ui/react/esm/select/group/SelectGroup.js
2375
- import * as React24 from "react";
2376
-
2377
- // node_modules/@base-ui/react/esm/select/group/SelectGroupContext.js
2378
- import * as React23 from "react";
2379
- "use client";
2380
- var SelectGroupContext = /* @__PURE__ */ React23.createContext(undefined);
2381
- if (true)
2382
- SelectGroupContext.displayName = "SelectGroupContext";
2383
- function useSelectGroupContext() {
2384
- const context = React23.useContext(SelectGroupContext);
2385
- if (context === undefined) {
2386
- throw new Error("Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.");
2387
- }
2388
- return context;
2389
- }
2390
-
2391
- // node_modules/@base-ui/react/esm/select/group/SelectGroup.js
2392
- import { jsx as _jsx10 } from "react/jsx-runtime";
2393
- "use client";
2394
- var SelectGroup = /* @__PURE__ */ React24.forwardRef(function SelectGroup2(componentProps, forwardedRef) {
2395
- const {
2396
- render,
2397
- className,
2398
- style,
2399
- ...elementProps
2400
- } = componentProps;
2401
- const [labelId, setLabelId] = React24.useState();
2402
- const contextValue = React24.useMemo(() => ({
2403
- labelId,
2404
- setLabelId
2405
- }), [labelId, setLabelId]);
2406
- const element = useRenderElement("div", componentProps, {
2407
- ref: forwardedRef,
2408
- props: [{
2409
- role: "group",
2410
- "aria-labelledby": labelId
2411
- }, elementProps]
2412
- });
2413
- return /* @__PURE__ */ _jsx10(SelectGroupContext.Provider, {
2414
- value: contextValue,
2415
- children: element
2416
- });
2417
- });
2418
- if (true)
2419
- SelectGroup.displayName = "SelectGroup";
2420
- // node_modules/@base-ui/react/esm/select/group-label/SelectGroupLabel.js
2421
- import * as React25 from "react";
2422
- "use client";
2423
- var SelectGroupLabel = /* @__PURE__ */ React25.forwardRef(function SelectGroupLabel2(componentProps, forwardedRef) {
2424
- const {
2425
- render,
2426
- className,
2427
- style,
2428
- id: idProp,
2429
- ...elementProps
2430
- } = componentProps;
2431
- const {
2432
- setLabelId
2433
- } = useSelectGroupContext();
2434
- const id = useBaseUiId(idProp);
2435
- useIsoLayoutEffect(() => {
2436
- setLabelId(id);
2437
- }, [id, setLabelId]);
2438
- const element = useRenderElement("div", componentProps, {
2439
- ref: forwardedRef,
2440
- props: [{
2441
- id
2442
- }, elementProps]
2443
- });
2444
- return element;
2445
- });
2446
- if (true)
2447
- SelectGroupLabel.displayName = "SelectGroupLabel";
2448
- export {
2449
- exports_index_parts as Select
2450
- };