@seed-design/lynx-react 0.7.1 → 0.8.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 (241) hide show
  1. package/lib/components/Accordion/Accordion.jsx +2 -2
  2. package/lib/components/ActionButton/ActionButton.jsx +1 -1
  3. package/lib/components/AlertDialog/AlertDialog.d.ts +64 -0
  4. package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
  5. package/lib/components/AlertDialog/AlertDialog.jsx +138 -0
  6. package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
  7. package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
  8. package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
  9. package/lib/components/AlertDialog/index.d.ts +3 -0
  10. package/lib/components/AlertDialog/index.d.ts.map +1 -0
  11. package/lib/components/AppBar/AppBar.d.ts +14 -1
  12. package/lib/components/AppBar/AppBar.d.ts.map +1 -1
  13. package/lib/components/AppBar/AppBar.jsx +39 -8
  14. package/lib/components/AppBar/AppBar.namespace.d.ts +1 -1
  15. package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -1
  16. package/lib/components/AppBar/index.d.ts +1 -1
  17. package/lib/components/AppBar/index.d.ts.map +1 -1
  18. package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts +182 -0
  19. package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts.map +1 -0
  20. package/lib/components/AttachmentDisplay/AttachmentDisplay.jsx +444 -0
  21. package/lib/components/AttachmentDisplay/index.d.ts +2 -0
  22. package/lib/components/AttachmentDisplay/index.d.ts.map +1 -0
  23. package/lib/components/AttachmentInput/AttachmentInput.d.ts +179 -0
  24. package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
  25. package/lib/components/AttachmentInput/AttachmentInput.jsx +520 -0
  26. package/lib/components/AttachmentInput/index.d.ts +2 -0
  27. package/lib/components/AttachmentInput/index.d.ts.map +1 -0
  28. package/lib/components/BottomSheet/BottomSheet.d.ts +1 -1
  29. package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  30. package/lib/components/BottomSheet/BottomSheet.jsx +1 -7
  31. package/lib/components/Callout/Callout.jsx +2 -2
  32. package/lib/components/Checkbox/Checkbox.jsx +2 -2
  33. package/lib/components/Chip/Chip.jsx +2 -2
  34. package/lib/components/ChipTabs/ChipTabs.d.ts +41 -0
  35. package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
  36. package/lib/components/ChipTabs/ChipTabs.jsx +39 -0
  37. package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
  38. package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
  39. package/lib/components/ChipTabs/ChipTabs.namespace.js +13 -0
  40. package/lib/components/ChipTabs/index.d.ts +3 -0
  41. package/lib/components/ChipTabs/index.d.ts.map +1 -0
  42. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts +18 -0
  43. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -0
  44. package/lib/components/ContextualFloatingButton/ContextualFloatingButton.jsx +113 -0
  45. package/lib/components/ContextualFloatingButton/index.d.ts +2 -0
  46. package/lib/components/ContextualFloatingButton/index.d.ts.map +1 -0
  47. package/lib/components/Dialog/Dialog.d.ts +87 -0
  48. package/lib/components/Dialog/Dialog.d.ts.map +1 -0
  49. package/lib/components/Dialog/Dialog.jsx +147 -0
  50. package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
  51. package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
  52. package/lib/components/Dialog/Dialog.namespace.js +18 -0
  53. package/lib/components/Dialog/index.d.ts +3 -0
  54. package/lib/components/Dialog/index.d.ts.map +1 -0
  55. package/lib/components/FloatingActionButton/FloatingActionButton.d.ts +23 -0
  56. package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -0
  57. package/lib/components/FloatingActionButton/FloatingActionButton.jsx +76 -0
  58. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts +2 -0
  59. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts.map +1 -0
  60. package/lib/components/FloatingActionButton/FloatingActionButton.namespace.js +10 -0
  61. package/lib/components/FloatingActionButton/index.d.ts +3 -0
  62. package/lib/components/FloatingActionButton/index.d.ts.map +1 -0
  63. package/lib/components/HelpBubble/HelpBubble.d.ts +67 -0
  64. package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
  65. package/lib/components/HelpBubble/HelpBubble.jsx +600 -0
  66. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
  67. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
  68. package/lib/components/HelpBubble/HelpBubble.namespace.js +18 -0
  69. package/lib/components/HelpBubble/index.d.ts +3 -0
  70. package/lib/components/HelpBubble/index.d.ts.map +1 -0
  71. package/lib/components/Icon/Icon.d.ts +1 -0
  72. package/lib/components/Icon/Icon.d.ts.map +1 -1
  73. package/lib/components/Icon/Icon.jsx +2 -1
  74. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts +28 -0
  75. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts.map +1 -0
  76. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.jsx +37 -0
  77. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts +2 -0
  78. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts.map +1 -0
  79. package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.js +9 -0
  80. package/lib/components/IdentityPlaceholder/identity-placeholder-business.js +4 -0
  81. package/lib/components/IdentityPlaceholder/identity-placeholder-person.js +4 -0
  82. package/lib/components/IdentityPlaceholder/index.d.ts +3 -0
  83. package/lib/components/IdentityPlaceholder/index.d.ts.map +1 -0
  84. package/lib/components/InputButton/InputButton.d.ts +2 -0
  85. package/lib/components/InputButton/InputButton.d.ts.map +1 -1
  86. package/lib/components/InputButton/InputButton.jsx +40 -8
  87. package/lib/components/List/List.d.ts +1 -1
  88. package/lib/components/List/List.d.ts.map +1 -1
  89. package/lib/components/List/List.jsx +26 -12
  90. package/lib/components/Menu/Menu.d.ts.map +1 -1
  91. package/lib/components/Menu/Menu.jsx +15 -5
  92. package/lib/components/PageBanner/PageBanner.d.ts +3 -0
  93. package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
  94. package/lib/components/PageBanner/PageBanner.jsx +49 -11
  95. package/lib/components/QuantityPicker/QuantityPicker.d.ts +53 -0
  96. package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -0
  97. package/lib/components/QuantityPicker/QuantityPicker.jsx +282 -0
  98. package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts +2 -0
  99. package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts.map +1 -0
  100. package/lib/components/QuantityPicker/QuantityPicker.namespace.js +11 -0
  101. package/lib/components/QuantityPicker/index.d.ts +3 -0
  102. package/lib/components/QuantityPicker/index.d.ts.map +1 -0
  103. package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
  104. package/lib/components/ReactionButton/ReactionButton.d.ts +1 -1
  105. package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
  106. package/lib/components/ReactionButton/ReactionButton.jsx +22 -13
  107. package/lib/components/ScrollFog/ScrollFog.d.ts +41 -0
  108. package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -0
  109. package/lib/components/ScrollFog/ScrollFog.jsx +65 -0
  110. package/lib/components/ScrollFog/index.d.ts +2 -0
  111. package/lib/components/ScrollFog/index.d.ts.map +1 -0
  112. package/lib/components/SegmentedControl/SegmentedControl.jsx +2 -2
  113. package/lib/components/Select/Select.d.ts +112 -0
  114. package/lib/components/Select/Select.d.ts.map +1 -0
  115. package/lib/components/Select/Select.jsx +885 -0
  116. package/lib/components/Select/Select.namespace.d.ts +2 -0
  117. package/lib/components/Select/Select.namespace.d.ts.map +1 -0
  118. package/lib/components/Select/Select.namespace.js +23 -0
  119. package/lib/components/Select/index.d.ts +3 -0
  120. package/lib/components/Select/index.d.ts.map +1 -0
  121. package/lib/components/Skeleton/Skeleton.d.ts +15 -0
  122. package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
  123. package/lib/components/Skeleton/Skeleton.jsx +18 -0
  124. package/lib/components/Skeleton/index.d.ts +2 -0
  125. package/lib/components/Skeleton/index.d.ts.map +1 -0
  126. package/lib/components/Slider/Slider.d.ts +101 -0
  127. package/lib/components/Slider/Slider.d.ts.map +1 -0
  128. package/lib/components/Slider/Slider.jsx +573 -0
  129. package/lib/components/Slider/Slider.namespace.d.ts +2 -0
  130. package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
  131. package/lib/components/Slider/Slider.namespace.js +19 -0
  132. package/lib/components/Slider/Slider.utils.d.ts +19 -0
  133. package/lib/components/Slider/Slider.utils.d.ts.map +1 -0
  134. package/lib/components/Slider/Slider.utils.js +106 -0
  135. package/lib/components/Slider/index.d.ts +3 -0
  136. package/lib/components/Slider/index.d.ts.map +1 -0
  137. package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
  138. package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +22 -8
  139. package/lib/components/Switch/Switch.d.ts.map +1 -1
  140. package/lib/components/Switch/Switch.jsx +5 -3
  141. package/lib/components/Tabs/Tabs.d.ts +34 -2
  142. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  143. package/lib/components/Tabs/Tabs.jsx +186 -56
  144. package/lib/components/Tabs/Tabs.utils.d.ts +14 -1
  145. package/lib/components/Tabs/Tabs.utils.d.ts.map +1 -1
  146. package/lib/components/Tabs/Tabs.utils.js +24 -3
  147. package/lib/components/Tabs/index.d.ts +1 -1
  148. package/lib/components/Tabs/index.d.ts.map +1 -1
  149. package/lib/components/index.d.ts +14 -0
  150. package/lib/components/index.d.ts.map +1 -1
  151. package/lib/hooks/useControllableState.d.ts +1 -14
  152. package/lib/hooks/useControllableState.d.ts.map +1 -1
  153. package/lib/hooks/usePressTap.d.ts +1 -27
  154. package/lib/hooks/usePressTap.d.ts.map +1 -1
  155. package/lib/index.js +29 -6
  156. package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
  157. package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
  158. package/lib/types.d.ts +1 -0
  159. package/lib/types.d.ts.map +1 -1
  160. package/package.json +9 -5
  161. package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
  162. package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
  163. package/src/components/AlertDialog/AlertDialog.tsx +374 -0
  164. package/src/components/AlertDialog/index.ts +24 -0
  165. package/src/components/AppBar/AppBar.namespace.ts +1 -0
  166. package/src/components/AppBar/AppBar.test.tsx +231 -0
  167. package/src/components/AppBar/AppBar.tsx +105 -13
  168. package/src/components/AppBar/index.ts +1 -0
  169. package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
  170. package/src/components/AttachmentDisplay/index.ts +48 -0
  171. package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
  172. package/src/components/AttachmentInput/index.ts +49 -0
  173. package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
  174. package/src/components/BottomSheet/BottomSheet.tsx +1 -19
  175. package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
  176. package/src/components/ChipTabs/ChipTabs.tsx +119 -0
  177. package/src/components/ChipTabs/index.ts +16 -0
  178. package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
  179. package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
  180. package/src/components/ContextualFloatingButton/index.ts +4 -0
  181. package/src/components/Dialog/Dialog.namespace.ts +24 -0
  182. package/src/components/Dialog/Dialog.test.tsx +172 -0
  183. package/src/components/Dialog/Dialog.tsx +373 -0
  184. package/src/components/Dialog/index.ts +26 -0
  185. package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
  186. package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
  187. package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
  188. package/src/components/FloatingActionButton/index.ts +10 -0
  189. package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
  190. package/src/components/HelpBubble/HelpBubble.tsx +998 -0
  191. package/src/components/HelpBubble/index.ts +26 -0
  192. package/src/components/Icon/Icon.test.tsx +0 -3
  193. package/src/components/Icon/Icon.tsx +11 -1
  194. package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
  195. package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
  196. package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
  197. package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
  198. package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
  199. package/src/components/IdentityPlaceholder/index.ts +8 -0
  200. package/src/components/InputButton/InputButton.test.tsx +128 -1
  201. package/src/components/InputButton/InputButton.tsx +60 -9
  202. package/src/components/List/List.test.tsx +54 -2
  203. package/src/components/List/List.tsx +43 -10
  204. package/src/components/Menu/Menu.tsx +14 -4
  205. package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
  206. package/src/components/PageBanner/PageBanner.test.tsx +110 -3
  207. package/src/components/PageBanner/PageBanner.tsx +83 -19
  208. package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
  209. package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
  210. package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
  211. package/src/components/QuantityPicker/index.ts +14 -0
  212. package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
  213. package/src/components/ReactionButton/ReactionButton.test.tsx +5 -3
  214. package/src/components/ReactionButton/ReactionButton.tsx +20 -12
  215. package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
  216. package/src/components/ScrollFog/ScrollFog.tsx +172 -0
  217. package/src/components/ScrollFog/index.ts +1 -0
  218. package/src/components/Select/Select.namespace.ts +34 -0
  219. package/src/components/Select/Select.test.tsx +297 -0
  220. package/src/components/Select/Select.tsx +1483 -0
  221. package/src/components/Select/index.ts +39 -0
  222. package/src/components/Skeleton/Skeleton.test.tsx +64 -0
  223. package/src/components/Skeleton/Skeleton.tsx +45 -0
  224. package/src/components/Skeleton/index.ts +1 -0
  225. package/src/components/Slider/Slider.namespace.ts +26 -0
  226. package/src/components/Slider/Slider.test.tsx +260 -0
  227. package/src/components/Slider/Slider.tsx +897 -0
  228. package/src/components/Slider/Slider.utils.ts +167 -0
  229. package/src/components/Slider/index.ts +30 -0
  230. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
  231. package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
  232. package/src/components/Switch/Switch.tsx +14 -13
  233. package/src/components/Tabs/Tabs.test.tsx +218 -1
  234. package/src/components/Tabs/Tabs.tsx +346 -75
  235. package/src/components/Tabs/Tabs.utils.ts +51 -1
  236. package/src/components/Tabs/index.ts +17 -1
  237. package/src/components/index.ts +14 -0
  238. package/src/hooks/useControllableState.ts +1 -43
  239. package/src/hooks/usePressTap.test.ts +23 -11
  240. package/src/hooks/usePressTap.ts +1 -60
  241. package/src/types.ts +1 -0
@@ -0,0 +1,573 @@
1
+ import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
2
+ import { mergeProps } from "../../utils/merge-props.js";
3
+ import { eventPageX, geometryFromRect, getStickyLabelOffset, getThumbInBoundsOffset, hasMinimumSteps, nearestValueIndex, normalizeValue, normalizeValues, percentageForValue, valueForPercentage } from "./Slider.utils.js";
4
+ import * as React from "@lynx-js/react";
5
+ import clsx from "clsx";
6
+ import { getRectByRef } from "@lynx-js/lynx-ui-common";
7
+ import { slider } from "@seed-design/lynx-css/recipes/slider";
8
+ import { sliderTick } from "@seed-design/lynx-css/recipes/slider-tick";
9
+ import { sliderMarker } from "@seed-design/lynx-css/recipes/slider-marker";
10
+ //#region src/components/Slider/Slider.tsx
11
+ function getLayoutWidth(event) {
12
+ const eventWithWidth = event;
13
+ const nextWidth = event.detail?.width ?? event.params?.width ?? eventWithWidth.width;
14
+ if (typeof nextWidth !== "number" || !Number.isFinite(nextWidth)) return null;
15
+ return Math.max(0, nextWidth);
16
+ }
17
+ var SliderContext = React.createContext(null);
18
+ function useSliderContext(consumer) {
19
+ const context = React.useContext(SliderContext);
20
+ if (!context) throw new Error(`<${consumer}/> must be rendered inside <Slider.Root/>.`);
21
+ return context;
22
+ }
23
+ function dynamicStyle(style, values) {
24
+ return {
25
+ ...values,
26
+ ...style ?? {}
27
+ };
28
+ }
29
+ function defaultGetValueIndicatorLabel({ value }) {
30
+ return String(value);
31
+ }
32
+ var SliderRoot = React.forwardRef((props, forwardedRef) => {
33
+ const [variantProps, restProps] = slider.splitVariantProps(props);
34
+ const { disabled = false } = variantProps;
35
+ const { children, className, style, values: valuesProp, defaultValues, min = 0, max = 100, step = 1, allowedValues, minStepsBetweenThumbs = 0, dir = "ltr", readOnly = false, invalid = false, onValuesChange, onValuesCommit, getAccessibilityLabel, getAccessibilityValueText, getValueIndicatorLabel = defaultGetValueIndicatorLabel, valueIndicatorTrigger = "auto", "consume-slide-event": consumeSlideEvent = [
36
+ [-180, -135],
37
+ [-45, 45],
38
+ [135, 180]
39
+ ], ...nativeProps } = restProps;
40
+ const resolvedValueIndicatorTrigger = valueIndicatorTrigger === "auto" ? "active" : valueIndicatorTrigger;
41
+ const getClasses = React.useCallback((state = {}) => slider(state), []);
42
+ const initialValues = React.useMemo(() => normalizeValues(defaultValues ?? valuesProp, min, max, step, allowedValues), [
43
+ defaultValues,
44
+ valuesProp,
45
+ min,
46
+ max,
47
+ step,
48
+ allowedValues
49
+ ]);
50
+ const [values, setValues] = useControllableState({
51
+ value: valuesProp === void 0 ? void 0 : normalizeValues(valuesProp, min, max, step, allowedValues),
52
+ defaultValue: initialValues,
53
+ onChange: onValuesChange
54
+ });
55
+ const valuesRef = React.useRef(values);
56
+ valuesRef.current = values;
57
+ const interaction = React.useRef({
58
+ active: false,
59
+ index: null,
60
+ changed: false,
61
+ pendingX: null
62
+ });
63
+ const pendingEndRef = React.useRef(false);
64
+ const moveFrameRef = React.useRef(null);
65
+ const [valueIndicatorEverShown, setValueIndicatorEverShown] = React.useState(false);
66
+ const trackRef = React.useRef(null);
67
+ const thumbRefs = React.useRef({});
68
+ const indicatorRefs = React.useRef({});
69
+ const [dragging, setDragging] = React.useState(false);
70
+ const [activeThumbIndex, setActiveThumbIndex] = React.useState(null);
71
+ const [trackLeft, setTrackLeft] = React.useState(0);
72
+ const trackLeftRef = React.useRef(0);
73
+ const trackWidthRef = React.useRef(0);
74
+ const [trackWidth, setTrackWidth] = React.useState(0);
75
+ const [thumbWidth, setThumbWidth] = React.useState(0);
76
+ const [indicatorWidths, setIndicatorWidths] = React.useState({});
77
+ const updateIndicatorWidth = React.useCallback((index, width) => {
78
+ setIndicatorWidths((previous) => {
79
+ if (previous[index] === width) return previous;
80
+ return {
81
+ ...previous,
82
+ [index]: width
83
+ };
84
+ });
85
+ }, []);
86
+ const measureInFlight = React.useRef(false);
87
+ const finalizeRef = React.useRef(void 0);
88
+ const updateFromRatioRef = React.useRef(void 0);
89
+ const measure = React.useCallback(() => {
90
+ const trackNode = trackRef.current;
91
+ if (measureInFlight.current || !trackNode) return;
92
+ measureInFlight.current = true;
93
+ const thumbNode = thumbRefs.current[0]?.current;
94
+ Promise.all([getRectByRef({ current: trackNode }), thumbNode ? getRectByRef({ current: thumbNode }) : Promise.resolve(null)]).then(([trackRect, thumbRect]) => {
95
+ const track = geometryFromRect(trackRect);
96
+ const thumb = geometryFromRect(thumbRect);
97
+ if (track) {
98
+ trackLeftRef.current = track.left;
99
+ trackWidthRef.current = track.width;
100
+ setTrackLeft(track.left);
101
+ setTrackWidth(track.width);
102
+ }
103
+ if (thumb) setThumbWidth(thumb.width);
104
+ measureInFlight.current = false;
105
+ const pending = interaction.current.pendingX;
106
+ if (pending !== null && track) {
107
+ interaction.current.pendingX = null;
108
+ updateFromRatioRef.current?.(clampRatio((pending - track.left) / track.width));
109
+ }
110
+ if (pendingEndRef.current) finalizeRef.current?.();
111
+ }).catch(() => {
112
+ measureInFlight.current = false;
113
+ if (!pendingEndRef.current) return;
114
+ const pending = interaction.current.pendingX;
115
+ if (pending !== null && trackWidthRef.current > 0) {
116
+ interaction.current.pendingX = null;
117
+ updateFromRatioRef.current?.(clampRatio((pending - trackLeftRef.current) / trackWidthRef.current));
118
+ }
119
+ finalizeRef.current?.();
120
+ });
121
+ }, []);
122
+ const registerThumb = React.useCallback((index, ref) => {
123
+ thumbRefs.current[index] = ref;
124
+ if (index === 0) measure();
125
+ }, [measure]);
126
+ const registerIndicator = React.useCallback((index, ref) => {
127
+ indicatorRefs.current[index] = ref;
128
+ const indicatorNode = ref.current;
129
+ if (!indicatorNode) return;
130
+ getRectByRef({ current: indicatorNode }).then((rect) => {
131
+ const geometry = geometryFromRect(rect);
132
+ if (geometry) updateIndicatorWidth(index, geometry.width);
133
+ }).catch(() => void 0);
134
+ }, [updateIndicatorWidth]);
135
+ const updateFromRatio = React.useCallback((ratio) => {
136
+ if (disabled || readOnly || !interaction.current.active) return;
137
+ const current = valuesRef.current;
138
+ const requested = valueForPercentage(ratio * 100, min, max, dir);
139
+ const index = interaction.current.index ?? nearestValueIndex(current, requested);
140
+ const nextValue = normalizeValue(requested, min, max, step, allowedValues);
141
+ const next = [...current];
142
+ next[index] = nextValue;
143
+ next.sort((a, b) => a - b);
144
+ if (!allowedValues?.length && !hasMinimumSteps(next, minStepsBetweenThumbs, step)) return;
145
+ if (next.every((value, valueIndex) => value === current[valueIndex])) return;
146
+ valuesRef.current = next;
147
+ interaction.current.index = next.indexOf(nextValue);
148
+ interaction.current.changed = true;
149
+ setActiveThumbIndex(interaction.current.index);
150
+ setValues(next);
151
+ }, [
152
+ allowedValues,
153
+ dir,
154
+ disabled,
155
+ max,
156
+ min,
157
+ minStepsBetweenThumbs,
158
+ readOnly,
159
+ setValues,
160
+ step
161
+ ]);
162
+ updateFromRatioRef.current = updateFromRatio;
163
+ const cancelPendingMove = React.useCallback(() => {
164
+ if (moveFrameRef.current === null) return;
165
+ cancelAnimationFrame(moveFrameRef.current);
166
+ moveFrameRef.current = null;
167
+ }, []);
168
+ const flushPendingMove = React.useCallback(() => {
169
+ "background only";
170
+ moveFrameRef.current = null;
171
+ if (!interaction.current.active || disabled || readOnly) return;
172
+ const pending = interaction.current.pendingX;
173
+ if (pending === null) return;
174
+ const track = trackWidthRef.current;
175
+ if (!track) {
176
+ measure();
177
+ return;
178
+ }
179
+ interaction.current.pendingX = null;
180
+ updateFromRatio(clampRatio((pending - trackLeftRef.current) / track));
181
+ }, [
182
+ disabled,
183
+ measure,
184
+ readOnly,
185
+ updateFromRatio
186
+ ]);
187
+ finalizeRef.current = React.useCallback(() => {
188
+ if (!interaction.current.active) return;
189
+ interaction.current.active = false;
190
+ interaction.current.pendingX = null;
191
+ pendingEndRef.current = false;
192
+ setDragging(false);
193
+ setActiveThumbIndex(null);
194
+ if (interaction.current.changed && !disabled && !readOnly) onValuesCommit?.([...valuesRef.current]);
195
+ interaction.current.index = null;
196
+ interaction.current.changed = false;
197
+ }, [
198
+ disabled,
199
+ onValuesCommit,
200
+ readOnly
201
+ ]);
202
+ const rootHandlers = {
203
+ catchtouchstart: React.useCallback((event) => {
204
+ "background only";
205
+ if (disabled || readOnly) {
206
+ interaction.current.index = null;
207
+ return;
208
+ }
209
+ const x = eventPageX(event);
210
+ if (!Number.isFinite(x)) return;
211
+ pendingEndRef.current = false;
212
+ interaction.current.active = true;
213
+ interaction.current.changed = false;
214
+ interaction.current.pendingX = x;
215
+ const current = valuesRef.current;
216
+ if (interaction.current.index === null && trackWidthRef.current > 0) {
217
+ const ratio = clampRatio((x - trackLeftRef.current) / trackWidthRef.current);
218
+ interaction.current.index = nearestValueIndex(current, valueForPercentage(ratio * 100, min, max, dir));
219
+ }
220
+ setActiveThumbIndex(interaction.current.index);
221
+ setDragging(true);
222
+ setValueIndicatorEverShown(true);
223
+ measure();
224
+ if (trackWidthRef.current > 0) updateFromRatio(clampRatio((x - trackLeftRef.current) / trackWidthRef.current));
225
+ }, [
226
+ dir,
227
+ disabled,
228
+ max,
229
+ measure,
230
+ min,
231
+ readOnly,
232
+ updateFromRatio
233
+ ]),
234
+ catchtouchmove: React.useCallback((event) => {
235
+ "background only";
236
+ if (!interaction.current.active || disabled || readOnly) return;
237
+ const x = eventPageX(event);
238
+ if (!Number.isFinite(x)) return;
239
+ interaction.current.pendingX = x;
240
+ if (moveFrameRef.current !== null) return;
241
+ moveFrameRef.current = requestAnimationFrame(flushPendingMove);
242
+ }, [
243
+ disabled,
244
+ flushPendingMove,
245
+ readOnly
246
+ ]),
247
+ catchtouchend: React.useCallback((event) => {
248
+ "background only";
249
+ if (!interaction.current.active) return;
250
+ cancelPendingMove();
251
+ const x = eventPageX(event);
252
+ if (Number.isFinite(x)) interaction.current.pendingX = x;
253
+ if (interaction.current.pendingX !== null && measureInFlight.current) {
254
+ pendingEndRef.current = true;
255
+ setDragging(false);
256
+ setActiveThumbIndex(null);
257
+ measure();
258
+ return;
259
+ }
260
+ if (interaction.current.pendingX !== null && trackWidthRef.current <= 0) {
261
+ pendingEndRef.current = true;
262
+ setDragging(false);
263
+ setActiveThumbIndex(null);
264
+ measure();
265
+ return;
266
+ }
267
+ if (interaction.current.pendingX !== null && trackWidthRef.current > 0) {
268
+ const pending = interaction.current.pendingX;
269
+ interaction.current.pendingX = null;
270
+ updateFromRatio(clampRatio((pending - trackLeftRef.current) / trackWidthRef.current));
271
+ }
272
+ finalizeRef.current?.();
273
+ }, [
274
+ cancelPendingMove,
275
+ measure,
276
+ updateFromRatio
277
+ ]),
278
+ catchtouchcancel: React.useCallback(() => {
279
+ "background only";
280
+ if (!interaction.current.active) return;
281
+ cancelPendingMove();
282
+ interaction.current.active = false;
283
+ interaction.current.pendingX = null;
284
+ pendingEndRef.current = false;
285
+ setDragging(false);
286
+ setActiveThumbIndex(null);
287
+ interaction.current.index = null;
288
+ interaction.current.changed = false;
289
+ }, [cancelPendingMove])
290
+ };
291
+ React.useEffect(() => cancelPendingMove, [cancelPendingMove]);
292
+ React.useEffect(() => {
293
+ measure();
294
+ }, [measure, values.length]);
295
+ const classes = React.useMemo(() => getClasses({
296
+ disabled,
297
+ dragging,
298
+ valueIndicatorEverShown
299
+ }), [
300
+ disabled,
301
+ dragging,
302
+ getClasses,
303
+ valueIndicatorEverShown
304
+ ]);
305
+ const dimensions = React.useMemo(() => ({
306
+ trackLeft,
307
+ trackWidth,
308
+ thumbWidth,
309
+ indicatorWidths
310
+ }), [
311
+ indicatorWidths,
312
+ thumbWidth,
313
+ trackLeft,
314
+ trackWidth
315
+ ]);
316
+ const startThumb = React.useCallback((index) => {
317
+ interaction.current.index = index;
318
+ }, []);
319
+ const formatters = React.useMemo(() => ({
320
+ getAccessibilityLabel,
321
+ getAccessibilityValueText,
322
+ getValueIndicatorLabel
323
+ }), [
324
+ getAccessibilityLabel,
325
+ getAccessibilityValueText,
326
+ getValueIndicatorLabel
327
+ ]);
328
+ const contextValue = React.useMemo(() => ({
329
+ values,
330
+ min,
331
+ max,
332
+ step,
333
+ allowedValues,
334
+ minStepsBetweenThumbs,
335
+ dir,
336
+ disabled,
337
+ readOnly,
338
+ invalid,
339
+ valueIndicatorTrigger: resolvedValueIndicatorTrigger,
340
+ dragging,
341
+ activeThumbIndex,
342
+ valueIndicatorEverShown,
343
+ classes,
344
+ getClasses,
345
+ trackRef,
346
+ dimensions,
347
+ registerThumb,
348
+ updateIndicatorWidth,
349
+ registerIndicator,
350
+ startThumb,
351
+ formatters,
352
+ interaction: interaction.current
353
+ }), [
354
+ activeThumbIndex,
355
+ allowedValues,
356
+ classes,
357
+ dimensions,
358
+ dir,
359
+ disabled,
360
+ dragging,
361
+ formatters,
362
+ getClasses,
363
+ invalid,
364
+ max,
365
+ min,
366
+ minStepsBetweenThumbs,
367
+ readOnly,
368
+ registerIndicator,
369
+ registerThumb,
370
+ resolvedValueIndicatorTrigger,
371
+ startThumb,
372
+ step,
373
+ updateIndicatorWidth,
374
+ valueIndicatorEverShown,
375
+ values
376
+ ]);
377
+ return <SliderContext.Provider value={contextValue}>
378
+ <view {...mergeProps(rootHandlers, nativeProps, { "consume-slide-event": consumeSlideEvent }, forwardedRef ? { ref: forwardedRef } : {})} className={clsx(classes.root, className)} style={style}>
379
+ {children}
380
+ </view>
381
+ </SliderContext.Provider>;
382
+ });
383
+ SliderRoot.displayName = "SliderRoot";
384
+ var SliderControl = React.forwardRef((props, ref) => {
385
+ const { children, className, ...nativeProps } = props;
386
+ const context = useSliderContext("Slider.Control");
387
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(context.classes.control, className)}>
388
+ {children}
389
+ </view>;
390
+ });
391
+ SliderControl.displayName = "SliderControl";
392
+ var SliderTrack = React.forwardRef((props, ref) => {
393
+ const { children, className, ...nativeProps } = props;
394
+ const context = useSliderContext("Slider.Track");
395
+ return <view {...mergeProps(ref ? { ref } : {}, { ref: context.trackRef }, nativeProps)} className={clsx(context.getClasses({
396
+ disabled: context.disabled,
397
+ dragging: context.dragging
398
+ }).track, className)}>
399
+ {children}
400
+ </view>;
401
+ });
402
+ SliderTrack.displayName = "SliderTrack";
403
+ var SliderRange = React.forwardRef((props, ref) => {
404
+ const { children: _children, className, style, ...nativeProps } = props;
405
+ const context = useSliderContext("Slider.Range");
406
+ const percentages = context.values.map((value) => percentageForValue(value, context.min, context.max));
407
+ const end = context.values.length > 1 ? Math.max(...percentages) : percentages[0] ?? 0;
408
+ const start = context.values.length > 1 ? Math.min(...percentages) : 0;
409
+ const left = context.dir === "ltr" ? start : 100 - end;
410
+ const width = Math.max(0, end - start);
411
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(context.getClasses({
412
+ disabled: context.disabled,
413
+ dragging: context.dragging
414
+ }).range, className)} style={dynamicStyle(style, {
415
+ "--slider-range-left": `${left}%`,
416
+ "--slider-range-width": `${width}%`
417
+ })} />;
418
+ });
419
+ SliderRange.displayName = "SliderRange";
420
+ var SliderThumb = React.forwardRef((props, forwardedRef) => {
421
+ const { children, index = 0, className, style, ...nativeProps } = props;
422
+ const context = useSliderContext("Slider.Thumb");
423
+ const value = context.values[index];
424
+ const localRef = React.useRef(null);
425
+ React.useEffect(() => {
426
+ context.registerThumb(index, localRef);
427
+ }, [context.registerThumb, index]);
428
+ if (value === void 0) return null;
429
+ const percent = percentageForValue(value, context.min, context.max);
430
+ const physicalPercent = context.dir === "ltr" ? percent : 100 - percent;
431
+ const offset = getThumbInBoundsOffset(context.dimensions.thumbWidth, physicalPercent, 1);
432
+ const accessibilityValue = context.formatters.getAccessibilityValueText?.(value, index) ?? `minimum ${context.min}, maximum ${context.max}, current ${value}`;
433
+ const { "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "adjustable", "accessibility-value": providedAccessibilityValue, "accessibility-traits": accessibilityTraits, ...restNativeProps } = nativeProps;
434
+ return <view {...mergeProps(forwardedRef ? { ref: forwardedRef } : {}, { ref: localRef }, restNativeProps, { bindtouchstart: () => context.startThumb(index) })} className={clsx(context.getClasses({
435
+ disabled: context.disabled,
436
+ dragging: context.dragging,
437
+ thumbDragging: context.dragging && context.activeThumbIndex === index
438
+ }).thumb, className)} style={dynamicStyle(style, {
439
+ "--slider-thumb-left": `${physicalPercent}%`,
440
+ "--slider-thumb-offset": `${offset}px`
441
+ })} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel ?? context.formatters.getAccessibilityLabel?.(index)} accessibility-role-description={accessibilityRoleDescription} accessibility-value={providedAccessibilityValue ?? accessibilityValue} accessibility-traits={context.disabled ? "disabled" : accessibilityTraits}>
442
+ {children}
443
+ </view>;
444
+ });
445
+ SliderThumb.displayName = "SliderThumb";
446
+ var SliderTick = React.forwardRef((props, ref) => {
447
+ const [variantProps, restProps] = sliderTick.splitVariantProps(props);
448
+ const { children: _children, className, style, value, ...nativeProps } = restProps;
449
+ const context = useSliderContext("Slider.Tick");
450
+ const percent = percentageForValue(value, context.min, context.max);
451
+ const physicalPercent = context.dir === "ltr" ? percent : 100 - percent;
452
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(sliderTick(variantProps), className)} style={dynamicStyle(style, {
453
+ "--slider-tick-left": `${physicalPercent}%`,
454
+ "--slider-tick-offset": `${getThumbInBoundsOffset(context.dimensions.thumbWidth, physicalPercent, 1)}px`
455
+ })} accessibility-elements-hidden={true} />;
456
+ });
457
+ SliderTick.displayName = "SliderTick";
458
+ var SliderMarkers = React.forwardRef((props, ref) => {
459
+ const { children, className, ...nativeProps } = props;
460
+ const context = useSliderContext("Slider.Markers");
461
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(context.getClasses({ disabled: context.disabled }).markers, className)}>
462
+ {children}
463
+ </view>;
464
+ });
465
+ SliderMarkers.displayName = "SliderMarkers";
466
+ var SliderMarker = React.forwardRef((props, ref) => {
467
+ const [variantProps, restProps] = sliderMarker.splitVariantProps(props);
468
+ const { children, className, style, value, ...nativeProps } = restProps;
469
+ const context = useSliderContext("Slider.Marker");
470
+ const percent = percentageForValue(value, context.min, context.max);
471
+ const physicalPercent = context.dir === "ltr" ? percent : 100 - percent;
472
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(sliderMarker({
473
+ ...variantProps,
474
+ dir: context.dir,
475
+ disabled: context.disabled
476
+ }), className)} style={dynamicStyle(style, {
477
+ "--slider-marker-left": `${physicalPercent}%`,
478
+ "--slider-marker-offset": percent === 0 || percent === 100 ? "0px" : `${getThumbInBoundsOffset(context.dimensions.thumbWidth, physicalPercent, 1)}px`
479
+ })} accessibility-elements-hidden={true}>
480
+ {children}
481
+ </view>;
482
+ });
483
+ SliderMarker.displayName = "SliderMarker";
484
+ var SliderValueIndicatorRoot = React.forwardRef((props, ref) => {
485
+ const { children, className, style, index = 0, bindlayoutchange: userBindLayoutChange, ...nativeProps } = props;
486
+ const context = useSliderContext("Slider.ValueIndicatorRoot");
487
+ const value = context.values[index];
488
+ const localRef = React.useRef(null);
489
+ React.useEffect(() => {
490
+ context.registerIndicator(index, localRef);
491
+ }, [
492
+ context.registerIndicator,
493
+ index,
494
+ value
495
+ ]);
496
+ const handleLayoutChange = React.useCallback((...args) => {
497
+ "background only";
498
+ userBindLayoutChange?.(...args);
499
+ const width = getLayoutWidth(args[0]);
500
+ if (width != null) context.updateIndicatorWidth(index, width);
501
+ }, [
502
+ context,
503
+ index,
504
+ userBindLayoutChange
505
+ ]);
506
+ if (value === void 0) return null;
507
+ const percent = percentageForValue(value, context.min, context.max);
508
+ const physicalPercent = context.dir === "ltr" ? percent : 100 - percent;
509
+ const thumbOffset = getThumbInBoundsOffset(context.dimensions.thumbWidth, physicalPercent, 1);
510
+ const indicatorOffset = getStickyLabelOffset(context.dimensions.indicatorWidths[index] ?? 0, physicalPercent, context.dimensions.thumbWidth, context.dimensions.trackWidth, 1);
511
+ const shown = context.dragging && context.activeThumbIndex === index;
512
+ const visible = !context.disabled && !context.readOnly && shown;
513
+ const classes = context.getClasses({
514
+ disabled: context.disabled,
515
+ dragging: context.dragging,
516
+ valueIndicatorShown: visible,
517
+ valueIndicatorEverShown: context.valueIndicatorEverShown
518
+ });
519
+ return <view className={classes.valueIndicatorMotion} style={dynamicStyle(void 0, {
520
+ "--slider-value-indicator-left": `${physicalPercent}%`,
521
+ "--slider-value-indicator-offset": `${indicatorOffset}px`,
522
+ "--slider-thumb-offset": `${thumbOffset}px`
523
+ })} accessibility-elements-hidden={true}>
524
+ <view {...mergeProps(nativeProps, ref ? { ref } : {}, { ref: localRef }, { bindlayoutchange: handleLayoutChange })} className={clsx(classes.valueIndicatorRoot, className)} style={style} accessibility-elements-hidden={true}>
525
+ {children}
526
+ </view>
527
+ </view>;
528
+ });
529
+ SliderValueIndicatorRoot.displayName = "SliderValueIndicatorRoot";
530
+ var SliderValueIndicatorArrow = React.forwardRef((props, ref) => {
531
+ const { children, className, ...nativeProps } = props;
532
+ const context = useSliderContext("Slider.ValueIndicatorArrow");
533
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(context.getClasses({
534
+ disabled: context.disabled,
535
+ dragging: context.dragging
536
+ }).valueIndicatorArrow, className)}>
537
+ {children}
538
+ </view>;
539
+ });
540
+ SliderValueIndicatorArrow.displayName = "SliderValueIndicatorArrow";
541
+ var SliderValueIndicatorArrowTip = React.forwardRef((props, ref) => {
542
+ const { children, className, ...nativeProps } = props;
543
+ const context = useSliderContext("Slider.ValueIndicatorArrowTip");
544
+ return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(context.getClasses({
545
+ disabled: context.disabled,
546
+ dragging: context.dragging
547
+ }).valueIndicatorArrowTip, className)}>
548
+ {children}
549
+ </view>;
550
+ });
551
+ SliderValueIndicatorArrowTip.displayName = "SliderValueIndicatorArrowTip";
552
+ var SliderValueIndicatorLabel = React.forwardRef((props, ref) => {
553
+ const { children, className, style, index = 0, ...nativeProps } = props;
554
+ const context = useSliderContext("Slider.ValueIndicatorLabel");
555
+ const value = context.values[index];
556
+ if (value === void 0) return null;
557
+ return <text {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(context.getClasses({
558
+ disabled: context.disabled,
559
+ dragging: context.dragging,
560
+ valueIndicatorEverShown: context.valueIndicatorEverShown
561
+ }).valueIndicatorLabel, className)} style={style}>
562
+ {children ?? context.formatters.getValueIndicatorLabel({
563
+ value,
564
+ thumbIndex: index
565
+ })}
566
+ </text>;
567
+ });
568
+ SliderValueIndicatorLabel.displayName = "SliderValueIndicatorLabel";
569
+ function clampRatio(value) {
570
+ return Math.min(1, Math.max(0, value));
571
+ }
572
+ //#endregion
573
+ export { SliderControl, SliderMarker, SliderMarkers, SliderRange, SliderRoot, SliderThumb, SliderTick, SliderTrack, SliderValueIndicatorArrow, SliderValueIndicatorArrowTip, SliderValueIndicatorLabel, SliderValueIndicatorRoot };
@@ -0,0 +1,2 @@
1
+ export { SliderRoot as Root, SliderControl as Control, SliderTrack as Track, SliderRange as Range, SliderThumb as Thumb, SliderTick as Tick, SliderMarkers as Markers, SliderMarker as Marker, SliderValueIndicatorRoot as ValueIndicatorRoot, SliderValueIndicatorArrow as ValueIndicatorArrow, SliderValueIndicatorArrowTip as ValueIndicatorArrowTip, SliderValueIndicatorLabel as ValueIndicatorLabel, type SliderRootProps as RootProps, type SliderControlProps as ControlProps, type SliderTrackProps as TrackProps, type SliderRangeProps as RangeProps, type SliderThumbProps as ThumbProps, type SliderTickProps as TickProps, type SliderMarkersProps as MarkersProps, type SliderMarkerProps as MarkerProps, type SliderValueIndicatorRootProps as ValueIndicatorRootProps, type SliderValueIndicatorArrowProps as ValueIndicatorArrowProps, type SliderValueIndicatorArrowTipProps as ValueIndicatorArrowTipProps, type SliderValueIndicatorLabelProps as ValueIndicatorLabelProps, } from './Slider';
2
+ //# sourceMappingURL=Slider.namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slider.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/Slider.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,IAAI,IAAI,EAClB,aAAa,IAAI,OAAO,EACxB,WAAW,IAAI,KAAK,EACpB,WAAW,IAAI,KAAK,EACpB,WAAW,IAAI,KAAK,EACpB,UAAU,IAAI,IAAI,EAClB,aAAa,IAAI,OAAO,EACxB,YAAY,IAAI,MAAM,EACtB,wBAAwB,IAAI,kBAAkB,EAC9C,yBAAyB,IAAI,mBAAmB,EAChD,4BAA4B,IAAI,sBAAsB,EACtD,yBAAyB,IAAI,mBAAmB,EAChD,KAAK,eAAe,IAAI,SAAS,EACjC,KAAK,kBAAkB,IAAI,YAAY,EACvC,KAAK,gBAAgB,IAAI,UAAU,EACnC,KAAK,gBAAgB,IAAI,UAAU,EACnC,KAAK,gBAAgB,IAAI,UAAU,EACnC,KAAK,eAAe,IAAI,SAAS,EACjC,KAAK,kBAAkB,IAAI,YAAY,EACvC,KAAK,iBAAiB,IAAI,WAAW,EACrC,KAAK,6BAA6B,IAAI,uBAAuB,EAC7D,KAAK,8BAA8B,IAAI,wBAAwB,EAC/D,KAAK,iCAAiC,IAAI,2BAA2B,EACrE,KAAK,8BAA8B,IAAI,wBAAwB,GAChE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+ import { SliderControl, SliderMarker, SliderMarkers, SliderRange, SliderRoot, SliderThumb, SliderTick, SliderTrack, SliderValueIndicatorArrow, SliderValueIndicatorArrowTip, SliderValueIndicatorLabel, SliderValueIndicatorRoot } from "./Slider.jsx";
3
+ //#region src/components/Slider/Slider.namespace.ts
4
+ var Slider_namespace_exports = /* @__PURE__ */ __exportAll({
5
+ Control: () => SliderControl,
6
+ Marker: () => SliderMarker,
7
+ Markers: () => SliderMarkers,
8
+ Range: () => SliderRange,
9
+ Root: () => SliderRoot,
10
+ Thumb: () => SliderThumb,
11
+ Tick: () => SliderTick,
12
+ Track: () => SliderTrack,
13
+ ValueIndicatorArrow: () => SliderValueIndicatorArrow,
14
+ ValueIndicatorArrowTip: () => SliderValueIndicatorArrowTip,
15
+ ValueIndicatorLabel: () => SliderValueIndicatorLabel,
16
+ ValueIndicatorRoot: () => SliderValueIndicatorRoot
17
+ });
18
+ //#endregion
19
+ export { Slider_namespace_exports };
@@ -0,0 +1,19 @@
1
+ export interface SliderGeometry {
2
+ left: number;
3
+ width: number;
4
+ }
5
+ export declare function clamp(value: number, min: number, max: number): number;
6
+ export declare function percentageForValue(value: number, min: number, max: number): number;
7
+ export declare function valueForPercentage(percent: number, min: number, max: number, dir: "ltr" | "rtl"): number;
8
+ export declare function decimalCount(value: number): number;
9
+ export declare function roundValue(value: number, decimals: number): number;
10
+ export declare function closestAllowedValue(value: number, allowedValues: readonly number[]): number;
11
+ export declare function normalizeValue(value: number, min: number, max: number, step: number, allowedValues?: readonly number[]): number;
12
+ export declare function normalizeValues(values: readonly number[] | undefined, min: number, max: number, step: number, allowedValues?: readonly number[]): number[];
13
+ export declare function nearestValueIndex(values: readonly number[], value: number): number;
14
+ export declare function hasMinimumSteps(values: readonly number[], minimumSteps: number, step: number): boolean;
15
+ export declare function getThumbInBoundsOffset(width: number, percent: number, direction: 1 | -1): number;
16
+ export declare function getStickyLabelOffset(labelWidth: number, percent: number, thumbWidth: number, trackWidth: number, direction: 1 | -1): number;
17
+ export declare function eventPageX(event: unknown): number;
18
+ export declare function geometryFromRect(value: unknown): SliderGeometry | null;
19
+ //# sourceMappingURL=Slider.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slider.utils.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/Slider.utils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGlF;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,KAAK,GAAG,KAAK,GACjB,MAAM,CAGR;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGlE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAa3F;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,GAChC,MAAM,CAcR;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACrC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,GAChC,MAAM,EAAE,CAKV;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAYlF;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,GACX,OAAO,CAUT;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAKhG;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,GAChB,MAAM,CAOR;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBjD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAKtE"}