@webority-technologies/mobile 0.0.22 → 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.
- package/lib/commonjs/components/Accordion/Accordion.js +9 -7
- package/lib/commonjs/components/AnimatePresence/AnimatePresence.js +69 -0
- package/lib/commonjs/components/AnimatePresence/index.js +13 -0
- package/lib/commonjs/components/AppBar/AppBar.js +9 -6
- package/lib/commonjs/components/Avatar/Avatar.js +4 -2
- package/lib/commonjs/components/Badge/Badge.js +5 -5
- package/lib/commonjs/components/Banner/Banner.js +20 -6
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +6 -4
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +8 -9
- package/lib/commonjs/components/Box/Box.js +162 -0
- package/lib/commonjs/components/Box/index.js +37 -0
- package/lib/commonjs/components/Button/Button.js +7 -7
- package/lib/commonjs/components/Card/Card.js +3 -3
- package/lib/commonjs/components/Carousel/Carousel.js +4 -2
- package/lib/commonjs/components/Checkbox/Checkbox.js +17 -7
- package/lib/commonjs/components/Chip/Chip.js +4 -2
- package/lib/commonjs/components/DatePicker/DatePicker.js +31 -24
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +16 -11
- package/lib/commonjs/components/Dialog/Dialog.js +6 -4
- package/lib/commonjs/components/Drawer/Drawer.js +4 -2
- package/lib/commonjs/components/FieldBase/FieldBase.js +8 -4
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +23 -13
- package/lib/commonjs/components/FormField/FormField.js +61 -25
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +17 -15
- package/lib/commonjs/components/Input/Input.js +41 -29
- package/lib/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +102 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +13 -0
- package/lib/commonjs/components/KeyboardToolbar/KeyboardToolbar.js +130 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +13 -0
- package/lib/commonjs/components/ListItem/ListItem.js +4 -3
- package/lib/commonjs/components/Modal/Modal.js +21 -9
- package/lib/commonjs/components/NumberInput/NumberInput.js +38 -29
- package/lib/commonjs/components/OTPInput/OTPInput.js +37 -22
- package/lib/commonjs/components/Radio/Radio.js +9 -8
- package/lib/commonjs/components/Radio/RadioGroup.js +10 -3
- package/lib/commonjs/components/Rating/Rating.js +4 -3
- package/lib/commonjs/components/SearchBar/SearchBar.js +11 -6
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +23 -12
- package/lib/commonjs/components/Select/Select.js +40 -36
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +5 -2
- package/lib/commonjs/components/Slider/Slider.js +241 -225
- package/lib/commonjs/components/Spinner/Spinner.js +5 -5
- package/lib/commonjs/components/Stepper/Stepper.js +6 -5
- package/lib/commonjs/components/Swipeable/Swipeable.js +8 -9
- package/lib/commonjs/components/Switch/Switch.js +29 -16
- package/lib/commonjs/components/Tabs/Tabs.js +8 -5
- package/lib/commonjs/components/Text/Text.js +142 -0
- package/lib/commonjs/components/Text/index.js +13 -0
- package/lib/commonjs/components/TimePicker/TimePicker.js +23 -15
- package/lib/commonjs/components/Toast/Toast.js +22 -10
- package/lib/commonjs/components/Tooltip/Tooltip.js +6 -2
- package/lib/commonjs/components/index.js +156 -103
- package/lib/commonjs/form/FormContext.js +40 -0
- package/lib/commonjs/form/index.js +68 -0
- package/lib/commonjs/form/path.js +79 -0
- package/lib/commonjs/form/rules.js +67 -0
- package/lib/commonjs/form/types.js +2 -0
- package/lib/commonjs/form/useField.js +54 -0
- package/lib/commonjs/form/useForm.js +316 -0
- package/lib/commonjs/hooks/index.js +14 -0
- package/lib/commonjs/hooks/useControllableState.js +30 -0
- package/lib/commonjs/hooks/useReducedMotion.js +31 -0
- package/lib/commonjs/index.js +96 -11
- package/lib/commonjs/theme/ThemeContext.js +30 -2
- package/lib/commonjs/theme/tokens.js +12 -0
- package/lib/commonjs/utils/hapticUtils.js +11 -1
- package/lib/commonjs/utils/index.js +6 -0
- package/lib/module/components/Accordion/Accordion.js +10 -8
- package/lib/module/components/AnimatePresence/AnimatePresence.js +63 -0
- package/lib/module/components/AnimatePresence/index.js +4 -0
- package/lib/module/components/AppBar/AppBar.js +10 -7
- package/lib/module/components/Avatar/Avatar.js +4 -2
- package/lib/module/components/Badge/Badge.js +5 -5
- package/lib/module/components/Banner/Banner.js +20 -6
- package/lib/module/components/BottomNavigation/BottomNavigation.js +6 -4
- package/lib/module/components/BottomSheet/BottomSheet.js +8 -9
- package/lib/module/components/Box/Box.js +156 -0
- package/lib/module/components/Box/index.js +4 -0
- package/lib/module/components/Button/Button.js +7 -7
- package/lib/module/components/Card/Card.js +4 -4
- package/lib/module/components/Carousel/Carousel.js +4 -2
- package/lib/module/components/Checkbox/Checkbox.js +18 -8
- package/lib/module/components/Chip/Chip.js +5 -3
- package/lib/module/components/DatePicker/DatePicker.js +32 -25
- package/lib/module/components/DateRangePicker/DateRangePicker.js +17 -12
- package/lib/module/components/Dialog/Dialog.js +7 -5
- package/lib/module/components/Drawer/Drawer.js +5 -3
- package/lib/module/components/FieldBase/FieldBase.js +8 -4
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +24 -14
- package/lib/module/components/FormField/FormField.js +62 -26
- package/lib/module/components/ImageGallery/ImageGallery.js +18 -16
- package/lib/module/components/Input/Input.js +41 -29
- package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +98 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +4 -0
- package/lib/module/components/KeyboardToolbar/KeyboardToolbar.js +125 -0
- package/lib/module/components/KeyboardToolbar/index.js +4 -0
- package/lib/module/components/ListItem/ListItem.js +5 -4
- package/lib/module/components/Modal/Modal.js +22 -10
- package/lib/module/components/NumberInput/NumberInput.js +36 -27
- package/lib/module/components/OTPInput/OTPInput.js +37 -22
- package/lib/module/components/Radio/Radio.js +10 -9
- package/lib/module/components/Radio/RadioGroup.js +10 -3
- package/lib/module/components/Rating/Rating.js +5 -4
- package/lib/module/components/SearchBar/SearchBar.js +12 -7
- package/lib/module/components/SegmentedControl/SegmentedControl.js +24 -13
- package/lib/module/components/Select/Select.js +41 -37
- package/lib/module/components/Skeleton/SkeletonContent.js +5 -2
- package/lib/module/components/Slider/Slider.js +244 -228
- package/lib/module/components/Spinner/Spinner.js +5 -5
- package/lib/module/components/Stepper/Stepper.js +7 -6
- package/lib/module/components/Swipeable/Swipeable.js +9 -10
- package/lib/module/components/Switch/Switch.js +29 -16
- package/lib/module/components/Tabs/Tabs.js +9 -6
- package/lib/module/components/Text/Text.js +138 -0
- package/lib/module/components/Text/index.js +4 -0
- package/lib/module/components/TimePicker/TimePicker.js +24 -16
- package/lib/module/components/Toast/Toast.js +22 -10
- package/lib/module/components/Tooltip/Tooltip.js +6 -2
- package/lib/module/components/index.js +5 -0
- package/lib/module/form/FormContext.js +32 -0
- package/lib/module/form/index.js +12 -0
- package/lib/module/form/path.js +72 -0
- package/lib/module/form/rules.js +52 -0
- package/lib/module/form/types.js +2 -0
- package/lib/module/form/useField.js +49 -0
- package/lib/module/form/useForm.js +312 -0
- package/lib/module/hooks/index.js +2 -0
- package/lib/module/hooks/useControllableState.js +26 -0
- package/lib/module/hooks/useReducedMotion.js +27 -0
- package/lib/module/index.js +3 -1
- package/lib/module/theme/ThemeContext.js +30 -2
- package/lib/module/theme/tokens.js +12 -0
- package/lib/module/utils/hapticUtils.js +9 -0
- package/lib/module/utils/index.js +1 -1
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +3 -0
- package/lib/typescript/commonjs/components/AnimatePresence/AnimatePresence.d.ts +30 -0
- package/lib/typescript/commonjs/components/AnimatePresence/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +6 -0
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +3 -0
- package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +1 -1
- package/lib/typescript/commonjs/components/Box/Box.d.ts +60 -0
- package/lib/typescript/commonjs/components/Box/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +1 -1
- package/lib/typescript/commonjs/components/Card/Card.d.ts +3 -0
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +4 -2
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +3 -0
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +6 -3
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +5 -2
- package/lib/typescript/commonjs/components/Drawer/Drawer.d.ts +3 -0
- package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +5 -0
- package/lib/typescript/commonjs/components/FormField/FormField.d.ts +13 -2
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -0
- package/lib/typescript/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
- package/lib/typescript/commonjs/components/KeyboardAwareScrollView/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
- package/lib/typescript/commonjs/components/KeyboardToolbar/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +3 -0
- package/lib/typescript/commonjs/components/Modal/Modal.d.ts +6 -0
- package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +6 -2
- package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +9 -2
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +2 -2
- package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +3 -2
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +6 -0
- package/lib/typescript/commonjs/components/SearchBar/SearchBar.d.ts +3 -0
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +6 -2
- package/lib/typescript/commonjs/components/Select/Select.d.ts +6 -0
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +9 -4
- package/lib/typescript/commonjs/components/Spinner/Spinner.d.ts +1 -1
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +6 -0
- package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +3 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +3 -2
- package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +3 -0
- package/lib/typescript/commonjs/components/Text/Text.d.ts +25 -0
- package/lib/typescript/commonjs/components/Text/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +6 -3
- package/lib/typescript/commonjs/components/index.d.ts +10 -0
- package/lib/typescript/commonjs/form/FormContext.d.ts +17 -0
- package/lib/typescript/commonjs/form/index.d.ts +9 -0
- package/lib/typescript/commonjs/form/path.d.ts +10 -0
- package/lib/typescript/commonjs/form/rules.d.ts +31 -0
- package/lib/typescript/commonjs/form/types.d.ts +94 -0
- package/lib/typescript/commonjs/form/useField.d.ts +27 -0
- package/lib/typescript/commonjs/form/useForm.d.ts +10 -0
- package/lib/typescript/commonjs/hooks/index.d.ts +3 -0
- package/lib/typescript/commonjs/hooks/useControllableState.d.ts +17 -0
- package/lib/typescript/commonjs/hooks/useReducedMotion.d.ts +8 -0
- package/lib/typescript/commonjs/index.d.ts +4 -2
- package/lib/typescript/commonjs/theme/types.d.ts +17 -67
- package/lib/typescript/commonjs/utils/hapticUtils.d.ts +8 -0
- package/lib/typescript/commonjs/utils/index.d.ts +1 -1
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +3 -0
- package/lib/typescript/module/components/AnimatePresence/AnimatePresence.d.ts +30 -0
- package/lib/typescript/module/components/AnimatePresence/index.d.ts +3 -0
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +6 -0
- package/lib/typescript/module/components/Banner/Banner.d.ts +3 -0
- package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +1 -1
- package/lib/typescript/module/components/Box/Box.d.ts +60 -0
- package/lib/typescript/module/components/Box/index.d.ts +3 -0
- package/lib/typescript/module/components/Button/Button.d.ts +1 -1
- package/lib/typescript/module/components/Card/Card.d.ts +3 -0
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +4 -2
- package/lib/typescript/module/components/Chip/Chip.d.ts +3 -0
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +6 -3
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +5 -2
- package/lib/typescript/module/components/Drawer/Drawer.d.ts +3 -0
- package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +5 -0
- package/lib/typescript/module/components/FormField/FormField.d.ts +13 -2
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -0
- package/lib/typescript/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
- package/lib/typescript/module/components/KeyboardAwareScrollView/index.d.ts +3 -0
- package/lib/typescript/module/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
- package/lib/typescript/module/components/KeyboardToolbar/index.d.ts +3 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +3 -0
- package/lib/typescript/module/components/Modal/Modal.d.ts +6 -0
- package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +6 -2
- package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +9 -2
- package/lib/typescript/module/components/Radio/Radio.d.ts +2 -2
- package/lib/typescript/module/components/Radio/RadioGroup.d.ts +3 -2
- package/lib/typescript/module/components/Rating/Rating.d.ts +6 -0
- package/lib/typescript/module/components/SearchBar/SearchBar.d.ts +3 -0
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +6 -2
- package/lib/typescript/module/components/Select/Select.d.ts +6 -0
- package/lib/typescript/module/components/Slider/Slider.d.ts +9 -4
- package/lib/typescript/module/components/Spinner/Spinner.d.ts +1 -1
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +6 -0
- package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +3 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +3 -2
- package/lib/typescript/module/components/Tabs/Tabs.d.ts +3 -0
- package/lib/typescript/module/components/Text/Text.d.ts +25 -0
- package/lib/typescript/module/components/Text/index.d.ts +3 -0
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +6 -3
- package/lib/typescript/module/components/index.d.ts +10 -0
- package/lib/typescript/module/form/FormContext.d.ts +17 -0
- package/lib/typescript/module/form/index.d.ts +9 -0
- package/lib/typescript/module/form/path.d.ts +10 -0
- package/lib/typescript/module/form/rules.d.ts +31 -0
- package/lib/typescript/module/form/types.d.ts +94 -0
- package/lib/typescript/module/form/useField.d.ts +27 -0
- package/lib/typescript/module/form/useForm.d.ts +10 -0
- package/lib/typescript/module/hooks/index.d.ts +3 -0
- package/lib/typescript/module/hooks/useControllableState.d.ts +17 -0
- package/lib/typescript/module/hooks/useReducedMotion.d.ts +8 -0
- package/lib/typescript/module/index.d.ts +4 -2
- package/lib/typescript/module/theme/types.d.ts +17 -67
- package/lib/typescript/module/utils/hapticUtils.d.ts +8 -0
- package/lib/typescript/module/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.Slider = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
10
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
9
11
|
var _index = require("../../theme/index.js");
|
|
10
12
|
var _index2 = require("../../utils/index.js");
|
|
13
|
+
var _index3 = require("../../hooks/index.js");
|
|
11
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
16
|
const SIZE_MAP = {
|
|
@@ -34,7 +37,6 @@ const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
|
34
37
|
const snapToStep = (value, min, max, step) => {
|
|
35
38
|
if (step <= 0) return clamp(value, min, max);
|
|
36
39
|
const stepped = Math.round((value - min) / step) * step + min;
|
|
37
|
-
// Guard against floating-point drift.
|
|
38
40
|
const decimals = String(step).split('.')[1]?.length ?? 0;
|
|
39
41
|
const fixed = decimals > 0 ? Number(stepped.toFixed(decimals)) : stepped;
|
|
40
42
|
return clamp(fixed, min, max);
|
|
@@ -51,6 +53,7 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
51
53
|
showLabel = false,
|
|
52
54
|
formatLabel = defaultFormatLabel,
|
|
53
55
|
accessibilityLabel,
|
|
56
|
+
haptic,
|
|
54
57
|
style,
|
|
55
58
|
containerStyle,
|
|
56
59
|
trackStyle,
|
|
@@ -65,222 +68,241 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
65
68
|
const theme = (0, _index.useTheme)();
|
|
66
69
|
const sliderTheme = theme.components.slider;
|
|
67
70
|
const sliderSizeTheme = sliderTheme?.[size];
|
|
68
|
-
const sizeCfg = {
|
|
71
|
+
const sizeCfg = (0, _react.useMemo)(() => ({
|
|
69
72
|
trackHeight: sliderSizeTheme?.trackHeight ?? SIZE_MAP[size].trackHeight,
|
|
70
73
|
thumbDiameter: sliderSizeTheme?.thumbDiameter ?? SIZE_MAP[size].thumbDiameter
|
|
71
|
-
};
|
|
74
|
+
}), [sliderSizeTheme, size]);
|
|
72
75
|
const thumbPressAnimationEnabled = sliderTheme?.thumbPressAnimation ?? false;
|
|
73
76
|
const resolvedPressScale = thumbPressScale ?? sliderTheme?.thumbPressScale ?? 1.1;
|
|
74
77
|
const resolvedLabelDuration = labelShowDuration ?? sliderTheme?.labelShowDuration ?? theme.motion.duration.fast;
|
|
75
78
|
const resolvedLabelOpacity = labelOpacityProp ?? sliderTheme?.labelOpacity ?? 1;
|
|
76
79
|
const styles = (0, _react.useMemo)(() => buildStyles(theme, sizeCfg), [theme, sizeCfg]);
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
const springCfg = (0, _react.useMemo)(() => ({
|
|
81
|
+
damping: theme.motion.spring.snappy.damping,
|
|
82
|
+
stiffness: theme.motion.spring.snappy.stiffness,
|
|
83
|
+
mass: theme.motion.spring.snappy.mass
|
|
84
|
+
}), [theme.motion.spring.snappy]);
|
|
79
85
|
const [trackWidth, setTrackWidth] = (0, _react.useState)(0);
|
|
80
86
|
const fillColor = theme.colors[TONE_TO_COLOR_KEY[tone]];
|
|
81
87
|
const isRange = props.range === true;
|
|
88
|
+
const [currentValue, setCurrentValue] = (0, _index3.useControllableState)({
|
|
89
|
+
value: props.value,
|
|
90
|
+
defaultValue: props.defaultValue ?? (isRange ? [min, max] : min),
|
|
91
|
+
onChange: props.onChange
|
|
92
|
+
});
|
|
82
93
|
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
// Label opacity per thumb.
|
|
98
|
-
const lowLabelOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
|
|
99
|
-
const highLabelOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
|
|
100
|
-
|
|
101
|
-
// Track which thumb is actively dragging (to anchor gesture math).
|
|
102
|
-
const dragOffsetRef = (0, _react.useRef)(0);
|
|
94
|
+
// ───────── Shared values (UI thread) ─────────
|
|
95
|
+
// lowX/highX: thumb px positions. lowVal/highVal: their snapped numeric values
|
|
96
|
+
// (mirrored on the UI thread so worklets can clamp the range + detect changes).
|
|
97
|
+
const lowX = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
98
|
+
const highX = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
99
|
+
const lowVal = (0, _reactNativeReanimated.useSharedValue)(isRange ? currentValue[0] : currentValue);
|
|
100
|
+
const highVal = (0, _reactNativeReanimated.useSharedValue)(isRange ? currentValue[1] : currentValue);
|
|
101
|
+
const dragStartX = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
102
|
+
const trackW = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
103
|
+
const lowScale = (0, _reactNativeReanimated.useSharedValue)(1);
|
|
104
|
+
const highScale = (0, _reactNativeReanimated.useSharedValue)(1);
|
|
105
|
+
const lowLabelOpacity = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
106
|
+
const highLabelOpacity = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
103
107
|
|
|
104
|
-
//
|
|
108
|
+
// Float-drift guard precision for step snapping (e.g. step 0.1 -> precision 10).
|
|
109
|
+
const precision = (0, _react.useMemo)(() => {
|
|
110
|
+
const decimals = String(step).split('.')[1]?.length ?? 0;
|
|
111
|
+
return Math.pow(10, decimals);
|
|
112
|
+
}, [step]);
|
|
113
|
+
(0, _react.useEffect)(() => {
|
|
114
|
+
return () => {
|
|
115
|
+
(0, _reactNativeReanimated.cancelAnimation)(lowX);
|
|
116
|
+
(0, _reactNativeReanimated.cancelAnimation)(highX);
|
|
117
|
+
(0, _reactNativeReanimated.cancelAnimation)(lowScale);
|
|
118
|
+
(0, _reactNativeReanimated.cancelAnimation)(highScale);
|
|
119
|
+
(0, _reactNativeReanimated.cancelAnimation)(lowLabelOpacity);
|
|
120
|
+
(0, _reactNativeReanimated.cancelAnimation)(highLabelOpacity);
|
|
121
|
+
};
|
|
122
|
+
}, [lowX, highX, lowScale, highScale, lowLabelOpacity, highLabelOpacity]);
|
|
105
123
|
const valueToPx = (0, _react.useCallback)((value, width) => {
|
|
106
124
|
if (max === min || width <= 0) return 0;
|
|
107
|
-
|
|
108
|
-
return ratio * width;
|
|
125
|
+
return (value - min) / (max - min) * width;
|
|
109
126
|
}, [min, max]);
|
|
110
|
-
|
|
111
|
-
// Derived helper: convert px -> snapped value.
|
|
112
127
|
const pxToValue = (0, _react.useCallback)((px, width) => {
|
|
113
128
|
if (width <= 0) return min;
|
|
114
129
|
const ratio = clamp(px / width, 0, 1);
|
|
115
|
-
|
|
116
|
-
return snapToStep(raw, min, max, step);
|
|
130
|
+
return snapToStep(min + ratio * (max - min), min, max, step);
|
|
117
131
|
}, [min, max, step]);
|
|
118
132
|
|
|
119
|
-
// Sync external value ->
|
|
133
|
+
// Sync external value -> shared values (controlled updates, value prop changes).
|
|
120
134
|
(0, _react.useEffect)(() => {
|
|
121
135
|
if (trackWidth <= 0) return;
|
|
122
136
|
if (isRange) {
|
|
123
|
-
const [v0, v1] =
|
|
137
|
+
const [v0, v1] = currentValue;
|
|
124
138
|
const lo = Math.min(v0, v1);
|
|
125
139
|
const hi = Math.max(v0, v1);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
(0, _index.setNativeValue)(lowX, valueToPx(lo, trackWidth));
|
|
131
|
-
(0, _index.setNativeValue)(highX, valueToPx(hi, trackWidth));
|
|
140
|
+
lowVal.value = lo;
|
|
141
|
+
highVal.value = hi;
|
|
142
|
+
lowX.value = valueToPx(lo, trackWidth);
|
|
143
|
+
highX.value = valueToPx(hi, trackWidth);
|
|
132
144
|
} else {
|
|
133
|
-
const v =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
(0, _index.setNativeValue)(lowX, valueToPx(v, trackWidth));
|
|
145
|
+
const v = currentValue;
|
|
146
|
+
lowVal.value = v;
|
|
147
|
+
highVal.value = v;
|
|
148
|
+
lowX.value = valueToPx(v, trackWidth);
|
|
138
149
|
}
|
|
139
|
-
// We intentionally listen to props.value across both shapes via JSON; ESLint is fine.
|
|
140
150
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
|
-
}, [JSON.stringify(
|
|
151
|
+
}, [JSON.stringify(currentValue), trackWidth, isRange, valueToPx]);
|
|
142
152
|
const onTrackLayout = (0, _react.useCallback)(e => {
|
|
143
153
|
const w = e.nativeEvent.layout.width;
|
|
154
|
+
trackW.value = w;
|
|
144
155
|
setTrackWidth(w);
|
|
145
|
-
|
|
146
|
-
if (isRange) {
|
|
147
|
-
const [v0, v1] = props.value;
|
|
148
|
-
const lo = Math.min(v0, v1);
|
|
149
|
-
const hi = Math.max(v0, v1);
|
|
150
|
-
(0, _index.setNativeValue)(lowX, valueToPx(lo, w));
|
|
151
|
-
(0, _index.setNativeValue)(highX, valueToPx(hi, w));
|
|
152
|
-
} else {
|
|
153
|
-
(0, _index.setNativeValue)(lowX, valueToPx(props.value, w));
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
157
|
-
[isRange, valueToPx]);
|
|
156
|
+
}, [trackW]);
|
|
158
157
|
const fireChange = (0, _react.useCallback)((lo, hi) => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, [
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
158
|
+
setCurrentValue(isRange ? [lo, hi] : lo);
|
|
159
|
+
}, [isRange, setCurrentValue]);
|
|
160
|
+
const fireHaptic = (0, _react.useCallback)(() => {
|
|
161
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
162
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
163
|
+
}, [haptic]);
|
|
164
|
+
|
|
165
|
+
// ───────── Pan gesture per thumb (UI thread) ─────────
|
|
166
|
+
const buildPan = (0, _react.useCallback)(which => {
|
|
167
|
+
const xSV = which === 'low' ? lowX : highX;
|
|
168
|
+
const valSV = which === 'low' ? lowVal : highVal;
|
|
169
|
+
const otherSV = which === 'low' ? highVal : lowVal;
|
|
170
|
+
const scaleSV = which === 'low' ? lowScale : highScale;
|
|
171
|
+
const labelSV = which === 'low' ? lowLabelOpacity : highLabelOpacity;
|
|
172
|
+
const isLow = which === 'low';
|
|
173
|
+
const _min = min;
|
|
174
|
+
const _max = max;
|
|
175
|
+
const _step = step;
|
|
176
|
+
const _precision = precision;
|
|
177
|
+
const _range = isRange;
|
|
178
|
+
const _pressScale = resolvedPressScale;
|
|
179
|
+
const _pressAnim = thumbPressAnimationEnabled;
|
|
180
|
+
const _showLabel = showLabel;
|
|
181
|
+
const _labelOpacity = resolvedLabelOpacity;
|
|
182
|
+
const _labelDur = resolvedLabelDuration;
|
|
183
|
+
const _spring = springCfg;
|
|
184
|
+
return _reactNativeGestureHandler.Gesture.Pan().enabled(!disabled).minDistance(0).onStart(() => {
|
|
185
|
+
'worklet';
|
|
184
186
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
animateThumbPress(which === 'low' ? lowScale : highScale, which === 'low' ? lowLabelOpacity : highLabelOpacity, true);
|
|
193
|
-
if (sliderTheme?.dragHaptic ?? false) (0, _index2.triggerHaptic)('selection');
|
|
194
|
-
},
|
|
195
|
-
onPanResponderMove: (_evt, gesture) => {
|
|
196
|
-
if (trackWidth <= 0) return;
|
|
197
|
-
const nextPx = clamp(dragOffsetRef.current + gesture.dx, 0, trackWidth);
|
|
198
|
-
let nextValue = pxToValue(nextPx, trackWidth);
|
|
199
|
-
if (which === 'low') {
|
|
200
|
-
if (isRange && nextValue > highRef.current) nextValue = highRef.current;
|
|
201
|
-
if (nextValue !== lastReportedLow.current) {
|
|
202
|
-
if (sliderTheme?.stepHaptic ?? false) (0, _index2.triggerHaptic)('selection');
|
|
203
|
-
lastReportedLow.current = nextValue;
|
|
204
|
-
}
|
|
205
|
-
lowRef.current = nextValue;
|
|
206
|
-
(0, _index.setNativeValue)(lowX, valueToPx(nextValue, trackWidth));
|
|
207
|
-
fireChange(nextValue, highRef.current);
|
|
208
|
-
} else {
|
|
209
|
-
if (isRange && nextValue < lowRef.current) nextValue = lowRef.current;
|
|
210
|
-
if (nextValue !== lastReportedHigh.current) {
|
|
211
|
-
if (sliderTheme?.stepHaptic ?? false) (0, _index2.triggerHaptic)('selection');
|
|
212
|
-
lastReportedHigh.current = nextValue;
|
|
213
|
-
}
|
|
214
|
-
highRef.current = nextValue;
|
|
215
|
-
(0, _index.setNativeValue)(highX, valueToPx(nextValue, trackWidth));
|
|
216
|
-
fireChange(lowRef.current, nextValue);
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
onPanResponderRelease: () => {
|
|
220
|
-
animateThumbPress(which === 'low' ? lowScale : highScale, which === 'low' ? lowLabelOpacity : highLabelOpacity, false);
|
|
221
|
-
},
|
|
222
|
-
onPanResponderTerminate: () => {
|
|
223
|
-
animateThumbPress(which === 'low' ? lowScale : highScale, which === 'low' ? lowLabelOpacity : highLabelOpacity, false);
|
|
187
|
+
dragStartX.value = xSV.value;
|
|
188
|
+
if (_pressAnim) scaleSV.value = (0, _reactNativeReanimated.withSpring)(_pressScale, _spring);
|
|
189
|
+
if (_showLabel) {
|
|
190
|
+
labelSV.value = (0, _reactNativeReanimated.withTiming)(_labelOpacity, {
|
|
191
|
+
duration: _labelDur,
|
|
192
|
+
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)
|
|
193
|
+
});
|
|
224
194
|
}
|
|
225
|
-
|
|
226
|
-
|
|
195
|
+
(0, _reactNativeReanimated.runOnJS)(fireHaptic)();
|
|
196
|
+
}).onUpdate(event => {
|
|
197
|
+
'worklet';
|
|
227
198
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
199
|
+
if (trackW.value <= 0) return;
|
|
200
|
+
const px = Math.min(Math.max(dragStartX.value + event.translationX, 0), trackW.value);
|
|
201
|
+
const ratio = px / trackW.value;
|
|
202
|
+
let v = _min + ratio * (_max - _min);
|
|
203
|
+
if (_step > 0) {
|
|
204
|
+
v = Math.round((v - _min) / _step) * _step + _min;
|
|
205
|
+
v = Math.round(v * _precision) / _precision;
|
|
206
|
+
}
|
|
207
|
+
v = Math.min(Math.max(v, _min), _max);
|
|
208
|
+
if (_range) {
|
|
209
|
+
if (isLow && v > otherSV.value) v = otherSV.value;
|
|
210
|
+
if (!isLow && v < otherSV.value) v = otherSV.value;
|
|
211
|
+
}
|
|
212
|
+
// Thumb sits at the snapped value's position.
|
|
213
|
+
xSV.value = _max === _min ? 0 : (v - _min) / (_max - _min) * trackW.value;
|
|
214
|
+
if (v !== valSV.value) {
|
|
215
|
+
valSV.value = v;
|
|
216
|
+
(0, _reactNativeReanimated.runOnJS)(fireHaptic)();
|
|
217
|
+
(0, _reactNativeReanimated.runOnJS)(fireChange)(lowVal.value, highVal.value);
|
|
218
|
+
}
|
|
219
|
+
}).onEnd(() => {
|
|
220
|
+
'worklet';
|
|
221
|
+
|
|
222
|
+
if (_pressAnim) scaleSV.value = (0, _reactNativeReanimated.withSpring)(1, _spring);
|
|
223
|
+
if (_showLabel) {
|
|
224
|
+
labelSV.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
225
|
+
duration: _labelDur,
|
|
226
|
+
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}, [disabled, min, max, step, precision, isRange, resolvedPressScale, thumbPressAnimationEnabled, showLabel, resolvedLabelOpacity, resolvedLabelDuration, springCfg, fireChange, fireHaptic, lowX, highX, lowVal, highVal, lowScale, highScale, lowLabelOpacity, highLabelOpacity, dragStartX, trackW]);
|
|
231
|
+
const lowPan = (0, _react.useMemo)(() => buildPan('low'), [buildPan]);
|
|
232
|
+
const highPan = (0, _react.useMemo)(() => buildPan('high'), [buildPan]);
|
|
231
233
|
|
|
232
234
|
// Tap on track jumps to position (single mode only).
|
|
233
235
|
const handleTrackPress = (0, _react.useCallback)(e => {
|
|
234
236
|
if (disabled || isRange || trackWidth <= 0) return;
|
|
235
237
|
const px = clamp(e.nativeEvent.locationX, 0, trackWidth);
|
|
236
238
|
const next = pxToValue(px, trackWidth);
|
|
237
|
-
if (next !==
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
_reactNative.Animated.timing(lowX, {
|
|
242
|
-
toValue: valueToPx(next, trackWidth),
|
|
239
|
+
if (next !== lowVal.value) {
|
|
240
|
+
fireHaptic();
|
|
241
|
+
lowVal.value = next;
|
|
242
|
+
lowX.value = (0, _reactNativeReanimated.withTiming)(valueToPx(next, trackWidth), {
|
|
243
243
|
duration: theme.motion.duration.fast,
|
|
244
|
-
easing:
|
|
245
|
-
|
|
246
|
-
}).start();
|
|
244
|
+
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)
|
|
245
|
+
});
|
|
247
246
|
fireChange(next, next);
|
|
248
247
|
}
|
|
249
|
-
}, [disabled, isRange, trackWidth, pxToValue, valueToPx, fireChange, lowX, theme.motion.duration.fast]);
|
|
248
|
+
}, [disabled, isRange, trackWidth, pxToValue, valueToPx, fireChange, fireHaptic, lowX, lowVal, theme.motion.duration.fast]);
|
|
250
249
|
|
|
251
|
-
// Accessibility actions: increment / decrement
|
|
250
|
+
// Accessibility actions: increment / decrement.
|
|
252
251
|
const handleAccessibilityAction = (0, _react.useCallback)(event => {
|
|
253
252
|
if (disabled) return;
|
|
254
253
|
const delta = event.nativeEvent.actionName === 'increment' ? step : -step;
|
|
255
254
|
if (isRange) {
|
|
256
|
-
const nextLow = clamp(
|
|
257
|
-
if (nextLow !==
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
(
|
|
261
|
-
|
|
262
|
-
fireChange(nextLow, highRef.current);
|
|
255
|
+
const nextLow = clamp(lowVal.value + delta, min, highVal.value);
|
|
256
|
+
if (nextLow !== lowVal.value) {
|
|
257
|
+
lowVal.value = nextLow;
|
|
258
|
+
lowX.value = valueToPx(nextLow, trackWidth);
|
|
259
|
+
fireHaptic();
|
|
260
|
+
fireChange(nextLow, highVal.value);
|
|
263
261
|
}
|
|
264
262
|
} else {
|
|
265
|
-
const next = clamp(
|
|
266
|
-
if (next !==
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
(
|
|
270
|
-
if (sliderTheme?.a11yHaptic ?? false) (0, _index2.triggerHaptic)('selection');
|
|
263
|
+
const next = clamp(lowVal.value + delta, min, max);
|
|
264
|
+
if (next !== lowVal.value) {
|
|
265
|
+
lowVal.value = next;
|
|
266
|
+
lowX.value = valueToPx(next, trackWidth);
|
|
267
|
+
fireHaptic();
|
|
271
268
|
fireChange(next, next);
|
|
272
269
|
}
|
|
273
270
|
}
|
|
274
|
-
}, [disabled, step, isRange, min, max, valueToPx, trackWidth, lowX, fireChange,
|
|
275
|
-
|
|
276
|
-
// Computed values for fill bar.
|
|
277
|
-
const fillLeft = isRange ? lowX : new _reactNative.Animated.Value(0);
|
|
278
|
-
const fillWidth = isRange ? _reactNative.Animated.subtract(highX, lowX) : lowX;
|
|
271
|
+
}, [disabled, step, isRange, min, max, valueToPx, trackWidth, lowX, lowVal, highVal, fireChange, fireHaptic]);
|
|
279
272
|
const thumbRadius = sizeCfg.thumbDiameter / 2;
|
|
280
273
|
|
|
281
|
-
//
|
|
282
|
-
const
|
|
283
|
-
|
|
274
|
+
// ───────── Animated styles ─────────
|
|
275
|
+
const fillAnimStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => isRange ? {
|
|
276
|
+
left: lowX.value,
|
|
277
|
+
width: Math.max(0, highX.value - lowX.value)
|
|
278
|
+
} : {
|
|
279
|
+
left: 0,
|
|
280
|
+
width: lowX.value
|
|
281
|
+
});
|
|
282
|
+
const lowThumbStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
283
|
+
transform: [{
|
|
284
|
+
translateX: lowX.value - thumbRadius
|
|
285
|
+
}, {
|
|
286
|
+
scale: lowScale.value
|
|
287
|
+
}]
|
|
288
|
+
}));
|
|
289
|
+
const highThumbStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
290
|
+
transform: [{
|
|
291
|
+
translateX: highX.value - thumbRadius
|
|
292
|
+
}, {
|
|
293
|
+
scale: highScale.value
|
|
294
|
+
}]
|
|
295
|
+
}));
|
|
296
|
+
const lowLabelStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
297
|
+
opacity: lowLabelOpacity.value
|
|
298
|
+
}));
|
|
299
|
+
const highLabelStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
300
|
+
opacity: highLabelOpacity.value
|
|
301
|
+
}));
|
|
302
|
+
|
|
303
|
+
// Display values (from committed state) for labels + a11y.
|
|
304
|
+
const lowDisplayValue = isRange ? Math.min(...currentValue) : currentValue;
|
|
305
|
+
const highDisplayValue = isRange ? Math.max(...currentValue) : currentValue;
|
|
284
306
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
285
307
|
ref: ref,
|
|
286
308
|
style: [styles.container, containerStyle, style],
|
|
@@ -290,10 +312,15 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
290
312
|
accessibilityState: {
|
|
291
313
|
disabled
|
|
292
314
|
},
|
|
293
|
-
accessibilityValue: {
|
|
315
|
+
accessibilityValue: isRange ? {
|
|
316
|
+
min,
|
|
317
|
+
max,
|
|
318
|
+
now: lowDisplayValue,
|
|
319
|
+
text: `${lowDisplayValue} to ${highDisplayValue}`
|
|
320
|
+
} : {
|
|
294
321
|
min,
|
|
295
322
|
max,
|
|
296
|
-
now:
|
|
323
|
+
now: lowDisplayValue
|
|
297
324
|
},
|
|
298
325
|
accessibilityActions: [{
|
|
299
326
|
name: 'increment'
|
|
@@ -314,69 +341,59 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
314
341
|
style: [styles.track, {
|
|
315
342
|
backgroundColor: disabled ? theme.colors.surface.disabled : theme.colors.border.primary
|
|
316
343
|
}, trackStyle]
|
|
317
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
344
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
318
345
|
style: [styles.fill, {
|
|
319
|
-
left: fillLeft,
|
|
320
|
-
width: fillWidth,
|
|
321
346
|
backgroundColor: disabled ? theme.colors.surface.disabled : fillColor,
|
|
322
|
-
opacity: disabled ? 0.
|
|
323
|
-
}, fillStyle]
|
|
324
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
backgroundColor: fillColor
|
|
373
|
-
}],
|
|
374
|
-
pointerEvents: "none",
|
|
375
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
376
|
-
style: [styles.bubbleText, labelStyle],
|
|
377
|
-
children: formatLabel(highDisplayValue)
|
|
378
|
-
})
|
|
379
|
-
}) : null
|
|
347
|
+
opacity: disabled ? 0.55 : 1
|
|
348
|
+
}, fillStyle, fillAnimStyle]
|
|
349
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
|
|
350
|
+
gesture: lowPan,
|
|
351
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
352
|
+
style: [styles.thumb, {
|
|
353
|
+
width: sizeCfg.thumbDiameter,
|
|
354
|
+
height: sizeCfg.thumbDiameter,
|
|
355
|
+
borderRadius: thumbRadius,
|
|
356
|
+
backgroundColor: theme.colors.background.elevated,
|
|
357
|
+
borderColor: disabled ? theme.colors.surface.disabled : fillColor,
|
|
358
|
+
opacity: disabled ? 0.55 : 1
|
|
359
|
+
}, thumbStyle, lowThumbStyle],
|
|
360
|
+
accessibilityElementsHidden: true,
|
|
361
|
+
importantForAccessibility: "no-hide-descendants",
|
|
362
|
+
children: showLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
363
|
+
style: [styles.bubble, {
|
|
364
|
+
backgroundColor: fillColor
|
|
365
|
+
}, lowLabelStyle],
|
|
366
|
+
pointerEvents: "none",
|
|
367
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
368
|
+
style: [styles.bubbleText, labelStyle],
|
|
369
|
+
children: formatLabel(lowDisplayValue)
|
|
370
|
+
})
|
|
371
|
+
}) : null
|
|
372
|
+
})
|
|
373
|
+
}), isRange ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
|
|
374
|
+
gesture: highPan,
|
|
375
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
376
|
+
style: [styles.thumb, {
|
|
377
|
+
width: sizeCfg.thumbDiameter,
|
|
378
|
+
height: sizeCfg.thumbDiameter,
|
|
379
|
+
borderRadius: thumbRadius,
|
|
380
|
+
backgroundColor: theme.colors.background.elevated,
|
|
381
|
+
borderColor: disabled ? theme.colors.surface.disabled : fillColor,
|
|
382
|
+
opacity: disabled ? 0.55 : 1
|
|
383
|
+
}, thumbStyle, highThumbStyle],
|
|
384
|
+
accessibilityElementsHidden: true,
|
|
385
|
+
importantForAccessibility: "no-hide-descendants",
|
|
386
|
+
children: showLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
387
|
+
style: [styles.bubble, {
|
|
388
|
+
backgroundColor: fillColor
|
|
389
|
+
}, highLabelStyle],
|
|
390
|
+
pointerEvents: "none",
|
|
391
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
392
|
+
style: [styles.bubbleText, labelStyle],
|
|
393
|
+
children: formatLabel(highDisplayValue)
|
|
394
|
+
})
|
|
395
|
+
}) : null
|
|
396
|
+
})
|
|
380
397
|
}) : null]
|
|
381
398
|
})
|
|
382
399
|
})
|
|
@@ -437,7 +454,6 @@ const buildStyles = (theme, sizeCfg) => {
|
|
|
437
454
|
minWidth: 36,
|
|
438
455
|
alignItems: 'center',
|
|
439
456
|
justifyContent: 'center',
|
|
440
|
-
// A subtle shadow for elevation.
|
|
441
457
|
..._reactNative.Platform.select({
|
|
442
458
|
ios: {
|
|
443
459
|
shadowColor: theme.shadows.sm.shadowColor,
|
|
@@ -10,9 +10,9 @@ var _index = require("../../theme/index.js");
|
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
12
|
const sizeMap = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
sm: 20,
|
|
14
|
+
md: 32,
|
|
15
|
+
lg: 48
|
|
16
16
|
};
|
|
17
17
|
const DOT_COUNT = 3;
|
|
18
18
|
const DOT_STAGGER_MS = 150;
|
|
@@ -55,7 +55,7 @@ const Dot = ({
|
|
|
55
55
|
};
|
|
56
56
|
const Spinner = exports.Spinner = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
57
57
|
const {
|
|
58
|
-
size = '
|
|
58
|
+
size = 'md',
|
|
59
59
|
color,
|
|
60
60
|
message,
|
|
61
61
|
overlay = false,
|
|
@@ -98,7 +98,7 @@ const Spinner = exports.Spinner = /*#__PURE__*/(0, _react.forwardRef)((props, re
|
|
|
98
98
|
}
|
|
99
99
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
100
100
|
color: resolvedColor,
|
|
101
|
-
size: size === '
|
|
101
|
+
size: size === 'sm' ? 'small' : 'large',
|
|
102
102
|
style: {
|
|
103
103
|
width: dimension,
|
|
104
104
|
height: dimension
|