@xaui/native 0.0.26 → 0.0.28
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.
- package/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +59 -127
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +7 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
package/dist/slider/index.cjs
CHANGED
|
@@ -1,100 +1,22 @@
|
|
|
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);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-HSPTLUFA.cjs');
|
|
29
2
|
|
|
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
3
|
|
|
37
|
-
// src/components/slider/slider.tsx
|
|
38
|
-
var import_react7 = __toESM(require("react"), 1);
|
|
39
|
-
var import_react_native6 = require("react-native");
|
|
40
4
|
|
|
41
|
-
|
|
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");
|
|
5
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
46
6
|
|
|
47
|
-
// src/
|
|
48
|
-
var
|
|
7
|
+
// src/components/slider/slider.tsx
|
|
8
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
49
9
|
|
|
50
|
-
// src/core/portal/portal-context.ts
|
|
51
|
-
var import_react = require("react");
|
|
52
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
53
10
|
|
|
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
11
|
|
|
63
|
-
// src/core/theme-context.tsx
|
|
64
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
65
12
|
|
|
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
13
|
|
|
91
|
-
|
|
92
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
14
|
+
var _reactnative = require('react-native');
|
|
93
15
|
|
|
94
16
|
// src/components/slider/slider.animation.ts
|
|
95
|
-
|
|
17
|
+
|
|
96
18
|
var runSliderThumbPressInAnimation = (scale) => {
|
|
97
|
-
|
|
19
|
+
_reactnative.Animated.spring(scale, {
|
|
98
20
|
toValue: 1.08,
|
|
99
21
|
friction: 6,
|
|
100
22
|
tension: 120,
|
|
@@ -102,7 +24,7 @@ var runSliderThumbPressInAnimation = (scale) => {
|
|
|
102
24
|
}).start();
|
|
103
25
|
};
|
|
104
26
|
var runSliderThumbPressOutAnimation = (scale) => {
|
|
105
|
-
|
|
27
|
+
_reactnative.Animated.spring(scale, {
|
|
106
28
|
toValue: 1,
|
|
107
29
|
friction: 6,
|
|
108
30
|
tension: 120,
|
|
@@ -111,11 +33,11 @@ var runSliderThumbPressOutAnimation = (scale) => {
|
|
|
111
33
|
};
|
|
112
34
|
|
|
113
35
|
// src/components/slider/slider.hook.ts
|
|
114
|
-
|
|
115
|
-
var
|
|
36
|
+
|
|
37
|
+
var _core = require('@xaui/core');
|
|
116
38
|
function useSliderSizeStyles(size) {
|
|
117
|
-
const theme = useXUITheme();
|
|
118
|
-
return (0,
|
|
39
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
40
|
+
return _react.useMemo.call(void 0, () => {
|
|
119
41
|
const sizes = {
|
|
120
42
|
xs: {
|
|
121
43
|
trackThickness: 4,
|
|
@@ -150,11 +72,11 @@ function useSliderSizeStyles(size) {
|
|
|
150
72
|
}, [size, theme]);
|
|
151
73
|
}
|
|
152
74
|
function useSliderColorStyles(color, isDisabled) {
|
|
153
|
-
const theme = useXUITheme();
|
|
154
|
-
const safeColor = (0,
|
|
75
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
76
|
+
const safeColor = _core.getSafeThemeColor.call(void 0, color);
|
|
155
77
|
const palette = theme.colors[safeColor];
|
|
156
|
-
const fillColor = (0,
|
|
157
|
-
return (0,
|
|
78
|
+
const fillColor = _core.withPaletteNumber.call(void 0, palette.main, 400);
|
|
79
|
+
return _react.useMemo.call(void 0, () => {
|
|
158
80
|
if (isDisabled) {
|
|
159
81
|
return {
|
|
160
82
|
trackColor: `${theme.colors.default.main}30`,
|
|
@@ -181,8 +103,8 @@ function useSliderColorStyles(color, isDisabled) {
|
|
|
181
103
|
}
|
|
182
104
|
|
|
183
105
|
// src/components/slider/slider.style.ts
|
|
184
|
-
|
|
185
|
-
var styles =
|
|
106
|
+
|
|
107
|
+
var styles = _reactnative.StyleSheet.create({
|
|
186
108
|
container: {
|
|
187
109
|
width: "100%"
|
|
188
110
|
},
|
|
@@ -323,7 +245,7 @@ var Slider = ({
|
|
|
323
245
|
customAppearance
|
|
324
246
|
}) => {
|
|
325
247
|
const isControlled = controlledValue !== void 0;
|
|
326
|
-
const [internalValue, setInternalValue] = (0,
|
|
248
|
+
const [internalValue, setInternalValue] = _react.useState.call(void 0,
|
|
327
249
|
getInitialValue({
|
|
328
250
|
value: controlledValue,
|
|
329
251
|
defaultValue,
|
|
@@ -331,30 +253,30 @@ var Slider = ({
|
|
|
331
253
|
maxValue
|
|
332
254
|
})
|
|
333
255
|
);
|
|
334
|
-
const [measuredTrackLength, setMeasuredTrackLength] = (0,
|
|
256
|
+
const [measuredTrackLength, setMeasuredTrackLength] = _react.useState.call(void 0,
|
|
335
257
|
trackLength && trackLength > 0 ? trackLength : 0
|
|
336
258
|
);
|
|
337
259
|
const currentValue = isControlled ? clamp(controlledValue, minValue, maxValue) : internalValue;
|
|
338
260
|
const sizeStyles = useSliderSizeStyles(size);
|
|
339
261
|
const colorStyles = useSliderColorStyles(color, isDisabled);
|
|
340
|
-
const radiusStyles = useBorderRadiusStyles(radius);
|
|
341
|
-
const theme = useXUITheme();
|
|
342
|
-
const thumbScale = (0,
|
|
343
|
-
const initialTouchTrackPosition = (0,
|
|
344
|
-
const animatedTrackPosition = (0,
|
|
345
|
-
const isDragging = (0,
|
|
346
|
-
const currentValueRef = (0,
|
|
262
|
+
const radiusStyles = _chunkOQ2BLOOGcjs.useBorderRadiusStyles.call(void 0, radius);
|
|
263
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
264
|
+
const thumbScale = _react.useRef.call(void 0, new _reactnative.Animated.Value(1)).current;
|
|
265
|
+
const initialTouchTrackPosition = _react.useRef.call(void 0, 0);
|
|
266
|
+
const animatedTrackPosition = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
267
|
+
const isDragging = _react.useRef.call(void 0, false);
|
|
268
|
+
const currentValueRef = _react.useRef.call(void 0, currentValue);
|
|
347
269
|
currentValueRef.current = currentValue;
|
|
348
|
-
const onChangeEndRef = (0,
|
|
270
|
+
const onChangeEndRef = _react.useRef.call(void 0, onChangeEnd);
|
|
349
271
|
onChangeEndRef.current = onChangeEnd;
|
|
350
272
|
const thumbOverlapInset = Math.max(
|
|
351
273
|
0,
|
|
352
274
|
(sizeStyles.thumbSize - sizeStyles.trackThickness) / 2
|
|
353
275
|
);
|
|
354
|
-
const formattedValue = (0,
|
|
276
|
+
const formattedValue = _react.useMemo.call(void 0, () => {
|
|
355
277
|
try {
|
|
356
278
|
return new Intl.NumberFormat(void 0, formatOptions).format(currentValue);
|
|
357
|
-
} catch {
|
|
279
|
+
} catch (e) {
|
|
358
280
|
return String(currentValue);
|
|
359
281
|
}
|
|
360
282
|
}, [currentValue, formatOptions]);
|
|
@@ -364,14 +286,14 @@ var Slider = ({
|
|
|
364
286
|
const trackContainerLengthStyle = orientation === "vertical" ? {
|
|
365
287
|
height: (trackLength && trackLength > 0 ? trackLength : 220) + thumbOverlapInset * 2
|
|
366
288
|
} : trackLength && trackLength > 0 ? { width: trackLength + thumbOverlapInset * 2 } : null;
|
|
367
|
-
(0,
|
|
289
|
+
_react.useEffect.call(void 0, () => {
|
|
368
290
|
if (!isDragging.current && effectiveTrackLength > 0) {
|
|
369
291
|
animatedTrackPosition.setValue(
|
|
370
292
|
clamp(thumbCenterPosition, 0, effectiveTrackLength)
|
|
371
293
|
);
|
|
372
294
|
}
|
|
373
295
|
}, [thumbCenterPosition, effectiveTrackLength, animatedTrackPosition]);
|
|
374
|
-
const animatedFillSize = (0,
|
|
296
|
+
const animatedFillSize = _react.useMemo.call(void 0, () => {
|
|
375
297
|
const safeLength = Math.max(effectiveTrackLength, 1);
|
|
376
298
|
return animatedTrackPosition.interpolate({
|
|
377
299
|
inputRange: [0, safeLength],
|
|
@@ -379,7 +301,7 @@ var Slider = ({
|
|
|
379
301
|
extrapolate: "clamp"
|
|
380
302
|
});
|
|
381
303
|
}, [animatedTrackPosition, effectiveTrackLength]);
|
|
382
|
-
const animatedThumbOffset = (0,
|
|
304
|
+
const animatedThumbOffset = _react.useMemo.call(void 0, () => {
|
|
383
305
|
const base = thumbOverlapInset - sizeStyles.thumbSize / 2;
|
|
384
306
|
const safeLength = Math.max(effectiveTrackLength, 1);
|
|
385
307
|
return animatedTrackPosition.interpolate({
|
|
@@ -393,16 +315,16 @@ var Slider = ({
|
|
|
393
315
|
thumbOverlapInset,
|
|
394
316
|
sizeStyles.thumbSize
|
|
395
317
|
]);
|
|
396
|
-
const setValue = (0,
|
|
318
|
+
const setValue = _react.useCallback.call(void 0,
|
|
397
319
|
(nextValue) => {
|
|
398
320
|
if (!isControlled) {
|
|
399
321
|
setInternalValue(nextValue);
|
|
400
322
|
}
|
|
401
|
-
onChange
|
|
323
|
+
_optionalChain([onChange, 'optionalCall', _2 => _2(nextValue)]);
|
|
402
324
|
},
|
|
403
325
|
[isControlled, onChange]
|
|
404
326
|
);
|
|
405
|
-
const setValueFromPosition = (0,
|
|
327
|
+
const setValueFromPosition = _react.useCallback.call(void 0,
|
|
406
328
|
(position) => {
|
|
407
329
|
const nextPercent = getRelativePosition(
|
|
408
330
|
position,
|
|
@@ -416,8 +338,8 @@ var Slider = ({
|
|
|
416
338
|
[effectiveTrackLength, maxValue, minValue, orientation, setValue, step]
|
|
417
339
|
);
|
|
418
340
|
const isInteractive = !isDisabled && !isReadOnly;
|
|
419
|
-
const panResponder = (0,
|
|
420
|
-
() =>
|
|
341
|
+
const panResponder = _react.useMemo.call(void 0,
|
|
342
|
+
() => _reactnative.PanResponder.create({
|
|
421
343
|
onStartShouldSetPanResponder: () => isInteractive,
|
|
422
344
|
onMoveShouldSetPanResponder: (_evt, gs) => {
|
|
423
345
|
if (!isInteractive) return false;
|
|
@@ -459,7 +381,7 @@ var Slider = ({
|
|
|
459
381
|
animatedTrackPosition.setValue(
|
|
460
382
|
getPixelPosition(snappedPercent, effectiveTrackLength)
|
|
461
383
|
);
|
|
462
|
-
onChangeEndRef.current
|
|
384
|
+
_optionalChain([onChangeEndRef, 'access', _3 => _3.current, 'optionalCall', _4 => _4(nextValue)]);
|
|
463
385
|
},
|
|
464
386
|
onPanResponderTerminate: () => {
|
|
465
387
|
isDragging.current = false;
|
|
@@ -467,7 +389,7 @@ var Slider = ({
|
|
|
467
389
|
const val = currentValueRef.current;
|
|
468
390
|
const pct = valueToPercent(val, minValue, maxValue);
|
|
469
391
|
animatedTrackPosition.setValue(getPixelPosition(pct, effectiveTrackLength));
|
|
470
|
-
onChangeEndRef.current
|
|
392
|
+
_optionalChain([onChangeEndRef, 'access', _5 => _5.current, 'optionalCall', _6 => _6(val)]);
|
|
471
393
|
}
|
|
472
394
|
}),
|
|
473
395
|
[
|
|
@@ -482,7 +404,7 @@ var Slider = ({
|
|
|
482
404
|
thumbOverlapInset
|
|
483
405
|
]
|
|
484
406
|
);
|
|
485
|
-
const handleTrackLayout = (0,
|
|
407
|
+
const handleTrackLayout = _react.useCallback.call(void 0,
|
|
486
408
|
(event) => {
|
|
487
409
|
if (trackLength && trackLength > 0) return;
|
|
488
410
|
const nextLength = orientation === "vertical" ? event.nativeEvent.layout.height : event.nativeEvent.layout.width;
|
|
@@ -490,34 +412,34 @@ var Slider = ({
|
|
|
490
412
|
},
|
|
491
413
|
[orientation, trackLength]
|
|
492
414
|
);
|
|
493
|
-
const steps = (0,
|
|
415
|
+
const steps = _react.useMemo.call(void 0, () => {
|
|
494
416
|
if (!showSteps || step <= 0 || maxValue <= minValue) return [];
|
|
495
417
|
const count = Math.floor((maxValue - minValue) / step);
|
|
496
418
|
if (count > 200) return [];
|
|
497
419
|
return Array.from({ length: count + 1 }, (_, index) => minValue + index * step);
|
|
498
420
|
}, [maxValue, minValue, showSteps, step]);
|
|
499
|
-
return /* @__PURE__ */
|
|
500
|
-
|
|
421
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, _optionalChain([customAppearance, 'optionalAccess', _7 => _7.container])] }, (label !== void 0 || showValueLabel) && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.header, _optionalChain([customAppearance, 'optionalAccess', _8 => _8.header])] }, label !== void 0 ? /* @__PURE__ */ _react2.default.createElement(
|
|
422
|
+
_reactnative.Text,
|
|
501
423
|
{
|
|
502
424
|
style: [
|
|
503
425
|
styles.label,
|
|
504
426
|
{ color: colorStyles.labelColor, fontSize: sizeStyles.fontSize },
|
|
505
|
-
customAppearance
|
|
427
|
+
_optionalChain([customAppearance, 'optionalAccess', _9 => _9.label])
|
|
506
428
|
]
|
|
507
429
|
},
|
|
508
430
|
label
|
|
509
|
-
) : /* @__PURE__ */
|
|
510
|
-
|
|
431
|
+
) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null), showValueLabel && /* @__PURE__ */ _react2.default.createElement(
|
|
432
|
+
_reactnative.Text,
|
|
511
433
|
{
|
|
512
434
|
style: [
|
|
513
435
|
styles.value,
|
|
514
436
|
{ color: colorStyles.valueColor, fontSize: sizeStyles.fontSize },
|
|
515
|
-
customAppearance
|
|
437
|
+
_optionalChain([customAppearance, 'optionalAccess', _10 => _10.value])
|
|
516
438
|
]
|
|
517
439
|
},
|
|
518
440
|
formattedValue
|
|
519
|
-
)), /* @__PURE__ */
|
|
520
|
-
|
|
441
|
+
)), /* @__PURE__ */ _react2.default.createElement(
|
|
442
|
+
_reactnative.View,
|
|
521
443
|
{
|
|
522
444
|
style: [
|
|
523
445
|
orientation === "vertical" ? styles.verticalRow : styles.row,
|
|
@@ -525,8 +447,8 @@ var Slider = ({
|
|
|
525
447
|
]
|
|
526
448
|
},
|
|
527
449
|
startContent,
|
|
528
|
-
/* @__PURE__ */
|
|
529
|
-
|
|
450
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
451
|
+
_reactnative.View,
|
|
530
452
|
{
|
|
531
453
|
...panResponder.panHandlers,
|
|
532
454
|
style: [
|
|
@@ -536,11 +458,11 @@ var Slider = ({
|
|
|
536
458
|
padding: thumbOverlapInset
|
|
537
459
|
},
|
|
538
460
|
trackContainerLengthStyle,
|
|
539
|
-
customAppearance
|
|
461
|
+
_optionalChain([customAppearance, 'optionalAccess', _11 => _11.trackContainer])
|
|
540
462
|
]
|
|
541
463
|
},
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
|
|
464
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
465
|
+
_reactnative.View,
|
|
544
466
|
{
|
|
545
467
|
onLayout: handleTrackLayout,
|
|
546
468
|
style: [
|
|
@@ -552,11 +474,11 @@ var Slider = ({
|
|
|
552
474
|
height: orientation === "vertical" ? "100%" : sizeStyles.trackThickness,
|
|
553
475
|
width: orientation === "vertical" ? sizeStyles.trackThickness : "100%"
|
|
554
476
|
},
|
|
555
|
-
customAppearance
|
|
477
|
+
_optionalChain([customAppearance, 'optionalAccess', _12 => _12.track])
|
|
556
478
|
]
|
|
557
479
|
},
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
|
|
480
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
481
|
+
_reactnative.Animated.View,
|
|
560
482
|
{
|
|
561
483
|
style: [
|
|
562
484
|
styles.fill,
|
|
@@ -566,15 +488,15 @@ var Slider = ({
|
|
|
566
488
|
height: orientation === "vertical" ? effectiveTrackLength > 0 ? animatedFillSize : `${activePercent}%` : sizeStyles.trackThickness,
|
|
567
489
|
width: orientation === "vertical" ? sizeStyles.trackThickness : effectiveTrackLength > 0 ? animatedFillSize : `${activePercent}%`
|
|
568
490
|
},
|
|
569
|
-
customAppearance
|
|
491
|
+
_optionalChain([customAppearance, 'optionalAccess', _13 => _13.fill])
|
|
570
492
|
]
|
|
571
493
|
}
|
|
572
494
|
),
|
|
573
495
|
showSteps && steps.map((stepValue) => {
|
|
574
496
|
const percent = valueToPercent(stepValue, minValue, maxValue);
|
|
575
497
|
const isActive = stepValue <= currentValue;
|
|
576
|
-
return /* @__PURE__ */
|
|
577
|
-
|
|
498
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
499
|
+
_reactnative.View,
|
|
578
500
|
{
|
|
579
501
|
key: `step-${stepValue}`,
|
|
580
502
|
style: [
|
|
@@ -586,15 +508,15 @@ var Slider = ({
|
|
|
586
508
|
left: orientation === "vertical" ? (sizeStyles.trackThickness - sizeStyles.stepDotSize) / 2 : getPixelPosition(percent, effectiveTrackLength) - sizeStyles.stepDotSize / 2,
|
|
587
509
|
bottom: orientation === "vertical" ? getPixelPosition(percent, effectiveTrackLength) - sizeStyles.stepDotSize / 2 : (sizeStyles.trackThickness - sizeStyles.stepDotSize) / 2
|
|
588
510
|
},
|
|
589
|
-
customAppearance
|
|
590
|
-
isActive && customAppearance
|
|
511
|
+
_optionalChain([customAppearance, 'optionalAccess', _14 => _14.step]),
|
|
512
|
+
isActive && _optionalChain([customAppearance, 'optionalAccess', _15 => _15.activeStep])
|
|
591
513
|
]
|
|
592
514
|
}
|
|
593
515
|
);
|
|
594
516
|
})
|
|
595
517
|
),
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
|
|
518
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
519
|
+
_reactnative.Animated.View,
|
|
598
520
|
{
|
|
599
521
|
pointerEvents: "none",
|
|
600
522
|
style: [
|
|
@@ -612,14 +534,14 @@ var Slider = ({
|
|
|
612
534
|
...theme.shadows.md,
|
|
613
535
|
transform: [{ scale: thumbScale }]
|
|
614
536
|
},
|
|
615
|
-
customAppearance
|
|
537
|
+
_optionalChain([customAppearance, 'optionalAccess', _16 => _16.thumb])
|
|
616
538
|
]
|
|
617
539
|
}
|
|
618
540
|
),
|
|
619
|
-
marks
|
|
541
|
+
_optionalChain([marks, 'optionalAccess', _17 => _17.map, 'call', _18 => _18((mark) => {
|
|
620
542
|
const percent = valueToPercent(mark.value, minValue, maxValue);
|
|
621
|
-
return /* @__PURE__ */
|
|
622
|
-
|
|
543
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
544
|
+
_reactnative.View,
|
|
623
545
|
{
|
|
624
546
|
key: `mark-${mark.value}`,
|
|
625
547
|
style: [
|
|
@@ -629,27 +551,26 @@ var Slider = ({
|
|
|
629
551
|
top: orientation === "vertical" ? void 0 : thumbOverlapInset + sizeStyles.trackThickness,
|
|
630
552
|
bottom: orientation === "vertical" ? thumbOverlapInset + getPixelPosition(percent, effectiveTrackLength) - 8 : void 0
|
|
631
553
|
},
|
|
632
|
-
customAppearance
|
|
554
|
+
_optionalChain([customAppearance, 'optionalAccess', _19 => _19.mark])
|
|
633
555
|
]
|
|
634
556
|
},
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
|
|
557
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
558
|
+
_reactnative.Text,
|
|
637
559
|
{
|
|
638
560
|
style: [
|
|
639
561
|
styles.markLabel,
|
|
640
562
|
{ color: colorStyles.markColor },
|
|
641
|
-
customAppearance
|
|
563
|
+
_optionalChain([customAppearance, 'optionalAccess', _20 => _20.markLabel])
|
|
642
564
|
]
|
|
643
565
|
},
|
|
644
566
|
renderMarkLabel(mark)
|
|
645
567
|
)
|
|
646
568
|
);
|
|
647
|
-
})
|
|
569
|
+
})])
|
|
648
570
|
),
|
|
649
571
|
endContent
|
|
650
572
|
));
|
|
651
573
|
};
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
});
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
exports.Slider = Slider;
|
package/dist/slider/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import "../chunk-DXXNBF5P.js";
|
|
1
2
|
import {
|
|
2
3
|
useBorderRadiusStyles,
|
|
3
4
|
useXUITheme
|
|
4
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-LTKYHG5V.js";
|
|
5
6
|
|
|
6
7
|
// src/components/slider/slider.tsx
|
|
7
8
|
import React, { useCallback, useEffect, useMemo as useMemo2, useRef, useState } from "react";
|