@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,1583 +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
- getDefaultLabelId,
6
- resolveAriaLabelledBy
7
- } from "./_chunk-b5ya6xds.js";
8
- import {
9
- clamp
10
- } from "./_chunk-yzr7eg4b.js";
11
- import {
12
- useIsHydrating
13
- } from "./_chunk-p0e2qacz.js";
14
- import {
15
- useCSPContext
16
- } from "./_chunk-watha94s.js";
17
- import {
18
- focusElementWithVisible,
19
- useLabel
20
- } from "./_chunk-ghn1tzt8.js";
21
- import {
22
- useLabelableId
23
- } from "./_chunk-23rx7haq.js";
24
- import {
25
- formatNumber,
26
- valueToPercent
27
- } from "./_chunk-ffpjy0ta.js";
28
- import"./_chunk-vgkfmtbe.js";
29
- import {
30
- useFormContext,
31
- useRegisterFieldControl
32
- } from "./_chunk-95tf2rxq.js";
33
- import {
34
- fieldValidityMapping,
35
- useFieldRootContext,
36
- useLabelableContext
37
- } from "./_chunk-8ctgmf06.js";
38
- import"./_chunk-dzvjwv25.js";
39
- import {
40
- useCompositeListItem
41
- } from "./_chunk-3enq1vat.js";
42
- import {
43
- CompositeList
44
- } from "./_chunk-j29xjete.js";
45
- import"./_chunk-3xpke33f.js";
46
- import {
47
- useDirection
48
- } from "./_chunk-gy0bpkmx.js";
49
- import {
50
- useControlled
51
- } from "./_chunk-9x63vfqj.js";
52
- import"./_chunk-1vw45v38.js";
53
- import {
54
- activeElement,
55
- contains,
56
- getTarget,
57
- matchesFocusVisible
58
- } from "./_chunk-cgptgywc.js";
59
- import {
60
- ARROW_DOWN,
61
- ARROW_LEFT,
62
- ARROW_RIGHT,
63
- ARROW_UP,
64
- COMPOSITE_KEYS,
65
- END,
66
- HOME,
67
- PAGE_DOWN,
68
- PAGE_UP
69
- } from "./_chunk-pv7b791x.js";
70
- import"./_chunk-kw8nnq00.js";
71
- import"./_chunk-rrh8rt4v.js";
72
- import {
73
- useValueChanged
74
- } from "./_chunk-s5pwkz8v.js";
75
- import {
76
- visuallyHidden
77
- } from "./_chunk-dan0mva4.js";
78
- import {
79
- addEventListener
80
- } from "./_chunk-ase0ydtt.js";
81
- import {
82
- useValueAsRef
83
- } from "./_chunk-6kqramh9.js";
84
- import {
85
- ownerDocument
86
- } from "./_chunk-451nqgsa.js";
87
- import {
88
- createChangeEventDetails,
89
- createGenericEventDetails,
90
- exports_reason_parts
91
- } from "./_chunk-e56mpvk1.js";
92
- import {
93
- useBaseUiId
94
- } from "./_chunk-wdqynnjf.js";
95
- import {
96
- useAnimationFrame
97
- } from "./_chunk-8a9vv8am.js";
98
- import"./_chunk-6ejf1z1r.js";
99
- import"./_chunk-hm5h9vsk.js";
100
- import {
101
- getWindow,
102
- isElement,
103
- isHTMLElement
104
- } from "./_chunk-000kmre8.js";
105
- import {
106
- useStableCallback
107
- } from "./_chunk-cwvtvwc7.js";
108
- import {
109
- useIsoLayoutEffect
110
- } from "./_chunk-5tze5c8q.js";
111
- import {
112
- useMergedRefs,
113
- useRenderElement,
114
- warn
115
- } from "./_chunk-x8xehj6d.js";
116
- import {
117
- __export,
118
- mergeProps
119
- } from "./_chunk-svxv97ph.js";
120
-
121
- // node_modules/@base-ui/react/esm/slider/index.parts.js
122
- var exports_index_parts = {};
123
- __export(exports_index_parts, {
124
- Value: () => SliderValue,
125
- Track: () => SliderTrack,
126
- Thumb: () => SliderThumb,
127
- Root: () => SliderRoot,
128
- Label: () => SliderLabel,
129
- Indicator: () => SliderIndicator,
130
- Control: () => SliderControl
131
- });
132
-
133
- // node_modules/@base-ui/react/esm/slider/root/SliderRoot.js
134
- import * as React2 from "react";
135
-
136
- // node_modules/@base-ui/react/esm/internals/areArraysEqual.js
137
- function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
138
- return array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index]));
139
- }
140
-
141
- // node_modules/@base-ui/react/esm/slider/utils/asc.js
142
- function asc(a, b) {
143
- return a - b;
144
- }
145
-
146
- // node_modules/@base-ui/react/esm/slider/utils/replaceArrayItemAtIndex.js
147
- function replaceArrayItemAtIndex(array, index, newValue) {
148
- const output = array.slice();
149
- output[index] = newValue;
150
- return output.sort(asc);
151
- }
152
-
153
- // node_modules/@base-ui/react/esm/slider/utils/getSliderValue.js
154
- function getSliderValue(valueInput, index, min, max, range, values) {
155
- let newValue = valueInput;
156
- newValue = clamp(newValue, min, max);
157
- if (range) {
158
- newValue = replaceArrayItemAtIndex(values, index, clamp(newValue, values[index - 1] || -Infinity, values[index + 1] || Infinity));
159
- }
160
- return newValue;
161
- }
162
-
163
- // node_modules/@base-ui/react/esm/slider/utils/validateMinimumDistance.js
164
- function validateMinimumDistance(values, step, minStepsBetweenValues) {
165
- if (!Array.isArray(values)) {
166
- return true;
167
- }
168
- const distances = values.reduce((acc, val, index, vals) => {
169
- if (index === vals.length - 1) {
170
- return acc;
171
- }
172
- acc.push(Math.abs(val - vals[index + 1]));
173
- return acc;
174
- }, []);
175
- return Math.min(...distances) >= step * minStepsBetweenValues;
176
- }
177
-
178
- // node_modules/@base-ui/react/esm/slider/root/stateAttributesMapping.js
179
- var sliderStateAttributesMapping = {
180
- activeThumbIndex: () => null,
181
- max: () => null,
182
- min: () => null,
183
- minStepsBetweenValues: () => null,
184
- step: () => null,
185
- values: () => null,
186
- ...fieldValidityMapping
187
- };
188
-
189
- // node_modules/@base-ui/react/esm/slider/root/SliderRootContext.js
190
- import * as React from "react";
191
- "use client";
192
- var SliderRootContext = /* @__PURE__ */ React.createContext(undefined);
193
- if (true)
194
- SliderRootContext.displayName = "SliderRootContext";
195
- function useSliderRootContext() {
196
- const context = React.useContext(SliderRootContext);
197
- if (context === undefined) {
198
- throw new Error("Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>.");
199
- }
200
- return context;
201
- }
202
-
203
- // node_modules/@base-ui/react/esm/slider/root/SliderRoot.js
204
- import { jsx as _jsx } from "react/jsx-runtime";
205
- "use client";
206
- function getSliderChangeEventReason(event) {
207
- return "key" in event ? exports_reason_parts.keyboard : exports_reason_parts.inputChange;
208
- }
209
- function areValuesEqual(newValue, oldValue) {
210
- if (typeof newValue === "number" && typeof oldValue === "number") {
211
- return newValue === oldValue;
212
- }
213
- if (Array.isArray(newValue) && Array.isArray(oldValue)) {
214
- return areArraysEqual(newValue, oldValue);
215
- }
216
- return false;
217
- }
218
- var SliderRoot = /* @__PURE__ */ React2.forwardRef(function SliderRoot2(componentProps, forwardedRef) {
219
- const {
220
- "aria-labelledby": ariaLabelledByProp,
221
- className,
222
- defaultValue,
223
- disabled: disabledProp = false,
224
- id: idProp,
225
- format,
226
- largeStep = 10,
227
- locale,
228
- render,
229
- max = 100,
230
- min = 0,
231
- minStepsBetweenValues = 0,
232
- form,
233
- name: nameProp,
234
- onValueChange: onValueChangeProp,
235
- onValueCommitted: onValueCommittedProp,
236
- orientation = "horizontal",
237
- step = 1,
238
- thumbCollisionBehavior = "push",
239
- thumbAlignment = "center",
240
- value: valueProp,
241
- style,
242
- ...elementProps
243
- } = componentProps;
244
- const id = useBaseUiId(idProp);
245
- const defaultLabelId = getDefaultLabelId(id);
246
- const onValueChange = useStableCallback(onValueChangeProp);
247
- const onValueCommitted = useStableCallback(onValueCommittedProp);
248
- const {
249
- clearErrors
250
- } = useFormContext();
251
- const {
252
- state: fieldState,
253
- disabled: fieldDisabled,
254
- name: fieldName,
255
- setTouched,
256
- setDirty,
257
- validityData,
258
- shouldValidateOnChange,
259
- validation
260
- } = useFieldRootContext();
261
- const {
262
- labelId: fieldLabelId
263
- } = useLabelableContext();
264
- const [labelId, setLabelId] = React2.useState();
265
- const ariaLabelledby = ariaLabelledByProp ?? resolveAriaLabelledBy(fieldLabelId, labelId);
266
- const disabled = fieldDisabled || disabledProp;
267
- const name = fieldName ?? nameProp;
268
- const [valueUnwrapped, setValueUnwrapped] = useControlled({
269
- controlled: valueProp,
270
- default: defaultValue ?? min,
271
- name: "Slider"
272
- });
273
- const sliderRef = React2.useRef(null);
274
- const controlRef = React2.useRef(null);
275
- const thumbRefs = React2.useRef([]);
276
- const pressedInputRef = React2.useRef(null);
277
- const pressedThumbCenterOffsetRef = React2.useRef(null);
278
- const pressedThumbIndexRef = React2.useRef(-1);
279
- const pressedValuesRef = React2.useRef(null);
280
- const lastChangedValueRef = React2.useRef(null);
281
- const lastChangeReasonRef = React2.useRef("none");
282
- const formatOptionsRef = useValueAsRef(format);
283
- const [active, setActiveState] = React2.useState(-1);
284
- const [lastUsedThumbIndex, setLastUsedThumbIndex] = React2.useState(-1);
285
- const [dragging, setDragging] = React2.useState(false);
286
- const [thumbMap, setThumbMap] = React2.useState(() => new Map);
287
- const [indicatorPosition, setIndicatorPosition] = React2.useState([undefined, undefined]);
288
- const setActive = useStableCallback((value) => {
289
- setActiveState(value);
290
- if (value !== -1) {
291
- setLastUsedThumbIndex(value);
292
- }
293
- });
294
- useRegisterFieldControl(controlRef, id, valueUnwrapped);
295
- useValueChanged(valueUnwrapped, () => {
296
- clearErrors(name);
297
- if (shouldValidateOnChange()) {
298
- validation.commit(valueUnwrapped);
299
- } else {
300
- validation.commit(valueUnwrapped, true);
301
- }
302
- const initialValue = validityData.initialValue;
303
- let isDirty;
304
- if (Array.isArray(valueUnwrapped) && Array.isArray(initialValue)) {
305
- isDirty = !areArraysEqual(valueUnwrapped, initialValue);
306
- } else {
307
- isDirty = valueUnwrapped !== initialValue;
308
- }
309
- setDirty(isDirty);
310
- });
311
- const registerFieldControlRef = useStableCallback((element2) => {
312
- if (element2) {
313
- controlRef.current = element2;
314
- }
315
- });
316
- const range = Array.isArray(valueUnwrapped);
317
- const values = React2.useMemo(() => {
318
- if (!range) {
319
- return [clamp(valueUnwrapped, min, max)];
320
- }
321
- return valueUnwrapped.slice().sort(asc);
322
- }, [max, min, range, valueUnwrapped]);
323
- const setValue = useStableCallback((newValue, details) => {
324
- if (Number.isNaN(newValue) || areValuesEqual(newValue, valueUnwrapped)) {
325
- return;
326
- }
327
- const changeDetails = details ?? createChangeEventDetails(exports_reason_parts.none, undefined, undefined, {
328
- activeThumbIndex: -1
329
- });
330
- lastChangeReasonRef.current = changeDetails.reason;
331
- const nativeEvent = changeDetails.event;
332
- const EventConstructor = nativeEvent.constructor ?? Event;
333
- const clonedEvent = new EventConstructor(nativeEvent.type, nativeEvent);
334
- Object.defineProperty(clonedEvent, "target", {
335
- writable: true,
336
- value: {
337
- value: newValue,
338
- name
339
- }
340
- });
341
- changeDetails.event = clonedEvent;
342
- lastChangedValueRef.current = newValue;
343
- onValueChange(newValue, changeDetails);
344
- if (changeDetails.isCanceled) {
345
- return;
346
- }
347
- setValueUnwrapped(newValue);
348
- });
349
- const handleInputChange = useStableCallback((valueInput, index, event) => {
350
- const newValue = getSliderValue(valueInput, index, min, max, range, values);
351
- if (validateMinimumDistance(newValue, step, minStepsBetweenValues)) {
352
- const reason = getSliderChangeEventReason(event);
353
- setValue(newValue, createChangeEventDetails(reason, event.nativeEvent, undefined, {
354
- activeThumbIndex: index
355
- }));
356
- setTouched(true);
357
- const nextValue = lastChangedValueRef.current ?? newValue;
358
- onValueCommitted(nextValue, createGenericEventDetails(reason, event.nativeEvent));
359
- }
360
- });
361
- if (true) {
362
- if (min >= max) {
363
- warn("Slider `max` must be greater than `min`.");
364
- }
365
- }
366
- useIsoLayoutEffect(() => {
367
- const activeEl = activeElement(ownerDocument(sliderRef.current));
368
- if (disabled && contains(sliderRef.current, activeEl)) {
369
- activeEl.blur();
370
- }
371
- }, [disabled]);
372
- if (disabled && active !== -1) {
373
- setActive(-1);
374
- }
375
- const state = React2.useMemo(() => ({
376
- ...fieldState,
377
- activeThumbIndex: active,
378
- disabled,
379
- dragging,
380
- orientation,
381
- max,
382
- min,
383
- minStepsBetweenValues,
384
- step,
385
- values
386
- }), [fieldState, active, disabled, dragging, max, min, minStepsBetweenValues, orientation, step, values]);
387
- const contextValue = React2.useMemo(() => ({
388
- active,
389
- controlRef,
390
- disabled,
391
- dragging,
392
- validation,
393
- formatOptionsRef,
394
- handleInputChange,
395
- indicatorPosition,
396
- inset: thumbAlignment !== "center",
397
- labelId: ariaLabelledby,
398
- rootLabelId: defaultLabelId,
399
- largeStep,
400
- lastUsedThumbIndex,
401
- lastChangedValueRef,
402
- lastChangeReasonRef,
403
- form,
404
- locale,
405
- max,
406
- min,
407
- minStepsBetweenValues,
408
- name,
409
- onValueCommitted,
410
- orientation,
411
- pressedInputRef,
412
- pressedThumbCenterOffsetRef,
413
- pressedThumbIndexRef,
414
- pressedValuesRef,
415
- registerFieldControlRef,
416
- renderBeforeHydration: thumbAlignment === "edge",
417
- setActive,
418
- setDragging,
419
- setIndicatorPosition,
420
- setLabelId,
421
- setValue,
422
- state,
423
- step,
424
- thumbCollisionBehavior,
425
- thumbMap,
426
- thumbRefs,
427
- values
428
- }), [active, controlRef, ariaLabelledby, defaultLabelId, disabled, dragging, validation, formatOptionsRef, handleInputChange, indicatorPosition, largeStep, lastUsedThumbIndex, lastChangedValueRef, lastChangeReasonRef, form, locale, max, min, minStepsBetweenValues, name, onValueCommitted, orientation, pressedInputRef, pressedThumbCenterOffsetRef, pressedThumbIndexRef, pressedValuesRef, registerFieldControlRef, setActive, setDragging, setIndicatorPosition, setLabelId, setValue, state, step, thumbCollisionBehavior, thumbAlignment, thumbMap, thumbRefs, values]);
429
- const element = useRenderElement("div", componentProps, {
430
- state,
431
- ref: [forwardedRef, sliderRef],
432
- props: [{
433
- "aria-labelledby": ariaLabelledby,
434
- id,
435
- role: "group"
436
- }, validation.getValidationProps, elementProps],
437
- stateAttributesMapping: sliderStateAttributesMapping
438
- });
439
- return /* @__PURE__ */ _jsx(SliderRootContext.Provider, {
440
- value: contextValue,
441
- children: /* @__PURE__ */ _jsx(CompositeList, {
442
- elementsRef: thumbRefs,
443
- onMapChange: setThumbMap,
444
- children: element
445
- })
446
- });
447
- });
448
- if (true)
449
- SliderRoot.displayName = "SliderRoot";
450
- // node_modules/@base-ui/react/esm/slider/label/SliderLabel.js
451
- import * as React3 from "react";
452
- "use client";
453
- var SliderLabel = /* @__PURE__ */ React3.forwardRef(function SliderLabel2(componentProps, forwardedRef) {
454
- const {
455
- render,
456
- className,
457
- style,
458
- ...elementProps
459
- } = componentProps;
460
- const elementPropsWithoutId = elementProps;
461
- delete elementPropsWithoutId.id;
462
- const {
463
- state,
464
- setLabelId,
465
- controlRef,
466
- rootLabelId
467
- } = useSliderRootContext();
468
- function focusControl(event, controlId) {
469
- if (controlId) {
470
- const controlElement = ownerDocument(event.currentTarget).getElementById(controlId);
471
- if (isHTMLElement(controlElement)) {
472
- focusElementWithVisible(controlElement);
473
- return;
474
- }
475
- }
476
- const fallbackInputs = controlRef.current?.querySelectorAll('input[type="range"]');
477
- const fallbackInput = fallbackInputs?.length === 1 ? fallbackInputs[0] : null;
478
- if (isHTMLElement(fallbackInput)) {
479
- focusElementWithVisible(fallbackInput);
480
- }
481
- }
482
- const labelProps = useLabel({
483
- id: rootLabelId,
484
- setLabelId,
485
- focusControl
486
- });
487
- return useRenderElement("div", componentProps, {
488
- ref: forwardedRef,
489
- state,
490
- props: [labelProps, elementProps],
491
- stateAttributesMapping: sliderStateAttributesMapping
492
- });
493
- });
494
- if (true)
495
- SliderLabel.displayName = "SliderLabel";
496
- // node_modules/@base-ui/react/esm/slider/value/SliderValue.js
497
- import * as React4 from "react";
498
- "use client";
499
- var SliderValue = /* @__PURE__ */ React4.forwardRef(function SliderValue2(componentProps, forwardedRef) {
500
- const {
501
- "aria-live": ariaLive = "off",
502
- render,
503
- className,
504
- children,
505
- style,
506
- ...elementProps
507
- } = componentProps;
508
- const {
509
- thumbMap,
510
- state,
511
- values,
512
- formatOptionsRef,
513
- locale
514
- } = useSliderRootContext();
515
- let htmlFor = "";
516
- for (const thumbMetadata of thumbMap.values()) {
517
- if (thumbMetadata?.inputId) {
518
- htmlFor += `${thumbMetadata.inputId} `;
519
- }
520
- }
521
- const outputFor = htmlFor.trim() === "" ? undefined : htmlFor.trim();
522
- const formattedValues = React4.useMemo(() => {
523
- const arr = [];
524
- for (let i = 0;i < values.length; i += 1) {
525
- arr.push(formatNumber(values[i], locale, formatOptionsRef.current ?? undefined));
526
- }
527
- return arr;
528
- }, [formatOptionsRef, locale, values]);
529
- const defaultDisplayValue = values.map((v, i) => formattedValues[i] || v).join(" – ");
530
- const element = useRenderElement("output", componentProps, {
531
- state,
532
- ref: forwardedRef,
533
- props: [{
534
- "aria-live": ariaLive,
535
- children: typeof children === "function" ? children(formattedValues, values) : defaultDisplayValue,
536
- htmlFor: outputFor
537
- }, elementProps],
538
- stateAttributesMapping: sliderStateAttributesMapping
539
- });
540
- return element;
541
- });
542
- if (true)
543
- SliderValue.displayName = "SliderValue";
544
- // node_modules/@base-ui/react/esm/slider/control/SliderControl.js
545
- import * as React5 from "react";
546
-
547
- // node_modules/@base-ui/react/esm/slider/utils/getMidpoint.js
548
- function getMidpoint(element) {
549
- const rect = element.getBoundingClientRect();
550
- return {
551
- x: (rect.left + rect.right) / 2,
552
- y: (rect.top + rect.bottom) / 2
553
- };
554
- }
555
-
556
- // node_modules/@base-ui/react/esm/slider/utils/roundValueToStep.js
557
- function getDecimalPrecision(num) {
558
- if (num === 0) {
559
- return 0;
560
- }
561
- if (Math.abs(num) < 1) {
562
- const parts = num.toExponential().split("e-");
563
- const matissaDecimalPart = parts[0].split(".")[1];
564
- return (matissaDecimalPart ? matissaDecimalPart.length : 0) + parseInt(parts[1], 10);
565
- }
566
- const decimalPart = num.toString().split(".")[1];
567
- return decimalPart ? decimalPart.length : 0;
568
- }
569
- function roundValueToStep(value, step, min) {
570
- const nearest = Math.round((value - min) / step) * step + min;
571
- return Number(nearest.toFixed(Math.max(getDecimalPrecision(step), getDecimalPrecision(min))));
572
- }
573
-
574
- // node_modules/@base-ui/react/esm/slider/utils/getPushedThumbValues.js
575
- function getPushedThumbValues({
576
- values,
577
- index,
578
- nextValue,
579
- min,
580
- max,
581
- step,
582
- minStepsBetweenValues,
583
- initialValues
584
- }) {
585
- if (values.length === 0) {
586
- return [];
587
- }
588
- const nextValues = values.slice();
589
- const minValueDifference = step * minStepsBetweenValues;
590
- const lastIndex = nextValues.length - 1;
591
- const baseInitialValues = initialValues ?? values;
592
- const indexMin = min + index * minValueDifference;
593
- const indexMax = max - (lastIndex - index) * minValueDifference;
594
- nextValues[index] = clamp(nextValue, indexMin, indexMax);
595
- for (let i = index + 1;i <= lastIndex; i += 1) {
596
- const minAllowed = nextValues[i - 1] + minValueDifference;
597
- const maxAllowed = max - (lastIndex - i) * minValueDifference;
598
- const initialValue = baseInitialValues[i] ?? nextValues[i];
599
- let candidate = Math.max(nextValues[i], minAllowed);
600
- if (initialValue < candidate) {
601
- candidate = Math.max(initialValue, minAllowed);
602
- }
603
- nextValues[i] = clamp(candidate, minAllowed, maxAllowed);
604
- }
605
- for (let i = index - 1;i >= 0; i -= 1) {
606
- const maxAllowed = nextValues[i + 1] - minValueDifference;
607
- const minAllowed = min + i * minValueDifference;
608
- const initialValue = baseInitialValues[i] ?? nextValues[i];
609
- let candidate = Math.min(nextValues[i], maxAllowed);
610
- if (initialValue > candidate) {
611
- candidate = Math.min(initialValue, maxAllowed);
612
- }
613
- nextValues[i] = clamp(candidate, minAllowed, maxAllowed);
614
- }
615
- for (let i = 0;i <= lastIndex; i += 1) {
616
- nextValues[i] = Number(nextValues[i].toFixed(12));
617
- }
618
- return nextValues;
619
- }
620
-
621
- // node_modules/@base-ui/react/esm/slider/utils/resolveThumbCollision.js
622
- function resolveThumbCollision({
623
- behavior,
624
- values,
625
- currentValues,
626
- initialValues,
627
- pressedIndex,
628
- nextValue,
629
- min,
630
- max,
631
- step,
632
- minStepsBetweenValues
633
- }) {
634
- const activeValues = currentValues ?? values;
635
- const baselineValues = initialValues ?? values;
636
- const range = activeValues.length > 1;
637
- if (!range) {
638
- return {
639
- value: nextValue,
640
- thumbIndex: 0,
641
- didSwap: false
642
- };
643
- }
644
- const minValueDifference = step * minStepsBetweenValues;
645
- switch (behavior) {
646
- case "swap": {
647
- const pressedInitialValue = activeValues[pressedIndex];
648
- const epsilon = 0.0000001;
649
- const candidateValues = activeValues.slice();
650
- const previousNeighbor = candidateValues[pressedIndex - 1];
651
- const nextNeighbor = candidateValues[pressedIndex + 1];
652
- const lowerBound = previousNeighbor != null ? previousNeighbor + minValueDifference : min;
653
- const upperBound = nextNeighbor != null ? nextNeighbor - minValueDifference : max;
654
- const constrainedValue = clamp(nextValue, lowerBound, upperBound);
655
- const pressedValueAfterClamp = Number(constrainedValue.toFixed(12));
656
- candidateValues[pressedIndex] = pressedValueAfterClamp;
657
- const movingForward = nextValue > pressedInitialValue;
658
- const movingBackward = nextValue < pressedInitialValue;
659
- const shouldSwapForward = movingForward && nextNeighbor != null && nextValue >= nextNeighbor - epsilon;
660
- const shouldSwapBackward = movingBackward && previousNeighbor != null && nextValue <= previousNeighbor + epsilon;
661
- if (!shouldSwapForward && !shouldSwapBackward) {
662
- return {
663
- value: candidateValues,
664
- thumbIndex: pressedIndex,
665
- didSwap: false
666
- };
667
- }
668
- const targetIndex = shouldSwapForward ? pressedIndex + 1 : pressedIndex - 1;
669
- const initialValuesForPush = candidateValues.map((_, index) => {
670
- if (index === pressedIndex) {
671
- return pressedValueAfterClamp;
672
- }
673
- const baseline = baselineValues[index];
674
- if (baseline != null) {
675
- return baseline;
676
- }
677
- return activeValues[index];
678
- });
679
- let nextValueForTarget = nextValue;
680
- if (shouldSwapForward) {
681
- nextValueForTarget = Math.max(nextValue, candidateValues[targetIndex]);
682
- } else {
683
- nextValueForTarget = Math.min(nextValue, candidateValues[targetIndex]);
684
- }
685
- const adjustedValues = getPushedThumbValues({
686
- values: candidateValues,
687
- index: targetIndex,
688
- nextValue: nextValueForTarget,
689
- min,
690
- max,
691
- step,
692
- minStepsBetweenValues,
693
- initialValues: initialValuesForPush
694
- });
695
- const neighborIndex = shouldSwapForward ? targetIndex - 1 : targetIndex + 1;
696
- if (neighborIndex >= 0 && neighborIndex < adjustedValues.length) {
697
- const previousValue = adjustedValues[neighborIndex - 1];
698
- const nextValueAfter = adjustedValues[neighborIndex + 1];
699
- let neighborLowerBound = previousValue != null ? previousValue + minValueDifference : min;
700
- neighborLowerBound = Math.max(neighborLowerBound, min + neighborIndex * minValueDifference);
701
- let neighborUpperBound = nextValueAfter != null ? nextValueAfter - minValueDifference : max;
702
- neighborUpperBound = Math.min(neighborUpperBound, max - (adjustedValues.length - 1 - neighborIndex) * minValueDifference);
703
- const restoredValue = clamp(pressedValueAfterClamp, neighborLowerBound, neighborUpperBound);
704
- adjustedValues[neighborIndex] = Number(restoredValue.toFixed(12));
705
- }
706
- return {
707
- value: adjustedValues,
708
- thumbIndex: targetIndex,
709
- didSwap: true
710
- };
711
- }
712
- case "push": {
713
- const nextValues = getPushedThumbValues({
714
- values: activeValues,
715
- index: pressedIndex,
716
- nextValue,
717
- min,
718
- max,
719
- step,
720
- minStepsBetweenValues
721
- });
722
- return {
723
- value: nextValues,
724
- thumbIndex: pressedIndex,
725
- didSwap: false
726
- };
727
- }
728
- case "none":
729
- default: {
730
- const candidateValues = activeValues.slice();
731
- const previousNeighbor = candidateValues[pressedIndex - 1];
732
- const nextNeighbor = candidateValues[pressedIndex + 1];
733
- const lowerBound = previousNeighbor != null ? previousNeighbor + minValueDifference : min;
734
- const upperBound = nextNeighbor != null ? nextNeighbor - minValueDifference : max;
735
- const constrainedValue = clamp(nextValue, lowerBound, upperBound);
736
- candidateValues[pressedIndex] = Number(constrainedValue.toFixed(12));
737
- return {
738
- value: candidateValues,
739
- thumbIndex: pressedIndex,
740
- didSwap: false
741
- };
742
- }
743
- }
744
- }
745
-
746
- // node_modules/@base-ui/react/esm/slider/control/SliderControl.js
747
- "use client";
748
- var INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
749
- function getControlOffset(styles, vertical) {
750
- if (!styles) {
751
- return {
752
- start: 0,
753
- end: 0
754
- };
755
- }
756
- function parseSize(value) {
757
- const parsed = value != null ? parseFloat(value) : 0;
758
- return Number.isNaN(parsed) ? 0 : parsed;
759
- }
760
- const start = !vertical ? "InlineStart" : "Top";
761
- const end = !vertical ? "InlineEnd" : "Bottom";
762
- return {
763
- start: parseSize(styles[`border${start}Width`]) + parseSize(styles[`padding${start}`]),
764
- end: parseSize(styles[`border${end}Width`]) + parseSize(styles[`padding${end}`])
765
- };
766
- }
767
- function getFingerCoords(event, touchIdRef) {
768
- if (touchIdRef.current != null && event.changedTouches) {
769
- const touchEvent = event;
770
- for (let i = 0;i < touchEvent.changedTouches.length; i += 1) {
771
- const touch = touchEvent.changedTouches[i];
772
- if (touch.identifier === touchIdRef.current) {
773
- return {
774
- x: touch.clientX,
775
- y: touch.clientY
776
- };
777
- }
778
- }
779
- return null;
780
- }
781
- return {
782
- x: event.clientX,
783
- y: event.clientY
784
- };
785
- }
786
- var SliderControl = /* @__PURE__ */ React5.forwardRef(function SliderControl2(componentProps, forwardedRef) {
787
- const {
788
- render: renderProp,
789
- className,
790
- style,
791
- ...elementProps
792
- } = componentProps;
793
- const {
794
- disabled,
795
- dragging,
796
- inset,
797
- lastChangedValueRef,
798
- lastChangeReasonRef,
799
- max,
800
- min,
801
- minStepsBetweenValues,
802
- onValueCommitted,
803
- orientation,
804
- pressedInputRef,
805
- pressedThumbCenterOffsetRef,
806
- pressedThumbIndexRef,
807
- pressedValuesRef,
808
- registerFieldControlRef,
809
- renderBeforeHydration,
810
- setActive,
811
- setDragging,
812
- setValue,
813
- state,
814
- step,
815
- thumbCollisionBehavior,
816
- thumbRefs,
817
- values
818
- } = useSliderRootContext();
819
- const direction = useDirection();
820
- const range = values.length > 1;
821
- const vertical = orientation === "vertical";
822
- const controlRef = React5.useRef(null);
823
- const stylesRef = React5.useRef(null);
824
- const setStylesRef = useStableCallback((element2) => {
825
- if (element2 && stylesRef.current == null) {
826
- stylesRef.current = getWindow(element2).getComputedStyle(element2);
827
- }
828
- });
829
- const touchIdRef = React5.useRef(null);
830
- const moveCountRef = React5.useRef(0);
831
- const insetThumbOffsetRef = React5.useRef(0);
832
- const latestValuesRef = useValueAsRef(values);
833
- function updatePressedThumb(nextIndex) {
834
- if (pressedThumbIndexRef.current !== nextIndex) {
835
- pressedThumbIndexRef.current = nextIndex;
836
- }
837
- const thumbElement = thumbRefs.current[nextIndex];
838
- if (!thumbElement) {
839
- pressedThumbCenterOffsetRef.current = null;
840
- pressedInputRef.current = null;
841
- return;
842
- }
843
- pressedInputRef.current = thumbElement.querySelector('input[type="range"]');
844
- }
845
- function getFingerState(fingerCoords) {
846
- const control = controlRef.current;
847
- if (!control) {
848
- return null;
849
- }
850
- const {
851
- width,
852
- height,
853
- bottom,
854
- left,
855
- right
856
- } = control.getBoundingClientRect();
857
- const controlOffset = getControlOffset(stylesRef.current, vertical);
858
- const insetThumbOffset = insetThumbOffsetRef.current;
859
- const controlSize = (vertical ? height : width) - controlOffset.start - controlOffset.end - insetThumbOffset * 2;
860
- const thumbCenterOffset = pressedThumbCenterOffsetRef.current ?? 0;
861
- const fingerX = fingerCoords.x - thumbCenterOffset;
862
- const fingerY = fingerCoords.y - thumbCenterOffset;
863
- const valueSize = vertical ? bottom - fingerY - controlOffset.end : (direction === "rtl" ? right - fingerX : fingerX - left) - controlOffset.start;
864
- const valueRescaled = clamp((valueSize - insetThumbOffset) / controlSize, 0, 1);
865
- let newValue = (max - min) * valueRescaled + min;
866
- newValue = roundValueToStep(newValue, step, min);
867
- newValue = clamp(newValue, min, max);
868
- if (!range) {
869
- return {
870
- value: newValue,
871
- thumbIndex: 0,
872
- didSwap: false
873
- };
874
- }
875
- const thumbIndex = pressedThumbIndexRef.current;
876
- if (thumbIndex < 0) {
877
- return null;
878
- }
879
- const collisionResult = resolveThumbCollision({
880
- behavior: thumbCollisionBehavior,
881
- values,
882
- currentValues: latestValuesRef.current ?? values,
883
- initialValues: pressedValuesRef.current,
884
- pressedIndex: thumbIndex,
885
- nextValue: newValue,
886
- min,
887
- max,
888
- step,
889
- minStepsBetweenValues
890
- });
891
- if (thumbCollisionBehavior === "swap" && collisionResult.didSwap) {
892
- updatePressedThumb(collisionResult.thumbIndex);
893
- } else {
894
- pressedThumbIndexRef.current = collisionResult.thumbIndex;
895
- }
896
- return collisionResult;
897
- }
898
- function startPressing(fingerCoords) {
899
- pressedValuesRef.current = range ? values.slice() : null;
900
- latestValuesRef.current = values;
901
- const pressedThumbIndex = pressedThumbIndexRef.current;
902
- let closestThumbIndex = pressedThumbIndex;
903
- if (pressedThumbIndex > -1 && pressedThumbIndex < values.length) {
904
- if (values[pressedThumbIndex] === max) {
905
- let candidateIndex = pressedThumbIndex;
906
- while (candidateIndex > 0 && values[candidateIndex - 1] === max) {
907
- candidateIndex -= 1;
908
- }
909
- closestThumbIndex = candidateIndex;
910
- }
911
- } else {
912
- const axis = !vertical ? "x" : "y";
913
- let minDistance;
914
- closestThumbIndex = -1;
915
- for (let i = 0;i < thumbRefs.current.length; i += 1) {
916
- const thumbEl = thumbRefs.current[i];
917
- if (isElement(thumbEl)) {
918
- const midpoint = getMidpoint(thumbEl);
919
- const distance = Math.abs(fingerCoords[axis] - midpoint[axis]);
920
- if (minDistance === undefined || distance <= minDistance) {
921
- closestThumbIndex = i;
922
- minDistance = distance;
923
- }
924
- }
925
- }
926
- }
927
- if (closestThumbIndex > -1 && closestThumbIndex !== pressedThumbIndex) {
928
- updatePressedThumb(closestThumbIndex);
929
- }
930
- if (inset) {
931
- const thumbEl = thumbRefs.current[closestThumbIndex];
932
- if (isElement(thumbEl)) {
933
- const thumbRect = thumbEl.getBoundingClientRect();
934
- const side = !vertical ? "width" : "height";
935
- insetThumbOffsetRef.current = thumbRect[side] / 2;
936
- }
937
- }
938
- }
939
- function focusThumb(thumbIndex) {
940
- const input = thumbRefs.current?.[thumbIndex]?.querySelector('input[type="range"]');
941
- if (!input) {
942
- return;
943
- }
944
- input.focus({
945
- preventScroll: true,
946
- focusVisible: false
947
- });
948
- }
949
- const handleTouchMove = useStableCallback((nativeEvent) => {
950
- const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
951
- if (fingerCoords == null) {
952
- return;
953
- }
954
- moveCountRef.current += 1;
955
- if (nativeEvent.type === "pointermove" && nativeEvent.buttons === 0) {
956
- handleTouchEnd(nativeEvent);
957
- return;
958
- }
959
- const finger = getFingerState(fingerCoords);
960
- if (finger == null) {
961
- return;
962
- }
963
- if (validateMinimumDistance(finger.value, step, minStepsBetweenValues)) {
964
- if (!dragging && moveCountRef.current > INTENTIONAL_DRAG_COUNT_THRESHOLD) {
965
- setDragging(true);
966
- }
967
- setValue(finger.value, createChangeEventDetails(exports_reason_parts.drag, nativeEvent, undefined, {
968
- activeThumbIndex: finger.thumbIndex
969
- }));
970
- latestValuesRef.current = Array.isArray(finger.value) ? finger.value : [finger.value];
971
- if (finger.didSwap) {
972
- focusThumb(finger.thumbIndex);
973
- }
974
- }
975
- });
976
- function handleTouchEnd(nativeEvent) {
977
- setActive(-1);
978
- setDragging(false);
979
- pressedInputRef.current = null;
980
- pressedThumbCenterOffsetRef.current = null;
981
- const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
982
- const finger = fingerCoords != null ? getFingerState(fingerCoords) : null;
983
- if (finger != null) {
984
- const commitReason = lastChangeReasonRef.current;
985
- onValueCommitted(lastChangedValueRef.current ?? finger.value, createGenericEventDetails(commitReason, nativeEvent));
986
- }
987
- if ("pointerType" in nativeEvent && controlRef.current?.hasPointerCapture(nativeEvent.pointerId)) {
988
- controlRef.current?.releasePointerCapture(nativeEvent.pointerId);
989
- }
990
- pressedThumbIndexRef.current = -1;
991
- touchIdRef.current = null;
992
- pressedValuesRef.current = null;
993
- stopListening();
994
- }
995
- const handleTouchStart = useStableCallback((nativeEvent) => {
996
- if (disabled) {
997
- return;
998
- }
999
- const touch = nativeEvent.changedTouches[0];
1000
- if (touch != null) {
1001
- touchIdRef.current = touch.identifier;
1002
- }
1003
- const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
1004
- if (fingerCoords != null) {
1005
- startPressing(fingerCoords);
1006
- const finger = getFingerState(fingerCoords);
1007
- if (finger == null) {
1008
- return;
1009
- }
1010
- focusThumb(finger.thumbIndex);
1011
- setValue(finger.value, createChangeEventDetails(exports_reason_parts.trackPress, nativeEvent, undefined, {
1012
- activeThumbIndex: finger.thumbIndex
1013
- }));
1014
- latestValuesRef.current = Array.isArray(finger.value) ? finger.value : [finger.value];
1015
- if (finger.didSwap) {
1016
- focusThumb(finger.thumbIndex);
1017
- }
1018
- }
1019
- moveCountRef.current = 0;
1020
- const doc = ownerDocument(controlRef.current);
1021
- doc.addEventListener("touchmove", handleTouchMove, {
1022
- passive: true
1023
- });
1024
- doc.addEventListener("touchend", handleTouchEnd, {
1025
- passive: true
1026
- });
1027
- });
1028
- const stopListening = useStableCallback(() => {
1029
- const doc = ownerDocument(controlRef.current);
1030
- doc.removeEventListener("pointermove", handleTouchMove);
1031
- doc.removeEventListener("pointerup", handleTouchEnd);
1032
- doc.removeEventListener("touchmove", handleTouchMove);
1033
- doc.removeEventListener("touchend", handleTouchEnd);
1034
- pressedValuesRef.current = null;
1035
- });
1036
- const focusFrame = useAnimationFrame();
1037
- React5.useEffect(() => {
1038
- const control = controlRef.current;
1039
- if (!control) {
1040
- return () => stopListening();
1041
- }
1042
- const unsubscribeTouchStart = addEventListener(control, "touchstart", handleTouchStart, {
1043
- passive: true
1044
- });
1045
- return () => {
1046
- unsubscribeTouchStart();
1047
- focusFrame.cancel();
1048
- stopListening();
1049
- };
1050
- }, [stopListening, handleTouchStart, controlRef, focusFrame]);
1051
- React5.useEffect(() => {
1052
- if (disabled) {
1053
- stopListening();
1054
- }
1055
- }, [disabled, stopListening]);
1056
- const element = useRenderElement("div", componentProps, {
1057
- state,
1058
- ref: [forwardedRef, registerFieldControlRef, controlRef, setStylesRef],
1059
- props: [{
1060
- ["data-base-ui-slider-control"]: renderBeforeHydration ? "" : undefined,
1061
- onPointerDown(event) {
1062
- const control = controlRef.current;
1063
- const target = getTarget(event.nativeEvent);
1064
- if (!control || disabled || event.defaultPrevented || !isElement(target) || event.button !== 0) {
1065
- return;
1066
- }
1067
- const fingerCoords = getFingerCoords(event, touchIdRef);
1068
- if (fingerCoords != null) {
1069
- startPressing(fingerCoords);
1070
- const finger = getFingerState(fingerCoords);
1071
- if (finger == null) {
1072
- return;
1073
- }
1074
- const pressedOnFocusedThumb = contains(thumbRefs.current[finger.thumbIndex], activeElement(ownerDocument(control)));
1075
- if (pressedOnFocusedThumb) {
1076
- event.preventDefault();
1077
- } else {
1078
- focusFrame.request(() => {
1079
- focusThumb(finger.thumbIndex);
1080
- });
1081
- }
1082
- setDragging(true);
1083
- const pressedOnAnyThumb = pressedThumbCenterOffsetRef.current != null;
1084
- if (!pressedOnAnyThumb) {
1085
- setValue(finger.value, createChangeEventDetails(exports_reason_parts.trackPress, event.nativeEvent, undefined, {
1086
- activeThumbIndex: finger.thumbIndex
1087
- }));
1088
- latestValuesRef.current = Array.isArray(finger.value) ? finger.value : [finger.value];
1089
- if (finger.didSwap) {
1090
- focusThumb(finger.thumbIndex);
1091
- }
1092
- }
1093
- }
1094
- if (event.nativeEvent.pointerId) {
1095
- control.setPointerCapture(event.nativeEvent.pointerId);
1096
- }
1097
- moveCountRef.current = 0;
1098
- const doc = ownerDocument(controlRef.current);
1099
- doc.addEventListener("pointermove", handleTouchMove, {
1100
- passive: true
1101
- });
1102
- doc.addEventListener("pointerup", handleTouchEnd, {
1103
- once: true
1104
- });
1105
- }
1106
- }, elementProps],
1107
- stateAttributesMapping: sliderStateAttributesMapping
1108
- });
1109
- return element;
1110
- });
1111
- if (true)
1112
- SliderControl.displayName = "SliderControl";
1113
- // node_modules/@base-ui/react/esm/slider/track/SliderTrack.js
1114
- import * as React6 from "react";
1115
- "use client";
1116
- var SliderTrack = /* @__PURE__ */ React6.forwardRef(function SliderTrack2(componentProps, forwardedRef) {
1117
- const {
1118
- render,
1119
- className,
1120
- style,
1121
- ...elementProps
1122
- } = componentProps;
1123
- const {
1124
- state
1125
- } = useSliderRootContext();
1126
- const element = useRenderElement("div", componentProps, {
1127
- state,
1128
- ref: forwardedRef,
1129
- props: [{
1130
- style: {
1131
- position: "relative"
1132
- }
1133
- }, elementProps],
1134
- stateAttributesMapping: sliderStateAttributesMapping
1135
- });
1136
- return element;
1137
- });
1138
- if (true)
1139
- SliderTrack.displayName = "SliderTrack";
1140
- // node_modules/@base-ui/react/esm/slider/thumb/SliderThumb.js
1141
- import * as React7 from "react";
1142
-
1143
- // node_modules/@base-ui/react/esm/slider/thumb/SliderThumbDataAttributes.js
1144
- var SliderThumbDataAttributes = /* @__PURE__ */ function(SliderThumbDataAttributes2) {
1145
- SliderThumbDataAttributes2["index"] = "data-index";
1146
- SliderThumbDataAttributes2["dragging"] = "data-dragging";
1147
- SliderThumbDataAttributes2["orientation"] = "data-orientation";
1148
- SliderThumbDataAttributes2["disabled"] = "data-disabled";
1149
- SliderThumbDataAttributes2["valid"] = "data-valid";
1150
- SliderThumbDataAttributes2["invalid"] = "data-invalid";
1151
- SliderThumbDataAttributes2["touched"] = "data-touched";
1152
- SliderThumbDataAttributes2["dirty"] = "data-dirty";
1153
- SliderThumbDataAttributes2["focused"] = "data-focused";
1154
- return SliderThumbDataAttributes2;
1155
- }({});
1156
-
1157
- // node_modules/@base-ui/react/esm/slider/thumb/prehydrationScript.min.js
1158
- var script = '!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();';
1159
-
1160
- // node_modules/@base-ui/react/esm/slider/thumb/SliderThumb.js
1161
- import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
1162
- "use client";
1163
- var ALL_KEYS = new Set([...COMPOSITE_KEYS, PAGE_UP, PAGE_DOWN]);
1164
- function getDefaultAriaValueText(values, index, format, locale) {
1165
- if (index < 0) {
1166
- return;
1167
- }
1168
- if (values.length === 2) {
1169
- if (index === 0) {
1170
- return `${formatNumber(values[index], locale, format)} start range`;
1171
- }
1172
- return `${formatNumber(values[index], locale, format)} end range`;
1173
- }
1174
- return format ? formatNumber(values[index], locale, format) : undefined;
1175
- }
1176
- function getNewValue(thumbValue, increment, direction, min, max) {
1177
- const value = direction === 1 ? thumbValue + increment : thumbValue - increment;
1178
- const roundedValue = Number(value.toFixed(Math.max(getDecimalPrecision(thumbValue), getDecimalPrecision(increment), getDecimalPrecision(min))));
1179
- return clamp(roundedValue, min, max);
1180
- }
1181
- var SliderThumb = /* @__PURE__ */ React7.forwardRef(function SliderThumb2(componentProps, forwardedRef) {
1182
- const {
1183
- render,
1184
- children: childrenProp,
1185
- className,
1186
- "aria-describedby": ariaDescribedByProp,
1187
- "aria-label": ariaLabelProp,
1188
- "aria-labelledby": ariaLabelledByProp,
1189
- disabled: disabledProp = false,
1190
- getAriaLabel: getAriaLabelProp,
1191
- getAriaValueText: getAriaValueTextProp,
1192
- id: idProp,
1193
- index: indexProp,
1194
- inputRef: inputRefProp,
1195
- onBlur: onBlurProp,
1196
- onFocus: onFocusProp,
1197
- onKeyDown: onKeyDownProp,
1198
- tabIndex: tabIndexProp,
1199
- style,
1200
- ...elementProps
1201
- } = componentProps;
1202
- const {
1203
- nonce
1204
- } = useCSPContext();
1205
- const id = useBaseUiId(idProp);
1206
- const {
1207
- active: activeIndex,
1208
- lastUsedThumbIndex,
1209
- controlRef,
1210
- disabled: contextDisabled,
1211
- validation,
1212
- formatOptionsRef,
1213
- handleInputChange,
1214
- inset,
1215
- labelId,
1216
- largeStep,
1217
- locale,
1218
- max,
1219
- min,
1220
- minStepsBetweenValues,
1221
- form,
1222
- name,
1223
- orientation,
1224
- pressedInputRef,
1225
- pressedThumbCenterOffsetRef,
1226
- pressedThumbIndexRef,
1227
- renderBeforeHydration,
1228
- setActive,
1229
- setIndicatorPosition,
1230
- state,
1231
- step,
1232
- values: sliderValues
1233
- } = useSliderRootContext();
1234
- const direction = useDirection();
1235
- const disabled = disabledProp || contextDisabled;
1236
- const range = sliderValues.length > 1;
1237
- const vertical = orientation === "vertical";
1238
- const rtl = direction === "rtl";
1239
- const {
1240
- setTouched,
1241
- setFocused,
1242
- validationMode
1243
- } = useFieldRootContext();
1244
- const thumbRef = React7.useRef(null);
1245
- const inputRef = React7.useRef(null);
1246
- const restoringFocusVisibleRef = React7.useRef(false);
1247
- const defaultInputId = useBaseUiId();
1248
- const labelableId = useLabelableId();
1249
- const inputId = range ? defaultInputId : labelableId;
1250
- const thumbMetadata = React7.useMemo(() => ({
1251
- inputId
1252
- }), [inputId]);
1253
- const {
1254
- ref: listItemRef,
1255
- index: compositeIndex
1256
- } = useCompositeListItem({
1257
- metadata: thumbMetadata
1258
- });
1259
- const index = !range ? 0 : indexProp ?? compositeIndex;
1260
- const last = index === sliderValues.length - 1;
1261
- const thumbValue = sliderValues[index];
1262
- const thumbValuePercent = valueToPercent(thumbValue, min, max);
1263
- const [positionPercent, setPositionPercent] = React7.useState();
1264
- const isHydrating = useIsHydrating();
1265
- const safeLastUsedThumbIndex = lastUsedThumbIndex >= 0 && lastUsedThumbIndex < sliderValues.length ? lastUsedThumbIndex : -1;
1266
- const getInsetPosition = useStableCallback(() => {
1267
- const control = controlRef.current;
1268
- const thumb = thumbRef.current;
1269
- if (!control || !thumb) {
1270
- return;
1271
- }
1272
- const thumbRect = thumb.getBoundingClientRect();
1273
- const controlRect = control.getBoundingClientRect();
1274
- const side = vertical ? "height" : "width";
1275
- const controlSize = controlRect[side] - thumbRect[side];
1276
- const thumbOffsetFromControlEdge = thumbRect[side] / 2 + controlSize * thumbValuePercent / 100;
1277
- const nextPositionPercent = thumbOffsetFromControlEdge / controlRect[side] * 100;
1278
- const nextInsetPosition = Number.isFinite(nextPositionPercent) ? nextPositionPercent : undefined;
1279
- setPositionPercent(nextInsetPosition);
1280
- if (index === 0) {
1281
- setIndicatorPosition((prevPosition) => [nextInsetPosition, prevPosition[1]]);
1282
- } else if (last) {
1283
- setIndicatorPosition((prevPosition) => [prevPosition[0], nextInsetPosition]);
1284
- }
1285
- });
1286
- useIsoLayoutEffect(() => {
1287
- if (inset) {
1288
- queueMicrotask(getInsetPosition);
1289
- }
1290
- }, [getInsetPosition, inset]);
1291
- useIsoLayoutEffect(() => {
1292
- if (inset) {
1293
- getInsetPosition();
1294
- }
1295
- }, [getInsetPosition, inset, thumbValuePercent]);
1296
- useIsoLayoutEffect(() => {
1297
- if (!inset) {
1298
- return;
1299
- }
1300
- const control = controlRef.current;
1301
- const thumb = thumbRef.current;
1302
- if (!control || !thumb) {
1303
- return;
1304
- }
1305
- const ResizeObserverCtor = getWindow(control).ResizeObserver;
1306
- if (typeof ResizeObserverCtor !== "function") {
1307
- return;
1308
- }
1309
- const resizeObserver = new ResizeObserverCtor(getInsetPosition);
1310
- resizeObserver.observe(control);
1311
- resizeObserver.observe(thumb);
1312
- return () => {
1313
- resizeObserver.disconnect();
1314
- };
1315
- }, [controlRef, getInsetPosition, inset]);
1316
- const startEdge = vertical ? "bottom" : "insetInlineStart";
1317
- const crossOffsetProperty = vertical ? "left" : "top";
1318
- let zIndex;
1319
- if (range) {
1320
- if (activeIndex === index) {
1321
- zIndex = 2;
1322
- } else if (safeLastUsedThumbIndex === index) {
1323
- zIndex = 1;
1324
- }
1325
- } else if (activeIndex === index) {
1326
- zIndex = 1;
1327
- }
1328
- let thumbStyle;
1329
- if (inset) {
1330
- thumbStyle = {
1331
- ["--position"]: `${positionPercent ?? 0}%`,
1332
- visibility: renderBeforeHydration && isHydrating || positionPercent === undefined ? "hidden" : undefined,
1333
- position: "absolute",
1334
- [startEdge]: "var(--position)",
1335
- [crossOffsetProperty]: "50%",
1336
- translate: `${(vertical || !rtl ? -1 : 1) * 50}% ${(vertical ? 1 : -1) * 50}%`,
1337
- zIndex
1338
- };
1339
- } else {
1340
- thumbStyle = !Number.isFinite(thumbValuePercent) ? visuallyHidden : {
1341
- position: "absolute",
1342
- [startEdge]: `${thumbValuePercent}%`,
1343
- [crossOffsetProperty]: "50%",
1344
- translate: `${(vertical || !rtl ? -1 : 1) * 50}% ${(vertical ? 1 : -1) * 50}%`,
1345
- zIndex
1346
- };
1347
- }
1348
- let cssWritingMode;
1349
- if (orientation === "vertical") {
1350
- cssWritingMode = rtl ? "vertical-rl" : "vertical-lr";
1351
- }
1352
- const ariaLabel = typeof getAriaLabelProp === "function" ? getAriaLabelProp(index) : ariaLabelProp;
1353
- const inputProps = mergeProps({
1354
- "aria-label": ariaLabel,
1355
- "aria-labelledby": ariaLabelledByProp ?? (ariaLabel == null ? labelId : undefined),
1356
- "aria-describedby": ariaDescribedByProp,
1357
- "aria-orientation": orientation,
1358
- "aria-valuenow": thumbValue,
1359
- "aria-valuetext": typeof getAriaValueTextProp === "function" ? getAriaValueTextProp(formatNumber(thumbValue, locale, formatOptionsRef.current ?? undefined), thumbValue, index) : getDefaultAriaValueText(sliderValues, index, formatOptionsRef.current ?? undefined, locale),
1360
- disabled,
1361
- form,
1362
- id: inputId,
1363
- max,
1364
- min,
1365
- name,
1366
- onChange(event) {
1367
- handleInputChange(event.currentTarget.valueAsNumber, index, event);
1368
- },
1369
- onFocus(event) {
1370
- const isRestoringFocusVisible = restoringFocusVisibleRef.current;
1371
- restoringFocusVisibleRef.current = false;
1372
- setActive(index);
1373
- setFocused(true);
1374
- if (isRestoringFocusVisible) {
1375
- event.stopPropagation();
1376
- }
1377
- },
1378
- onBlur(event) {
1379
- if (restoringFocusVisibleRef.current) {
1380
- event.stopPropagation();
1381
- return;
1382
- }
1383
- if (!thumbRef.current) {
1384
- return;
1385
- }
1386
- setActive(-1);
1387
- setTouched(true);
1388
- setFocused(false);
1389
- if (validationMode === "onBlur") {
1390
- validation.commit(getSliderValue(thumbValue, index, min, max, range, sliderValues));
1391
- }
1392
- },
1393
- onKeyDown(event) {
1394
- if (!ALL_KEYS.has(event.key)) {
1395
- return;
1396
- }
1397
- if (COMPOSITE_KEYS.has(event.key)) {
1398
- event.stopPropagation();
1399
- }
1400
- let newValue = null;
1401
- const roundedValue = roundValueToStep(thumbValue, step, min);
1402
- switch (event.key) {
1403
- case ARROW_UP:
1404
- newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, 1, min, max);
1405
- break;
1406
- case ARROW_RIGHT:
1407
- newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, rtl ? -1 : 1, min, max);
1408
- break;
1409
- case ARROW_DOWN:
1410
- newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, -1, min, max);
1411
- break;
1412
- case ARROW_LEFT:
1413
- newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, rtl ? 1 : -1, min, max);
1414
- break;
1415
- case PAGE_UP:
1416
- newValue = getNewValue(roundedValue, largeStep, 1, min, max);
1417
- break;
1418
- case PAGE_DOWN:
1419
- newValue = getNewValue(roundedValue, largeStep, -1, min, max);
1420
- break;
1421
- case END:
1422
- newValue = max;
1423
- if (range) {
1424
- newValue = Number.isFinite(sliderValues[index + 1]) ? sliderValues[index + 1] - step * minStepsBetweenValues : max;
1425
- }
1426
- break;
1427
- case HOME:
1428
- newValue = min;
1429
- if (range) {
1430
- newValue = Number.isFinite(sliderValues[index - 1]) ? sliderValues[index - 1] + step * minStepsBetweenValues : min;
1431
- }
1432
- break;
1433
- default:
1434
- break;
1435
- }
1436
- if (newValue !== null) {
1437
- const input = event.currentTarget;
1438
- if (!matchesFocusVisible(input)) {
1439
- restoringFocusVisibleRef.current = true;
1440
- input.blur();
1441
- input.focus({
1442
- preventScroll: true,
1443
- focusVisible: true
1444
- });
1445
- }
1446
- handleInputChange(newValue, index, event);
1447
- event.preventDefault();
1448
- }
1449
- },
1450
- step,
1451
- style: {
1452
- ...visuallyHidden,
1453
- width: "100%",
1454
- height: "100%",
1455
- writingMode: cssWritingMode
1456
- },
1457
- tabIndex: tabIndexProp ?? undefined,
1458
- type: "range",
1459
- value: thumbValue ?? ""
1460
- }, validation.getInputValidationProps);
1461
- const mergedInputRef = useMergedRefs(inputRef, validation.inputRef, inputRefProp);
1462
- const element = useRenderElement("div", componentProps, {
1463
- state,
1464
- ref: [forwardedRef, listItemRef, thumbRef],
1465
- props: [{
1466
- [SliderThumbDataAttributes.index]: index,
1467
- children: /* @__PURE__ */ _jsxs(React7.Fragment, {
1468
- children: [childrenProp, /* @__PURE__ */ _jsx2("input", {
1469
- ref: mergedInputRef,
1470
- ...inputProps,
1471
- suppressHydrationWarning: true
1472
- }), inset && isHydrating && renderBeforeHydration && last && /* @__PURE__ */ _jsx2("script", {
1473
- nonce,
1474
- dangerouslySetInnerHTML: {
1475
- __html: script
1476
- },
1477
- suppressHydrationWarning: true
1478
- })]
1479
- }),
1480
- id,
1481
- onBlur: onBlurProp,
1482
- onFocus: onFocusProp,
1483
- onPointerDown(event) {
1484
- pressedThumbIndexRef.current = index;
1485
- if (thumbRef.current != null) {
1486
- const axis = orientation === "horizontal" ? "x" : "y";
1487
- const midpoint = getMidpoint(thumbRef.current);
1488
- const offset = (orientation === "horizontal" ? event.clientX : event.clientY) - midpoint[axis];
1489
- pressedThumbCenterOffsetRef.current = offset;
1490
- }
1491
- if (inputRef.current != null && pressedInputRef.current !== inputRef.current) {
1492
- pressedInputRef.current = inputRef.current;
1493
- }
1494
- },
1495
- style: thumbStyle,
1496
- suppressHydrationWarning: renderBeforeHydration || undefined
1497
- }, elementProps],
1498
- stateAttributesMapping: sliderStateAttributesMapping
1499
- });
1500
- return element;
1501
- });
1502
- if (true)
1503
- SliderThumb.displayName = "SliderThumb";
1504
- // node_modules/@base-ui/react/esm/slider/indicator/SliderIndicator.js
1505
- import * as React8 from "react";
1506
- "use client";
1507
- function getInsetStyles(vertical, range, start, end, renderBeforeHydration, hydrating) {
1508
- const visibility = start === undefined || range && end === undefined ? "hidden" : undefined;
1509
- const startEdge = vertical ? "bottom" : "insetInlineStart";
1510
- const mainSide = vertical ? "height" : "width";
1511
- const crossSide = vertical ? "width" : "height";
1512
- const styles = {
1513
- visibility: renderBeforeHydration && hydrating ? "hidden" : visibility,
1514
- position: vertical ? "absolute" : "relative",
1515
- [crossSide]: "inherit"
1516
- };
1517
- styles["--start-position"] = `${start ?? 0}%`;
1518
- if (!range) {
1519
- styles[startEdge] = 0;
1520
- styles[mainSide] = "var(--start-position)";
1521
- return styles;
1522
- }
1523
- styles["--relative-size"] = `${(end ?? 0) - (start ?? 0)}%`;
1524
- styles[startEdge] = "var(--start-position)";
1525
- styles[mainSide] = "var(--relative-size)";
1526
- return styles;
1527
- }
1528
- function getCenteredStyles(vertical, range, start, end) {
1529
- const startEdge = vertical ? "bottom" : "insetInlineStart";
1530
- const mainSide = vertical ? "height" : "width";
1531
- const crossSide = vertical ? "width" : "height";
1532
- const styles = {
1533
- position: vertical ? "absolute" : "relative",
1534
- [crossSide]: "inherit"
1535
- };
1536
- if (!range) {
1537
- styles[startEdge] = 0;
1538
- styles[mainSide] = `${start}%`;
1539
- return styles;
1540
- }
1541
- const size = end - start;
1542
- styles[startEdge] = `${start}%`;
1543
- styles[mainSide] = `${size}%`;
1544
- return styles;
1545
- }
1546
- var SliderIndicator = /* @__PURE__ */ React8.forwardRef(function SliderIndicator2(componentProps, forwardedRef) {
1547
- const {
1548
- render,
1549
- className,
1550
- style: styleProp,
1551
- ...elementProps
1552
- } = componentProps;
1553
- const {
1554
- indicatorPosition,
1555
- inset,
1556
- max,
1557
- min,
1558
- orientation,
1559
- renderBeforeHydration,
1560
- state,
1561
- values
1562
- } = useSliderRootContext();
1563
- const isHydrating = useIsHydrating();
1564
- const vertical = orientation === "vertical";
1565
- const range = values.length > 1;
1566
- const style = inset ? getInsetStyles(vertical, range, indicatorPosition[0], indicatorPosition[1], renderBeforeHydration, isHydrating) : getCenteredStyles(vertical, range, valueToPercent(values[0], min, max), valueToPercent(values[values.length - 1], min, max));
1567
- const element = useRenderElement("div", componentProps, {
1568
- state,
1569
- ref: forwardedRef,
1570
- props: [{
1571
- ["data-base-ui-slider-indicator"]: renderBeforeHydration ? "" : undefined,
1572
- style,
1573
- suppressHydrationWarning: renderBeforeHydration || undefined
1574
- }, elementProps],
1575
- stateAttributesMapping: sliderStateAttributesMapping
1576
- });
1577
- return element;
1578
- });
1579
- if (true)
1580
- SliderIndicator.displayName = "SliderIndicator";
1581
- export {
1582
- exports_index_parts as Slider
1583
- };