@koide-labs/ui 0.0.14 → 0.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 (310) hide show
  1. package/dist/-utils.d.ts +2 -2
  2. package/dist/-utils.js +1 -1
  3. package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
  4. package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
  5. package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
  6. package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
  7. package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
  8. package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
  9. package/dist/accordion.css +1 -0
  10. package/dist/alert-dialog.css +1 -0
  11. package/dist/anchor.css +1 -0
  12. package/dist/avatar.css +1 -0
  13. package/dist/badge.css +1 -0
  14. package/dist/button.css +1 -0
  15. package/dist/checkbox.css +1 -0
  16. package/dist/code.css +1 -0
  17. package/dist/collapse.css +1 -0
  18. package/dist/command.css +1 -0
  19. package/dist/components/accordion/accordion.d.ts +19 -0
  20. package/dist/components/accordion/accordion.js +701 -0
  21. package/dist/components/accordion/index.d.ts +1 -12
  22. package/dist/components/accordion/index.js +2 -697
  23. package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
  24. package/dist/components/alert-dialog/alert-dialog.js +138 -0
  25. package/dist/components/alert-dialog/index.d.ts +1 -26
  26. package/dist/components/alert-dialog/index.js +2 -134
  27. package/dist/components/anchor/anchor.d.ts +12 -0
  28. package/dist/components/anchor/anchor.js +21 -0
  29. package/dist/components/anchor/index.d.ts +1 -8
  30. package/dist/components/anchor/index.js +2 -19
  31. package/dist/components/avatar/avatar.d.ts +25 -0
  32. package/dist/components/avatar/avatar.js +161 -0
  33. package/dist/components/avatar/index.d.ts +1 -21
  34. package/dist/components/avatar/index.js +2 -159
  35. package/dist/components/badge/badge.d.ts +20 -0
  36. package/dist/components/badge/badge.js +42 -0
  37. package/dist/components/badge/index.d.ts +1 -16
  38. package/dist/components/badge/index.js +2 -40
  39. package/dist/components/button/button.d.ts +27 -0
  40. package/dist/components/button/button.js +47 -0
  41. package/dist/components/button/index.d.ts +1 -24
  42. package/dist/components/button/index.js +2 -45
  43. package/dist/components/checkbox/checkbox.d.ts +13 -0
  44. package/dist/components/checkbox/checkbox.js +269 -0
  45. package/dist/components/checkbox/index.d.ts +1 -9
  46. package/dist/components/checkbox/index.js +2 -267
  47. package/dist/components/code/code.d.ts +13 -0
  48. package/dist/components/code/code.js +1206 -0
  49. package/dist/components/code/index.d.ts +1 -9
  50. package/dist/components/code/index.js +2 -1204
  51. package/dist/components/collapse/collapse.d.ts +14 -0
  52. package/dist/components/collapse/collapse.js +35 -0
  53. package/dist/components/collapse/index.d.ts +1 -11
  54. package/dist/components/collapse/index.js +2 -33
  55. package/dist/components/command/command.d.ts +36 -0
  56. package/dist/components/command/command.js +1695 -0
  57. package/dist/components/command/index.d.ts +1 -15
  58. package/dist/components/command/index.js +2 -1693
  59. package/dist/components/context-menu/context-menu.d.ts +82 -0
  60. package/dist/components/context-menu/context-menu.js +1445 -0
  61. package/dist/components/context-menu/index.d.ts +1 -42
  62. package/dist/components/context-menu/index.js +2 -1442
  63. package/dist/components/dialog/dialog.d.ts +22 -0
  64. package/dist/components/dialog/dialog.js +140 -0
  65. package/dist/components/dialog/dialog.types.d.ts +38 -0
  66. package/dist/components/dialog/index.d.ts +1 -48
  67. package/dist/components/dialog/index.js +2 -136
  68. package/dist/components/heading/heading.d.ts +25 -0
  69. package/dist/components/heading/heading.js +36 -0
  70. package/dist/components/heading/index.d.ts +1 -44
  71. package/dist/components/heading/index.js +2 -49
  72. package/dist/components/icon/icon.d.ts +28 -0
  73. package/dist/components/icon/icon.js +43 -0
  74. package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
  75. package/dist/components/icon/icon.types.js +1 -0
  76. package/dist/components/icon/index.d.ts +2 -24
  77. package/dist/components/icon/index.js +2 -41
  78. package/dist/components/icon-button/icon-button.d.ts +16 -0
  79. package/dist/components/icon-button/icon-button.js +46 -0
  80. package/dist/components/icon-button/index.d.ts +1 -12
  81. package/dist/components/icon-button/index.js +2 -44
  82. package/dist/components/inline-code/index.d.ts +1 -6
  83. package/dist/components/inline-code/index.js +2 -20
  84. package/dist/components/inline-code/inline-code.d.ts +10 -0
  85. package/dist/components/inline-code/inline-code.js +25 -0
  86. package/dist/components/input/index.d.ts +1 -3
  87. package/dist/components/input/index.js +2 -117
  88. package/dist/components/input/input.d.ts +9 -0
  89. package/dist/components/input/input.js +126 -0
  90. package/dist/components/meter/index.d.ts +1 -18
  91. package/dist/components/meter/index.js +2 -163
  92. package/dist/components/meter/meter.d.ts +22 -0
  93. package/dist/components/meter/meter.js +165 -0
  94. package/dist/components/multiline-input/index.d.ts +1 -6
  95. package/dist/components/multiline-input/index.js +2 -98
  96. package/dist/components/multiline-input/multiline-input.d.ts +10 -0
  97. package/dist/components/multiline-input/multiline-input.js +100 -0
  98. package/dist/components/number-input/index.d.ts +1 -10
  99. package/dist/components/number-input/index.js +2 -1167
  100. package/dist/components/number-input/number-input.d.ts +14 -0
  101. package/dist/components/number-input/number-input.js +1169 -0
  102. package/dist/components/password-input/index.d.ts +1 -2
  103. package/dist/components/password-input/index.js +2 -27
  104. package/dist/components/password-input/password-input.d.ts +7 -0
  105. package/dist/components/password-input/password-input.js +29 -0
  106. package/dist/components/pill/index.d.ts +1 -13
  107. package/dist/components/pill/index.js +2 -36
  108. package/dist/components/pill/pill.d.ts +17 -0
  109. package/dist/components/pill/pill.js +38 -0
  110. package/dist/components/popover/index.d.ts +1 -21
  111. package/dist/components/popover/index.js +2 -634
  112. package/dist/components/popover/popover.d.ts +22 -0
  113. package/dist/components/popover/popover.js +634 -0
  114. package/dist/components/preview-card/index.d.ts +1 -17
  115. package/dist/components/preview-card/index.js +2 -400
  116. package/dist/components/preview-card/preview-card.d.ts +21 -0
  117. package/dist/components/preview-card/preview-card.js +402 -0
  118. package/dist/components/radio-group/index.d.ts +1 -0
  119. package/dist/components/radio-group/index.js +5 -0
  120. package/dist/components/radio-group/radio-group.d.ts +25 -0
  121. package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
  122. package/dist/components/search-bar/index.d.ts +1 -12
  123. package/dist/components/search-bar/index.js +2 -46
  124. package/dist/components/search-bar/search-bar.d.ts +16 -0
  125. package/dist/components/search-bar/search-bar.js +43 -0
  126. package/dist/components/select/index.d.ts +1 -16
  127. package/dist/components/select/index.js +2 -1261
  128. package/dist/components/select/select.d.ts +22 -0
  129. package/dist/components/select/select.js +1263 -0
  130. package/dist/components/separator/index.d.ts +1 -7
  131. package/dist/components/separator/index.js +2 -4
  132. package/dist/components/separator/separator.d.ts +10 -0
  133. package/dist/components/separator/separator.js +6 -0
  134. package/dist/components/slider/index.d.ts +1 -5
  135. package/dist/components/slider/index.js +2 -900
  136. package/dist/components/slider/slider.d.ts +10 -0
  137. package/dist/components/slider/slider.js +899 -0
  138. package/dist/components/spinner/index.d.ts +1 -2
  139. package/dist/components/spinner/index.js +2 -11
  140. package/dist/components/spinner/spinner.d.ts +7 -0
  141. package/dist/components/spinner/spinner.js +13 -0
  142. package/dist/components/stacked-avatars/index.d.ts +1 -14
  143. package/dist/components/stacked-avatars/index.js +2 -90
  144. package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
  145. package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
  146. package/dist/components/status-banner/index.d.ts +1 -17
  147. package/dist/components/status-banner/index.js +2 -69
  148. package/dist/components/status-banner/status-banner.d.ts +22 -0
  149. package/dist/components/status-banner/status-banner.js +71 -0
  150. package/dist/components/surface/index.d.ts +2 -27
  151. package/dist/components/surface/index.js +2 -39
  152. package/dist/components/surface/surface.d.ts +26 -0
  153. package/dist/components/surface/surface.js +36 -0
  154. package/dist/components/surface/surface.types.d.ts +1 -0
  155. package/dist/components/surface/surface.types.js +1 -0
  156. package/dist/components/switch/index.d.ts +1 -5
  157. package/dist/components/switch/index.js +2 -194
  158. package/dist/components/switch/switch.d.ts +10 -0
  159. package/dist/components/switch/switch.js +193 -0
  160. package/dist/components/tabs/index.d.ts +1 -18
  161. package/dist/components/tabs/index.js +2 -507
  162. package/dist/components/tabs/tabs.d.ts +28 -0
  163. package/dist/components/tabs/tabs.js +511 -0
  164. package/dist/components/text/index.d.ts +1 -26
  165. package/dist/components/text/index.js +2 -46
  166. package/dist/components/text/text.d.ts +29 -0
  167. package/dist/components/text/text.js +48 -0
  168. package/dist/components/theme-provider/index.d.ts +1 -1
  169. package/dist/components/theme-provider/theme-provider.d.ts +8 -4
  170. package/dist/components/theme-provider/theme-provider.js +3 -3
  171. package/dist/components/timestamp/index.d.ts +1 -23
  172. package/dist/components/timestamp/index.js +2 -1390
  173. package/dist/components/timestamp/timestamp.d.ts +26 -0
  174. package/dist/components/timestamp/timestamp.js +1391 -0
  175. package/dist/components/toaster/index.d.ts +2 -0
  176. package/dist/components/toaster/index.js +7 -0
  177. package/dist/components/toaster/toaster.d.ts +7 -0
  178. package/dist/components/toaster/toaster.js +923 -0
  179. package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
  180. package/dist/components/tooltip/index.d.ts +1 -14
  181. package/dist/components/tooltip/index.js +2 -710
  182. package/dist/components/tooltip/tooltip.d.ts +24 -0
  183. package/dist/components/tooltip/tooltip.js +9 -0
  184. package/dist/components/view/index.d.ts +2 -30
  185. package/dist/components/view/index.js +2 -79
  186. package/dist/components/view/view.d.ts +31 -0
  187. package/dist/components/view/view.js +83 -0
  188. package/dist/components/view/view.types.d.ts +5 -0
  189. package/dist/components/view/view.types.js +1 -0
  190. package/dist/components/visually-hidden/index.d.ts +5 -1
  191. package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
  192. package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
  193. package/dist/context-menu.css +1 -0
  194. package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
  195. package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
  196. package/dist/dialog.css +1 -1
  197. package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
  198. package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
  199. package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
  200. package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
  201. package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
  202. package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
  203. package/dist/heading.css +1 -0
  204. package/dist/icon-button.css +1 -0
  205. package/dist/icon.css +1 -0
  206. package/dist/index.d.ts +10 -10
  207. package/dist/index.js +86 -104
  208. package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
  209. package/dist/inline-code.css +1 -0
  210. package/dist/input.css +1 -1
  211. package/dist/input.module-CtE19OH8.js +8 -0
  212. package/dist/integrations/react-markdown/index.js +12 -12
  213. package/dist/meter.css +1 -0
  214. package/dist/number-input.css +1 -0
  215. package/dist/password-input.css +1 -0
  216. package/dist/pill.css +1 -0
  217. package/dist/popover.css +1 -0
  218. package/dist/preview-card.css +1 -0
  219. package/dist/radio-group.css +1 -0
  220. package/dist/safePolygon-DnkzOIur.js +558 -0
  221. package/dist/search-bar.css +1 -0
  222. package/dist/select.css +1 -0
  223. package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
  224. package/dist/separator.css +1 -0
  225. package/dist/slider.css +1 -0
  226. package/dist/spinner.css +1 -0
  227. package/dist/stacked-avatars.css +1 -0
  228. package/dist/status-banner.css +1 -0
  229. package/dist/styles/core.css +1 -1
  230. package/dist/surface.css +1 -0
  231. package/dist/switch.css +1 -0
  232. package/dist/tabs.css +1 -0
  233. package/dist/text.css +1 -0
  234. package/dist/timestamp.css +1 -0
  235. package/dist/toaster.css +1 -0
  236. package/dist/tooltip-oCp-elli.js +765 -0
  237. package/dist/tooltip.css +1 -0
  238. package/dist/transitions.css +1 -1
  239. package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
  240. package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
  241. package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
  242. package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
  243. package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
  244. package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
  245. package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
  246. package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
  247. package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
  248. package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
  249. package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
  250. package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
  251. package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
  252. package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
  253. package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
  254. package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
  255. package/dist/view.css +1 -1
  256. package/dist/view.module-Dj7wj0kk.js +6 -0
  257. package/dist/view2.css +1 -0
  258. package/package.json +16 -19
  259. package/dist/components/radio/index.d.ts +0 -13
  260. package/dist/components/toast/index.d.ts +0 -2
  261. package/dist/components/toast/index.js +0 -8
  262. package/dist/components/toast/toast.d.ts +0 -2
  263. package/dist/components/toast/toast.js +0 -921
  264. package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
  265. package/dist/components/tooltip/tooltip-arrow.js +0 -6
  266. package/dist/index10.css +0 -1
  267. package/dist/index11.css +0 -1
  268. package/dist/index12.css +0 -1
  269. package/dist/index13.css +0 -1
  270. package/dist/index14.css +0 -1
  271. package/dist/index15.css +0 -1
  272. package/dist/index16.css +0 -1
  273. package/dist/index17.css +0 -1
  274. package/dist/index18.css +0 -1
  275. package/dist/index19.css +0 -1
  276. package/dist/index20.css +0 -1
  277. package/dist/index21.css +0 -1
  278. package/dist/index22.css +0 -1
  279. package/dist/index23.css +0 -1
  280. package/dist/index24.css +0 -1
  281. package/dist/index25.css +0 -1
  282. package/dist/index26.css +0 -1
  283. package/dist/index27.css +0 -1
  284. package/dist/index28.css +0 -1
  285. package/dist/index29.css +0 -1
  286. package/dist/index3.css +0 -1
  287. package/dist/index30.css +0 -1
  288. package/dist/index31.css +0 -1
  289. package/dist/index32.css +0 -1
  290. package/dist/index33.css +0 -1
  291. package/dist/index34.css +0 -1
  292. package/dist/index35.css +0 -1
  293. package/dist/index36.css +0 -1
  294. package/dist/index37.css +0 -1
  295. package/dist/index4.css +0 -1
  296. package/dist/index5.css +0 -1
  297. package/dist/index6.css +0 -1
  298. package/dist/index7.css +0 -1
  299. package/dist/index8.css +0 -1
  300. package/dist/index9.css +0 -1
  301. package/dist/input.module-DDQY_Ij6.js +0 -7
  302. package/dist/safePolygon-DWy1dGKJ.js +0 -308
  303. package/dist/toast.css +0 -1
  304. package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
  305. package/dist/tooltip-arrow.css +0 -1
  306. package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
  307. package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
  308. package/dist/view.module-DfDLgJE0.js +0 -6
  309. /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
  310. /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
@@ -1,903 +1,5 @@
1
1
  "use client";
2
- import { jsx as be, jsxs as Je } from "react/jsx-runtime";
3
- import { c as Ct } from "../../clsx-OuTLNxxd.js";
4
- import { View as Pt } from "../view/index.js";
5
- import * as a from "react";
6
- import { o as Ne } from "../../owner-rKN292Q9.js";
7
- import { u as _t } from "../../useControlled-Du4sJyMj.js";
8
- import { u as z } from "../../useStableCallback-CkTrVkNX.js";
9
- import { u as Qe } from "../../useValueAsRef-HURLzret.js";
10
- import { u as ze } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
11
- import { w as Nt } from "../../warn-CKtX8MLJ.js";
12
- import { c as we, h as Ze, n as wt, k as Et, p as Vt, r as At, u as Ye } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
13
- import { u as Tt } from "../../useValueChanged-DL757-yD.js";
14
- import { u as We } from "../../useBaseUiId-B7WyxtIE.js";
15
- import { u as Ee, m as Mt, c as Ot } from "../../useRenderElement-DwToLA61.js";
16
- import { c as ue } from "../../clamp-D0KDAQIz.js";
17
- import { C as Ft, u as Bt } from "../../useCompositeListItem-OkcAim_1.js";
18
- import { c as Dt, a as et, u as Lt, b as kt } from "../../LabelableContext-BMvjVwor.js";
19
- import { f as $t } from "../../formatErrorMessage-BqPuTBN-.js";
20
- import { h as tt, f as Ht } from "../../element-CZEOj04G.js";
21
- import { a as Ue } from "../../floating-ui.utils.dom-C7FS5id0.js";
22
- import { u as Ut } from "../../useAnimationFrame-451ugS_6.js";
23
- import { u as nt } from "../../DirectionContext-C2o_MF_i.js";
24
- import { u as rt } from "../../useOnMount-VRW6CK2u.js";
25
- import { v as qe } from "../../valueToPercent-DaP9qN4u.js";
26
- import { v as Ge } from "../../visuallyHidden-CpJ-mhai.js";
27
- import { f as De } from "../../formatNumber-1UNwjeqf.js";
28
- import { C as zt, H as ot, E as it, d as st, b as at, c as ut, e as lt } from "../../composite-C9L5QmZL.js";
29
- import { u as Wt } from "../../useLabelableId-Ci_jDvmv.js";
30
- import '../../index33.css';function ct(e, t, r = (i, o) => i === o) {
31
- return e.length === t.length && e.every((i, o) => r(i, t[o]));
32
- }
33
- function dt(e, t) {
34
- return e - t;
35
- }
36
- function qt(e, t, r) {
37
- const i = e.slice();
38
- return i[t] = r, i.sort(dt);
39
- }
40
- function ft(e, t, r, i, o, l) {
41
- let u = e;
42
- return u = ue(u, r, i), o && (u = qt(
43
- l,
44
- t,
45
- // Bound the new value to the thumb's neighbours.
46
- ue(u, l[t - 1] || -1 / 0, l[t + 1] || 1 / 0)
47
- )), u;
48
- }
49
- function mt(e, t, r) {
50
- if (!Array.isArray(e))
51
- return !0;
52
- const i = e.reduce((o, l, u, g) => (u === g.length - 1 || o.push(Math.abs(l - g[u + 1])), o), []);
53
- return Math.min(...i) >= t * r;
54
- }
55
- const Ve = {
56
- activeThumbIndex: () => null,
57
- max: () => null,
58
- min: () => null,
59
- minStepsBetweenValues: () => null,
60
- step: () => null,
61
- values: () => null
62
- }, Ke = /* @__PURE__ */ a.createContext(void 0);
63
- process.env.NODE_ENV !== "production" && (Ke.displayName = "SliderRootContext");
64
- function Le() {
65
- const e = a.useContext(Ke);
66
- if (e === void 0)
67
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>." : $t(62));
68
- return e;
69
- }
70
- function Kt(e) {
71
- return "key" in e ? Et : Vt;
72
- }
73
- function jt(e, t) {
74
- return typeof e == "number" && typeof t == "number" ? e === t : Array.isArray(e) && Array.isArray(t) ? ct(e, t) : !1;
75
- }
76
- const pt = /* @__PURE__ */ a.forwardRef(function(t, r) {
77
- const {
78
- "aria-labelledby": i,
79
- className: o,
80
- defaultValue: l,
81
- disabled: u = !1,
82
- id: g,
83
- format: p,
84
- largeStep: w = 10,
85
- locale: h,
86
- render: W,
87
- max: E = 100,
88
- min: m = 0,
89
- minStepsBetweenValues: s = 0,
90
- name: V,
91
- onValueChange: x,
92
- onValueCommitted: P,
93
- orientation: y = "horizontal",
94
- step: M = 1,
95
- thumbCollisionBehavior: te = "push",
96
- thumbAlignment: ne = "center",
97
- value: re,
98
- ...Re
99
- } = t, le = We(g), q = z(x), ce = z(P), {
100
- clearErrors: H
101
- } = Dt(), {
102
- state: U,
103
- disabled: K,
104
- name: S,
105
- setTouched: j,
106
- setDirty: A,
107
- validityData: R,
108
- shouldValidateOnChange: _,
109
- validation: B
110
- } = et(), {
111
- labelId: oe
112
- } = Lt(), X = i ?? oe, Y = K || u, de = S ?? V, [C, Ie] = _t({
113
- controlled: re,
114
- default: l ?? m,
115
- name: "Slider"
116
- }), ie = a.useRef(null), he = a.useRef(null), O = a.useRef([]), F = a.useRef(null), fe = a.useRef(null), ye = a.useRef(-1), D = a.useRef(null), L = a.useRef(null), se = a.useRef("none"), n = Qe(p), [f, c] = a.useState(-1), [b, d] = a.useState(-1), [$, me] = a.useState(!1), [J, ge] = a.useState(() => /* @__PURE__ */ new Map()), [Pe, Se] = a.useState([void 0, void 0]), I = z((v) => {
117
- c(v), v !== -1 && d(v);
118
- });
119
- kt({
120
- id: le,
121
- commit: B.commit,
122
- value: C,
123
- controlRef: he,
124
- name: de,
125
- getValue: () => C
126
- }), Tt(C, () => {
127
- H(de), _() ? B.commit(C) : B.commit(C, !0);
128
- const v = R.initialValue;
129
- let pe;
130
- Array.isArray(C) && Array.isArray(v) ? pe = !ct(C, v) : pe = C !== v, A(pe);
131
- });
132
- const xe = z((v) => {
133
- v && (he.current = v);
134
- }), Q = Array.isArray(C), Z = a.useMemo(() => Q ? C.slice().sort(dt) : [ue(C, m, E)], [E, m, Q, C]), G = z((v, pe) => {
135
- if (Number.isNaN(v) || jt(v, C))
136
- return;
137
- const ae = pe ?? we(wt, void 0, void 0, {
138
- activeThumbIndex: -1
139
- });
140
- se.current = ae.reason;
141
- const ve = new event.constructor(event.type, event);
142
- Object.defineProperty(ve, "target", {
143
- writable: !0,
144
- value: {
145
- value: v,
146
- name: de
147
- }
148
- }), ae.event = ve, L.current = v, q(v, ae), !ae.isCanceled && Ie(v);
149
- }), Ce = z((v, pe, ae) => {
150
- const ve = ft(v, pe, m, E, Q, Z);
151
- if (mt(ve, M, s)) {
152
- const Te = Kt(ae);
153
- G(ve, we(Te, ae.nativeEvent, void 0, {
154
- activeThumbIndex: pe
155
- })), j(!0);
156
- const je = L.current ?? ve;
157
- ce(je, Ze(Te, ae.nativeEvent));
158
- }
159
- });
160
- process.env.NODE_ENV !== "production" && m >= E && Nt("Slider `max` must be greater than `min`."), ze(() => {
161
- const v = tt(Ne(ie.current));
162
- Y && v && ie.current?.contains(v) && v.blur();
163
- }, [Y]), Y && f !== -1 && I(-1);
164
- const ee = a.useMemo(() => ({
165
- ...U,
166
- activeThumbIndex: f,
167
- disabled: Y,
168
- dragging: $,
169
- orientation: y,
170
- max: E,
171
- min: m,
172
- minStepsBetweenValues: s,
173
- step: M,
174
- values: Z
175
- }), [U, f, Y, $, E, m, s, y, M, Z]), ke = a.useMemo(() => ({
176
- active: f,
177
- controlRef: he,
178
- disabled: Y,
179
- dragging: $,
180
- validation: B,
181
- formatOptionsRef: n,
182
- handleInputChange: Ce,
183
- indicatorPosition: Pe,
184
- inset: ne !== "center",
185
- labelId: X,
186
- largeStep: w,
187
- lastUsedThumbIndex: b,
188
- lastChangedValueRef: L,
189
- lastChangeReasonRef: se,
190
- locale: h,
191
- max: E,
192
- min: m,
193
- minStepsBetweenValues: s,
194
- name: de,
195
- onValueCommitted: ce,
196
- orientation: y,
197
- pressedInputRef: F,
198
- pressedThumbCenterOffsetRef: fe,
199
- pressedThumbIndexRef: ye,
200
- pressedValuesRef: D,
201
- registerFieldControlRef: xe,
202
- renderBeforeHydration: ne === "edge",
203
- setActive: I,
204
- setDragging: me,
205
- setIndicatorPosition: Se,
206
- setValue: G,
207
- state: ee,
208
- step: M,
209
- thumbCollisionBehavior: te,
210
- thumbMap: J,
211
- thumbRefs: O,
212
- values: Z
213
- }), [f, he, X, Y, $, B, n, Ce, Pe, w, b, L, se, h, E, m, s, de, ce, y, F, fe, ye, D, xe, I, me, Se, G, ee, M, te, ne, J, O, Z]), Ae = Ee("div", t, {
214
- state: ee,
215
- ref: [r, ie],
216
- props: [{
217
- "aria-labelledby": X,
218
- id: le,
219
- role: "group"
220
- }, B.getValidationProps, Re],
221
- stateAttributesMapping: Ve
222
- });
223
- return /* @__PURE__ */ be(Ke.Provider, {
224
- value: ke,
225
- children: /* @__PURE__ */ be(Ft, {
226
- elementsRef: O,
227
- onMapChange: ge,
228
- children: Ae
229
- })
230
- });
231
- });
232
- process.env.NODE_ENV !== "production" && (pt.displayName = "SliderRoot");
233
- function ht(e) {
234
- const t = e.getBoundingClientRect();
235
- return {
236
- x: (t.left + t.right) / 2,
237
- y: (t.top + t.bottom) / 2
238
- };
239
- }
240
- function Yt(e) {
241
- if (Math.abs(e) < 1) {
242
- const r = e.toExponential().split("e-"), i = r[0].split(".")[1];
243
- return (i ? i.length : 0) + parseInt(r[1], 10);
244
- }
245
- const t = e.toString().split(".")[1];
246
- return t ? t.length : 0;
247
- }
248
- function gt(e, t, r) {
249
- const i = Math.round((e - r) / t) * t + r;
250
- return Number(i.toFixed(Yt(t)));
251
- }
252
- function Xe({
253
- values: e,
254
- index: t,
255
- nextValue: r,
256
- min: i,
257
- max: o,
258
- step: l,
259
- minStepsBetweenValues: u,
260
- initialValues: g
261
- }) {
262
- if (e.length === 0)
263
- return [];
264
- const p = e.slice(), w = l * u, h = p.length - 1, W = g ?? e, E = i + t * w, m = o - (h - t) * w;
265
- p[t] = ue(r, E, m);
266
- for (let s = t + 1; s <= h; s += 1) {
267
- const V = p[s - 1] + w, x = o - (h - s) * w, P = W[s] ?? p[s];
268
- let y = Math.max(p[s], V);
269
- P < y && (y = Math.max(P, V)), p[s] = ue(y, V, x);
270
- }
271
- for (let s = t - 1; s >= 0; s -= 1) {
272
- const V = p[s + 1] - w, x = i + s * w, P = W[s] ?? p[s];
273
- let y = Math.min(p[s], V);
274
- P > y && (y = Math.min(P, V)), p[s] = ue(y, x, V);
275
- }
276
- for (let s = 0; s <= h; s += 1)
277
- p[s] = Number(p[s].toFixed(12));
278
- return p;
279
- }
280
- function Gt({
281
- behavior: e,
282
- values: t,
283
- currentValues: r,
284
- initialValues: i,
285
- pressedIndex: o,
286
- nextValue: l,
287
- min: u,
288
- max: g,
289
- step: p,
290
- minStepsBetweenValues: w
291
- }) {
292
- const h = r ?? t, W = i ?? t;
293
- if (!(h.length > 1))
294
- return {
295
- value: l,
296
- thumbIndex: 0,
297
- didSwap: !1
298
- };
299
- const m = p * w;
300
- switch (e) {
301
- case "swap": {
302
- const s = h[o], V = 1e-7, x = h.slice(), P = x[o - 1], y = x[o + 1], M = P != null ? P + m : u, te = y != null ? y - m : g, ne = ue(l, M, te), re = Number(ne.toFixed(12));
303
- x[o] = re;
304
- const Re = l > s, le = l < s, q = Re && y != null && l >= y - V, ce = le && P != null && l <= P + V;
305
- if (!q && !ce)
306
- return {
307
- value: x,
308
- thumbIndex: o,
309
- didSwap: !1
310
- };
311
- const H = q ? o + 1 : o - 1, U = x.map((A, R) => {
312
- if (R === o)
313
- return re;
314
- const _ = W[R];
315
- return _ ?? h[R];
316
- });
317
- let K = l;
318
- q ? K = Math.max(l, x[H]) : K = Math.min(l, x[H]);
319
- const S = Xe({
320
- values: x,
321
- index: H,
322
- nextValue: K,
323
- min: u,
324
- max: g,
325
- step: p,
326
- minStepsBetweenValues: w,
327
- initialValues: U
328
- }), j = q ? H - 1 : H + 1;
329
- if (j >= 0 && j < S.length) {
330
- const A = S[j - 1], R = S[j + 1];
331
- let _ = A != null ? A + m : u;
332
- _ = Math.max(_, u + j * m);
333
- let B = R != null ? R - m : g;
334
- B = Math.min(B, g - (S.length - 1 - j) * m);
335
- const oe = ue(re, _, B);
336
- S[j] = Number(oe.toFixed(12));
337
- }
338
- return {
339
- value: S,
340
- thumbIndex: H,
341
- didSwap: !0
342
- };
343
- }
344
- case "push":
345
- return {
346
- value: Xe({
347
- values: h,
348
- index: o,
349
- nextValue: l,
350
- min: u,
351
- max: g,
352
- step: p,
353
- minStepsBetweenValues: w
354
- }),
355
- thumbIndex: o,
356
- didSwap: !1
357
- };
358
- default: {
359
- const s = h.slice(), V = s[o - 1], x = s[o + 1], P = V != null ? V + m : u, y = x != null ? x - m : g, M = ue(l, P, y);
360
- return s[o] = Number(M.toFixed(12)), {
361
- value: s,
362
- thumbIndex: o,
363
- didSwap: !1
364
- };
365
- }
366
- }
367
- }
368
- const Xt = 2;
369
- function Jt(e, t) {
370
- if (!e)
371
- return {
372
- start: 0,
373
- end: 0
374
- };
375
- function r(l) {
376
- const u = l != null ? parseFloat(l) : 0;
377
- return Number.isNaN(u) ? 0 : u;
378
- }
379
- const i = t ? "Top" : "InlineStart", o = t ? "Bottom" : "InlineEnd";
380
- return {
381
- start: r(e[`border${i}Width`]) + r(e[`padding${i}`]),
382
- end: r(e[`border${o}Width`]) + r(e[`padding${o}`])
383
- };
384
- }
385
- function Fe(e, t) {
386
- if (t.current != null && e.changedTouches) {
387
- const r = e;
388
- for (let i = 0; i < r.changedTouches.length; i += 1) {
389
- const o = r.changedTouches[i];
390
- if (o.identifier === t.current)
391
- return {
392
- x: o.clientX,
393
- y: o.clientY
394
- };
395
- }
396
- return null;
397
- }
398
- return {
399
- x: e.clientX,
400
- y: e.clientY
401
- };
402
- }
403
- const bt = /* @__PURE__ */ a.forwardRef(function(t, r) {
404
- const {
405
- render: i,
406
- className: o,
407
- ...l
408
- } = t, {
409
- disabled: u,
410
- dragging: g,
411
- validation: p,
412
- inset: w,
413
- lastChangedValueRef: h,
414
- lastChangeReasonRef: W,
415
- max: E,
416
- min: m,
417
- minStepsBetweenValues: s,
418
- onValueCommitted: V,
419
- orientation: x,
420
- pressedInputRef: P,
421
- pressedThumbCenterOffsetRef: y,
422
- pressedThumbIndexRef: M,
423
- pressedValuesRef: te,
424
- registerFieldControlRef: ne,
425
- renderBeforeHydration: re,
426
- setActive: Re,
427
- setDragging: le,
428
- setValue: q,
429
- state: ce,
430
- step: H,
431
- thumbCollisionBehavior: U,
432
- thumbRefs: K,
433
- values: S
434
- } = Le(), j = nt(), A = S.length > 1, R = x === "vertical", _ = a.useRef(null), B = a.useRef(null), oe = z((n) => {
435
- n && B.current == null && B.current == null && (B.current = getComputedStyle(n));
436
- }), X = a.useRef(null), Y = a.useRef(0), de = a.useRef(0), C = Qe(S), Ie = z((n) => {
437
- M.current !== n && (M.current = n);
438
- const f = K.current[n];
439
- if (!f) {
440
- y.current = null, P.current = null;
441
- return;
442
- }
443
- P.current = f.querySelector('input[type="range"]');
444
- }), ie = z((n) => {
445
- const f = _.current;
446
- if (!f)
447
- return null;
448
- const {
449
- width: c,
450
- height: b,
451
- bottom: d,
452
- left: $,
453
- right: me
454
- } = f.getBoundingClientRect(), J = Jt(B.current, R), ge = de.current, Pe = (R ? b : c) - J.start - J.end - ge * 2, Se = y.current ?? 0, I = n.x - Se, xe = n.y - Se, Q = R ? d - xe - J.end : (j === "rtl" ? me - I : I - $) - J.start, Z = ue((Q - ge) / Pe, 0, 1);
455
- let G = (E - m) * Z + m;
456
- if (G = gt(G, H, m), G = ue(G, m, E), !A)
457
- return {
458
- value: G,
459
- thumbIndex: 0,
460
- didSwap: !1
461
- };
462
- const Ce = M.current;
463
- if (Ce < 0)
464
- return null;
465
- const ee = Gt({
466
- behavior: U,
467
- values: S,
468
- currentValues: C.current ?? S,
469
- initialValues: te.current,
470
- pressedIndex: Ce,
471
- nextValue: G,
472
- min: m,
473
- max: E,
474
- step: H,
475
- minStepsBetweenValues: s
476
- });
477
- return U === "swap" && ee.didSwap ? Ie(ee.thumbIndex) : M.current = ee.thumbIndex, ee;
478
- }), he = z((n) => {
479
- te.current = A ? S.slice() : null, C.current = S;
480
- const f = M.current;
481
- let c = f;
482
- if (f > -1 && f < S.length) {
483
- if (S[f] === E) {
484
- let b = f;
485
- for (; b > 0 && S[b - 1] === E; )
486
- b -= 1;
487
- c = b;
488
- }
489
- } else {
490
- const b = R ? "y" : "x";
491
- let d;
492
- c = -1;
493
- for (let $ = 0; $ < K.current.length; $ += 1) {
494
- const me = K.current[$];
495
- if (Ue(me)) {
496
- const J = ht(me), ge = Math.abs(n[b] - J[b]);
497
- (d === void 0 || ge <= d) && (c = $, d = ge);
498
- }
499
- }
500
- }
501
- if (c > -1 && c !== f && Ie(c), w) {
502
- const b = K.current[c];
503
- if (Ue(b)) {
504
- const d = b.getBoundingClientRect(), $ = R ? "height" : "width";
505
- de.current = d[$] / 2;
506
- }
507
- }
508
- }), O = z((n) => {
509
- K.current?.[n]?.querySelector('input[type="range"]')?.focus({
510
- preventScroll: !0
511
- });
512
- }), F = z((n) => {
513
- const f = Fe(n, X);
514
- if (f == null)
515
- return;
516
- if (Y.current += 1, n.type === "pointermove" && n.buttons === 0) {
517
- fe(n);
518
- return;
519
- }
520
- const c = ie(f);
521
- c != null && mt(c.value, H, s) && (!g && Y.current > Xt && le(!0), q(c.value, we(At, n, void 0, {
522
- activeThumbIndex: c.thumbIndex
523
- })), C.current = Array.isArray(c.value) ? c.value : [c.value], c.didSwap && O(c.thumbIndex));
524
- });
525
- function fe(n) {
526
- Re(-1), le(!1), P.current = null, y.current = null, M.current = -1;
527
- const f = Fe(n, X), c = f != null ? ie(f) : null;
528
- if (c != null) {
529
- const b = W.current;
530
- p.commit(h.current ?? c.value), V(h.current ?? c.value, Ze(b, n));
531
- }
532
- "pointerType" in n && _.current?.hasPointerCapture(n.pointerId) && _.current?.releasePointerCapture(n.pointerId), X.current = null, te.current = null, D();
533
- }
534
- const ye = z((n) => {
535
- if (u)
536
- return;
537
- const f = n.changedTouches[0];
538
- f != null && (X.current = f.identifier);
539
- const c = Fe(n, X);
540
- if (c != null) {
541
- he(c);
542
- const d = ie(c);
543
- if (d == null)
544
- return;
545
- O(d.thumbIndex), q(d.value, we(Ye, n, void 0, {
546
- activeThumbIndex: d.thumbIndex
547
- })), C.current = Array.isArray(d.value) ? d.value : [d.value], d.didSwap && O(d.thumbIndex);
548
- }
549
- Y.current = 0;
550
- const b = Ne(_.current);
551
- b.addEventListener("touchmove", F, {
552
- passive: !0
553
- }), b.addEventListener("touchend", fe, {
554
- passive: !0
555
- });
556
- }), D = z(() => {
557
- const n = Ne(_.current);
558
- n.removeEventListener("pointermove", F), n.removeEventListener("pointerup", fe), n.removeEventListener("touchmove", F), n.removeEventListener("touchend", fe), te.current = null;
559
- }), L = Ut();
560
- return a.useEffect(() => {
561
- const n = _.current;
562
- return n ? (n.addEventListener("touchstart", ye, {
563
- passive: !0
564
- }), () => {
565
- n.removeEventListener("touchstart", ye), L.cancel(), D();
566
- }) : () => D();
567
- }, [D, ye, _, L]), a.useEffect(() => {
568
- u && D();
569
- }, [u, D]), Ee("div", t, {
570
- state: ce,
571
- ref: [r, ne, _, oe],
572
- props: [{
573
- "data-base-ui-slider-control": re ? "" : void 0,
574
- onPointerDown(n) {
575
- const f = _.current;
576
- if (!f || u || n.defaultPrevented || !Ue(n.target) || // Only handle left clicks
577
- n.button !== 0)
578
- return;
579
- const c = Fe(n, X);
580
- if (c != null) {
581
- he(c);
582
- const d = ie(c);
583
- if (d == null)
584
- return;
585
- Ht(K.current[d.thumbIndex], tt(Ne(f))) ? n.preventDefault() : L.request(() => {
586
- O(d.thumbIndex);
587
- }), le(!0), y.current != null || (q(d.value, we(Ye, n.nativeEvent, void 0, {
588
- activeThumbIndex: d.thumbIndex
589
- })), C.current = Array.isArray(d.value) ? d.value : [d.value], d.didSwap && O(d.thumbIndex));
590
- }
591
- n.nativeEvent.pointerId && f.setPointerCapture(n.nativeEvent.pointerId), Y.current = 0;
592
- const b = Ne(_.current);
593
- b.addEventListener("pointermove", F, {
594
- passive: !0
595
- }), b.addEventListener("pointerup", fe, {
596
- once: !0
597
- });
598
- },
599
- tabIndex: -1
600
- }, l],
601
- stateAttributesMapping: Ve
602
- });
603
- });
604
- process.env.NODE_ENV !== "production" && (bt.displayName = "SliderControl");
605
- const yt = /* @__PURE__ */ a.forwardRef(function(t, r) {
606
- const {
607
- render: i,
608
- className: o,
609
- ...l
610
- } = t, {
611
- state: u
612
- } = Le();
613
- return Ee("div", t, {
614
- state: u,
615
- ref: r,
616
- props: [{
617
- style: {
618
- position: "relative"
619
- }
620
- }, l],
621
- stateAttributesMapping: Ve
622
- });
623
- });
624
- process.env.NODE_ENV !== "production" && (yt.displayName = "SliderTrack");
625
- let Qt = /* @__PURE__ */ (function(e) {
626
- return e.index = "data-index", e.dragging = "data-dragging", e.orientation = "data-orientation", e.disabled = "data-disabled", e.readonly = "data-readonly", e.required = "data-required", e.valid = "data-valid", e.invalid = "data-invalid", e.touched = "data-touched", e.dirty = "data-dirty", e.focused = "data-focused", e;
627
- })({});
628
- const Zt = '!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"))))}}();', vt = "PageUp", Rt = "PageDown", en = /* @__PURE__ */ new Set([lt, at, st, ut, ot, it, vt, Rt]);
629
- function tn(e, t, r, i) {
630
- if (!(t < 0))
631
- return e.length === 2 ? t === 0 ? `${De(e[t], i, r)} start range` : `${De(e[t], i, r)} end range` : r ? De(e[t], i, r) : void 0;
632
- }
633
- function _e(e, t, r, i, o) {
634
- return r === 1 ? Math.min(e + t, o) : Math.max(e - t, i);
635
- }
636
- const It = /* @__PURE__ */ a.forwardRef(function(t, r) {
637
- const {
638
- render: i,
639
- children: o,
640
- className: l,
641
- "aria-describedby": u,
642
- "aria-label": g,
643
- "aria-labelledby": p,
644
- disabled: w = !1,
645
- getAriaLabel: h,
646
- getAriaValueText: W,
647
- id: E,
648
- index: m,
649
- inputRef: s,
650
- onBlur: V,
651
- onFocus: x,
652
- onKeyDown: P,
653
- tabIndex: y,
654
- ...M
655
- } = t, te = We(E), {
656
- active: ne,
657
- lastUsedThumbIndex: re,
658
- controlRef: Re,
659
- disabled: le,
660
- validation: q,
661
- formatOptionsRef: ce,
662
- handleInputChange: H,
663
- inset: U,
664
- labelId: K,
665
- largeStep: S,
666
- locale: j,
667
- max: A,
668
- min: R,
669
- minStepsBetweenValues: _,
670
- name: B,
671
- orientation: oe,
672
- pressedInputRef: X,
673
- pressedThumbCenterOffsetRef: Y,
674
- pressedThumbIndexRef: de,
675
- renderBeforeHydration: C,
676
- setActive: Ie,
677
- setIndicatorPosition: ie,
678
- state: he,
679
- step: O,
680
- values: F
681
- } = Le(), fe = nt(), ye = w || le, D = F.length > 1, L = oe === "vertical", se = fe === "rtl", {
682
- setTouched: n,
683
- setFocused: f,
684
- validationMode: c
685
- } = et(), b = a.useRef(null), d = a.useRef(null), $ = We(), me = Wt(), J = D ? $ : me, ge = a.useMemo(() => ({
686
- inputId: J
687
- }), [J]), {
688
- ref: Pe,
689
- index: Se
690
- } = Bt({
691
- metadata: ge
692
- }), I = D ? m ?? Se : 0, xe = I === F.length - 1, Q = F[I], Z = qe(Q, R, A), [G, Ce] = a.useState(!1), [ee, ke] = a.useState();
693
- rt(() => Ce(!0));
694
- const Ae = re >= 0 && re < F.length ? re : -1, v = z(() => {
695
- const N = Re.current, T = b.current;
696
- if (!N || !T)
697
- return;
698
- const k = T.getBoundingClientRect(), Me = N.getBoundingClientRect(), Oe = L ? "height" : "width", xt = Me[Oe] - k[Oe], $e = (k[Oe] / 2 + xt * Z / 100) / Me[Oe] * 100;
699
- ke($e), I === 0 ? ie((He) => [$e, He[1]]) : xe && ie((He) => [He[0], $e]);
700
- });
701
- ze(() => {
702
- U && queueMicrotask(v);
703
- }, [v, U]), ze(() => {
704
- U && v();
705
- }, [v, U, Z]);
706
- const pe = a.useCallback(() => {
707
- const N = L ? "bottom" : "insetInlineStart", T = L ? "left" : "top";
708
- let k;
709
- return D ? ne === I ? k = 2 : Ae === I && (k = 1) : ne === I && (k = 1), U ? {
710
- "--position": `${ee}%`,
711
- visibility: C && !G || ee === void 0 ? "hidden" : void 0,
712
- position: "absolute",
713
- [N]: "var(--position)",
714
- [T]: "50%",
715
- translate: `${(L || !se ? -1 : 1) * 50}% ${(L ? 1 : -1) * 50}%`,
716
- zIndex: k
717
- } : Number.isFinite(Z) ? {
718
- position: "absolute",
719
- [N]: `${Z}%`,
720
- [T]: "50%",
721
- translate: `${(L || !se ? -1 : 1) * 50}% ${(L ? 1 : -1) * 50}%`,
722
- zIndex: k
723
- } : Ge;
724
- }, [ne, I, U, G, ee, D, C, se, Ae, Z, L]);
725
- let ae;
726
- oe === "vertical" && (ae = se ? "vertical-rl" : "vertical-lr");
727
- const ve = Mt({
728
- "aria-label": typeof h == "function" ? h(I) : g,
729
- "aria-labelledby": p ?? K,
730
- "aria-describedby": u,
731
- "aria-orientation": oe,
732
- "aria-valuenow": Q,
733
- "aria-valuetext": typeof W == "function" ? W(De(Q, j, ce.current ?? void 0), Q, I) : tn(F, I, ce.current ?? void 0, j),
734
- disabled: ye,
735
- id: J,
736
- max: A,
737
- min: R,
738
- name: B,
739
- onChange(N) {
740
- H(N.target.valueAsNumber, I, N);
741
- },
742
- onFocus() {
743
- Ie(I), f(!0);
744
- },
745
- onBlur() {
746
- b.current && (Ie(-1), n(!0), f(!1), c === "onBlur" && q.commit(ft(Q, I, R, A, D, F)));
747
- },
748
- onKeyDown(N) {
749
- if (!en.has(N.key))
750
- return;
751
- zt.has(N.key) && N.stopPropagation();
752
- let T = null;
753
- const k = gt(Q, O, R);
754
- switch (N.key) {
755
- case lt:
756
- T = _e(k, N.shiftKey ? S : O, 1, R, A);
757
- break;
758
- case ut:
759
- T = _e(k, N.shiftKey ? S : O, se ? -1 : 1, R, A);
760
- break;
761
- case at:
762
- T = _e(k, N.shiftKey ? S : O, -1, R, A);
763
- break;
764
- case st:
765
- T = _e(k, N.shiftKey ? S : O, se ? 1 : -1, R, A);
766
- break;
767
- case vt:
768
- T = _e(k, S, 1, R, A);
769
- break;
770
- case Rt:
771
- T = _e(k, S, -1, R, A);
772
- break;
773
- case it:
774
- T = A, D && (T = Number.isFinite(F[I + 1]) ? F[I + 1] - O * _ : A);
775
- break;
776
- case ot:
777
- T = R, D && (T = Number.isFinite(F[I - 1]) ? F[I - 1] + O * _ : R);
778
- break;
779
- }
780
- T !== null && (H(T, I, N), N.preventDefault());
781
- },
782
- step: O,
783
- style: {
784
- ...Ge,
785
- // So that VoiceOver's focus indicator matches the thumb's dimensions
786
- width: "100%",
787
- height: "100%",
788
- writingMode: ae
789
- },
790
- tabIndex: y ?? void 0,
791
- type: "range",
792
- value: Q ?? ""
793
- }, q.getInputValidationProps), Te = Ot(d, q.inputRef, s);
794
- return Ee("div", t, {
795
- state: he,
796
- ref: [r, Pe, b],
797
- props: [{
798
- [Qt.index]: I,
799
- children: /* @__PURE__ */ Je(a.Fragment, {
800
- children: [o, /* @__PURE__ */ be("input", {
801
- ref: Te,
802
- ...ve
803
- }), U && !G && C && // this must be rendered with the last thumb to ensure all
804
- // preceding thumbs are already rendered in the DOM
805
- xe && /* @__PURE__ */ be("script", {
806
- // eslint-disable-next-line react/no-danger
807
- dangerouslySetInnerHTML: {
808
- __html: Zt
809
- },
810
- suppressHydrationWarning: !0
811
- })]
812
- }),
813
- id: te,
814
- onBlur: V,
815
- onFocus: x,
816
- onPointerDown(N) {
817
- if (de.current = I, b.current != null) {
818
- const T = oe === "horizontal" ? "x" : "y", k = ht(b.current), Me = (oe === "horizontal" ? N.clientX : N.clientY) - k[T];
819
- Y.current = Me;
820
- }
821
- d.current != null && X.current !== d.current && (X.current = d.current);
822
- },
823
- style: pe(),
824
- suppressHydrationWarning: C || void 0,
825
- tabIndex: -1
826
- }, M],
827
- stateAttributesMapping: Ve
828
- });
829
- });
830
- process.env.NODE_ENV !== "production" && (It.displayName = "SliderThumb");
831
- function nn(e, t, r, i, o, l) {
832
- const u = r === void 0 || t && i === void 0 ? "hidden" : void 0, g = e ? "bottom" : "insetInlineStart", p = e ? "height" : "width", h = {
833
- visibility: o && !l ? "hidden" : u,
834
- position: e ? "absolute" : "relative",
835
- [e ? "width" : "height"]: "inherit"
836
- };
837
- return h["--start-position"] = `${r ?? 0}%`, t ? (h["--relative-size"] = `${(i ?? 0) - (r ?? 0)}%`, h[g] = "var(--start-position)", h[p] = "var(--relative-size)", h) : (h[g] = 0, h[p] = "var(--start-position)", h);
838
- }
839
- function rn(e, t, r, i) {
840
- const o = e ? "bottom" : "insetInlineStart", l = e ? "height" : "width", g = {
841
- position: e ? "absolute" : "relative",
842
- [e ? "width" : "height"]: "inherit"
843
- };
844
- if (!t)
845
- return g[o] = 0, g[l] = `${r}%`, g;
846
- const p = i - r;
847
- return g[o] = `${r}%`, g[l] = `${p}%`, g;
848
- }
849
- const St = /* @__PURE__ */ a.forwardRef(function(t, r) {
850
- const {
851
- render: i,
852
- className: o,
853
- ...l
854
- } = t, {
855
- indicatorPosition: u,
856
- inset: g,
857
- max: p,
858
- min: w,
859
- orientation: h,
860
- renderBeforeHydration: W,
861
- state: E,
862
- values: m
863
- } = Le(), [s, V] = a.useState(!1);
864
- rt(() => V(!0));
865
- const x = h === "vertical", P = m.length > 1, y = g ? nn(x, P, u[0], u[1], W, s) : rn(x, P, qe(m[0], w, p), qe(m[m.length - 1], w, p));
866
- return Ee("div", t, {
867
- state: E,
868
- ref: r,
869
- props: [{
870
- "data-base-ui-slider-indicator": W ? "" : void 0,
871
- style: y,
872
- suppressHydrationWarning: W || void 0
873
- }, l],
874
- stateAttributesMapping: Ve
875
- });
876
- });
877
- process.env.NODE_ENV !== "production" && (St.displayName = "SliderIndicator");
878
- const on = "_slider__control_15j4n_1", sn = "_slider__track_15j4n_8", an = "_slider__indicator_15j4n_16", un = "_slider__thumb_15j4n_27", Be = {
879
- slider__control: on,
880
- slider__track: sn,
881
- slider__indicator: an,
882
- slider__thumb: un
883
- };
884
- function Dn({
885
- color: e = "primary",
886
- ...t
887
- }) {
888
- return /* @__PURE__ */ be(pt, { ...t, children: /* @__PURE__ */ be(bt, { className: Be.slider__control, children: /* @__PURE__ */ Je(
889
- Pt,
890
- {
891
- render: /* @__PURE__ */ be(yt, {}),
892
- color: e,
893
- className: Be.slider__track,
894
- children: [
895
- /* @__PURE__ */ be(St, { className: Be.slider__indicator }),
896
- /* @__PURE__ */ be(It, { className: Ct(Be.slider__thumb) })
897
- ]
898
- }
899
- ) }) });
900
- }
2
+ import { Slider as i } from "./slider.js";
901
3
  export {
902
- Dn as Slider
4
+ i as Slider
903
5
  };