solid-baseui 0.1.0-alpha.1 → 0.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +51 -20
  3. package/dist/lib/client/DialogHandle-DluOK_7u.js +521 -0
  4. package/dist/lib/client/DialogPopup-CfEb3F54.js +138 -0
  5. package/dist/lib/client/FieldControl-eDe-Jnp9.js +142 -0
  6. package/dist/lib/client/{FieldRootContext-izCEh80D.js → FieldRootContext-D3fuVjs3.js} +1 -1
  7. package/dist/lib/client/{FocusManager-NP1uPXTi.js → FocusManager-q7z7PMV1.js} +92 -89
  8. package/dist/lib/client/{InternalBackdrop-cSK13gaM.js → InternalBackdrop-B8_lfUvf.js} +1 -1
  9. package/dist/lib/client/{MenuSubmenuTrigger-yfncqM-D.js → MenuSubmenuTrigger-DMb5CwTF.js} +386 -386
  10. package/dist/lib/client/{PopupHandle-CQI6Om1Z.js → PopupHandle-DyX5gY1e.js} +17 -11
  11. package/dist/lib/client/{PopupStore-Du0O57fL.js → PopupStore-BjRwcvbG.js} +91 -88
  12. package/dist/lib/client/PopupViewport-BanYHrD-.js +154 -0
  13. package/dist/lib/client/{TriggerFocusGuards-Cs8LVBj5.js → TriggerFocusGuards-Fzspp3Y1.js} +2 -2
  14. package/dist/lib/client/accordion/index.js +1 -1
  15. package/dist/lib/client/{accordion-BFeZFpJZ.js → accordion-CA2DfX67.js} +144 -144
  16. package/dist/lib/client/alert-dialog/index.js +1 -1
  17. package/dist/lib/client/{alert-dialog-BxGUF8_Q.js → alert-dialog-Bup88Dpx.js} +2 -2
  18. package/dist/lib/client/autocomplete/index.js +1 -1
  19. package/dist/lib/client/{autocomplete-C9QA98XD.js → autocomplete-oyy_uRpU.js} +2 -2
  20. package/dist/lib/client/avatar/index.js +1 -1
  21. package/dist/lib/client/avatar-DNZ4fnBd.js +191 -0
  22. package/dist/lib/client/button/index.js +1 -1
  23. package/dist/lib/client/button-BJZYmCVv.js +88 -0
  24. package/dist/lib/client/checkbox/index.js +1 -1
  25. package/dist/lib/client/checkbox-group/index.js +1 -1
  26. package/dist/lib/client/{checkbox-group-CwMDoSTK.js → checkbox-group-DGyrciZJ.js} +1 -1
  27. package/dist/lib/client/checkbox-sQHYTbpB.js +425 -0
  28. package/dist/lib/client/collapsible/index.js +1 -1
  29. package/dist/lib/client/collapsible-BENbFFCc.js +230 -0
  30. package/dist/lib/client/combobox/index.js +1 -1
  31. package/dist/lib/client/{combobox-6DhOdzit.js → combobox-BGH8QLXH.js} +143 -141
  32. package/dist/lib/client/compositeNavigation-DCt1sQon.js +82 -0
  33. package/dist/lib/client/{constants-cOVxAoxB.js → constants-ByOMFJAe.js} +100 -100
  34. package/dist/lib/client/context-menu/index.js +1 -1
  35. package/dist/lib/client/context-menu-xQ1sBCET.js +220 -0
  36. package/dist/lib/client/{createAnchorPositioning-D96gu-Dz.js → createAnchorPositioning-DCXIApS1.js} +1 -1
  37. package/dist/lib/client/{createAnchoredPopupScrollLock-Cx0cbh1_.js → createAnchoredPopupScrollLock-BxKpJbCE.js} +2 -2
  38. package/dist/lib/client/{createClickInteraction-CTaIFBiV.js → createClickInteraction-BeBsTqtY.js} +1 -1
  39. package/dist/lib/client/{createFocusInteraction--s9_qBf3.js → createFocusInteraction-DQPWkZe2.js} +7 -7
  40. package/dist/lib/client/{createPopupAutoResize-Dn-stj-8.js → createPopupAutoResize-CSNpMz5v.js} +3 -3
  41. package/dist/lib/client/dialog/index.js +1 -1
  42. package/dist/lib/client/{dialog-B9tR9X48.js → dialog-C0EF0a5u.js} +2 -2
  43. package/dist/lib/client/{dom-BEAeQ9Eb.js → dom-lDdayFF_.js} +25 -15
  44. package/dist/lib/client/drawer/index.js +1 -1
  45. package/dist/lib/client/{drawer-dyr3_sKQ.js → drawer-uKoNBwDU.js} +519 -518
  46. package/dist/lib/client/field/index.js +1 -1
  47. package/dist/lib/client/{field-CjUAjp1m.js → field-DIMrgpBW.js} +144 -144
  48. package/dist/lib/client/form/index.js +1 -1
  49. package/dist/lib/client/form-Bqq8wSLY.js +109 -0
  50. package/dist/lib/client/index.js +34 -34
  51. package/dist/lib/client/input/index.js +1 -1
  52. package/dist/lib/client/{input-_QHvSSqM.js → input-YthuKwIE.js} +1 -1
  53. package/dist/lib/client/internals/composeEventHandlers.js +14 -8
  54. package/dist/lib/client/internals/field-root-context/index.js +2 -2
  55. package/dist/lib/client/{mergeStyleValue-DhTA9Nwe.js → isSolidAccessor-BH_FevwH.js} +1 -12
  56. package/dist/lib/client/menu/index.js +1 -1
  57. package/dist/lib/client/{menu-DLqUBmMK.js → menu-4rNLN6aX.js} +79 -79
  58. package/dist/lib/client/menubar/index.js +1 -1
  59. package/dist/lib/client/menubar-nFQGtNmY.js +163 -0
  60. package/dist/lib/client/mergeStyleValue-Dcd36yxZ.js +12 -0
  61. package/dist/lib/client/navigation-menu/index.js +1 -1
  62. package/dist/lib/client/{navigation-menu-mVHV41Ky.js → navigation-menu-BbRyun3a.js} +284 -284
  63. package/dist/lib/client/number-field/index.js +1 -1
  64. package/dist/lib/client/{number-field-DusLw_0X.js → number-field-hT_H0hVu.js} +356 -356
  65. package/dist/lib/client/otp-field/index.js +1 -1
  66. package/dist/lib/client/otp-field-lsy2iGID.js +584 -0
  67. package/dist/lib/client/popover/index.js +1 -1
  68. package/dist/lib/client/{popover-Cv7xn0nW.js → popover-Cmvmuf1L.js} +250 -248
  69. package/dist/lib/client/{popupStateMapping-C6jQ_LKo.js → popupStateMapping-nhukB8NK.js} +51 -51
  70. package/dist/lib/client/preview-card/index.js +1 -1
  71. package/dist/lib/client/{preview-card-FTN_aafM.js → preview-card-Dtu8AnBN.js} +168 -168
  72. package/dist/lib/client/radio/index.js +1 -1
  73. package/dist/lib/client/{radio-DA_oZhQT.js → radio-CeCU-Qqi.js} +77 -77
  74. package/dist/lib/client/radio-group/index.js +1 -1
  75. package/dist/lib/client/radio-group-NbuJvjQe.js +195 -0
  76. package/dist/lib/client/{safePolygon-DJG0VIVo.js → safePolygon-DVAR5dQD.js} +70 -70
  77. package/dist/lib/client/scroll-area/index.js +1 -1
  78. package/dist/lib/client/scroll-area-DqbvoAd7.js +717 -0
  79. package/dist/lib/client/{scrollable-SRNYlhF7.js → scrollable-BVaDUXng.js} +12 -12
  80. package/dist/lib/client/select/index.js +1 -1
  81. package/dist/lib/client/{select-DSPJt7Rk.js → select-Dad51Xbn.js} +635 -634
  82. package/dist/lib/client/slider/index.js +1 -1
  83. package/dist/lib/client/slider-CLSKFq_M.js +927 -0
  84. package/dist/lib/client/switch/index.js +1 -1
  85. package/dist/lib/client/{switch-CPl7QHKI.js → switch-Bzuu5EIg.js} +61 -61
  86. package/dist/lib/client/tabs/index.js +1 -1
  87. package/dist/lib/client/{tabs-Bn4rZDyZ.js → tabs-DWiBDv8D.js} +252 -249
  88. package/dist/lib/client/toast/index.js +1 -1
  89. package/dist/lib/client/{toast-7LdqZWOs.js → toast-DmtPJW2k.js} +353 -353
  90. package/dist/lib/client/toggle/index.js +1 -1
  91. package/dist/lib/client/{toggle-CsC37e3e.js → toggle-CAe-Z8Xn.js} +33 -33
  92. package/dist/lib/client/toggle-group/index.js +1 -1
  93. package/dist/lib/client/{toggle-group-DSWb9HxN.js → toggle-group-BbQg5s-m.js} +44 -44
  94. package/dist/lib/client/toolbar/index.js +1 -1
  95. package/dist/lib/client/{toolbar-DcCi3HNp.js → toolbar-BXT_g-oX.js} +218 -218
  96. package/dist/lib/client/tooltip/index.js +1 -1
  97. package/dist/lib/client/{tooltip-D-PkGco9.js → tooltip-h2r2_Xuo.js} +250 -249
  98. package/dist/lib/client/{useFilteredItems-B7z2CGMV.js → useFilteredItems-BX0BEuSI.js} +850 -819
  99. package/dist/lib/server/{DialogHandle-nJSSy_jM.js → DialogHandle-BGIISmG7.js} +16 -16
  100. package/dist/lib/server/{DialogPopup-Da1aIxVA.js → DialogPopup-C2ZDGf42.js} +4 -4
  101. package/dist/lib/server/{FieldControl-BDeNR3ug.js → FieldControl-CDMMyvuj.js} +6 -6
  102. package/dist/lib/server/{FieldRootContext-IC-LWzVp.js → FieldRootContext-Bfpna6gA.js} +3 -3
  103. package/dist/lib/server/{FocusManager-1LfoCsya.js → FocusManager-D-xgblGs.js} +9 -3
  104. package/dist/lib/server/{InternalBackdrop-C_iDPVR-.js → InternalBackdrop-D_2zAWnl.js} +1 -1
  105. package/dist/lib/server/{MenuSubmenuTrigger-rR8ZN7YR.js → MenuSubmenuTrigger-BMQKlOvU.js} +50 -50
  106. package/dist/lib/server/{PopupHandle-Ct6wywmP.js → PopupHandle-QNj4mED2.js} +14 -5
  107. package/dist/lib/server/{PopupStore-kHjFPiQ5.js → PopupStore-evylvVnN.js} +5 -2
  108. package/dist/lib/server/{PopupViewport-DftN5VUp.js → PopupViewport-BDttjORN.js} +37 -27
  109. package/dist/lib/server/{TriggerFocusGuards-CvoGfft9.js → TriggerFocusGuards-B9GNbLrL.js} +2 -2
  110. package/dist/lib/server/accordion/index.js +7 -7
  111. package/dist/lib/server/alert-dialog/index.js +2 -2
  112. package/dist/lib/server/autocomplete/index.js +2 -2
  113. package/dist/lib/server/avatar/index.js +3 -3
  114. package/dist/lib/server/button/index.js +6 -6
  115. package/dist/lib/server/checkbox/index.js +7 -7
  116. package/dist/lib/server/checkbox-group/index.js +1 -1
  117. package/dist/lib/server/collapsible/index.js +6 -6
  118. package/dist/lib/server/combobox/index.js +18 -18
  119. package/dist/lib/server/{compositeNavigation-BRVT1C38.js → compositeNavigation-D5jKM4yk.js} +32 -1
  120. package/dist/lib/server/{constants-D7ciIzsV.js → constants-ByqXubhO.js} +2 -2
  121. package/dist/lib/server/context-menu/index.js +9 -9
  122. package/dist/lib/server/{createAnchorPositioning-B5Y0WEev.js → createAnchorPositioning-DrQYe7RS.js} +1 -1
  123. package/dist/lib/server/{createAnchoredPopupScrollLock-DFuUrykR.js → createAnchoredPopupScrollLock-q6gnOSmv.js} +2 -2
  124. package/dist/lib/server/{createClickInteraction-BYsMgvup.js → createClickInteraction-D7oc1Vco.js} +1 -1
  125. package/dist/lib/server/{createFocusInteraction-DMyKsniI.js → createFocusInteraction-DFKr4G7a.js} +1 -1
  126. package/dist/lib/server/{createPopupAutoResize-ImBjwdj_.js → createPopupAutoResize-Cg0-lLf4.js} +1 -1
  127. package/dist/lib/server/dialog/index.js +2 -2
  128. package/dist/lib/server/{dom-Crg_2R-j.js → dom-D8_aB1yy.js} +14 -1
  129. package/dist/lib/server/drawer/index.js +38 -34
  130. package/dist/lib/server/field/index.js +6 -6
  131. package/dist/lib/server/form/index.js +2 -2
  132. package/dist/lib/server/input/index.js +1 -1
  133. package/dist/lib/server/internals/composeEventHandlers.js +15 -9
  134. package/dist/lib/server/internals/field-root-context/index.js +1 -1
  135. package/dist/lib/server/{mergeStyleValue-BwJ10_X2.js → isSolidAccessor-CZpzAH5l.js} +1 -20
  136. package/dist/lib/server/menu/index.js +17 -17
  137. package/dist/lib/server/menubar/index.js +4 -4
  138. package/dist/lib/server/mergeStyleValue-DecVaoac.js +20 -0
  139. package/dist/lib/server/navigation-menu/index.js +21 -21
  140. package/dist/lib/server/number-field/index.js +21 -21
  141. package/dist/lib/server/otp-field/index.js +8 -8
  142. package/dist/lib/server/popover/index.js +27 -26
  143. package/dist/lib/server/{popupStateMapping-B2KsiiLb.js → popupStateMapping-VHqr6M4H.js} +1 -1
  144. package/dist/lib/server/preview-card/index.js +16 -16
  145. package/dist/lib/server/radio/index.js +6 -6
  146. package/dist/lib/server/radio-group/index.js +5 -5
  147. package/dist/lib/server/{safePolygon-C1GNJbKR.js → safePolygon-B8QtiIZ3.js} +1 -1
  148. package/dist/lib/server/scroll-area/index.js +18 -18
  149. package/dist/lib/server/{scrollable-CjsSxbGr.js → scrollable-C9Pgq8T5.js} +1 -1
  150. package/dist/lib/server/select/index.js +39 -38
  151. package/dist/lib/server/slider/index.js +14 -14
  152. package/dist/lib/server/switch/index.js +9 -9
  153. package/dist/lib/server/tabs/index.js +12 -8
  154. package/dist/lib/server/toast/index.js +32 -32
  155. package/dist/lib/server/toggle/index.js +7 -7
  156. package/dist/lib/server/toggle-group/index.js +2 -2
  157. package/dist/lib/server/toolbar/index.js +14 -14
  158. package/dist/lib/server/tooltip/index.js +32 -27
  159. package/dist/lib/server/{useFilteredItems-DCxq20Is.js → useFilteredItems-BmhL0nf1.js} +181 -137
  160. package/dist/lib/types/accordion/trigger/AccordionTrigger.d.ts +7 -7
  161. package/dist/lib/types/combobox/chip/ComboboxChip.d.ts +2 -0
  162. package/dist/lib/types/combobox/root/ComboboxRoot.d.ts +6 -1
  163. package/dist/lib/types/combobox/store/ComboboxStore.d.ts +1 -0
  164. package/dist/lib/types/combobox/utils/handleInputPress.d.ts +1 -1
  165. package/dist/lib/types/field/control/FieldControl.d.ts +5 -5
  166. package/dist/lib/types/internals/composeEventHandlers.d.ts +9 -2
  167. package/dist/lib/types/internals/field-root-context/FieldRootContext.d.ts +1 -0
  168. package/dist/lib/types/internals/overlay/dom.d.ts +2 -0
  169. package/dist/lib/types/number-field/input/NumberFieldInput.d.ts +5 -5
  170. package/dist/lib/types/slider/track/SliderTrack.d.ts +2 -2
  171. package/dist/lib/types/toolbar/link/ToolbarLink.d.ts +10 -3
  172. package/dist/lib/types/toolbar/root/ToolbarRoot.d.ts +10 -4
  173. package/package.json +1 -1
  174. package/dist/lib/client/DialogHandle-BGyIbcvg.js +0 -521
  175. package/dist/lib/client/DialogPopup-Df7MC358.js +0 -138
  176. package/dist/lib/client/FieldControl-C0PATyKV.js +0 -142
  177. package/dist/lib/client/PopupViewport-IS4XU03s.js +0 -152
  178. package/dist/lib/client/avatar-BQoEzzav.js +0 -191
  179. package/dist/lib/client/button-akYS6FyY.js +0 -88
  180. package/dist/lib/client/checkbox-DOXtzBhA.js +0 -425
  181. package/dist/lib/client/collapsible-t8YReaIp.js +0 -230
  182. package/dist/lib/client/compositeNavigation-sxniYTc7.js +0 -58
  183. package/dist/lib/client/context-menu-CplDpqmi.js +0 -220
  184. package/dist/lib/client/form-6Ne_bWQX.js +0 -109
  185. package/dist/lib/client/menubar-DhPRUQZ6.js +0 -163
  186. package/dist/lib/client/otp-field-D-B9tZzF.js +0 -584
  187. package/dist/lib/client/radio-group-CWtQxWDl.js +0 -195
  188. package/dist/lib/client/scroll-area-NCr49LkD.js +0 -717
  189. package/dist/lib/client/slider-CWq9hxFf.js +0 -927
@@ -1,927 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { t } from "./useRender-CxZ8PI-g.js";
3
- import { getStateAttributesProps as n } from "./internals/getStateAttributesProps.js";
4
- import { b as r, c as i, h as a, j as o, w as s } from "./reasons-Co5CzjKq.js";
5
- import { n as c, t as l } from "./resolveStyle-XcgAuaKR.js";
6
- import { createChangeEventDetails as u, createGenericEventDetails as d } from "./internals/createBaseUIEventDetails.js";
7
- import { composeEventHandlers as f } from "./internals/composeEventHandlers.js";
8
- import { n as p } from "./DirectionContext-BwMabICS.js";
9
- import { fieldStateAttributesMapping as m } from "./internals/field-constants.js";
10
- import { n as h } from "./FieldRootContext-izCEh80D.js";
11
- import { n as g } from "./FormContext-CwLBtm_d.js";
12
- import { r as ee } from "./LabelableContext-CmQF-TX2.js";
13
- import { n as _ } from "./CSPContext-faVzToiT.js";
14
- import { mergeStyles as v } from "./internals/mergeStyles.js";
15
- import { addEvent as y, createComponent as b, delegateEvents as te, effect as x, getNextElement as S, isServer as C, memo as w, mergeProps as T, ref as E, runHydrationEvents as D, setAttribute as O, setProperty as ne, spread as k, style as A, template as j } from "@solidjs/web";
16
- import { createContext as M, createEffect as N, createMemo as P, createSignal as F, createUniqueId as re, flush as ie, omit as I, onCleanup as ae, onSettled as oe, sharedConfig as se, untrack as L, useContext as ce } from "solid-js";
17
- //#region src/slider/stateAttributesMapping.ts
18
- var R = () => null, le = {
19
- activeThumbIndex: R,
20
- max: R,
21
- min: R,
22
- minStepsBetweenValues: R,
23
- step: R,
24
- values: R,
25
- ...m
26
- };
27
- //#endregion
28
- //#region src/slider/utils/dom.ts
29
- function ue(e, t) {
30
- let n = e.getBoundingClientRect();
31
- return t ? (n.top + n.bottom) / 2 : (n.left + n.right) / 2;
32
- }
33
- function de(e) {
34
- let t = e.composedPath()[0] ?? e.target;
35
- if (!t || typeof t.nodeType != "number") return null;
36
- let n = t;
37
- return n.nodeType === 1 ? n : n.parentElement;
38
- }
39
- function fe(e, t) {
40
- if (!e || !t || typeof t.nodeType != "number") return !1;
41
- let n = t;
42
- for (; n;) {
43
- if (e.contains(n)) return !0;
44
- let t = n.getRootNode();
45
- n = t.nodeType === 11 && "host" in t ? t.host : null;
46
- }
47
- return !1;
48
- }
49
- //#endregion
50
- //#region src/slider/utils/math.ts
51
- function z(e, t, n) {
52
- return Math.min(Math.max(e, t), n);
53
- }
54
- function B(e, t) {
55
- return e === t ? !0 : !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => e === t[n]);
56
- }
57
- function V(e, t, n) {
58
- return (e - t) * 100 / (n - t);
59
- }
60
- function H(e, t, n) {
61
- return new Intl.NumberFormat(t, n).format(e);
62
- }
63
- //#endregion
64
- //#region src/slider/utils/getSliderValue.ts
65
- function pe(e, t, n, r, i, a) {
66
- let o = z(e, n, r);
67
- if (!i) return o;
68
- let s = a.slice();
69
- return s[t] = z(o, a[t - 1] ?? -Infinity, a[t + 1] ?? Infinity), s.sort((e, t) => e - t);
70
- }
71
- //#endregion
72
- //#region src/slider/utils/validateMinimumDistance.ts
73
- function me(e, t, n) {
74
- if (!Array.isArray(e)) return !0;
75
- let r = t * n;
76
- for (let t = 0; t < e.length - 1; t += 1) if (!(Math.abs(e[t] - e[t + 1]) >= r)) return !1;
77
- return !0;
78
- }
79
- //#endregion
80
- //#region src/slider/root/SliderRootContext.ts
81
- var U = Symbol("SliderRootContext"), W = M(U);
82
- function he() {
83
- let e = ce(W);
84
- if (e === U) throw Error("Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>.");
85
- return e;
86
- }
87
- //#endregion
88
- //#region src/slider/root/SliderRoot.tsx
89
- var ge = /* @__PURE__ */ j("<div>");
90
- function _e(e) {
91
- let i = h(!0), o = g(), f = ee(), p = e, m = e, _ = Symbol("Slider"), v = Symbol("SliderControl"), y = `base-ui-${re()}`, te = `base-ui-${re()}`, x = L(f.controlId), C = typeof x == "string" ? x : te, w = L(() => p.value !== void 0), E = L(() => p.defaultValue ?? p.min ?? 0), [O, ne] = F(() => E), [A, j] = F(), [M, oe] = F(), [se, ce] = F(-1), [R, ue] = F(-1), [de, V] = F(!1), [H, U] = F(), [he, _e] = F([void 0, void 0]), [xe, K] = F(0, { ownedWrite: !0 }), q = [], Se = 0, J = {
92
- pressedThumbCenterOffset: null,
93
- pressedThumbIndex: -1,
94
- pressedValues: null,
95
- lastChangeReason: s
96
- }, Ce = I(m, "aria-describedby", "aria-labelledby", "render", "class", "defaultValue", "disabled", "format", "form", "id", "largeStep", "locale", "max", "min", "minStepsBetweenValues", "name", "onValueChange", "onValueCommitted", "orientation", "ref", "step", "style", "thumbAlignment", "thumbCollisionBehavior", "value"), Y = P(() => p.id ?? y), X = P(() => p.min ?? 0), Z = P(() => p.max ?? 100), we = P(() => p.step ?? 1), Te = P(() => p.largeStep ?? 10), Ee = P(() => p.minStepsBetweenValues ?? 0), De = P(() => p.orientation ?? "horizontal"), Oe = P(() => p.thumbAlignment ?? "center"), ke = P(() => p.thumbCollisionBehavior ?? "push"), Q = P(() => i.disabled() || (p.disabled ?? !1)), Ae = P(() => i.name() ?? p.name), je = P(() => w ? p.value : O()), Me = P(() => {
97
- let e = je();
98
- return Array.isArray(e) ? e.map((e) => z(e, X(), Z())).sort((e, t) => e - t) : [z(e, X(), Z())];
99
- }), Ne = P(() => Array.isArray(je())), Pe = P(() => Ne() ? Me() : Me()[0]), Fe = P(() => `${Y()}-label`), Ie = P(() => p["aria-labelledby"] ?? f.labelId() ?? H()), $ = P(() => ({
100
- ...i.state(),
101
- activeThumbIndex: se(),
102
- disabled: Q(),
103
- dragging: de(),
104
- max: Z(),
105
- min: X(),
106
- minStepsBetweenValues: Ee(),
107
- orientation: De(),
108
- step: we(),
109
- values: Me()
110
- })), Le = P(() => c(e.class, $())), Re = t(e, () => $(), (e) => (() => {
111
- var t = S(ge);
112
- return k(t, e, !1), D(), t;
113
- })()), ze = P(() => l(e.style, $())), Be = P(() => n($(), le)), Ve = P(() => f.getAriaDescribedBy(p["aria-describedby"])), He = P(() => (xe(), q.slice().sort(ve))), Ue = be(L(Pe)), We = {
114
- id: y,
115
- name: p.name,
116
- value: Pe,
117
- getControl: () => He().find((e) => !e.input()?.disabled)?.input() ?? M() ?? A() ?? null
118
- };
119
- function Ge(e) {
120
- ce(e), e !== -1 && ue(e);
121
- }
122
- function Ke(e) {
123
- return e.order = Se, Se += 1, q.push(e), K((e) => e + 1), () => {
124
- let t = q.indexOf(e);
125
- t !== -1 && (q.splice(t, 1), K((e) => e + 1));
126
- };
127
- }
128
- function qe(e, t) {
129
- _e((n) => n[e] === t ? n : e === 0 ? [t, n[1]] : [n[0], t]);
130
- }
131
- function Je(e, t) {
132
- if (Number.isNaN(e) || B(e, L(je))) return !1;
133
- let n = t.event, r = G(n);
134
- return Object.defineProperty(r, "target", {
135
- configurable: !0,
136
- writable: !0,
137
- value: {
138
- value: e,
139
- name: L(Ae)
140
- }
141
- }), t.event = r, p.onValueChange?.(e, t), w && ie(), !t.isCanceled && (J.lastChangeReason = t.reason, w || ne(() => e), !0);
142
- }
143
- function Ye(e, t) {
144
- p.onValueCommitted?.(e, t);
145
- }
146
- function Xe(e, t, n) {
147
- let o = L(Me), s = pe(e, t, L(X), L(Z), L(Ne), o);
148
- if (!me(s, L(we), L(Ee))) {
149
- queueMicrotask(Ze);
150
- return;
151
- }
152
- let c = "key" in n ? r : a, l = Je(s, u(c, n, void 0, { activeThumbIndex: t }));
153
- i.setTouched(!0), l && Ye(s, d(c, n)), queueMicrotask(Ze);
154
- }
155
- function Ze() {
156
- let e = L(Me);
157
- for (let t of L(He)) {
158
- let n = t.input(), r = e[t.index()];
159
- n && r !== void 0 && n.valueAsNumber !== r && (n.value = String(r));
160
- }
161
- }
162
- let Qe = {
163
- active: se,
164
- controlElement: M,
165
- disabled: Q,
166
- dragging: de,
167
- fieldControlSource: _,
168
- format: () => p.format,
169
- form: () => p.form,
170
- handleInputChange: Xe,
171
- indicatorPosition: he,
172
- inset: () => Oe() !== "center",
173
- interaction: J,
174
- labelId: Ie,
175
- largeStep: Te,
176
- lastUsedThumbIndex: R,
177
- locale: () => p.locale,
178
- max: Z,
179
- min: X,
180
- minStepsBetweenValues: Ee,
181
- name: Ae,
182
- onValueCommitted: Ye,
183
- orientation: De,
184
- orderedThumbs: He,
185
- range: Ne,
186
- registerThumb: Ke,
187
- renderBeforeHydration: () => Oe() === "edge",
188
- rootId: Y,
189
- rootLabelId: Fe,
190
- setActive: Ge,
191
- setControlElement: oe,
192
- setDragging: V,
193
- setIndicatorPosition: qe,
194
- setLocalLabelId: U,
195
- setValue: Je,
196
- singleInputId: C,
197
- state: $,
198
- step: we,
199
- syncInputs: Ze,
200
- thumbCollisionBehavior: ke,
201
- values: Me
202
- };
203
- return N(() => ({
204
- disabled: Q(),
205
- element: A(),
206
- id: Y(),
207
- name: p.name
208
- }), (e) => {
209
- We.id = e.id, We.name = e.name, i.registerFieldControl(_, e.disabled || !e.element ? void 0 : We);
210
- }), N(Pe, (e) => {
211
- B(e, Ue) || (Ue = be(e), L(() => {
212
- o.clearError(Ae()), i.validation.change(e), i.setDirty(!B(e, i.validityData().initialValue));
213
- }));
214
- }), N(() => ({
215
- disabled: Q(),
216
- element: A()
217
- }), (e) => {
218
- if (!e.disabled || !e.element) return;
219
- let t = ye(e.element.ownerDocument);
220
- t && fe(e.element, t) && t.blur(), Ge(-1), V(!1);
221
- }), N(() => ({
222
- range: Ne(),
223
- inputId: He()[0]?.input()?.id
224
- }), (e) => {
225
- f.registerControlId(v, e.range ? void 0 : e.inputId);
226
- }), N(A, (e) => {
227
- let t = e?.ownerDocument.defaultView?.MutationObserver;
228
- if (!e || !t) return;
229
- let n = new t(() => K((e) => e + 1));
230
- return n.observe(e, {
231
- childList: !0,
232
- subtree: !0
233
- }), () => n.disconnect();
234
- }), N(() => ({
235
- max: Z(),
236
- min: X()
237
- }), (e) => {}), ae(() => {
238
- i.registerFieldControl(_, void 0), f.registerControlId(v, void 0);
239
- }), b(W, {
240
- value: Qe,
241
- get children() {
242
- return b(Re, T({
243
- ref: [((e) => j(e)), p.ref],
244
- get id() {
245
- return Y();
246
- },
247
- role: "group",
248
- get class() {
249
- return Le();
250
- },
251
- get style() {
252
- return ze();
253
- },
254
- get "aria-labelledby"() {
255
- return Ie();
256
- },
257
- get "aria-describedby"() {
258
- return Ve();
259
- },
260
- get "aria-invalid"() {
261
- return $().valid === !1 && !Q() ? "true" : void 0;
262
- }
263
- }, Be, Ce));
264
- }
265
- });
266
- }
267
- function ve(e, t) {
268
- let n = e.element(), r = t.element();
269
- if (n && r && n !== r) {
270
- let e = n.compareDocumentPosition(r);
271
- if (e & 4) return -1;
272
- if (e & 2) return 1;
273
- }
274
- return e.order - t.order;
275
- }
276
- function ye(e) {
277
- let t = e.activeElement;
278
- for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
279
- return t;
280
- }
281
- function be(e) {
282
- return Array.isArray(e) ? e.slice() : e;
283
- }
284
- function G(e) {
285
- let t = e.constructor;
286
- try {
287
- return new t(e.type, e);
288
- } catch {
289
- return new Event(e.type, {
290
- bubbles: e.bubbles,
291
- cancelable: e.cancelable,
292
- composed: e.composed
293
- });
294
- }
295
- }
296
- //#endregion
297
- //#region src/slider/label/SliderLabel.tsx
298
- var xe = /* @__PURE__ */ j("<div>");
299
- function K(e) {
300
- let r = he(), i = ee(), a = e, o = I(e, "render", "class", "id", "onClick", "onPointerDown", "ref", "style"), s = P(() => r.state()), u = P(() => c(e.class, s())), d = t(e, () => s(), (e) => (() => {
301
- var t = S(xe);
302
- return k(t, e, !1), D(), t;
303
- })()), p = P(() => l(e.style, s())), m = P(() => n(s(), le));
304
- function h(e) {
305
- let t = e.composedPath()[0];
306
- if (t instanceof Element && t.closest("button,input,select,textarea")) return;
307
- !e.defaultPrevented && e.detail > 1 && e.preventDefault();
308
- let n = e.currentTarget, a = i.controlId(), o = a ? n.ownerDocument.getElementById(a) : null;
309
- if (o instanceof HTMLElement) {
310
- o.focus({ focusVisible: !0 });
311
- return;
312
- }
313
- let s = r.controlElement()?.querySelectorAll("input[type=\"range\"]");
314
- s?.length === 1 && s[0]?.focus({ focusVisible: !0 });
315
- }
316
- function g(e) {
317
- e.preventDefault();
318
- }
319
- let _ = f(() => a.onClick, () => h), v = f(() => a.onPointerDown, () => g);
320
- return N(r.rootLabelId, (e) => {
321
- r.setLocalLabelId(e);
322
- let t = i.registerLabelId(e);
323
- return () => {
324
- t(), L(r.labelId) === e && r.setLocalLabelId(void 0);
325
- };
326
- }), b(d, T({
327
- ref: [a.ref],
328
- get id() {
329
- return r.rootLabelId();
330
- },
331
- get class() {
332
- return u();
333
- },
334
- get style() {
335
- return p();
336
- },
337
- onClick: _,
338
- onPointerDown: v
339
- }, m, o));
340
- }
341
- //#endregion
342
- //#region src/slider/value/SliderValue.tsx
343
- var q = /* @__PURE__ */ j("<output>");
344
- function Se(e) {
345
- let r = he(), i = e, a = I(e, "aria-live", "render", "children", "class", "ref", "style"), o = P(() => r.state()), s = P(() => c(e.class, o())), u = t(e, () => o(), (e) => (() => {
346
- var t = S(q);
347
- return k(t, e, !1), D(), t;
348
- })()), d = P(() => l(e.style, o())), f = P(() => n(o(), le)), p = P(() => r.values().map((e) => H(e, r.locale(), r.format()))), m = P(() => typeof i.children == "function" ? i.children(p(), r.values()) : p().join(" – ")), h = P(() => r.orderedThumbs().map((e) => e.inputId()).join(" ").trim() || void 0);
349
- return b(u, T({
350
- ref: [i.ref],
351
- get class() {
352
- return s();
353
- },
354
- get style() {
355
- return d();
356
- },
357
- get "aria-live"() {
358
- return i["aria-live"] ?? "off";
359
- },
360
- get for() {
361
- return h();
362
- }
363
- }, f, a, { get children() {
364
- return m();
365
- } }));
366
- }
367
- //#endregion
368
- //#region src/slider/utils/getPushedThumbValues.ts
369
- function J(e, t, n, r, i, a, o, s) {
370
- let c = e.slice(), l = a * o, u = c.length - 1, d = s ?? e;
371
- c[t] = z(n, r + t * l, i - (u - t) * l);
372
- for (let e = t + 1; e <= u; e += 1) {
373
- let t = c[e - 1] + l, n = i - (u - e) * l, r = Math.max(c[e], t);
374
- d[e] < r && (r = Math.max(d[e], t)), c[e] = z(r, t, n);
375
- }
376
- for (let e = t - 1; e >= 0; --e) {
377
- let t = c[e + 1] - l, n = r + e * l, i = Math.min(c[e], t);
378
- d[e] > i && (i = Math.min(d[e], t)), c[e] = z(i, n, t);
379
- }
380
- return c.map((e) => Number(e.toFixed(12)));
381
- }
382
- //#endregion
383
- //#region src/slider/utils/resolveThumbCollision.ts
384
- function Ce(e, t, n, r, i, a, o, s, c, l) {
385
- let u = n ?? t, d = r ?? t;
386
- if (u.length <= 1) return {
387
- value: a,
388
- thumbIndex: 0,
389
- didSwap: !1
390
- };
391
- let f = c * l;
392
- if (e === "push") return {
393
- value: J(u, i, a, o, s, c, l),
394
- thumbIndex: i,
395
- didSwap: !1
396
- };
397
- let p = u.slice(), m = p[i - 1], h = p[i + 1], g = m == null ? o : m + f, ee = h == null ? s : h - f, _ = Number(z(a, g, ee).toFixed(12));
398
- if (p[i] = _, e !== "swap") return {
399
- value: p,
400
- thumbIndex: i,
401
- didSwap: !1
402
- };
403
- let v = u[i], y = 1e-7, b = a > v && h != null && a >= h - y, te = a < v && m != null && a <= m + y;
404
- if (!b && !te) return {
405
- value: p,
406
- thumbIndex: i,
407
- didSwap: !1
408
- };
409
- let x = b ? i + 1 : i - 1, S = p.map((e, t) => t === i ? _ : d[t] ?? u[t]), C = J(p, x, b ? Math.max(a, p[x]) : Math.min(a, p[x]), o, s, c, l, S), w = b ? x - 1 : x + 1, T = C[w - 1], E = C[w + 1], D = Math.max(T == null ? o : T + f, o + w * f), O = Math.min(E == null ? s : E - f, s - (C.length - 1 - w) * f);
410
- return C[w] = Number(z(_, D, O).toFixed(12)), {
411
- value: C,
412
- thumbIndex: x,
413
- didSwap: !0
414
- };
415
- }
416
- //#endregion
417
- //#region src/slider/utils/roundValueToStep.ts
418
- function Y(e) {
419
- if (e === 0) return 0;
420
- if (Math.abs(e) < 1) {
421
- let t = e.toExponential().split("e-");
422
- return (t[0]?.split(".")[1]?.length ?? 0) + Number.parseInt(t[1] ?? "0", 10);
423
- }
424
- return e.toString().split(".")[1]?.length ?? 0;
425
- }
426
- function X(e, t, n) {
427
- let r = Math.round((e - n) / t) * t + n;
428
- return Number(r.toFixed(Math.max(Y(t), Y(n))));
429
- }
430
- //#endregion
431
- //#region src/slider/control/SliderControl.tsx
432
- var Z = /* @__PURE__ */ j("<div>"), we = 2;
433
- function Te(e) {
434
- let r = he(), a = p(), s = e, m = e, [h, g] = F(), ee = I(m, "render", "class", "onPointerDown", "onTouchStart", "ref", "style"), _ = P(() => r.state()), v = P(() => c(e.class, _())), y = t(e, () => _(), (e) => (() => {
435
- var t = S(Z);
436
- return k(t, e, !1), D(), t;
437
- })()), te = P(() => l(e.style, _())), x = P(() => n(_(), le)), C = null, w = 0, E = 0, O = null, ne = null, A = null, j = null, M;
438
- function re(e) {
439
- return r.orderedThumbs()[e]?.input();
440
- }
441
- function ie(e) {
442
- r.interaction.pressedThumbIndex = e, r.orderedThumbs()[e]?.element() || (r.interaction.pressedThumbCenterOffset = null);
443
- }
444
- function oe() {
445
- r.interaction.pressedThumbIndex = -1, r.interaction.pressedThumbCenterOffset = null;
446
- }
447
- function se(e) {
448
- return r.orderedThumbs().some((t) => fe(t.element(), e) && t.input()?.disabled === !0);
449
- }
450
- function L(e) {
451
- let t = r.values(), n = t.length > 1;
452
- r.interaction.pressedValues = n ? t.slice() : null, O = null, ne = t;
453
- let i = r.interaction.pressedThumbIndex, a = i;
454
- if (i >= 0 && i < t.length) {
455
- if (t[i] === r.max()) for (; a > 0 && t[a - 1] === r.max();) --a;
456
- } else {
457
- a = -1;
458
- let t, n = r.orientation() === "vertical" ? "y" : "x";
459
- for (let i = 0; i < r.orderedThumbs().length; i += 1) {
460
- let o = r.orderedThumbs()[i], s = o?.element();
461
- if (!s || o.input()?.disabled) continue;
462
- let c = Math.abs(e[n] - ue(s, r.orientation() === "vertical"));
463
- (t === void 0 || c <= t) && (t = c, a = i);
464
- }
465
- }
466
- if (a >= 0 && a !== i && ie(a), r.inset()) {
467
- let e = r.orderedThumbs()[a]?.element()?.getBoundingClientRect();
468
- E = e ? (r.orientation() === "vertical" ? e.height : e.width) / 2 : 0;
469
- } else E = 0;
470
- }
471
- function ce(e) {
472
- let t = h(), n = r.values(), i = r.interaction.pressedThumbIndex;
473
- if (!t || i < 0 || i >= n.length) return i >= n.length && (O = null), null;
474
- let o = r.orientation() === "vertical", s = t.getBoundingClientRect(), c = Ee(t.ownerDocument.defaultView?.getComputedStyle(t) ?? null, o), l = (o ? s.height : s.width) - c.start - c.end - E * 2, u = r.interaction.pressedThumbCenterOffset ?? 0, d = e.x - u, f = e.y - u, p = z(((o ? s.bottom - f - c.end : (a() === "rtl" ? s.right - d : d - s.left) - c.start) - E) / l, 0, 1), m = z(X((r.max() - r.min()) * p + r.min(), r.step(), r.min()), r.min(), r.max());
475
- return n.length <= 1 ? {
476
- value: m,
477
- thumbIndex: i,
478
- didSwap: !1
479
- } : Ce(r.thumbCollisionBehavior(), n, ne, r.interaction.pressedValues, i, m, r.min(), r.max(), r.step(), r.minStepsBetweenValues());
480
- }
481
- function R(e, t = !1) {
482
- re(e)?.focus({
483
- preventScroll: !0,
484
- focusVisible: t
485
- });
486
- }
487
- function B(e, t, n) {
488
- let i = r.setValue(e.value, u(t, n, void 0, { activeThumbIndex: e.thumbIndex }));
489
- return i && (O = e.value, ne = Array.isArray(e.value) ? e.value : [e.value], e.didSwap && (ie(e.thumbIndex), R(e.thumbIndex))), i;
490
- }
491
- function V(e) {
492
- let t = De(e, C);
493
- if (!t) return;
494
- if (w += 1, e.type === "pointermove" && e.buttons === 0) {
495
- H(e);
496
- return;
497
- }
498
- let n = ce(t);
499
- !n || !me(n.value, r.step(), r.minStepsBetweenValues()) || (!r.dragging() && w > we && r.setDragging(!0), B(n, i, e));
500
- }
501
- function H(e) {
502
- if ("changedTouches" in e && C != null && !Oe(e, C)) return;
503
- r.setActive(-1), r.setDragging(!1), r.interaction.pressedThumbCenterOffset = null;
504
- let t = r.values();
505
- Array.isArray(O) && O.length !== t.length && (O = null), O != null && r.onValueCommitted(O, d(r.interaction.lastChangeReason, e));
506
- let n = h();
507
- if ("pointerId" in e && n) try {
508
- n.hasPointerCapture(e.pointerId) && n.releasePointerCapture(e.pointerId);
509
- } catch {}
510
- oe(), C = null, A = null, ge();
511
- }
512
- function pe(e) {
513
- if (r.disabled()) return;
514
- if (se(de(e))) {
515
- oe();
516
- return;
517
- }
518
- let t = e.changedTouches[0];
519
- if (!t) return;
520
- C = t.identifier;
521
- let n = {
522
- x: t.clientX,
523
- y: t.clientY
524
- };
525
- L(n);
526
- let i = ce(n);
527
- i && (R(i.thumbIndex), B(i, o, e), w = 0, W(h()?.ownerDocument, "touch"));
528
- }
529
- function U(e) {
530
- let t = h(), n = de(e);
531
- if (!t || r.disabled() || e.defaultPrevented || !n || e.button !== 0) return;
532
- if (se(n)) {
533
- oe();
534
- return;
535
- }
536
- let i = {
537
- x: e.clientX,
538
- y: e.clientY
539
- };
540
- L(i);
541
- let a = ce(i);
542
- if (!a) return;
543
- let s = ke(t.ownerDocument);
544
- if (fe(r.orderedThumbs()[a.thumbIndex]?.element(), s)) e.preventDefault();
545
- else {
546
- let e = t.ownerDocument.defaultView;
547
- M !== void 0 && e?.cancelAnimationFrame(M), M = e?.requestAnimationFrame(() => R(a.thumbIndex));
548
- }
549
- if (r.setDragging(!0), r.interaction.pressedThumbCenterOffset ?? B(a, o, e), e.pointerId) {
550
- A = e.pointerId;
551
- try {
552
- t.setPointerCapture(e.pointerId);
553
- } catch {}
554
- }
555
- w = 0, W(t.ownerDocument, "pointer");
556
- }
557
- function W(e, t) {
558
- _e(), e && (j = e, t === "touch" ? (e.addEventListener("touchmove", V, { passive: !0 }), e.addEventListener("touchend", H, { passive: !0 }), e.addEventListener("touchcancel", H, { passive: !0 })) : (e.addEventListener("pointermove", V, { passive: !0 }), e.addEventListener("pointerup", H), e.addEventListener("pointercancel", H)));
559
- }
560
- function ge() {
561
- _e(), r.interaction.pressedValues = null, O = null, ne = null;
562
- }
563
- function _e() {
564
- let e = j;
565
- e && (e.removeEventListener("pointermove", V), e.removeEventListener("pointerup", H), e.removeEventListener("pointercancel", H), e.removeEventListener("touchmove", V), e.removeEventListener("touchend", H), e.removeEventListener("touchcancel", H)), j = null;
566
- }
567
- let ve = f(() => s.onPointerDown, () => U), ye = f(() => s.onTouchStart, () => pe);
568
- return N(h, (e) => {
569
- if (r.setControlElement(e), !e) return;
570
- let t = (t) => ye.call(e, t);
571
- return e.addEventListener("touchstart", t, { passive: !0 }), () => {
572
- e.removeEventListener("touchstart", t), r.controlElement() === e && r.setControlElement(void 0);
573
- };
574
- }), N(r.disabled, (e) => {
575
- e && (r.setDragging(!1), oe(), ge());
576
- }), ae(() => {
577
- let e = h()?.ownerDocument.defaultView;
578
- if (M !== void 0 && e?.cancelAnimationFrame(M), A != null) try {
579
- h()?.hasPointerCapture(A) && h()?.releasePointerCapture(A);
580
- } catch {}
581
- ge();
582
- }), b(y, T({
583
- ref: [((e) => g(e)), s.ref],
584
- get class() {
585
- return v();
586
- },
587
- get style() {
588
- return te();
589
- },
590
- get "data-base-ui-slider-control"() {
591
- return r.renderBeforeHydration() ? "" : void 0;
592
- },
593
- onPointerDown: ve
594
- }, x, ee));
595
- }
596
- function Ee(e, t) {
597
- let n = (e) => {
598
- let t = e == null ? 0 : Number.parseFloat(e);
599
- return Number.isNaN(t) ? 0 : t;
600
- };
601
- return e ? t ? {
602
- start: n(e.borderTopWidth) + n(e.paddingTop),
603
- end: n(e.borderBottomWidth) + n(e.paddingBottom)
604
- } : {
605
- start: n(e.borderInlineStartWidth) + n(e.paddingInlineStart),
606
- end: n(e.borderInlineEndWidth) + n(e.paddingInlineEnd)
607
- } : {
608
- start: 0,
609
- end: 0
610
- };
611
- }
612
- function De(e, t) {
613
- if (t != null && "changedTouches" in e) {
614
- for (let n of e.changedTouches) if (n.identifier === t) return {
615
- x: n.clientX,
616
- y: n.clientY
617
- };
618
- return null;
619
- }
620
- return {
621
- x: e.clientX,
622
- y: e.clientY
623
- };
624
- }
625
- function Oe(e, t) {
626
- for (let n of e.changedTouches) if (n.identifier === t) return !0;
627
- return !1;
628
- }
629
- function ke(e) {
630
- let t = e.activeElement;
631
- for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
632
- return t;
633
- }
634
- //#endregion
635
- //#region src/slider/track/SliderTrack.tsx
636
- var Q = /* @__PURE__ */ j("<div>");
637
- function Ae(e) {
638
- let r = he(), i = e, a = I(e, "render", "class", "ref", "style"), o = P(() => r.state()), s = P(() => c(e.class, o())), u = t(e, () => o(), (e) => (() => {
639
- var t = S(Q);
640
- return k(t, e, !1), D(), t;
641
- })()), d = P(() => v({ position: "relative" }, l(e.style, o()))), f = P(() => n(o(), le));
642
- return b(u, T({
643
- ref: [i.ref],
644
- get class() {
645
- return s();
646
- },
647
- get style() {
648
- return d();
649
- }
650
- }, f, a));
651
- }
652
- //#endregion
653
- //#region src/slider/thumb/SliderThumbDataAttributes.ts
654
- var je = /* @__PURE__ */ function(e) {
655
- return e.index = "data-index", e.dragging = "data-dragging", e.orientation = "data-orientation", e.disabled = "data-disabled", e.valid = "data-valid", e.invalid = "data-invalid", e.touched = "data-touched", e.dirty = "data-dirty", e.focused = "data-focused", e;
656
- }({}), Me = /* @__PURE__ */ j("<div>"), Ne = /* @__PURE__ */ j("<input type=range>"), Pe = /* @__PURE__ */ j("<script>"), Fe = /* @__PURE__ */ new Set([
657
- "ArrowDown",
658
- "ArrowLeft",
659
- "ArrowRight",
660
- "ArrowUp",
661
- "End",
662
- "Home",
663
- "PageDown",
664
- "PageUp"
665
- ]), Ie = /* @__PURE__ */ new Set([
666
- "ArrowDown",
667
- "ArrowLeft",
668
- "ArrowRight",
669
- "ArrowUp",
670
- "End",
671
- "Home"
672
- ]), $ = {
673
- position: "fixed",
674
- width: "1px",
675
- height: "1px",
676
- padding: "0",
677
- margin: "-1px",
678
- overflow: "hidden",
679
- clip: "rect(0, 0, 0, 0)",
680
- "white-space": "nowrap",
681
- border: "0"
682
- };
683
- function Le(e) {
684
- let r = he(), i = h(!0), a = ee(), o = p(), s = _(), u = e, d = e, m = `base-ui-${re()}`, g = `base-ui-${re()}`, te = Symbol("SliderThumb"), [j, M] = F(), [ie, ce] = F(), [R, de] = F(), [z, B] = F(C || se.hydrating), me = { innerHTML: "" }, U = !1, W, ge = () => -1, _e = P(() => r.range() ? g : r.singleInputId), ve = {
685
- token: te,
686
- order: 0,
687
- element: j,
688
- input: ie,
689
- inputId: _e,
690
- index: () => ge()
691
- }, ye = r.registerThumb(ve), be = P(() => r.orderedThumbs().indexOf(ve)), G = P(() => r.range() ? u.index ?? be() : 0);
692
- ge = G;
693
- let xe = I(d, "aria-describedby", "aria-label", "aria-labelledby", "aria-valuetext", "render", "children", "class", "disabled", "getAriaLabel", "getAriaValueText", "id", "index", "inputRef", "onBlur", "onFocus", "onKeyDown", "onPointerDown", "ref", "style", "tabIndex"), K = P(() => r.values()[G()]), q = P(() => V(K(), r.min(), r.max())), Se = r.range, J = P(() => r.orientation() === "vertical"), Ce = P(() => r.disabled() || (u.disabled ?? !1)), Y = P(() => G() === r.values().length - 1), Z = P(() => r.state()), we = P(() => c(e.class, Z())), Te = t(e, () => Z(), (e) => (() => {
694
- var t = S(Me);
695
- return k(t, e, !1), D(), t;
696
- })()), Ee = P(() => {
697
- let e = q();
698
- if (!r.inset() && !Number.isFinite(e)) return $;
699
- let t = r.lastUsedThumbIndex() >= 0 && r.lastUsedThumbIndex() < r.values().length ? r.lastUsedThumbIndex() : -1, n;
700
- return Se() ? r.active() === G() ? n = 2 : t === G() && (n = 1) : r.active() === G() && (n = 1), {
701
- position: "absolute",
702
- [J() ? "bottom" : "inset-inline-start"]: r.inset() ? "var(--position)" : `${e}%`,
703
- [J() ? "left" : "top"]: "50%",
704
- translate: `${(J() || o() !== "rtl" ? -1 : 1) * 50}% ${(J() ? 1 : -1) * 50}%`,
705
- "z-index": n,
706
- ...r.inset() ? {
707
- "--position": `${R() ?? 0}%`,
708
- visibility: r.renderBeforeHydration() && z() || R() === void 0 ? "hidden" : void 0
709
- } : {}
710
- };
711
- }), De = P(() => v(Ee(), l(e.style, Z()))), Oe = P(() => n(Z(), le)), ke = P(() => ({ [je.index]: String(G()) })), Q = P(() => H(K(), r.locale(), r.format())), Ae = P(() => typeof u.getAriaLabel == "function" ? u.getAriaLabel(G()) : u["aria-label"]), Le = P(() => {
712
- let e = K();
713
- if (!(e === void 0 || G() < 0)) return typeof u.getAriaValueText == "function" ? u.getAriaValueText(Q(), e, G()) : u["aria-valuetext"] === void 0 ? r.values().length === 2 ? `${Q()} ${G() === 0 ? "start" : "end"} range` : r.format() ? Q() : void 0 : u["aria-valuetext"];
714
- }), Be = P(() => ({
715
- ...$,
716
- width: "100%",
717
- height: "100%",
718
- "writing-mode": J() ? o() === "rtl" ? "vertical-rl" : "vertical-lr" : void 0
719
- }));
720
- function Ve() {
721
- if (!r.inset()) return;
722
- let e = r.controlElement(), t = j();
723
- if (!e || !t) return;
724
- let n = t.getBoundingClientRect(), i = e.getBoundingClientRect(), a = J() ? "height" : "width", o = i[a] - n[a], s = (n[a] / 2 + o * q() / 100) / i[a] * 100, c = Number.isFinite(s) ? s : void 0;
725
- de(c), G() === 0 ? r.setIndicatorPosition(0, c) : Y() && r.setIndicatorPosition(1, c);
726
- }
727
- function He(e) {
728
- let t = U;
729
- if (U = !1, r.setActive(G()), i.setFocused(!0), t) {
730
- e.stopPropagation();
731
- return;
732
- }
733
- }
734
- function Ue(e) {
735
- if (U) {
736
- e.stopPropagation();
737
- return;
738
- }
739
- if (r.setActive(-1), !r.orderedThumbs().some((t) => fe(t.element(), e.relatedTarget)) && (i.setTouched(!0), i.setFocused(!1), i.validationMode() === "onBlur")) {
740
- let e = K();
741
- e !== void 0 && i.validation.commit(pe(e, G(), r.min(), r.max(), Se(), r.values()));
742
- }
743
- }
744
- function We(e) {
745
- if (Ce() || e.defaultPrevented || !Fe.has(e.key)) return;
746
- Ie.has(e.key) && e.stopPropagation();
747
- let t = K();
748
- if (t === void 0) return;
749
- let n = null, i = 0, a = e.shiftKey ? r.largeStep() : r.step(), s = X(t, r.step(), r.min());
750
- switch (e.key) {
751
- case "ArrowUp":
752
- i = 1;
753
- break;
754
- case "ArrowRight":
755
- i = o() === "rtl" ? -1 : 1;
756
- break;
757
- case "ArrowDown":
758
- i = -1;
759
- break;
760
- case "ArrowLeft":
761
- i = o() === "rtl" ? 1 : -1;
762
- break;
763
- case "PageUp":
764
- a = r.largeStep(), i = 1;
765
- break;
766
- case "PageDown":
767
- a = r.largeStep(), i = -1;
768
- break;
769
- case "End":
770
- n = Se() && Number.isFinite(r.values()[G() + 1]) ? r.values()[G() + 1] - r.step() * r.minStepsBetweenValues() : r.max();
771
- break;
772
- case "Home": n = Se() && Number.isFinite(r.values()[G() - 1]) ? r.values()[G() - 1] + r.step() * r.minStepsBetweenValues() : r.min();
773
- }
774
- if (i !== 0 && (n = Re(s, a, i, r.min(), r.max())), n === null) return;
775
- let c = ie();
776
- c && !ze(c) && (U = !0, c.blur(), c.focus({
777
- preventScroll: !0,
778
- focusVisible: !0
779
- })), r.handleInputChange(n, G(), e), e.preventDefault();
780
- }
781
- function Ge(e) {
782
- Ce() || (r.interaction.pressedThumbIndex = G(), r.interaction.pressedThumbCenterOffset = (J() ? e.clientY : e.clientX) - ue(e.currentTarget, J()));
783
- }
784
- function Ke(e) {
785
- if (Ce()) {
786
- queueMicrotask(r.syncInputs);
787
- return;
788
- }
789
- r.handleInputChange(e.currentTarget.valueAsNumber, G(), e);
790
- }
791
- function qe(e) {
792
- W = e.currentTarget.valueAsNumber, Ke(e);
793
- }
794
- function Je(e) {
795
- if (W === e.currentTarget.valueAsNumber) {
796
- W = void 0;
797
- return;
798
- }
799
- Ke(e);
800
- }
801
- let Ye = f(() => U ? void 0 : u.onFocus, () => He), Xe = f(() => U ? void 0 : u.onBlur, () => Ue), Ze = f(() => u.onKeyDown, () => We), Qe = f(() => u.onPointerDown, () => Ge);
802
- return N(() => ({
803
- control: r.controlElement(),
804
- inset: r.inset(),
805
- percent: q(),
806
- thumb: j()
807
- }), (e) => {
808
- if (!e.inset || !e.control || !e.thumb) return;
809
- queueMicrotask(() => L(Ve)), L(Ve);
810
- let t = e.control.ownerDocument.defaultView?.ResizeObserver;
811
- if (!t) return;
812
- let n = new t(Ve);
813
- return n.observe(e.control), n.observe(e.thumb), () => n.disconnect();
814
- }), N(ie, (e) => {
815
- if (e) return i.validation.registerInput(r.fieldControlSource, e, () => e);
816
- }), oe(() => {
817
- B(!1);
818
- }), ae(ye), b(Te, T({
819
- ref: [((e) => {
820
- M(e);
821
- let t = Number.parseFloat(e.style.getPropertyValue("--position"));
822
- Number.isFinite(t) && de(t);
823
- }), u.ref],
824
- get id() {
825
- return u.id ?? m;
826
- },
827
- get class() {
828
- return we();
829
- },
830
- get style() {
831
- return De();
832
- },
833
- onPointerDown: Qe
834
- }, ke, Oe, xe, { get children() {
835
- return [
836
- w(() => u.children),
837
- (() => {
838
- var e = S(Ne);
839
- return y(e, "keydown", Ze, !0), y(e, "blur", Xe), y(e, "focus", Ye), e.addEventListener("change", Je), e.$$input = qe, E(() => [((e) => ce(e)), u.inputRef], e), x(() => ({
840
- e: _e(),
841
- t: r.name(),
842
- a: r.form(),
843
- o: r.min(),
844
- i: r.max(),
845
- n: r.step(),
846
- s: K() ?? "",
847
- h: Ce(),
848
- r: u.tabIndex,
849
- d: Be(),
850
- l: Ae(),
851
- u: u["aria-labelledby"] ?? (Ae() == null ? r.labelId() : void 0),
852
- c: a.getAriaDescribedBy(u["aria-describedby"]),
853
- w: r.orientation(),
854
- m: K(),
855
- f: Le(),
856
- y: Z().valid === !1 && !Ce() ? "true" : void 0
857
- }), ({ e: t, t: n, a: r, o: i, i: a, n: o, s, h: c, r: l, d: u, l: d, u: f, c: p, w: m, m: h, f: g, y: ee }, _) => {
858
- t !== _?.e && O(e, "id", t), n !== _?.t && O(e, "name", n), r !== _?.a && O(e, "form", r), i !== _?.o && O(e, "min", i), a !== _?.i && O(e, "max", a), o !== _?.n && O(e, "step", o), ne(e, "value", s), c !== _?.h && O(e, "disabled", c), l !== _?.r && O(e, "tabindex", l), A(e, u, _?.d), d !== _?.l && O(e, "aria-label", d), f !== _?.u && O(e, "aria-labelledby", f), p !== _?.c && O(e, "aria-describedby", p), m !== _?.w && O(e, "aria-orientation", m), h !== _?.m && O(e, "aria-valuenow", h), g !== _?.f && O(e, "aria-valuetext", g), ee !== _?.y && O(e, "aria-invalid", ee);
859
- }), D(), e;
860
- })(),
861
- w(() => w(() => !!(r.inset() && Y() && r.renderBeforeHydration() && z()))() ? (() => {
862
- var e = S(Pe);
863
- return k(e, T({ get nonce() {
864
- return s.nonce();
865
- } }, me), !1), D(), e;
866
- })() : r.inset() && Y() && r.renderBeforeHydration() && z())
867
- ];
868
- } }));
869
- }
870
- function Re(e, t, n, r, i) {
871
- let a = e + t * n;
872
- return z(Number(a.toFixed(Math.max(Y(e), Y(t), Y(r)))), r, i);
873
- }
874
- function ze(e) {
875
- try {
876
- return e.matches(":focus-visible");
877
- } catch {
878
- return !1;
879
- }
880
- }
881
- te(["input", "keydown"]);
882
- //#endregion
883
- //#region src/slider/indicator/SliderIndicator.tsx
884
- var Be = /* @__PURE__ */ j("<div>");
885
- function Ve(e) {
886
- let r = he(), i = e, a = e, [o, s] = F(C || se.hydrating), u = I(a, "render", "class", "ref", "style"), d = P(() => r.state()), f = P(() => c(e.class, d())), p = t(e, () => d(), (e) => (() => {
887
- var t = S(Be);
888
- return k(t, e, !1), D(), t;
889
- })()), m = P(() => {
890
- let e = r.values(), t = r.orientation() === "vertical", n = e.length > 1, i = r.indicatorPosition(), a = r.inset() ? i[0] : V(e[0], r.min(), r.max()), s = r.inset() ? i[1] : V(e[e.length - 1], r.min(), r.max()), c = `${a ?? 0}%`, l = `${(s ?? 0) - (a ?? 0)}%`, u = {
891
- visibility: r.inset() && r.renderBeforeHydration() && o() || r.inset() && (a === void 0 || n && s === void 0) ? "hidden" : void 0,
892
- position: t ? "absolute" : "relative",
893
- [t ? "width" : "height"]: "inherit"
894
- };
895
- return r.inset() && (u["--start-position"] = c, c = "var(--start-position)", n && (u["--relative-size"] = l, l = "var(--relative-size)")), u[t ? "bottom" : "inset-inline-start"] = n ? c : 0, u[t ? "height" : "width"] = n ? l : c, u;
896
- }), h = P(() => v(m(), l(e.style, d()))), g = P(() => n(d(), le));
897
- return oe(() => {
898
- s(!1);
899
- }), b(p, T({
900
- ref: [((e) => {
901
- let t = Number.parseFloat(e.style.getPropertyValue("--start-position")), n = Number.parseFloat(e.style.getPropertyValue("--relative-size"));
902
- Number.isFinite(t) && r.setIndicatorPosition(0, t), Number.isFinite(t) && Number.isFinite(n) && r.setIndicatorPosition(1, t + n);
903
- }), i.ref],
904
- get class() {
905
- return f();
906
- },
907
- get style() {
908
- return h();
909
- },
910
- get "data-base-ui-slider-indicator"() {
911
- return r.renderBeforeHydration() ? "" : void 0;
912
- }
913
- }, g, u));
914
- }
915
- //#endregion
916
- //#region src/slider/index.parts.ts
917
- var He = /* @__PURE__ */ e({
918
- Control: () => Te,
919
- Indicator: () => Ve,
920
- Label: () => K,
921
- Root: () => _e,
922
- Thumb: () => Le,
923
- Track: () => Ae,
924
- Value: () => Se
925
- });
926
- //#endregion
927
- export { He as t };