@xaui/native 0.0.21 → 0.0.24

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 (113) hide show
  1. package/README.md +195 -2
  2. package/dist/alert/index.js +1 -2
  3. package/dist/app-bar/index.cjs +217 -0
  4. package/dist/app-bar/index.d.cts +52 -0
  5. package/dist/app-bar/index.d.ts +52 -0
  6. package/dist/app-bar/index.js +142 -0
  7. package/dist/autocomplete/index.js +48 -36
  8. package/dist/avatar/index.js +1 -2
  9. package/dist/badge/index.js +1 -2
  10. package/dist/bottom-sheet/index.js +1 -2
  11. package/dist/bottom-tab-bar/index.cjs +571 -0
  12. package/dist/bottom-tab-bar/index.d.cts +211 -0
  13. package/dist/bottom-tab-bar/index.d.ts +211 -0
  14. package/dist/bottom-tab-bar/index.js +497 -0
  15. package/dist/button/index.d.cts +102 -5
  16. package/dist/button/index.d.ts +102 -5
  17. package/dist/button/index.js +2 -3
  18. package/dist/button.type-j1ZdkkSl.d.cts +4 -0
  19. package/dist/button.type-j1ZdkkSl.d.ts +4 -0
  20. package/dist/card/index.cjs +2 -0
  21. package/dist/card/index.d.cts +6 -1
  22. package/dist/card/index.d.ts +6 -1
  23. package/dist/card/index.js +4 -2
  24. package/dist/carousel/index.js +1 -1
  25. package/dist/chart/index.cjs +1067 -0
  26. package/dist/chart/index.d.cts +218 -0
  27. package/dist/chart/index.d.ts +218 -0
  28. package/dist/chart/index.js +1026 -0
  29. package/dist/checkbox/index.js +1 -2
  30. package/dist/chip/index.js +1 -2
  31. package/dist/chunk-3XSXTM3G.js +661 -0
  32. package/dist/chunk-4KSZLONZ.js +79 -0
  33. package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
  34. package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
  35. package/dist/chunk-I4V5Y5GD.js +76 -0
  36. package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
  37. package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
  38. package/dist/chunk-URBEEDFX.js +79 -0
  39. package/dist/core/index.js +3 -5
  40. package/dist/datepicker/index.js +1 -2
  41. package/dist/divider/index.js +2 -3
  42. package/dist/drawer/index.cjs +310 -0
  43. package/dist/drawer/index.d.cts +58 -0
  44. package/dist/drawer/index.d.ts +58 -0
  45. package/dist/drawer/index.js +236 -0
  46. package/dist/{accordion → expansion-panel}/index.cjs +45 -45
  47. package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
  48. package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
  49. package/dist/{accordion → expansion-panel}/index.js +40 -41
  50. package/dist/fab/index.d.cts +3 -3
  51. package/dist/fab/index.d.ts +3 -3
  52. package/dist/fab/index.js +3 -4
  53. package/dist/fab-menu/index.d.cts +2 -2
  54. package/dist/fab-menu/index.d.ts +2 -2
  55. package/dist/fab-menu/index.js +3 -4
  56. package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
  57. package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
  58. package/dist/feature-discovery/index.cjs +531 -0
  59. package/dist/feature-discovery/index.d.cts +82 -0
  60. package/dist/feature-discovery/index.d.ts +82 -0
  61. package/dist/feature-discovery/index.js +464 -0
  62. package/dist/indicator/index.js +2 -3
  63. package/dist/input/index.cjs +258 -164
  64. package/dist/input/index.d.cts +15 -1
  65. package/dist/input/index.d.ts +15 -1
  66. package/dist/input/index.js +219 -126
  67. package/dist/list/index.js +1 -2
  68. package/dist/menu/index.js +2 -2
  69. package/dist/menubox/index.cjs +369 -0
  70. package/dist/menubox/index.d.cts +98 -0
  71. package/dist/menubox/index.d.ts +98 -0
  72. package/dist/menubox/index.js +296 -0
  73. package/dist/pager/index.cjs +243 -0
  74. package/dist/pager/index.d.cts +93 -0
  75. package/dist/pager/index.d.ts +93 -0
  76. package/dist/pager/index.js +205 -0
  77. package/dist/progress/index.js +1 -2
  78. package/dist/radio/index.cjs +537 -0
  79. package/dist/radio/index.d.cts +145 -0
  80. package/dist/radio/index.d.ts +145 -0
  81. package/dist/radio/index.js +464 -0
  82. package/dist/segment-button/index.js +2 -2
  83. package/dist/select/index.js +22 -10
  84. package/dist/skeleton/index.js +2 -2
  85. package/dist/slider/index.cjs +655 -0
  86. package/dist/slider/index.d.cts +171 -0
  87. package/dist/slider/index.d.ts +171 -0
  88. package/dist/slider/index.js +575 -0
  89. package/dist/stepper/index.cjs +624 -0
  90. package/dist/stepper/index.d.cts +137 -0
  91. package/dist/stepper/index.d.ts +137 -0
  92. package/dist/stepper/index.js +549 -0
  93. package/dist/switch/index.js +1 -2
  94. package/dist/tabs/index.cjs +523 -0
  95. package/dist/tabs/index.d.cts +176 -0
  96. package/dist/tabs/index.d.ts +176 -0
  97. package/dist/tabs/index.js +438 -0
  98. package/dist/timepicker/index.cjs +1280 -0
  99. package/dist/timepicker/index.d.cts +215 -0
  100. package/dist/timepicker/index.d.ts +215 -0
  101. package/dist/timepicker/index.js +1181 -0
  102. package/dist/toolbar/index.cjs +395 -0
  103. package/dist/toolbar/index.d.cts +100 -0
  104. package/dist/toolbar/index.d.ts +100 -0
  105. package/dist/toolbar/index.js +325 -0
  106. package/dist/typography/index.js +1 -2
  107. package/dist/view/index.cjs +16 -2
  108. package/dist/view/index.js +16 -2
  109. package/package.json +73 -8
  110. package/dist/button.type-D8tzEBo7.d.ts +0 -104
  111. package/dist/button.type-ikaWzhIg.d.cts +0 -104
  112. package/dist/chunk-GBHQCAKW.js +0 -19
  113. package/dist/chunk-JEGEPGVU.js +0 -287
@@ -0,0 +1,655 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/slider/index.ts
31
+ var slider_exports = {};
32
+ __export(slider_exports, {
33
+ Slider: () => Slider
34
+ });
35
+ module.exports = __toCommonJS(slider_exports);
36
+
37
+ // src/components/slider/slider.tsx
38
+ var import_react7 = __toESM(require("react"), 1);
39
+ var import_react_native6 = require("react-native");
40
+
41
+ // src/core/theme-context.tsx
42
+ var import_react4 = __toESM(require("react"), 1);
43
+ var import_react_native2 = require("react-native");
44
+ var import_theme = require("@xaui/core/theme");
45
+ var import_palette = require("@xaui/core/palette");
46
+
47
+ // src/core/portal/portal.tsx
48
+ var import_react2 = require("react");
49
+
50
+ // src/core/portal/portal-context.ts
51
+ var import_react = require("react");
52
+ var PortalContext = (0, import_react.createContext)(null);
53
+
54
+ // src/core/portal/portal-host.tsx
55
+ var import_react3 = __toESM(require("react"), 1);
56
+ var import_react_native = require("react-native");
57
+ var hostStyles = import_react_native.StyleSheet.create({
58
+ container: {
59
+ flex: 1
60
+ }
61
+ });
62
+
63
+ // src/core/theme-context.tsx
64
+ var XUIThemeContext = (0, import_react4.createContext)(null);
65
+
66
+ // src/core/theme-hooks.ts
67
+ var import_react5 = require("react");
68
+ var import_react_native3 = require("react-native");
69
+ function useXUITheme() {
70
+ const theme = (0, import_react5.useContext)(XUIThemeContext);
71
+ if (!theme) {
72
+ throw new Error("useXUITheme must be used within XUIProvider");
73
+ }
74
+ return theme;
75
+ }
76
+ function useBorderRadiusStyles(radius) {
77
+ const theme = useXUITheme();
78
+ const borderRadius = (0, import_react5.useMemo)(() => {
79
+ const radiusMap = {
80
+ none: theme.borderRadius.none,
81
+ sm: theme.borderRadius.sm,
82
+ md: theme.borderRadius.md,
83
+ lg: theme.borderRadius.lg,
84
+ full: theme.borderRadius.full
85
+ };
86
+ return { borderRadius: radiusMap[radius] };
87
+ }, [radius, theme]);
88
+ return borderRadius;
89
+ }
90
+
91
+ // src/core/index.ts
92
+ var import_theme2 = require("@xaui/core/theme");
93
+
94
+ // src/components/slider/slider.animation.ts
95
+ var import_react_native4 = require("react-native");
96
+ var runSliderThumbPressInAnimation = (scale) => {
97
+ import_react_native4.Animated.spring(scale, {
98
+ toValue: 1.08,
99
+ friction: 6,
100
+ tension: 120,
101
+ useNativeDriver: false
102
+ }).start();
103
+ };
104
+ var runSliderThumbPressOutAnimation = (scale) => {
105
+ import_react_native4.Animated.spring(scale, {
106
+ toValue: 1,
107
+ friction: 6,
108
+ tension: 120,
109
+ useNativeDriver: false
110
+ }).start();
111
+ };
112
+
113
+ // src/components/slider/slider.hook.ts
114
+ var import_react6 = require("react");
115
+ var import_core = require("@xaui/core");
116
+ function useSliderSizeStyles(size) {
117
+ const theme = useXUITheme();
118
+ return (0, import_react6.useMemo)(() => {
119
+ const sizes = {
120
+ xs: {
121
+ trackThickness: 4,
122
+ thumbSize: 14,
123
+ stepDotSize: 4,
124
+ markOffset: 12,
125
+ fontSize: theme.fontSizes.xs
126
+ },
127
+ sm: {
128
+ trackThickness: 6,
129
+ thumbSize: 16,
130
+ stepDotSize: 5,
131
+ markOffset: 14,
132
+ fontSize: theme.fontSizes.sm
133
+ },
134
+ md: {
135
+ trackThickness: 8,
136
+ thumbSize: 20,
137
+ stepDotSize: 6,
138
+ markOffset: 16,
139
+ fontSize: theme.fontSizes.md
140
+ },
141
+ lg: {
142
+ trackThickness: 10,
143
+ thumbSize: 24,
144
+ stepDotSize: 7,
145
+ markOffset: 18,
146
+ fontSize: theme.fontSizes.lg
147
+ }
148
+ };
149
+ return sizes[size];
150
+ }, [size, theme]);
151
+ }
152
+ function useSliderColorStyles(color, isDisabled) {
153
+ const theme = useXUITheme();
154
+ const safeColor = (0, import_core.getSafeThemeColor)(color);
155
+ const palette = theme.colors[safeColor];
156
+ const fillColor = (0, import_core.withPaletteNumber)(palette.main, 400);
157
+ return (0, import_react6.useMemo)(() => {
158
+ if (isDisabled) {
159
+ return {
160
+ trackColor: `${theme.colors.default.main}30`,
161
+ fillColor: `${theme.colors.default.main}55`,
162
+ thumbColor: `${theme.colors.default.main}85`,
163
+ valueColor: `${theme.colors.foreground}85`,
164
+ labelColor: `${theme.colors.foreground}85`,
165
+ stepColor: `${theme.colors.default.main}50`,
166
+ activeStepColor: `${theme.colors.default.main}75`,
167
+ markColor: `${theme.colors.foreground}80`
168
+ };
169
+ }
170
+ return {
171
+ trackColor: `${palette.main}28`,
172
+ fillColor,
173
+ thumbColor: fillColor,
174
+ valueColor: theme.colors.foreground,
175
+ labelColor: theme.colors.foreground,
176
+ stepColor: `${palette.main}40`,
177
+ activeStepColor: fillColor,
178
+ markColor: `${theme.colors.foreground}90`
179
+ };
180
+ }, [fillColor, isDisabled, palette.main, theme.colors]);
181
+ }
182
+
183
+ // src/components/slider/slider.style.ts
184
+ var import_react_native5 = require("react-native");
185
+ var styles = import_react_native5.StyleSheet.create({
186
+ container: {
187
+ width: "100%"
188
+ },
189
+ header: {
190
+ flexDirection: "row",
191
+ alignItems: "center",
192
+ justifyContent: "space-between",
193
+ marginBottom: 10
194
+ },
195
+ row: {
196
+ flexDirection: "row",
197
+ alignItems: "center",
198
+ gap: 10,
199
+ width: "100%"
200
+ },
201
+ verticalRow: {
202
+ flexDirection: "column",
203
+ alignItems: "center",
204
+ justifyContent: "center",
205
+ gap: 10
206
+ },
207
+ trackContainer: {
208
+ flex: 1,
209
+ justifyContent: "center",
210
+ position: "relative"
211
+ },
212
+ verticalTrackContainer: {
213
+ height: 220,
214
+ justifyContent: "center",
215
+ alignItems: "center"
216
+ },
217
+ track: {
218
+ width: "100%",
219
+ overflow: "hidden"
220
+ },
221
+ verticalTrack: {
222
+ width: 8,
223
+ height: "100%"
224
+ },
225
+ fill: {
226
+ position: "absolute",
227
+ left: 0,
228
+ top: 0
229
+ },
230
+ verticalFill: {
231
+ left: 0,
232
+ bottom: 0,
233
+ top: void 0
234
+ },
235
+ thumb: {
236
+ position: "absolute",
237
+ justifyContent: "center",
238
+ alignItems: "center"
239
+ },
240
+ mark: {
241
+ position: "absolute",
242
+ alignItems: "center"
243
+ },
244
+ stepDot: {
245
+ position: "absolute",
246
+ borderRadius: 999
247
+ },
248
+ disabled: {
249
+ opacity: 0.55
250
+ },
251
+ label: {
252
+ fontWeight: "600"
253
+ },
254
+ value: {
255
+ fontWeight: "500"
256
+ },
257
+ markLabel: {
258
+ marginTop: 6,
259
+ fontSize: 12
260
+ }
261
+ });
262
+
263
+ // src/components/slider/slider.tsx
264
+ var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
265
+ var roundToStep = (value, min, step) => {
266
+ const safeStep = step <= 0 ? 1 : step;
267
+ return Math.round((value - min) / safeStep) * safeStep + min;
268
+ };
269
+ var valueToPercent = (value, min, max) => {
270
+ const range = max - min;
271
+ if (range <= 0) return 0;
272
+ return (value - min) / range * 100;
273
+ };
274
+ var percentToValue = (percent, min, max, step) => {
275
+ const raw = min + (max - min) * percent / 100;
276
+ return clamp(roundToStep(raw, min, step), min, max);
277
+ };
278
+ var getInitialValue = ({
279
+ value,
280
+ defaultValue,
281
+ minValue,
282
+ maxValue
283
+ }) => {
284
+ if (value !== void 0) return clamp(value, minValue, maxValue);
285
+ if (defaultValue !== void 0) return clamp(defaultValue, minValue, maxValue);
286
+ return minValue;
287
+ };
288
+ var getRelativePosition = (location, trackLength, orientation) => {
289
+ if (trackLength <= 0) return 0;
290
+ const ratio = clamp(location / trackLength, 0, 1);
291
+ return orientation === "vertical" ? (1 - ratio) * 100 : ratio * 100;
292
+ };
293
+ var renderMarkLabel = (mark) => {
294
+ if (mark.label === void 0) return null;
295
+ return mark.label;
296
+ };
297
+ var getPixelPosition = (percent, length) => {
298
+ if (length <= 0) return 0;
299
+ return clamp(percent, 0, 100) / 100 * length;
300
+ };
301
+ var Slider = ({
302
+ value: controlledValue,
303
+ defaultValue,
304
+ minValue = 0,
305
+ maxValue = 100,
306
+ step = 1,
307
+ label,
308
+ showValueLabel = false,
309
+ formatOptions,
310
+ marks,
311
+ showSteps = false,
312
+ orientation = "horizontal",
313
+ size = "md",
314
+ color = "primary",
315
+ radius = "full",
316
+ startContent,
317
+ endContent,
318
+ isDisabled = false,
319
+ isReadOnly = false,
320
+ trackLength,
321
+ onChange,
322
+ onChangeEnd,
323
+ customAppearance
324
+ }) => {
325
+ const isControlled = controlledValue !== void 0;
326
+ const [internalValue, setInternalValue] = (0, import_react7.useState)(
327
+ getInitialValue({
328
+ value: controlledValue,
329
+ defaultValue,
330
+ minValue,
331
+ maxValue
332
+ })
333
+ );
334
+ const [measuredTrackLength, setMeasuredTrackLength] = (0, import_react7.useState)(
335
+ trackLength && trackLength > 0 ? trackLength : 0
336
+ );
337
+ const currentValue = isControlled ? clamp(controlledValue, minValue, maxValue) : internalValue;
338
+ const sizeStyles = useSliderSizeStyles(size);
339
+ const colorStyles = useSliderColorStyles(color, isDisabled);
340
+ const radiusStyles = useBorderRadiusStyles(radius);
341
+ const theme = useXUITheme();
342
+ const thumbScale = (0, import_react7.useRef)(new import_react_native6.Animated.Value(1)).current;
343
+ const initialTouchTrackPosition = (0, import_react7.useRef)(0);
344
+ const animatedTrackPosition = (0, import_react7.useRef)(new import_react_native6.Animated.Value(0)).current;
345
+ const isDragging = (0, import_react7.useRef)(false);
346
+ const currentValueRef = (0, import_react7.useRef)(currentValue);
347
+ currentValueRef.current = currentValue;
348
+ const onChangeEndRef = (0, import_react7.useRef)(onChangeEnd);
349
+ onChangeEndRef.current = onChangeEnd;
350
+ const thumbOverlapInset = Math.max(
351
+ 0,
352
+ (sizeStyles.thumbSize - sizeStyles.trackThickness) / 2
353
+ );
354
+ const formattedValue = (0, import_react7.useMemo)(() => {
355
+ try {
356
+ return new Intl.NumberFormat(void 0, formatOptions).format(currentValue);
357
+ } catch {
358
+ return String(currentValue);
359
+ }
360
+ }, [currentValue, formatOptions]);
361
+ const activePercent = valueToPercent(currentValue, minValue, maxValue);
362
+ const effectiveTrackLength = trackLength && trackLength > 0 ? trackLength : measuredTrackLength;
363
+ const thumbCenterPosition = getPixelPosition(activePercent, effectiveTrackLength);
364
+ const trackContainerLengthStyle = orientation === "vertical" ? {
365
+ height: (trackLength && trackLength > 0 ? trackLength : 220) + thumbOverlapInset * 2
366
+ } : trackLength && trackLength > 0 ? { width: trackLength + thumbOverlapInset * 2 } : null;
367
+ (0, import_react7.useEffect)(() => {
368
+ if (!isDragging.current && effectiveTrackLength > 0) {
369
+ animatedTrackPosition.setValue(
370
+ clamp(thumbCenterPosition, 0, effectiveTrackLength)
371
+ );
372
+ }
373
+ }, [thumbCenterPosition, effectiveTrackLength, animatedTrackPosition]);
374
+ const animatedFillSize = (0, import_react7.useMemo)(() => {
375
+ const safeLength = Math.max(effectiveTrackLength, 1);
376
+ return animatedTrackPosition.interpolate({
377
+ inputRange: [0, safeLength],
378
+ outputRange: [0, safeLength],
379
+ extrapolate: "clamp"
380
+ });
381
+ }, [animatedTrackPosition, effectiveTrackLength]);
382
+ const animatedThumbOffset = (0, import_react7.useMemo)(() => {
383
+ const base = thumbOverlapInset - sizeStyles.thumbSize / 2;
384
+ const safeLength = Math.max(effectiveTrackLength, 1);
385
+ return animatedTrackPosition.interpolate({
386
+ inputRange: [0, safeLength],
387
+ outputRange: [base, safeLength + base],
388
+ extrapolate: "clamp"
389
+ });
390
+ }, [
391
+ animatedTrackPosition,
392
+ effectiveTrackLength,
393
+ thumbOverlapInset,
394
+ sizeStyles.thumbSize
395
+ ]);
396
+ const setValue = (0, import_react7.useCallback)(
397
+ (nextValue) => {
398
+ if (!isControlled) {
399
+ setInternalValue(nextValue);
400
+ }
401
+ onChange?.(nextValue);
402
+ },
403
+ [isControlled, onChange]
404
+ );
405
+ const setValueFromPosition = (0, import_react7.useCallback)(
406
+ (position) => {
407
+ const nextPercent = getRelativePosition(
408
+ position,
409
+ effectiveTrackLength,
410
+ orientation
411
+ );
412
+ const nextValue = percentToValue(nextPercent, minValue, maxValue, step);
413
+ setValue(nextValue);
414
+ return nextValue;
415
+ },
416
+ [effectiveTrackLength, maxValue, minValue, orientation, setValue, step]
417
+ );
418
+ const isInteractive = !isDisabled && !isReadOnly;
419
+ const panResponder = (0, import_react7.useMemo)(
420
+ () => import_react_native6.PanResponder.create({
421
+ onStartShouldSetPanResponder: () => isInteractive,
422
+ onMoveShouldSetPanResponder: (_evt, gs) => {
423
+ if (!isInteractive) return false;
424
+ return orientation === "horizontal" ? Math.abs(gs.dx) >= Math.abs(gs.dy) : Math.abs(gs.dy) >= Math.abs(gs.dx);
425
+ },
426
+ onPanResponderTerminationRequest: () => !isDragging.current,
427
+ onPanResponderGrant: (event) => {
428
+ if (!isInteractive) return;
429
+ isDragging.current = true;
430
+ runSliderThumbPressInAnimation(thumbScale);
431
+ const point = orientation === "vertical" ? event.nativeEvent.locationY : event.nativeEvent.locationX;
432
+ const rawPosition = point - thumbOverlapInset;
433
+ initialTouchTrackPosition.current = rawPosition;
434
+ const clamped = clamp(rawPosition, 0, effectiveTrackLength);
435
+ animatedTrackPosition.setValue(
436
+ orientation === "vertical" ? effectiveTrackLength - clamped : clamped
437
+ );
438
+ setValueFromPosition(rawPosition);
439
+ },
440
+ onPanResponderMove: (_event, gestureState) => {
441
+ if (!isInteractive) return;
442
+ const delta = orientation === "vertical" ? gestureState.dy : gestureState.dx;
443
+ const rawPosition = initialTouchTrackPosition.current + delta;
444
+ const clamped = clamp(rawPosition, 0, effectiveTrackLength);
445
+ animatedTrackPosition.setValue(
446
+ orientation === "vertical" ? effectiveTrackLength - clamped : clamped
447
+ );
448
+ setValueFromPosition(rawPosition);
449
+ },
450
+ onPanResponderRelease: (_event, gestureState) => {
451
+ isDragging.current = false;
452
+ runSliderThumbPressOutAnimation(thumbScale);
453
+ if (!isInteractive) return;
454
+ const delta = orientation === "vertical" ? gestureState.dy : gestureState.dx;
455
+ const nextValue = setValueFromPosition(
456
+ initialTouchTrackPosition.current + delta
457
+ );
458
+ const snappedPercent = valueToPercent(nextValue, minValue, maxValue);
459
+ animatedTrackPosition.setValue(
460
+ getPixelPosition(snappedPercent, effectiveTrackLength)
461
+ );
462
+ onChangeEndRef.current?.(nextValue);
463
+ },
464
+ onPanResponderTerminate: () => {
465
+ isDragging.current = false;
466
+ runSliderThumbPressOutAnimation(thumbScale);
467
+ const val = currentValueRef.current;
468
+ const pct = valueToPercent(val, minValue, maxValue);
469
+ animatedTrackPosition.setValue(getPixelPosition(pct, effectiveTrackLength));
470
+ onChangeEndRef.current?.(val);
471
+ }
472
+ }),
473
+ [
474
+ animatedTrackPosition,
475
+ effectiveTrackLength,
476
+ isInteractive,
477
+ minValue,
478
+ maxValue,
479
+ orientation,
480
+ setValueFromPosition,
481
+ thumbScale,
482
+ thumbOverlapInset
483
+ ]
484
+ );
485
+ const handleTrackLayout = (0, import_react7.useCallback)(
486
+ (event) => {
487
+ if (trackLength && trackLength > 0) return;
488
+ const nextLength = orientation === "vertical" ? event.nativeEvent.layout.height : event.nativeEvent.layout.width;
489
+ setMeasuredTrackLength(nextLength);
490
+ },
491
+ [orientation, trackLength]
492
+ );
493
+ const steps = (0, import_react7.useMemo)(() => {
494
+ if (!showSteps || step <= 0 || maxValue <= minValue) return [];
495
+ const count = Math.floor((maxValue - minValue) / step);
496
+ if (count > 200) return [];
497
+ return Array.from({ length: count + 1 }, (_, index) => minValue + index * step);
498
+ }, [maxValue, minValue, showSteps, step]);
499
+ return /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: [styles.container, customAppearance?.container] }, (label !== void 0 || showValueLabel) && /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: [styles.header, customAppearance?.header] }, label !== void 0 ? /* @__PURE__ */ import_react7.default.createElement(
500
+ import_react_native6.Text,
501
+ {
502
+ style: [
503
+ styles.label,
504
+ { color: colorStyles.labelColor, fontSize: sizeStyles.fontSize },
505
+ customAppearance?.label
506
+ ]
507
+ },
508
+ label
509
+ ) : /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, null), showValueLabel && /* @__PURE__ */ import_react7.default.createElement(
510
+ import_react_native6.Text,
511
+ {
512
+ style: [
513
+ styles.value,
514
+ { color: colorStyles.valueColor, fontSize: sizeStyles.fontSize },
515
+ customAppearance?.value
516
+ ]
517
+ },
518
+ formattedValue
519
+ )), /* @__PURE__ */ import_react7.default.createElement(
520
+ import_react_native6.View,
521
+ {
522
+ style: [
523
+ orientation === "vertical" ? styles.verticalRow : styles.row,
524
+ (isDisabled || isReadOnly) && styles.disabled
525
+ ]
526
+ },
527
+ startContent,
528
+ /* @__PURE__ */ import_react7.default.createElement(
529
+ import_react_native6.View,
530
+ {
531
+ ...panResponder.panHandlers,
532
+ style: [
533
+ styles.trackContainer,
534
+ orientation === "vertical" && styles.verticalTrackContainer,
535
+ {
536
+ padding: thumbOverlapInset
537
+ },
538
+ trackContainerLengthStyle,
539
+ customAppearance?.trackContainer
540
+ ]
541
+ },
542
+ /* @__PURE__ */ import_react7.default.createElement(
543
+ import_react_native6.View,
544
+ {
545
+ onLayout: handleTrackLayout,
546
+ style: [
547
+ styles.track,
548
+ orientation === "vertical" && styles.verticalTrack,
549
+ {
550
+ borderRadius: radiusStyles.borderRadius,
551
+ backgroundColor: colorStyles.trackColor,
552
+ height: orientation === "vertical" ? "100%" : sizeStyles.trackThickness,
553
+ width: orientation === "vertical" ? sizeStyles.trackThickness : "100%"
554
+ },
555
+ customAppearance?.track
556
+ ]
557
+ },
558
+ /* @__PURE__ */ import_react7.default.createElement(
559
+ import_react_native6.Animated.View,
560
+ {
561
+ style: [
562
+ styles.fill,
563
+ orientation === "vertical" && styles.verticalFill,
564
+ {
565
+ backgroundColor: colorStyles.fillColor,
566
+ height: orientation === "vertical" ? effectiveTrackLength > 0 ? animatedFillSize : `${activePercent}%` : sizeStyles.trackThickness,
567
+ width: orientation === "vertical" ? sizeStyles.trackThickness : effectiveTrackLength > 0 ? animatedFillSize : `${activePercent}%`
568
+ },
569
+ customAppearance?.fill
570
+ ]
571
+ }
572
+ ),
573
+ showSteps && steps.map((stepValue) => {
574
+ const percent = valueToPercent(stepValue, minValue, maxValue);
575
+ const isActive = stepValue <= currentValue;
576
+ return /* @__PURE__ */ import_react7.default.createElement(
577
+ import_react_native6.View,
578
+ {
579
+ key: `step-${stepValue}`,
580
+ style: [
581
+ styles.stepDot,
582
+ {
583
+ width: sizeStyles.stepDotSize,
584
+ height: sizeStyles.stepDotSize,
585
+ backgroundColor: isActive ? colorStyles.activeStepColor : colorStyles.stepColor,
586
+ left: orientation === "vertical" ? (sizeStyles.trackThickness - sizeStyles.stepDotSize) / 2 : getPixelPosition(percent, effectiveTrackLength) - sizeStyles.stepDotSize / 2,
587
+ bottom: orientation === "vertical" ? getPixelPosition(percent, effectiveTrackLength) - sizeStyles.stepDotSize / 2 : (sizeStyles.trackThickness - sizeStyles.stepDotSize) / 2
588
+ },
589
+ customAppearance?.step,
590
+ isActive && customAppearance?.activeStep
591
+ ]
592
+ }
593
+ );
594
+ })
595
+ ),
596
+ /* @__PURE__ */ import_react7.default.createElement(
597
+ import_react_native6.Animated.View,
598
+ {
599
+ pointerEvents: "none",
600
+ style: [
601
+ styles.thumb,
602
+ {
603
+ width: sizeStyles.thumbSize,
604
+ height: sizeStyles.thumbSize,
605
+ borderRadius: sizeStyles.thumbSize / 2,
606
+ left: orientation === "vertical" ? 0 : animatedThumbOffset,
607
+ top: orientation === "vertical" ? void 0 : 0,
608
+ bottom: orientation === "vertical" ? animatedThumbOffset : void 0,
609
+ backgroundColor: theme.colors.background,
610
+ borderWidth: 2,
611
+ borderColor: colorStyles.fillColor,
612
+ ...theme.shadows.md,
613
+ transform: [{ scale: thumbScale }]
614
+ },
615
+ customAppearance?.thumb
616
+ ]
617
+ }
618
+ ),
619
+ marks?.map((mark) => {
620
+ const percent = valueToPercent(mark.value, minValue, maxValue);
621
+ return /* @__PURE__ */ import_react7.default.createElement(
622
+ import_react_native6.View,
623
+ {
624
+ key: `mark-${mark.value}`,
625
+ style: [
626
+ styles.mark,
627
+ {
628
+ left: orientation === "vertical" ? thumbOverlapInset + sizeStyles.trackThickness + 8 : thumbOverlapInset + getPixelPosition(percent, effectiveTrackLength) - 10,
629
+ top: orientation === "vertical" ? void 0 : thumbOverlapInset + sizeStyles.trackThickness,
630
+ bottom: orientation === "vertical" ? thumbOverlapInset + getPixelPosition(percent, effectiveTrackLength) - 8 : void 0
631
+ },
632
+ customAppearance?.mark
633
+ ]
634
+ },
635
+ /* @__PURE__ */ import_react7.default.createElement(
636
+ import_react_native6.Text,
637
+ {
638
+ style: [
639
+ styles.markLabel,
640
+ { color: colorStyles.markColor },
641
+ customAppearance?.markLabel
642
+ ]
643
+ },
644
+ renderMarkLabel(mark)
645
+ )
646
+ );
647
+ })
648
+ ),
649
+ endContent
650
+ ));
651
+ };
652
+ // Annotate the CommonJS export names for ESM import in node:
653
+ 0 && (module.exports = {
654
+ Slider
655
+ });