@webority-technologies/mobile 0.0.23 → 0.0.25
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 +5 -5
- 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/Autocomplete/Autocomplete.js +204 -0
- package/lib/commonjs/components/Autocomplete/index.js +13 -0
- package/lib/commonjs/components/Banner/Banner.js +12 -2
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/commonjs/components/Card/Card.js +3 -3
- package/lib/commonjs/components/Checkbox/Checkbox.js +3 -2
- package/lib/commonjs/components/Chip/Chip.js +4 -2
- package/lib/commonjs/components/Confetti/Confetti.js +170 -0
- package/lib/commonjs/components/Confetti/index.js +13 -0
- package/lib/commonjs/components/DatePicker/DatePicker.js +23 -18
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +11 -9
- package/lib/commonjs/components/Dialog/Dialog.js +4 -2
- package/lib/commonjs/components/Drawer/Drawer.js +4 -2
- package/lib/commonjs/components/FieldBase/FieldBase.js +0 -2
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +10 -8
- package/lib/commonjs/components/IconButton/IconButton.js +176 -0
- package/lib/commonjs/components/IconButton/index.js +13 -0
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +17 -15
- package/lib/commonjs/components/ListItem/ListItem.js +4 -3
- package/lib/commonjs/components/Modal/Modal.js +4 -4
- package/lib/commonjs/components/NumberInput/NumberInput.js +7 -5
- package/lib/commonjs/components/OTPInput/OTPInput.js +7 -7
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +32 -4
- package/lib/commonjs/components/Radio/Radio.js +2 -3
- package/lib/commonjs/components/Rating/Rating.js +4 -3
- package/lib/commonjs/components/SearchBar/SearchBar.js +7 -4
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +4 -3
- package/lib/commonjs/components/Select/Select.js +7 -4
- package/lib/commonjs/components/SlideToConfirm/SlideToConfirm.js +224 -0
- package/lib/commonjs/components/SlideToConfirm/index.js +13 -0
- package/lib/commonjs/components/Slider/Slider.js +228 -228
- package/lib/commonjs/components/Stepper/Stepper.js +6 -5
- package/lib/commonjs/components/Swipeable/Swipeable.js +8 -9
- package/lib/commonjs/components/Tabs/Tabs.js +4 -3
- package/lib/commonjs/components/TimePicker/TimePicker.js +14 -9
- package/lib/commonjs/components/index.js +149 -114
- package/lib/commonjs/hooks/usePressAnimation.js +0 -1
- package/lib/commonjs/utils/hapticUtils.js +11 -1
- package/lib/commonjs/utils/index.js +6 -0
- package/lib/module/components/Accordion/Accordion.js +6 -6
- 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/Autocomplete/Autocomplete.js +199 -0
- package/lib/module/components/Autocomplete/index.js +4 -0
- package/lib/module/components/Banner/Banner.js +12 -2
- package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/module/components/Card/Card.js +4 -4
- package/lib/module/components/Checkbox/Checkbox.js +4 -3
- package/lib/module/components/Chip/Chip.js +5 -3
- package/lib/module/components/Confetti/Confetti.js +166 -0
- package/lib/module/components/Confetti/index.js +4 -0
- package/lib/module/components/DatePicker/DatePicker.js +24 -19
- package/lib/module/components/DateRangePicker/DateRangePicker.js +12 -10
- package/lib/module/components/Dialog/Dialog.js +5 -3
- package/lib/module/components/Drawer/Drawer.js +5 -3
- package/lib/module/components/FieldBase/FieldBase.js +0 -2
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +11 -9
- package/lib/module/components/IconButton/IconButton.js +172 -0
- package/lib/module/components/IconButton/index.js +4 -0
- package/lib/module/components/ImageGallery/ImageGallery.js +18 -16
- package/lib/module/components/ListItem/ListItem.js +5 -4
- package/lib/module/components/Modal/Modal.js +5 -5
- package/lib/module/components/NumberInput/NumberInput.js +8 -6
- package/lib/module/components/OTPInput/OTPInput.js +8 -8
- package/lib/module/components/ProgressBar/ProgressBar.js +33 -5
- package/lib/module/components/Radio/Radio.js +3 -4
- package/lib/module/components/Rating/Rating.js +5 -4
- package/lib/module/components/SearchBar/SearchBar.js +8 -5
- package/lib/module/components/SegmentedControl/SegmentedControl.js +5 -4
- package/lib/module/components/Select/Select.js +8 -5
- package/lib/module/components/SlideToConfirm/SlideToConfirm.js +220 -0
- package/lib/module/components/SlideToConfirm/index.js +4 -0
- package/lib/module/components/Slider/Slider.js +231 -231
- package/lib/module/components/Stepper/Stepper.js +7 -6
- package/lib/module/components/Swipeable/Swipeable.js +9 -10
- package/lib/module/components/Tabs/Tabs.js +5 -4
- package/lib/module/components/TimePicker/TimePicker.js +15 -10
- package/lib/module/components/index.js +5 -0
- package/lib/module/hooks/usePressAnimation.js +0 -1
- 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/Autocomplete/Autocomplete.d.ts +53 -0
- package/lib/typescript/commonjs/components/Autocomplete/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +3 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +3 -0
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +1 -0
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +3 -0
- package/lib/typescript/commonjs/components/Confetti/Confetti.d.ts +41 -0
- package/lib/typescript/commonjs/components/Confetti/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +3 -0
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +3 -0
- 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/IconButton/IconButton.d.ts +34 -0
- package/lib/typescript/commonjs/components/IconButton/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -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 +3 -0
- package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +6 -0
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +12 -0
- package/lib/typescript/commonjs/components/ProgressBar/index.d.ts +1 -1
- 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 +3 -0
- package/lib/typescript/commonjs/components/Select/Select.d.ts +6 -0
- package/lib/typescript/commonjs/components/SlideToConfirm/SlideToConfirm.d.ts +34 -0
- package/lib/typescript/commonjs/components/SlideToConfirm/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +3 -0
- 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/Tabs/Tabs.d.ts +3 -0
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +3 -0
- package/lib/typescript/commonjs/components/index.d.ts +11 -1
- package/lib/typescript/commonjs/hooks/usePressAnimation.d.ts +1 -2
- package/lib/typescript/commonjs/theme/types.d.ts +2 -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/Autocomplete/Autocomplete.d.ts +53 -0
- package/lib/typescript/module/components/Autocomplete/index.d.ts +3 -0
- package/lib/typescript/module/components/Banner/Banner.d.ts +3 -0
- package/lib/typescript/module/components/Card/Card.d.ts +3 -0
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +1 -0
- package/lib/typescript/module/components/Chip/Chip.d.ts +3 -0
- package/lib/typescript/module/components/Confetti/Confetti.d.ts +41 -0
- package/lib/typescript/module/components/Confetti/index.d.ts +3 -0
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +3 -0
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +3 -0
- 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/IconButton/IconButton.d.ts +34 -0
- package/lib/typescript/module/components/IconButton/index.d.ts +3 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -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 +3 -0
- package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +6 -0
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +12 -0
- package/lib/typescript/module/components/ProgressBar/index.d.ts +1 -1
- 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 +3 -0
- package/lib/typescript/module/components/Select/Select.d.ts +6 -0
- package/lib/typescript/module/components/SlideToConfirm/SlideToConfirm.d.ts +34 -0
- package/lib/typescript/module/components/SlideToConfirm/index.d.ts +3 -0
- package/lib/typescript/module/components/Slider/Slider.d.ts +3 -0
- 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/Tabs/Tabs.d.ts +3 -0
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +3 -0
- package/lib/typescript/module/components/index.d.ts +11 -1
- package/lib/typescript/module/hooks/usePressAnimation.d.ts +1 -2
- package/lib/typescript/module/theme/types.d.ts +2 -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
|
@@ -18,7 +18,6 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
18
18
|
visible,
|
|
19
19
|
onRequestClose,
|
|
20
20
|
presentation = 'centered',
|
|
21
|
-
backdropOpacity = 0.5,
|
|
22
21
|
backdropPressClose = true,
|
|
23
22
|
animationDuration,
|
|
24
23
|
accessibilityLabel,
|
|
@@ -27,6 +26,7 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
27
26
|
contentStyle,
|
|
28
27
|
backdropStyle,
|
|
29
28
|
restoreFocusRef,
|
|
29
|
+
haptic,
|
|
30
30
|
testID
|
|
31
31
|
} = props;
|
|
32
32
|
const theme = (0, _index.useTheme)();
|
|
@@ -35,7 +35,6 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
35
35
|
const screenHeight = _reactNative.Dimensions.get('window').height;
|
|
36
36
|
const modalTokens = theme.components.modal;
|
|
37
37
|
const scaleStartValue = modalTokens?.scaleStartValue ?? 0.9;
|
|
38
|
-
const backdropHaptic = modalTokens?.backdropHaptic ?? false;
|
|
39
38
|
const backdropAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
|
|
40
39
|
const scaleAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(scaleStartValue)).current;
|
|
41
40
|
const opacityAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
|
|
@@ -131,9 +130,10 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
131
130
|
}, [visible, duration, restoreFocusRef]);
|
|
132
131
|
const handleBackdropPress = (0, _react.useCallback)(() => {
|
|
133
132
|
if (!backdropPressClose) return;
|
|
134
|
-
|
|
133
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
134
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
135
135
|
onRequestClose();
|
|
136
|
-
}, [backdropPressClose, onRequestClose,
|
|
136
|
+
}, [backdropPressClose, onRequestClose, haptic]);
|
|
137
137
|
const handleHardwareBack = (0, _react.useCallback)(() => {
|
|
138
138
|
if (hardwareBackPress) {
|
|
139
139
|
onRequestClose();
|
|
@@ -63,6 +63,7 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
63
63
|
size = 'md',
|
|
64
64
|
variant = 'inline',
|
|
65
65
|
unit,
|
|
66
|
+
haptic,
|
|
66
67
|
accessibilityLabel,
|
|
67
68
|
style,
|
|
68
69
|
containerStyle,
|
|
@@ -86,7 +87,6 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
86
87
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
87
88
|
const longPressDelay = theme.components.numberInput?.longPressDelayMs ?? DEFAULT_LONG_PRESS_DELAY;
|
|
88
89
|
const longPressInterval = theme.components.numberInput?.longPressIntervalMs ?? DEFAULT_LONG_PRESS_INTERVAL;
|
|
89
|
-
const pressHaptic = theme.components.numberInput?.pressHaptic ?? false;
|
|
90
90
|
const inputRef = (0, _react.useRef)(null);
|
|
91
91
|
const [draft, setDraft] = (0, _react.useState)(formatValue(current, allowDecimal, precision));
|
|
92
92
|
const [editing, setEditing] = (0, _react.useState)(false);
|
|
@@ -121,14 +121,16 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
121
121
|
}, [allowDecimal, max, min, setCurrent, precision, current]);
|
|
122
122
|
const decrement = (0, _react.useCallback)(() => {
|
|
123
123
|
if (!interactive || atMin) return;
|
|
124
|
-
|
|
124
|
+
const h = (0, _index3.resolveHaptic)(haptic, 'selection');
|
|
125
|
+
if (h) (0, _index3.triggerHaptic)(h);
|
|
125
126
|
setExternal(current - step);
|
|
126
|
-
}, [atMin, interactive,
|
|
127
|
+
}, [atMin, interactive, haptic, setExternal, step, current]);
|
|
127
128
|
const increment = (0, _react.useCallback)(() => {
|
|
128
129
|
if (!interactive || atMax) return;
|
|
129
|
-
|
|
130
|
+
const h = (0, _index3.resolveHaptic)(haptic, 'selection');
|
|
131
|
+
if (h) (0, _index3.triggerHaptic)(h);
|
|
130
132
|
setExternal(current + step);
|
|
131
|
-
}, [atMax, interactive,
|
|
133
|
+
}, [atMax, interactive, haptic, setExternal, step, current]);
|
|
132
134
|
_react.default.useImperativeHandle(ref, () => ({
|
|
133
135
|
focus: () => inputRef.current?.focus(),
|
|
134
136
|
blur: () => inputRef.current?.blur(),
|
|
@@ -52,6 +52,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
52
52
|
error,
|
|
53
53
|
size = 'md',
|
|
54
54
|
secure = false,
|
|
55
|
+
haptic,
|
|
55
56
|
accessibilityLabel,
|
|
56
57
|
style,
|
|
57
58
|
cellStyle,
|
|
@@ -94,8 +95,6 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
94
95
|
const previousFocusedIndexRef = (0, _react.useRef)(-1);
|
|
95
96
|
const shakeOnError = theme.components.otpInput?.shakeOnError ?? false;
|
|
96
97
|
const reduceMotion = (0, _index2.useReducedMotion)();
|
|
97
|
-
const errorHaptic = theme.components.otpInput?.errorHaptic ?? false;
|
|
98
|
-
const selectionHaptic = theme.components.otpInput?.selectionHaptic ?? false;
|
|
99
98
|
const hasError = Boolean(error);
|
|
100
99
|
const errorMessage = typeof error === 'string' ? error : undefined;
|
|
101
100
|
|
|
@@ -105,7 +104,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
105
104
|
const isFirstRun = previousErrorRef.current === null;
|
|
106
105
|
let anim;
|
|
107
106
|
if (!isFirstRun && hasError && !previousErrorRef.current) {
|
|
108
|
-
if (
|
|
107
|
+
if (haptic !== false) (0, _index3.triggerHaptic)('notificationError');
|
|
109
108
|
if (shakeOnError && !reduceMotion) {
|
|
110
109
|
(0, _index.setNativeValue)(shake, 0);
|
|
111
110
|
anim = _reactNative.Animated.sequence([_reactNative.Animated.timing(shake, {
|
|
@@ -134,7 +133,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
134
133
|
}
|
|
135
134
|
previousErrorRef.current = hasError;
|
|
136
135
|
return () => anim?.stop();
|
|
137
|
-
}, [hasError, shake, shakeOnError,
|
|
136
|
+
}, [hasError, shake, shakeOnError, haptic]);
|
|
138
137
|
|
|
139
138
|
// Animate underline opacity for the focused cell. Skip on first mount
|
|
140
139
|
// (no prior focus state) — values are already at 0 and there's nothing to animate.
|
|
@@ -230,8 +229,9 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
230
229
|
const next = chars.join('').slice(0, length);
|
|
231
230
|
const previousLength = current.length;
|
|
232
231
|
updateValue(next);
|
|
233
|
-
if (next.length !== previousLength
|
|
234
|
-
(0, _index3.
|
|
232
|
+
if (next.length !== previousLength) {
|
|
233
|
+
const h = (0, _index3.resolveHaptic)(haptic, 'selection');
|
|
234
|
+
if (h) (0, _index3.triggerHaptic)(h);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
// Move focus to the next empty cell or last cell.
|
|
@@ -241,7 +241,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
241
241
|
} else {
|
|
242
242
|
focusCell(nextFocus);
|
|
243
243
|
}
|
|
244
|
-
}, [cells, focusCell, keyboardType, length,
|
|
244
|
+
}, [cells, focusCell, keyboardType, length, haptic, updateValue, current]);
|
|
245
245
|
const handleKeyPress = (0, _react.useCallback)((index, e) => {
|
|
246
246
|
const key = e.nativeEvent.key;
|
|
247
247
|
if (key !== 'Backspace') return;
|
|
@@ -38,6 +38,8 @@ const ProgressBar = exports.ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
38
38
|
tone = 'primary',
|
|
39
39
|
trackColor,
|
|
40
40
|
barColor,
|
|
41
|
+
gradient,
|
|
42
|
+
segments,
|
|
41
43
|
animated = true,
|
|
42
44
|
style,
|
|
43
45
|
containerStyle,
|
|
@@ -58,6 +60,12 @@ const ProgressBar = exports.ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
58
60
|
const resolvedRadius = radius ?? theme.radius.full;
|
|
59
61
|
const resolvedTrack = trackColor ?? theme.colors.surface.disabled;
|
|
60
62
|
const resolvedBar = barColor ?? toneColor(theme, tone);
|
|
63
|
+
const resolvedGradient = (0, _react.useMemo)(() => {
|
|
64
|
+
if (!gradient) return null;
|
|
65
|
+
if (typeof gradient === 'string') return theme.gradients[gradient] ?? null;
|
|
66
|
+
return gradient;
|
|
67
|
+
}, [gradient, theme.gradients]);
|
|
68
|
+
const hasSegments = Array.isArray(segments) && segments.length > 0;
|
|
61
69
|
(0, _react.useEffect)(() => {
|
|
62
70
|
if (isIndeterminate) return;
|
|
63
71
|
if (!animated) {
|
|
@@ -116,7 +124,18 @@ const ProgressBar = exports.ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
116
124
|
borderRadius: resolvedRadius,
|
|
117
125
|
backgroundColor: resolvedTrack
|
|
118
126
|
}, style, containerStyle],
|
|
119
|
-
children:
|
|
127
|
+
children: hasSegments ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
128
|
+
style: [styles.segments, {
|
|
129
|
+
height
|
|
130
|
+
}],
|
|
131
|
+
children: (segments ?? []).map((s, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
132
|
+
style: {
|
|
133
|
+
width: `${clampProgress(s.value) * 100}%`,
|
|
134
|
+
height,
|
|
135
|
+
backgroundColor: s.color ?? toneColor(theme, s.tone ?? 'primary')
|
|
136
|
+
}
|
|
137
|
+
}, i))
|
|
138
|
+
}) : isIndeterminate ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
120
139
|
style: [styles.indeterminateBar, {
|
|
121
140
|
height,
|
|
122
141
|
borderRadius: resolvedRadius,
|
|
@@ -130,9 +149,14 @@ const ProgressBar = exports.ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
130
149
|
style: [styles.determinateBar, {
|
|
131
150
|
height,
|
|
132
151
|
borderRadius: resolvedRadius,
|
|
133
|
-
backgroundColor: resolvedBar,
|
|
134
|
-
width: determinateWidth
|
|
135
|
-
|
|
152
|
+
backgroundColor: resolvedGradient ? 'transparent' : resolvedBar,
|
|
153
|
+
width: determinateWidth,
|
|
154
|
+
overflow: resolvedGradient ? 'hidden' : undefined
|
|
155
|
+
}, barStyle],
|
|
156
|
+
children: resolvedGradient ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Gradient, {
|
|
157
|
+
gradient: resolvedGradient,
|
|
158
|
+
style: _reactNative.StyleSheet.absoluteFill
|
|
159
|
+
}) : null
|
|
136
160
|
})
|
|
137
161
|
});
|
|
138
162
|
});
|
|
@@ -151,6 +175,10 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
151
175
|
position: 'absolute',
|
|
152
176
|
left: 0,
|
|
153
177
|
top: 0
|
|
178
|
+
},
|
|
179
|
+
segments: {
|
|
180
|
+
flexDirection: 'row',
|
|
181
|
+
width: '100%'
|
|
154
182
|
}
|
|
155
183
|
});
|
|
156
184
|
var _default = exports.default = ProgressBar;
|
|
@@ -70,8 +70,6 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
70
70
|
const inner = sizeOverrides?.inner ?? sizeMap[size].inner;
|
|
71
71
|
const radioBorderWidth = theme.colors.border.width;
|
|
72
72
|
const radioLabelGap = theme.components.radio?.labelGap ?? 10;
|
|
73
|
-
const pressHapticEnabled = theme.components.radio?.pressHaptic ?? false;
|
|
74
|
-
const resolvedHaptic = haptic === undefined ? pressHapticEnabled ? 'selection' : false : haptic;
|
|
75
73
|
const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(selected ? 1 : 0)).current;
|
|
76
74
|
(0, _react.useEffect)(() => {
|
|
77
75
|
const anim = _reactNative.Animated.spring(progress, {
|
|
@@ -90,7 +88,8 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
90
88
|
});
|
|
91
89
|
const handlePress = event => {
|
|
92
90
|
if (disabled) return;
|
|
93
|
-
|
|
91
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
92
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
94
93
|
if (ctx) {
|
|
95
94
|
ctx.onChange(value);
|
|
96
95
|
} else {
|
|
@@ -85,6 +85,7 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
85
85
|
tone = 'warning',
|
|
86
86
|
label,
|
|
87
87
|
loading = false,
|
|
88
|
+
haptic,
|
|
88
89
|
accessibilityLabel,
|
|
89
90
|
style,
|
|
90
91
|
containerStyle,
|
|
@@ -121,7 +122,6 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
121
122
|
}, [max]);
|
|
122
123
|
const pulseOnPress = theme.components.rating?.pulseOnPress ?? false;
|
|
123
124
|
const pulseScale = theme.components.rating?.pulseScale ?? 1.2;
|
|
124
|
-
const pressHapticEnabled = theme.components.rating?.pressHaptic ?? false;
|
|
125
125
|
const pulse = (0, _react.useCallback)(idx => {
|
|
126
126
|
const v = scaleRefs[idx];
|
|
127
127
|
if (!v) return;
|
|
@@ -141,10 +141,11 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
141
141
|
const commit = (0, _react.useCallback)((next, animatedIndex) => {
|
|
142
142
|
if (!interactive || !onChange) return;
|
|
143
143
|
const cleaned = clampToStep(next, max, step);
|
|
144
|
-
|
|
144
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
145
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
145
146
|
if (pulseOnPress && typeof animatedIndex === 'number') pulse(animatedIndex);
|
|
146
147
|
onChange(cleaned);
|
|
147
|
-
}, [interactive, onChange, max, step, pulse,
|
|
148
|
+
}, [interactive, onChange, max, step, pulse, haptic, pulseOnPress]);
|
|
148
149
|
const handleStarPress = (0, _react.useCallback)(index => e => {
|
|
149
150
|
if (!interactive) return;
|
|
150
151
|
const w = starWidthRef.current || starSize;
|
|
@@ -29,6 +29,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
29
29
|
size = 'md',
|
|
30
30
|
variant: variantProp,
|
|
31
31
|
cancelLabel = 'Cancel',
|
|
32
|
+
haptic,
|
|
32
33
|
style,
|
|
33
34
|
accessibilityLabel,
|
|
34
35
|
testID,
|
|
@@ -97,16 +98,18 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
97
98
|
onChangeText(text);
|
|
98
99
|
}, [debounceMs, onChangeText]);
|
|
99
100
|
const handleClear = (0, _react.useCallback)(() => {
|
|
100
|
-
(0, _hapticUtils.
|
|
101
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
102
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
101
103
|
if (debounceMs !== undefined) {
|
|
102
104
|
setInternalValue('');
|
|
103
105
|
lastSentRef.current = '';
|
|
104
106
|
}
|
|
105
107
|
onChangeText('');
|
|
106
108
|
onClear?.();
|
|
107
|
-
}, [debounceMs, onChangeText, onClear]);
|
|
109
|
+
}, [haptic, debounceMs, onChangeText, onClear]);
|
|
108
110
|
const handleCancel = (0, _react.useCallback)(() => {
|
|
109
|
-
(0, _hapticUtils.
|
|
111
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
112
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
110
113
|
if (debounceMs !== undefined) {
|
|
111
114
|
setInternalValue('');
|
|
112
115
|
lastSentRef.current = '';
|
|
@@ -114,7 +117,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
114
117
|
onChangeText('');
|
|
115
118
|
setIsFocused(false);
|
|
116
119
|
onCancel?.();
|
|
117
|
-
}, [debounceMs, onChangeText, onCancel]);
|
|
120
|
+
}, [haptic, debounceMs, onChangeText, onCancel]);
|
|
118
121
|
const handleSubmit = (0, _react.useCallback)(() => {
|
|
119
122
|
onSubmit?.(debounceMs !== undefined ? internalValue : value);
|
|
120
123
|
}, [onSubmit, debounceMs, internalValue, value]);
|
|
@@ -42,6 +42,7 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
|
|
|
42
42
|
fullWidth = true,
|
|
43
43
|
disabled = false,
|
|
44
44
|
tone = 'primary',
|
|
45
|
+
haptic,
|
|
45
46
|
accessibilityLabel,
|
|
46
47
|
style,
|
|
47
48
|
containerStyle,
|
|
@@ -66,7 +67,6 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
|
|
|
66
67
|
paddingHorizontal: segTheme?.[size]?.paddingHorizontal ?? baseSize.paddingHorizontal
|
|
67
68
|
};
|
|
68
69
|
const trackPadding = segTheme?.trackPadding ?? TRACK_PADDING;
|
|
69
|
-
const changeHapticEnabled = segTheme?.changeHaptic ?? false;
|
|
70
70
|
|
|
71
71
|
// Track width is measured from onLayout. Thumb width is a regular number (not
|
|
72
72
|
// animated) — `width` cannot be driven by the native animated module, and mixing
|
|
@@ -107,9 +107,10 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
|
|
|
107
107
|
const handlePress = (0, _react.useCallback)(segment => {
|
|
108
108
|
if (disabled) return;
|
|
109
109
|
if (segment.value === current) return;
|
|
110
|
-
|
|
110
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
111
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
111
112
|
setCurrent(segment.value);
|
|
112
|
-
}, [disabled, setCurrent, current,
|
|
113
|
+
}, [disabled, setCurrent, current, haptic]);
|
|
113
114
|
const thumbBg = tone === 'primary' ? theme.colors.background.elevated : theme.colors.background.elevated;
|
|
114
115
|
const activeTextColor = tone === 'primary' ? theme.colors.text.primary : theme.colors.text.primary;
|
|
115
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
@@ -32,6 +32,7 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
32
32
|
getOptionDescription,
|
|
33
33
|
placeholder,
|
|
34
34
|
searchable = false,
|
|
35
|
+
haptic,
|
|
35
36
|
label,
|
|
36
37
|
error,
|
|
37
38
|
disabled = false,
|
|
@@ -119,9 +120,10 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
119
120
|
}, [searchable, query, options, labelOf, descriptionOf]);
|
|
120
121
|
const handleOpen = (0, _react.useCallback)(() => {
|
|
121
122
|
if (disabled) return;
|
|
122
|
-
(0, _index2.
|
|
123
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
124
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
123
125
|
setOpen(true);
|
|
124
|
-
}, [disabled]);
|
|
126
|
+
}, [disabled, haptic]);
|
|
125
127
|
const handleClose = (0, _react.useCallback)(() => {
|
|
126
128
|
setOpen(false);
|
|
127
129
|
setQuery('');
|
|
@@ -129,7 +131,8 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
129
131
|
const handleSelect = (0, _react.useCallback)(option => {
|
|
130
132
|
if (disabledOf(option)) return;
|
|
131
133
|
const optValue = valueOf(option);
|
|
132
|
-
(0, _index2.
|
|
134
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
135
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
133
136
|
if (multi) {
|
|
134
137
|
const current = props.value ?? [];
|
|
135
138
|
const next = current.includes(optValue) ? current.filter(v => v !== optValue) : [...current, optValue];
|
|
@@ -138,7 +141,7 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
138
141
|
}
|
|
139
142
|
props.onChange(optValue);
|
|
140
143
|
handleClose();
|
|
141
|
-
}, [multi, props, handleClose, disabledOf, valueOf]);
|
|
144
|
+
}, [multi, props, handleClose, disabledOf, valueOf, haptic]);
|
|
142
145
|
|
|
143
146
|
// Trigger label / placeholder text.
|
|
144
147
|
const triggerText = selectedOptions.length === 0 ? placeholder ?? 'Select…' : selectedOptions.map(o => labelOf(o)).join(', ');
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.SlideToConfirm = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
10
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
11
|
+
var _index = require("../../theme/index.js");
|
|
12
|
+
var _index2 = require("../../utils/index.js");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
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); }
|
|
15
|
+
const SIZE_MAP = {
|
|
16
|
+
sm: {
|
|
17
|
+
height: 44,
|
|
18
|
+
pad: 4
|
|
19
|
+
},
|
|
20
|
+
md: {
|
|
21
|
+
height: 56,
|
|
22
|
+
pad: 5
|
|
23
|
+
},
|
|
24
|
+
lg: {
|
|
25
|
+
height: 64,
|
|
26
|
+
pad: 6
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const Chevron = ({
|
|
30
|
+
color,
|
|
31
|
+
size
|
|
32
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
33
|
+
style: {
|
|
34
|
+
width: 0,
|
|
35
|
+
height: 0,
|
|
36
|
+
borderTopWidth: size * 0.4,
|
|
37
|
+
borderBottomWidth: size * 0.4,
|
|
38
|
+
borderLeftWidth: size * 0.55,
|
|
39
|
+
borderTopColor: 'transparent',
|
|
40
|
+
borderBottomColor: 'transparent',
|
|
41
|
+
borderLeftColor: color,
|
|
42
|
+
marginLeft: size * 0.2
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const SlideToConfirm = exports.SlideToConfirm = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
46
|
+
const {
|
|
47
|
+
onConfirm,
|
|
48
|
+
label = 'Slide to confirm',
|
|
49
|
+
confirmedLabel = 'Confirmed',
|
|
50
|
+
tone = 'primary',
|
|
51
|
+
size = 'md',
|
|
52
|
+
disabled = false,
|
|
53
|
+
threshold = 0.9,
|
|
54
|
+
resetAfter = false,
|
|
55
|
+
haptic,
|
|
56
|
+
icon,
|
|
57
|
+
style,
|
|
58
|
+
trackStyle,
|
|
59
|
+
handleStyle,
|
|
60
|
+
labelStyle,
|
|
61
|
+
testID
|
|
62
|
+
} = props;
|
|
63
|
+
const theme = (0, _index.useTheme)();
|
|
64
|
+
const sizeCfg = SIZE_MAP[size];
|
|
65
|
+
const handleSize = sizeCfg.height - sizeCfg.pad * 2;
|
|
66
|
+
const styles = (0, _react.useMemo)(() => buildStyles(theme, sizeCfg), [theme, sizeCfg]);
|
|
67
|
+
const toneColor = theme.colors[tone];
|
|
68
|
+
const [confirmed, setConfirmed] = (0, _react.useState)(false);
|
|
69
|
+
const x = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
70
|
+
const maxX = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
71
|
+
const dragStart = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
72
|
+
const resetTimer = (0, _react.useRef)(null);
|
|
73
|
+
const fireHaptic = (0, _react.useCallback)(() => {
|
|
74
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'notificationSuccess');
|
|
75
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
76
|
+
}, [haptic]);
|
|
77
|
+
const reset = (0, _react.useCallback)(() => {
|
|
78
|
+
setConfirmed(false);
|
|
79
|
+
x.value = (0, _reactNativeReanimated.withSpring)(0, {
|
|
80
|
+
damping: 18,
|
|
81
|
+
stiffness: 160,
|
|
82
|
+
mass: 1
|
|
83
|
+
});
|
|
84
|
+
}, [x]);
|
|
85
|
+
const handleConfirm = (0, _react.useCallback)(() => {
|
|
86
|
+
setConfirmed(true);
|
|
87
|
+
fireHaptic();
|
|
88
|
+
onConfirm();
|
|
89
|
+
if (resetAfter !== false) {
|
|
90
|
+
if (resetTimer.current) clearTimeout(resetTimer.current);
|
|
91
|
+
resetTimer.current = setTimeout(reset, resetAfter);
|
|
92
|
+
}
|
|
93
|
+
}, [fireHaptic, onConfirm, resetAfter, reset]);
|
|
94
|
+
_react.default.useEffect(() => () => {
|
|
95
|
+
(0, _reactNativeReanimated.cancelAnimation)(x);
|
|
96
|
+
if (resetTimer.current) clearTimeout(resetTimer.current);
|
|
97
|
+
}, [x]);
|
|
98
|
+
const onLayout = (0, _react.useCallback)(e => {
|
|
99
|
+
maxX.value = Math.max(0, e.nativeEvent.layout.width - handleSize - sizeCfg.pad * 2);
|
|
100
|
+
}, [maxX, handleSize, sizeCfg.pad]);
|
|
101
|
+
const pan = (0, _react.useMemo)(() => {
|
|
102
|
+
const thresholdFrac = threshold;
|
|
103
|
+
const springCfg = {
|
|
104
|
+
damping: 18,
|
|
105
|
+
stiffness: 160,
|
|
106
|
+
mass: 1
|
|
107
|
+
};
|
|
108
|
+
const timingCfg = {
|
|
109
|
+
duration: theme.motion.duration.fast,
|
|
110
|
+
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)
|
|
111
|
+
};
|
|
112
|
+
return _reactNativeGestureHandler.Gesture.Pan().enabled(!disabled && !confirmed).minDistance(0).onStart(() => {
|
|
113
|
+
'worklet';
|
|
114
|
+
|
|
115
|
+
dragStart.value = x.value;
|
|
116
|
+
}).onUpdate(event => {
|
|
117
|
+
'worklet';
|
|
118
|
+
|
|
119
|
+
x.value = Math.min(Math.max(dragStart.value + event.translationX, 0), maxX.value);
|
|
120
|
+
}).onEnd(() => {
|
|
121
|
+
'worklet';
|
|
122
|
+
|
|
123
|
+
if (maxX.value > 0 && x.value >= maxX.value * thresholdFrac) {
|
|
124
|
+
x.value = (0, _reactNativeReanimated.withTiming)(maxX.value, timingCfg);
|
|
125
|
+
(0, _reactNativeReanimated.runOnJS)(handleConfirm)();
|
|
126
|
+
} else {
|
|
127
|
+
x.value = (0, _reactNativeReanimated.withSpring)(0, springCfg);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}, [disabled, confirmed, threshold, x, maxX, dragStart, handleConfirm, theme.motion.duration.fast]);
|
|
131
|
+
const handleAnim = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
132
|
+
transform: [{
|
|
133
|
+
translateX: x.value
|
|
134
|
+
}]
|
|
135
|
+
}));
|
|
136
|
+
const fillAnim = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
137
|
+
width: x.value + handleSize + sizeCfg.pad
|
|
138
|
+
}));
|
|
139
|
+
const labelAnim = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
140
|
+
const max = maxX.value > 0 ? maxX.value : 1;
|
|
141
|
+
return {
|
|
142
|
+
opacity: Math.max(0, 1 - x.value / (max * 0.6))
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
146
|
+
ref: ref,
|
|
147
|
+
style: [styles.track, {
|
|
148
|
+
backgroundColor: theme.colors.background.secondary
|
|
149
|
+
}, trackStyle, style],
|
|
150
|
+
onLayout: onLayout,
|
|
151
|
+
testID: testID,
|
|
152
|
+
accessibilityRole: "adjustable",
|
|
153
|
+
accessibilityLabel: confirmed ? confirmedLabel : label,
|
|
154
|
+
accessibilityState: {
|
|
155
|
+
disabled
|
|
156
|
+
},
|
|
157
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
158
|
+
style: [styles.fill, {
|
|
159
|
+
backgroundColor: toneColor,
|
|
160
|
+
opacity: disabled ? 0.5 : 1
|
|
161
|
+
}, fillAnim],
|
|
162
|
+
pointerEvents: "none"
|
|
163
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
164
|
+
style: [styles.labelWrap, labelAnim],
|
|
165
|
+
pointerEvents: "none",
|
|
166
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
167
|
+
style: [styles.label, {
|
|
168
|
+
color: theme.colors.text.secondary,
|
|
169
|
+
fontSize: theme.typography.fontSize.base
|
|
170
|
+
}, labelStyle],
|
|
171
|
+
numberOfLines: 1,
|
|
172
|
+
children: confirmed ? confirmedLabel : label
|
|
173
|
+
})
|
|
174
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
|
|
175
|
+
gesture: pan,
|
|
176
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
177
|
+
style: [styles.handle, {
|
|
178
|
+
width: handleSize,
|
|
179
|
+
height: handleSize,
|
|
180
|
+
borderRadius: handleSize / 2,
|
|
181
|
+
backgroundColor: theme.colors.background.elevated,
|
|
182
|
+
opacity: disabled ? 0.5 : 1,
|
|
183
|
+
...theme.shadows.sm
|
|
184
|
+
}, handleStyle, handleAnim],
|
|
185
|
+
children: icon ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(Chevron, {
|
|
186
|
+
color: toneColor,
|
|
187
|
+
size: handleSize * 0.5
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
})]
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
SlideToConfirm.displayName = 'SlideToConfirm';
|
|
194
|
+
const buildStyles = (theme, sizeCfg) => _reactNative.StyleSheet.create({
|
|
195
|
+
track: {
|
|
196
|
+
height: sizeCfg.height,
|
|
197
|
+
borderRadius: sizeCfg.height / 2,
|
|
198
|
+
justifyContent: 'center',
|
|
199
|
+
overflow: 'hidden',
|
|
200
|
+
padding: sizeCfg.pad
|
|
201
|
+
},
|
|
202
|
+
fill: {
|
|
203
|
+
position: 'absolute',
|
|
204
|
+
left: 0,
|
|
205
|
+
top: 0,
|
|
206
|
+
bottom: 0,
|
|
207
|
+
borderRadius: sizeCfg.height / 2
|
|
208
|
+
},
|
|
209
|
+
labelWrap: {
|
|
210
|
+
position: 'absolute',
|
|
211
|
+
left: sizeCfg.height,
|
|
212
|
+
right: sizeCfg.height
|
|
213
|
+
},
|
|
214
|
+
label: {
|
|
215
|
+
textAlign: 'center',
|
|
216
|
+
includeFontPadding: false
|
|
217
|
+
},
|
|
218
|
+
handle: {
|
|
219
|
+
alignItems: 'center',
|
|
220
|
+
justifyContent: 'center'
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
var _default = exports.default = SlideToConfirm;
|
|
224
|
+
//# sourceMappingURL=SlideToConfirm.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SlideToConfirm", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _SlideToConfirm.SlideToConfirm;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _SlideToConfirm = require("./SlideToConfirm.js");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|