@webority-technologies/mobile 0.0.14 → 0.0.20
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 +60 -19
- package/lib/commonjs/components/AppBar/AppBar.js +29 -20
- package/lib/commonjs/components/Avatar/Avatar.js +38 -8
- package/lib/commonjs/components/Badge/Badge.js +66 -4
- package/lib/commonjs/components/Banner/Banner.js +146 -66
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +85 -50
- package/lib/commonjs/components/Button/Button.js +12 -5
- package/lib/commonjs/components/Card/Card.js +106 -16
- package/lib/commonjs/components/Carousel/Carousel.js +66 -12
- package/lib/commonjs/components/Checkbox/Checkbox.js +11 -7
- package/lib/commonjs/components/Chip/Chip.js +44 -12
- package/lib/commonjs/components/DatePicker/DatePicker.js +185 -76
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +133 -59
- package/lib/commonjs/components/Dialog/Dialog.js +16 -10
- package/lib/commonjs/components/Drawer/Drawer.js +13 -10
- package/lib/commonjs/components/FieldBase/FieldBase.js +306 -0
- package/lib/commonjs/components/FieldBase/index.js +32 -0
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/commonjs/components/FormField/FormField.js +3 -2
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +132 -44
- package/lib/commonjs/components/Input/Input.js +144 -181
- package/lib/commonjs/components/ListItem/ListItem.js +90 -11
- package/lib/commonjs/components/Modal/Modal.js +55 -27
- package/lib/commonjs/components/NumberInput/NumberInput.js +60 -106
- package/lib/commonjs/components/OTPInput/OTPInput.js +65 -58
- package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +185 -0
- package/lib/commonjs/components/{AppIcon → PickerTrigger}/index.js +4 -4
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/commonjs/components/Radio/Radio.js +11 -6
- package/lib/commonjs/components/Rating/Rating.js +85 -19
- package/lib/commonjs/components/SearchBar/SearchBar.js +84 -107
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/commonjs/components/Select/Select.js +62 -91
- package/lib/commonjs/components/Skeleton/Skeleton.js +131 -174
- package/lib/commonjs/components/Skeleton/SkeletonClock.js +117 -0
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +164 -81
- package/lib/commonjs/components/Skeleton/SkeletonProvider.js +72 -10
- package/lib/commonjs/components/Skeleton/index.js +17 -16
- package/lib/commonjs/components/Slider/Slider.js +44 -25
- package/lib/commonjs/components/Stepper/Stepper.js +199 -29
- package/lib/commonjs/components/Swipeable/Swipeable.js +36 -19
- package/lib/commonjs/components/Switch/Switch.js +9 -2
- package/lib/commonjs/components/Tabs/Tabs.js +84 -21
- package/lib/commonjs/components/TimePicker/TimePicker.js +123 -45
- package/lib/commonjs/components/Toast/Toast.js +27 -16
- package/lib/commonjs/components/Tooltip/Tooltip.js +56 -32
- package/lib/commonjs/components/index.js +37 -37
- package/lib/commonjs/theme/tokens.js +55 -7
- package/lib/module/components/Accordion/Accordion.js +61 -20
- package/lib/module/components/AppBar/AppBar.js +29 -20
- package/lib/module/components/Avatar/Avatar.js +39 -9
- package/lib/module/components/Badge/Badge.js +67 -5
- package/lib/module/components/Banner/Banner.js +147 -67
- package/lib/module/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/module/components/BottomSheet/BottomSheet.js +87 -52
- package/lib/module/components/Button/Button.js +12 -5
- package/lib/module/components/Card/Card.js +107 -17
- package/lib/module/components/Carousel/Carousel.js +67 -13
- package/lib/module/components/Checkbox/Checkbox.js +11 -7
- package/lib/module/components/Chip/Chip.js +45 -13
- package/lib/module/components/DatePicker/DatePicker.js +185 -76
- package/lib/module/components/DateRangePicker/DateRangePicker.js +134 -60
- package/lib/module/components/Dialog/Dialog.js +16 -10
- package/lib/module/components/Drawer/Drawer.js +13 -10
- package/lib/module/components/FieldBase/FieldBase.js +297 -0
- package/lib/module/components/FieldBase/index.js +4 -0
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/module/components/FormField/FormField.js +3 -2
- package/lib/module/components/ImageGallery/ImageGallery.js +128 -40
- package/lib/module/components/Input/Input.js +144 -179
- package/lib/module/components/ListItem/ListItem.js +91 -12
- package/lib/module/components/Modal/Modal.js +55 -27
- package/lib/module/components/NumberInput/NumberInput.js +60 -106
- package/lib/module/components/OTPInput/OTPInput.js +65 -58
- package/lib/module/components/PickerTrigger/PickerTrigger.js +181 -0
- package/lib/module/components/PickerTrigger/index.js +4 -0
- package/lib/module/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/module/components/Radio/Radio.js +11 -6
- package/lib/module/components/Rating/Rating.js +86 -20
- package/lib/module/components/SearchBar/SearchBar.js +84 -107
- package/lib/module/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/module/components/Select/Select.js +62 -91
- package/lib/module/components/Skeleton/Skeleton.js +135 -175
- package/lib/module/components/Skeleton/SkeletonClock.js +110 -0
- package/lib/module/components/Skeleton/SkeletonContent.js +167 -84
- package/lib/module/components/Skeleton/SkeletonProvider.js +71 -10
- package/lib/module/components/Skeleton/index.js +3 -2
- package/lib/module/components/Slider/Slider.js +44 -25
- package/lib/module/components/Stepper/Stepper.js +201 -31
- package/lib/module/components/Swipeable/Swipeable.js +36 -19
- package/lib/module/components/Switch/Switch.js +9 -2
- package/lib/module/components/Tabs/Tabs.js +84 -21
- package/lib/module/components/TimePicker/TimePicker.js +123 -45
- package/lib/module/components/Toast/Toast.js +27 -16
- package/lib/module/components/Tooltip/Tooltip.js +56 -32
- package/lib/module/components/index.js +2 -2
- package/lib/module/theme/tokens.js +55 -7
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/commonjs/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +17 -6
- package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/commonjs/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/commonjs/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/commonjs/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/commonjs/components/Input/Input.d.ts +6 -0
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/commonjs/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/commonjs/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/commonjs/components/index.d.ts +5 -5
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +553 -11
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/module/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/module/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/module/components/Card/Card.d.ts +17 -6
- package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/module/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/module/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/module/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/module/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/module/components/Input/Input.d.ts +6 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/module/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/module/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/module/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/module/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/module/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/module/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/module/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/module/components/index.d.ts +5 -5
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/theme/index.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +553 -11
- package/package.json +2 -6
- package/lib/commonjs/components/AppIcon/AppIcon.js +0 -120
- package/lib/commonjs/types/vector-icons.d.js +0 -2
- package/lib/module/components/AppIcon/AppIcon.js +0 -111
- package/lib/module/components/AppIcon/index.js +0 -4
- package/lib/module/types/vector-icons.d.js +0 -2
- package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/commonjs/components/AppIcon/index.d.ts +0 -3
- package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/module/components/AppIcon/index.d.ts +0 -3
|
@@ -6,10 +6,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.DateRangePicker = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
9
10
|
var _index = require("../../theme/index.js");
|
|
10
11
|
var _index2 = require("../../utils/index.js");
|
|
12
|
+
var _index3 = require("../PickerTrigger/index.js");
|
|
11
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
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
|
+
/**
|
|
16
|
+
* DateRangePicker — supports two usage modes:
|
|
17
|
+
*
|
|
18
|
+
* 1. Controlled-modal mode (pass `visible` + `onClose`): renders only the
|
|
19
|
+
* modal; parent owns open/close state.
|
|
20
|
+
* 2. Trigger mode (omit `visible`): renders a built-in `PickerTrigger`
|
|
21
|
+
* field that opens an internally-managed modal on tap. Confirm fires
|
|
22
|
+
* `onChange?.(...)` and closes.
|
|
23
|
+
*/
|
|
24
|
+
|
|
13
25
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
14
26
|
const startOfDay = date => new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
15
27
|
const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
@@ -75,6 +87,18 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
75
87
|
value,
|
|
76
88
|
onChange,
|
|
77
89
|
onClose,
|
|
90
|
+
label,
|
|
91
|
+
placeholder,
|
|
92
|
+
helperText,
|
|
93
|
+
error,
|
|
94
|
+
required,
|
|
95
|
+
disabled,
|
|
96
|
+
size,
|
|
97
|
+
variant,
|
|
98
|
+
clearable,
|
|
99
|
+
onClear,
|
|
100
|
+
formatValue,
|
|
101
|
+
triggerStyle,
|
|
78
102
|
minDate,
|
|
79
103
|
maxDate,
|
|
80
104
|
disabledDates,
|
|
@@ -85,9 +109,17 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
85
109
|
cancelLabel = 'Cancel',
|
|
86
110
|
maxRange,
|
|
87
111
|
style,
|
|
112
|
+
containerStyle,
|
|
113
|
+
headerLabelStyle,
|
|
114
|
+
navButtonStyle,
|
|
115
|
+
footerButtonStyle,
|
|
88
116
|
testID
|
|
89
117
|
} = props;
|
|
118
|
+
const isControlled = visible !== undefined;
|
|
119
|
+
const [internalOpen, setInternalOpen] = (0, _react.useState)(false);
|
|
120
|
+
const open = isControlled ? visible : internalOpen;
|
|
90
121
|
const theme = (0, _index.useTheme)();
|
|
122
|
+
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
91
123
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
92
124
|
const today = (0, _react.useMemo)(() => startOfDay(new Date()), []);
|
|
93
125
|
const initialAnchor = value.start ? startOfDay(value.start) : today;
|
|
@@ -117,16 +149,17 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
117
149
|
}
|
|
118
150
|
}, [value.start, value.end]);
|
|
119
151
|
|
|
120
|
-
// Modal open / close animation.
|
|
152
|
+
// Modal open / close animation. Backdrop opacity uses JS driver — see
|
|
153
|
+
// Modal.tsx for the Fabric reason. Sheet transform stays native.
|
|
121
154
|
(0, _react.useEffect)(() => {
|
|
122
|
-
if (
|
|
123
|
-
|
|
155
|
+
if (open) {
|
|
156
|
+
backdrop.setValue(0);
|
|
124
157
|
(0, _index.setNativeValue)(sheet, 0);
|
|
125
158
|
_reactNative.Animated.parallel([_reactNative.Animated.timing(backdrop, {
|
|
126
159
|
toValue: 1,
|
|
127
160
|
duration: theme.motion.duration.normal,
|
|
128
161
|
easing: _reactNative.Easing.out(_reactNative.Easing.cubic),
|
|
129
|
-
useNativeDriver:
|
|
162
|
+
useNativeDriver: false
|
|
130
163
|
}), _reactNative.Animated.spring(sheet, {
|
|
131
164
|
toValue: 1,
|
|
132
165
|
damping: theme.motion.spring.gentle.damping,
|
|
@@ -135,7 +168,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
135
168
|
useNativeDriver: true
|
|
136
169
|
})]).start();
|
|
137
170
|
}
|
|
138
|
-
}, [
|
|
171
|
+
}, [open, backdrop, sheet, theme.motion]);
|
|
139
172
|
const disabledIsoSet = (0, _react.useMemo)(() => {
|
|
140
173
|
const set = new Set();
|
|
141
174
|
disabledDates?.forEach(d => set.add(toIso(startOfDay(d))));
|
|
@@ -153,17 +186,19 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
153
186
|
const headerLabel = (0, _react.useMemo)(() => formatMonthYear(anchor, locale), [anchor, locale]);
|
|
154
187
|
const weekdays = (0, _react.useMemo)(() => weekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
155
188
|
const animateMonthChange = (0, _react.useCallback)(delta => {
|
|
156
|
-
(0, _index2.triggerHaptic)('impactLight');
|
|
189
|
+
if (theme.components.dateRangePicker?.haptic) (0, _index2.triggerHaptic)('impactLight');
|
|
157
190
|
const direction = delta > 0 ? 1 : -1;
|
|
158
|
-
const distance = 32;
|
|
191
|
+
const distance = theme.components.dateRangePicker?.monthSlideDistance ?? 32;
|
|
192
|
+
const outDuration = theme.components.dateRangePicker?.monthSlideOutDuration ?? theme.motion.duration.fast ?? 140;
|
|
193
|
+
const inDuration = theme.components.dateRangePicker?.monthSlideInDuration ?? theme.motion.duration.fast ?? 160;
|
|
159
194
|
_reactNative.Animated.sequence([_reactNative.Animated.parallel([_reactNative.Animated.timing(monthSlide, {
|
|
160
195
|
toValue: -direction * distance,
|
|
161
|
-
duration:
|
|
196
|
+
duration: outDuration,
|
|
162
197
|
easing: _reactNative.Easing.out(_reactNative.Easing.quad),
|
|
163
198
|
useNativeDriver: true
|
|
164
199
|
}), _reactNative.Animated.timing(monthFade, {
|
|
165
200
|
toValue: 0,
|
|
166
|
-
duration:
|
|
201
|
+
duration: outDuration,
|
|
167
202
|
useNativeDriver: true
|
|
168
203
|
})]), _reactNative.Animated.timing(monthSlide, {
|
|
169
204
|
toValue: direction * distance,
|
|
@@ -171,23 +206,23 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
171
206
|
useNativeDriver: true
|
|
172
207
|
}), _reactNative.Animated.parallel([_reactNative.Animated.timing(monthSlide, {
|
|
173
208
|
toValue: 0,
|
|
174
|
-
duration:
|
|
209
|
+
duration: inDuration,
|
|
175
210
|
easing: _reactNative.Easing.out(_reactNative.Easing.cubic),
|
|
176
211
|
useNativeDriver: true
|
|
177
212
|
}), _reactNative.Animated.timing(monthFade, {
|
|
178
213
|
toValue: 1,
|
|
179
|
-
duration:
|
|
214
|
+
duration: inDuration,
|
|
180
215
|
useNativeDriver: true
|
|
181
216
|
})])]).start();
|
|
182
217
|
const next = addMonths(anchor, delta);
|
|
183
218
|
setAnchor(next);
|
|
184
219
|
_reactNative.AccessibilityInfo.announceForAccessibility(formatMonthYear(next, locale));
|
|
185
|
-
}, [anchor, locale, monthFade, monthSlide]);
|
|
220
|
+
}, [anchor, locale, monthFade, monthSlide, theme.components.dateRangePicker, theme.motion.duration.fast]);
|
|
186
221
|
const goPrev = (0, _react.useCallback)(() => animateMonthChange(-1), [animateMonthChange]);
|
|
187
222
|
const goNext = (0, _react.useCallback)(() => animateMonthChange(1), [animateMonthChange]);
|
|
188
223
|
const pressDay = (0, _react.useCallback)(cell => {
|
|
189
224
|
if (isDisabled(cell.date)) return;
|
|
190
|
-
(0, _index2.triggerHaptic)('selection');
|
|
225
|
+
if (theme.components.dateRangePicker?.haptic) (0, _index2.triggerHaptic)('selection');
|
|
191
226
|
const target = cell.date;
|
|
192
227
|
|
|
193
228
|
// First tap: pick start. Or, when there's already a complete range, restart.
|
|
@@ -206,7 +241,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
206
241
|
} else {
|
|
207
242
|
if (maxRange && daysBetween(pendingStart, target) + 1 > maxRange) {
|
|
208
243
|
// Reject ranges longer than maxRange — restart from the new tap.
|
|
209
|
-
(0, _index2.triggerHaptic)('notificationWarning');
|
|
244
|
+
if (theme.components.dateRangePicker?.haptic) (0, _index2.triggerHaptic)('notificationWarning');
|
|
210
245
|
setPendingStart(target);
|
|
211
246
|
setPendingEnd(null);
|
|
212
247
|
return;
|
|
@@ -217,35 +252,42 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
217
252
|
if (!cell.inMonth) {
|
|
218
253
|
setAnchor(new Date(cell.date.getFullYear(), cell.date.getMonth(), 1));
|
|
219
254
|
}
|
|
220
|
-
}, [isDisabled, pendingStart, pendingEnd, maxRange]);
|
|
255
|
+
}, [isDisabled, pendingStart, pendingEnd, maxRange, theme.components.dateRangePicker]);
|
|
256
|
+
const handleCloseModal = (0, _react.useCallback)(() => {
|
|
257
|
+
if (isControlled) {
|
|
258
|
+
onClose?.();
|
|
259
|
+
} else {
|
|
260
|
+
setInternalOpen(false);
|
|
261
|
+
}
|
|
262
|
+
}, [isControlled, onClose]);
|
|
221
263
|
const handleClose = (0, _react.useCallback)(() => {
|
|
222
264
|
_reactNative.Animated.parallel([_reactNative.Animated.timing(backdrop, {
|
|
223
265
|
toValue: 0,
|
|
224
266
|
duration: theme.motion.duration.fast,
|
|
225
267
|
easing: _reactNative.Easing.in(_reactNative.Easing.cubic),
|
|
226
|
-
useNativeDriver:
|
|
268
|
+
useNativeDriver: false
|
|
227
269
|
}), _reactNative.Animated.timing(sheet, {
|
|
228
270
|
toValue: 0,
|
|
229
271
|
duration: theme.motion.duration.fast,
|
|
230
272
|
easing: _reactNative.Easing.in(_reactNative.Easing.cubic),
|
|
231
273
|
useNativeDriver: true
|
|
232
274
|
})]).start(() => {
|
|
233
|
-
|
|
275
|
+
handleCloseModal();
|
|
234
276
|
});
|
|
235
|
-
}, [backdrop,
|
|
277
|
+
}, [backdrop, handleCloseModal, sheet, theme.motion.duration.fast]);
|
|
236
278
|
const handleCancel = (0, _react.useCallback)(() => {
|
|
237
|
-
(0, _index2.triggerHaptic)('selection');
|
|
279
|
+
if (theme.components.dateRangePicker?.haptic) (0, _index2.triggerHaptic)('selection');
|
|
238
280
|
handleClose();
|
|
239
|
-
}, [handleClose]);
|
|
281
|
+
}, [handleClose, theme.components.dateRangePicker]);
|
|
240
282
|
const handleConfirm = (0, _react.useCallback)(() => {
|
|
241
283
|
if (!pendingStart || !pendingEnd) return;
|
|
242
|
-
(0, _index2.triggerHaptic)('notificationSuccess');
|
|
243
|
-
onChange({
|
|
284
|
+
if (theme.components.dateRangePicker?.haptic) (0, _index2.triggerHaptic)('notificationSuccess');
|
|
285
|
+
onChange?.({
|
|
244
286
|
start: pendingStart,
|
|
245
287
|
end: pendingEnd
|
|
246
288
|
});
|
|
247
289
|
handleClose();
|
|
248
|
-
}, [handleClose, onChange, pendingStart, pendingEnd]);
|
|
290
|
+
}, [handleClose, onChange, pendingStart, pendingEnd, theme.components.dateRangePicker]);
|
|
249
291
|
const sheetTranslate = sheet.interpolate({
|
|
250
292
|
inputRange: [0, 1],
|
|
251
293
|
outputRange: [320, 0]
|
|
@@ -266,7 +308,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
266
308
|
}, [pendingStart, pendingEnd]);
|
|
267
309
|
const confirmDisabled = !pendingStart || !pendingEnd;
|
|
268
310
|
const calendar = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
269
|
-
style: [styles.card, style],
|
|
311
|
+
style: [styles.card, style, containerStyle],
|
|
270
312
|
ref: ref,
|
|
271
313
|
accessible: false,
|
|
272
314
|
testID: testID,
|
|
@@ -287,7 +329,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
287
329
|
onPress: goPrev,
|
|
288
330
|
style: ({
|
|
289
331
|
pressed
|
|
290
|
-
}) => [styles.navBtn, pressed && styles.navBtnPressed],
|
|
332
|
+
}) => [styles.navBtn, pressed && styles.navBtnPressed, navButtonStyle],
|
|
291
333
|
accessibilityRole: "button",
|
|
292
334
|
accessibilityLabel: "Previous month",
|
|
293
335
|
hitSlop: 8,
|
|
@@ -301,7 +343,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
301
343
|
transform: [{
|
|
302
344
|
translateX: monthSlide
|
|
303
345
|
}]
|
|
304
|
-
}],
|
|
346
|
+
}, headerLabelStyle],
|
|
305
347
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
306
348
|
style: styles.headerLabel,
|
|
307
349
|
accessibilityLiveRegion: "polite",
|
|
@@ -311,7 +353,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
311
353
|
onPress: goNext,
|
|
312
354
|
style: ({
|
|
313
355
|
pressed
|
|
314
|
-
}) => [styles.navBtn, pressed && styles.navBtnPressed],
|
|
356
|
+
}) => [styles.navBtn, pressed && styles.navBtnPressed, navButtonStyle],
|
|
315
357
|
accessibilityRole: "button",
|
|
316
358
|
accessibilityLabel: "Next month",
|
|
317
359
|
hitSlop: 8,
|
|
@@ -402,7 +444,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
402
444
|
onPress: handleCancel,
|
|
403
445
|
style: ({
|
|
404
446
|
pressed
|
|
405
|
-
}) => [styles.footerBtn, styles.footerCancel, pressed && styles.footerBtnPressed],
|
|
447
|
+
}) => [styles.footerBtn, styles.footerCancel, pressed && styles.footerBtnPressed, footerButtonStyle],
|
|
406
448
|
accessibilityRole: "button",
|
|
407
449
|
accessibilityLabel: cancelLabel,
|
|
408
450
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -421,7 +463,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
421
463
|
opacity: confirmDisabled ? 0.5 : 1
|
|
422
464
|
}, pressed && {
|
|
423
465
|
backgroundColor: theme.colors.primaryHover
|
|
424
|
-
}],
|
|
466
|
+
}, footerButtonStyle],
|
|
425
467
|
accessibilityRole: "button",
|
|
426
468
|
accessibilityLabel: confirmLabel,
|
|
427
469
|
accessibilityState: {
|
|
@@ -436,32 +478,64 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
436
478
|
})]
|
|
437
479
|
})]
|
|
438
480
|
});
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
481
|
+
const triggerValueText = (0, _react.useMemo)(() => {
|
|
482
|
+
if (!value.start || !value.end) return '';
|
|
483
|
+
const range = {
|
|
484
|
+
start: value.start,
|
|
485
|
+
end: value.end
|
|
486
|
+
};
|
|
487
|
+
if (formatValue) return formatValue(range);
|
|
488
|
+
return `${range.start.toLocaleDateString()} – ${range.end.toLocaleDateString()}`;
|
|
489
|
+
}, [value.start, value.end, formatValue]);
|
|
490
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
491
|
+
children: [!isControlled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.PickerTrigger, {
|
|
492
|
+
label: label,
|
|
493
|
+
placeholder: placeholder,
|
|
494
|
+
helperText: helperText,
|
|
495
|
+
error: error,
|
|
496
|
+
required: required,
|
|
497
|
+
disabled: disabled,
|
|
498
|
+
size: size,
|
|
499
|
+
variant: variant,
|
|
500
|
+
clearable: clearable,
|
|
501
|
+
onClear: onClear,
|
|
502
|
+
value: triggerValueText,
|
|
503
|
+
onPress: () => setInternalOpen(true),
|
|
504
|
+
triggerStyle: triggerStyle
|
|
505
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
506
|
+
visible: open,
|
|
507
|
+
transparent: true,
|
|
508
|
+
statusBarTranslucent: true
|
|
509
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
510
|
+
// @ts-ignore — Android-only RN 0.71+; iOS ignores it.
|
|
511
|
+
,
|
|
512
|
+
navigationBarTranslucent: true,
|
|
513
|
+
animationType: "none",
|
|
514
|
+
onRequestClose: handleClose,
|
|
515
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View
|
|
516
|
+
// Backdrop wraps the sheet — see Modal.tsx for the Fabric reason.
|
|
517
|
+
, {
|
|
518
|
+
collapsable: false,
|
|
519
|
+
style: [styles.backdrop, {
|
|
520
|
+
backgroundColor: theme.colors.background.overlay
|
|
521
|
+
}],
|
|
522
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
523
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
524
|
+
onPress: handleClose,
|
|
525
|
+
accessibilityLabel: "Dismiss"
|
|
526
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
527
|
+
style: [styles.sheetWrap, {
|
|
528
|
+
paddingBottom: insets.bottom + theme.spacing.lg,
|
|
529
|
+
opacity: sheet,
|
|
530
|
+
transform: [{
|
|
531
|
+
translateY: sheetTranslate
|
|
532
|
+
}]
|
|
533
|
+
}],
|
|
534
|
+
accessibilityViewIsModal: true,
|
|
535
|
+
accessibilityRole: "none",
|
|
536
|
+
children: calendar
|
|
537
|
+
})]
|
|
454
538
|
})
|
|
455
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
456
|
-
style: [styles.sheetWrap, {
|
|
457
|
-
opacity: sheet,
|
|
458
|
-
transform: [{
|
|
459
|
-
translateY: sheetTranslate
|
|
460
|
-
}]
|
|
461
|
-
}],
|
|
462
|
-
accessibilityViewIsModal: true,
|
|
463
|
-
accessibilityRole: "none",
|
|
464
|
-
children: calendar
|
|
465
539
|
})]
|
|
466
540
|
});
|
|
467
541
|
});
|
|
@@ -510,8 +584,8 @@ const buildStyles = theme => {
|
|
|
510
584
|
marginBottom: theme.spacing.md
|
|
511
585
|
},
|
|
512
586
|
navBtn: {
|
|
513
|
-
width: 36,
|
|
514
|
-
height: 36,
|
|
587
|
+
width: theme.components.dateRangePicker?.navButtonSize ?? 36,
|
|
588
|
+
height: theme.components.dateRangePicker?.navButtonSize ?? 36,
|
|
515
589
|
borderRadius: theme.radius.full,
|
|
516
590
|
alignItems: 'center',
|
|
517
591
|
justifyContent: 'center',
|
|
@@ -521,8 +595,8 @@ const buildStyles = theme => {
|
|
|
521
595
|
backgroundColor: theme.colors.surface.pressed
|
|
522
596
|
},
|
|
523
597
|
navText: {
|
|
524
|
-
fontSize: 22,
|
|
525
|
-
lineHeight: 24,
|
|
598
|
+
fontSize: theme.components.dateRangePicker?.navTextFontSize ?? 22,
|
|
599
|
+
lineHeight: theme.components.dateRangePicker?.navTextLineHeight ?? 24,
|
|
526
600
|
color: theme.colors.text.primary,
|
|
527
601
|
fontWeight: theme.typography.fontWeight.semibold
|
|
528
602
|
},
|
|
@@ -604,7 +678,7 @@ const buildStyles = theme => {
|
|
|
604
678
|
paddingHorizontal: theme.spacing.lg,
|
|
605
679
|
paddingVertical: theme.spacing.sm,
|
|
606
680
|
borderRadius: theme.radius.md,
|
|
607
|
-
minHeight: 40,
|
|
681
|
+
minHeight: theme.components.dateRangePicker?.footerButtonMinHeight ?? 40,
|
|
608
682
|
alignItems: 'center',
|
|
609
683
|
justifyContent: 'center'
|
|
610
684
|
},
|
|
@@ -24,6 +24,12 @@ const Dialog = props => {
|
|
|
24
24
|
accessibilityLabel,
|
|
25
25
|
contentStyle,
|
|
26
26
|
containerStyle,
|
|
27
|
+
titleStyle,
|
|
28
|
+
messageStyle,
|
|
29
|
+
iconWrapperStyle,
|
|
30
|
+
actionsRowStyle,
|
|
31
|
+
actionButtonStyle,
|
|
32
|
+
actionTextStyle,
|
|
27
33
|
testID
|
|
28
34
|
} = props;
|
|
29
35
|
const theme = (0, _index.useTheme)();
|
|
@@ -35,12 +41,12 @@ const Dialog = props => {
|
|
|
35
41
|
const actionButtonMinHeight = dialogTokens?.actionButtonMinHeight ?? 44;
|
|
36
42
|
const handleAction = (0, _react.useCallback)(action => {
|
|
37
43
|
if (action.loading) return;
|
|
38
|
-
(0, _hapticUtils.triggerHaptic)('selection');
|
|
44
|
+
if (dialogTokens?.actionHaptic) (0, _hapticUtils.triggerHaptic)('selection');
|
|
39
45
|
action.onPress();
|
|
40
46
|
if (dismissOnAction) {
|
|
41
47
|
onClose();
|
|
42
48
|
}
|
|
43
|
-
}, [dismissOnAction, onClose]);
|
|
49
|
+
}, [dismissOnAction, onClose, dialogTokens?.actionHaptic]);
|
|
44
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
45
51
|
visible: visible,
|
|
46
52
|
onRequestClose: onClose,
|
|
@@ -49,7 +55,7 @@ const Dialog = props => {
|
|
|
49
55
|
contentStyle: contentStyle,
|
|
50
56
|
testID: testID,
|
|
51
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
52
|
-
accessibilityRole:
|
|
58
|
+
accessibilityRole: "alert",
|
|
53
59
|
accessibilityLabel: accessibilityLabel ?? title,
|
|
54
60
|
style: [styles.container, containerStyle],
|
|
55
61
|
children: [icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -59,7 +65,7 @@ const Dialog = props => {
|
|
|
59
65
|
borderRadius: iconWrapperBorderRadius,
|
|
60
66
|
backgroundColor: variantTint.muted,
|
|
61
67
|
marginBottom: theme.spacing.md
|
|
62
|
-
}],
|
|
68
|
+
}, iconWrapperStyle],
|
|
63
69
|
children: icon
|
|
64
70
|
}) : null, title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
65
71
|
style: [styles.title, {
|
|
@@ -67,7 +73,7 @@ const Dialog = props => {
|
|
|
67
73
|
fontSize: theme.typography.fontSize.xl,
|
|
68
74
|
...(0, _index.fontFor)(theme, 'semibold'),
|
|
69
75
|
marginBottom: message ? theme.spacing.sm : theme.spacing.md
|
|
70
|
-
}],
|
|
76
|
+
}, titleStyle],
|
|
71
77
|
accessibilityRole: "header",
|
|
72
78
|
children: title
|
|
73
79
|
}) : null, typeof message === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -76,7 +82,7 @@ const Dialog = props => {
|
|
|
76
82
|
fontSize: theme.typography.fontSize.base,
|
|
77
83
|
lineHeight: theme.typography.fontSize.base * theme.typography.lineHeight.normal,
|
|
78
84
|
marginBottom: actions && actions.length > 0 ? theme.spacing.lg : 0
|
|
79
|
-
}],
|
|
85
|
+
}, messageStyle],
|
|
80
86
|
children: message
|
|
81
87
|
}) : message ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
82
88
|
style: {
|
|
@@ -84,7 +90,7 @@ const Dialog = props => {
|
|
|
84
90
|
},
|
|
85
91
|
children: message
|
|
86
92
|
}) : null, actions && actions.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
87
|
-
style: styles.actionsRow,
|
|
93
|
+
style: [styles.actionsRow, actionsRowStyle],
|
|
88
94
|
children: actions.map((action, index) => {
|
|
89
95
|
const tone = action.tone ?? 'primary';
|
|
90
96
|
const buttonStyle = actionStyleFor(theme, tone, variant);
|
|
@@ -110,17 +116,17 @@ const Dialog = props => {
|
|
|
110
116
|
paddingHorizontal: theme.spacing.lg,
|
|
111
117
|
marginRight: isLast ? 0 : theme.spacing.sm,
|
|
112
118
|
opacity: action.loading ? 0.7 : pressed ? 0.85 : 1
|
|
113
|
-
}],
|
|
119
|
+
}, actionButtonStyle],
|
|
114
120
|
children: action.loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
115
121
|
size: "small",
|
|
116
122
|
color: buttonStyle.textColor
|
|
117
123
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
118
|
-
style: {
|
|
124
|
+
style: [{
|
|
119
125
|
color: buttonStyle.textColor,
|
|
120
126
|
fontSize: theme.typography.fontSize.base,
|
|
121
127
|
...(0, _index.fontFor)(theme, 'semibold'),
|
|
122
128
|
textAlign: 'center'
|
|
123
|
-
},
|
|
129
|
+
}, actionTextStyle],
|
|
124
130
|
numberOfLines: 1,
|
|
125
131
|
children: action.label
|
|
126
132
|
})
|
|
@@ -33,8 +33,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
33
33
|
* ref.current?.toggle();
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
const DEFAULT_CLOSE_VELOCITY_THRESHOLD = 1000;
|
|
37
|
+
const DEFAULT_DRAG_ACTIVATION_OFFSET = 10;
|
|
38
38
|
const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
39
39
|
const {
|
|
40
40
|
visible: controlledVisible,
|
|
@@ -53,6 +53,9 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
53
53
|
const theme = (0, _index.useTheme)();
|
|
54
54
|
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
55
55
|
const isControlled = typeof controlledVisible === 'boolean';
|
|
56
|
+
const drawerTokens = theme.components.drawer;
|
|
57
|
+
const closeVelocityThreshold = drawerTokens?.closeVelocityThreshold ?? DEFAULT_CLOSE_VELOCITY_THRESHOLD;
|
|
58
|
+
const dragActivationOffset = drawerTokens?.dragActivationOffset ?? DEFAULT_DRAG_ACTIVATION_OFFSET;
|
|
56
59
|
const [windowDims, setWindowDims] = (0, _react.useState)(() => _reactNative.Dimensions.get('window'));
|
|
57
60
|
(0, _react.useEffect)(() => {
|
|
58
61
|
const sub = _reactNative.Dimensions.addEventListener('change', ({
|
|
@@ -137,9 +140,9 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
137
140
|
const swipeAllowed = enableSwipe;
|
|
138
141
|
let g = _reactNativeGestureHandler.Gesture.Pan();
|
|
139
142
|
if (isHorizontal) {
|
|
140
|
-
g = g.activeOffsetX([-
|
|
143
|
+
g = g.activeOffsetX([-dragActivationOffset, dragActivationOffset]).failOffsetY([-15, 15]);
|
|
141
144
|
} else {
|
|
142
|
-
g = g.activeOffsetY([-
|
|
145
|
+
g = g.activeOffsetY([-dragActivationOffset, dragActivationOffset]).failOffsetX([-15, 15]);
|
|
143
146
|
}
|
|
144
147
|
return g.onStart(() => {
|
|
145
148
|
'worklet';
|
|
@@ -177,9 +180,9 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
177
180
|
// bottom → positive Y
|
|
178
181
|
let isFastClose = false;
|
|
179
182
|
if (sideValue === 'left' || sideValue === 'top') {
|
|
180
|
-
isFastClose = velocity < -
|
|
183
|
+
isFastClose = velocity < -closeVelocityThreshold;
|
|
181
184
|
} else {
|
|
182
|
-
isFastClose = velocity >
|
|
185
|
+
isFastClose = velocity > closeVelocityThreshold;
|
|
183
186
|
}
|
|
184
187
|
const closedAbs = Math.abs(closed);
|
|
185
188
|
const traveledClosed = Math.abs(releaseOffset) / closedAbs; // 0 = open, 1 = closed
|
|
@@ -192,7 +195,7 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
192
195
|
offset.value = (0, _reactNativeReanimated.withSpring)(0, springCfg);
|
|
193
196
|
}
|
|
194
197
|
});
|
|
195
|
-
}, [closedOffset, dragStart, enableSwipe, isHorizontal, offset, setOpenJS, side, springCfg]);
|
|
198
|
+
}, [closedOffset, dragStart, enableSwipe, isHorizontal, offset, setOpenJS, side, springCfg, closeVelocityThreshold, dragActivationOffset]);
|
|
196
199
|
|
|
197
200
|
// ───────── Animated styles ─────────
|
|
198
201
|
const sheetStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
@@ -221,9 +224,9 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
221
224
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
222
225
|
const handleBackdropPress = (0, _react.useCallback)(() => {
|
|
223
226
|
if (!enableBackdropPress) return;
|
|
224
|
-
(0, _index2.triggerHaptic)('selection');
|
|
227
|
+
if (drawerTokens?.backdropPressHaptic) (0, _index2.triggerHaptic)('selection');
|
|
225
228
|
close();
|
|
226
|
-
}, [enableBackdropPress, close]);
|
|
229
|
+
}, [enableBackdropPress, close, drawerTokens?.backdropPressHaptic]);
|
|
227
230
|
|
|
228
231
|
// Per-side container layout — must be a hook on every render path so we
|
|
229
232
|
// can't gate it on the lazy-mount early-return below.
|
|
@@ -302,7 +305,7 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
302
305
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
|
|
303
306
|
gesture: panGesture,
|
|
304
307
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
305
|
-
accessibilityRole:
|
|
308
|
+
accessibilityRole: "alert",
|
|
306
309
|
accessibilityLabel: accessibilityLabel ?? 'Drawer',
|
|
307
310
|
accessibilityViewIsModal: isOpen,
|
|
308
311
|
style: [sideLayout, {
|