@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Confetti", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Confetti.Confetti;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _Confetti = require("./Confetti.js");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -120,6 +120,7 @@ const DatePicker = props => {
|
|
|
120
120
|
headerLabelStyle,
|
|
121
121
|
navButtonStyle,
|
|
122
122
|
footerButtonStyle,
|
|
123
|
+
haptic,
|
|
123
124
|
testID,
|
|
124
125
|
label,
|
|
125
126
|
placeholder,
|
|
@@ -235,7 +236,7 @@ const DatePicker = props => {
|
|
|
235
236
|
return false;
|
|
236
237
|
}, [minDay, maxDay]);
|
|
237
238
|
const animateMonthChange = (0, _react.useCallback)(delta => {
|
|
238
|
-
if (
|
|
239
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('impactLight');
|
|
239
240
|
const direction = delta > 0 ? 1 : -1;
|
|
240
241
|
const distance = theme.components.datePicker?.monthSlideDistance ?? 32;
|
|
241
242
|
const outDuration = theme.components.datePicker?.monthSlideOutDuration ?? theme.motion.duration.fast ?? 140;
|
|
@@ -266,31 +267,31 @@ const DatePicker = props => {
|
|
|
266
267
|
const next = addMonths(anchor, delta);
|
|
267
268
|
setAnchor(next);
|
|
268
269
|
_reactNative.AccessibilityInfo.announceForAccessibility(formatMonthYear(next, locale));
|
|
269
|
-
}, [anchor, locale, monthFade, monthSlide, theme.components.datePicker, theme.motion.duration.fast]);
|
|
270
|
+
}, [anchor, haptic, locale, monthFade, monthSlide, theme.components.datePicker, theme.motion.duration.fast]);
|
|
270
271
|
const goPrev = (0, _react.useCallback)(() => {
|
|
271
272
|
if (viewMode === 'days') {
|
|
272
273
|
animateMonthChange(-1);
|
|
273
274
|
return;
|
|
274
275
|
}
|
|
275
|
-
if (
|
|
276
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('impactLight');
|
|
276
277
|
if (viewMode === 'years') {
|
|
277
278
|
setAnchor(prev => new Date(prev.getFullYear() - GRID_SIZE, prev.getMonth(), 1));
|
|
278
279
|
} else {
|
|
279
280
|
setAnchor(prev => new Date(prev.getFullYear() - GRID_SIZE * DECADE_SPAN, prev.getMonth(), 1));
|
|
280
281
|
}
|
|
281
|
-
}, [animateMonthChange, viewMode,
|
|
282
|
+
}, [animateMonthChange, viewMode, haptic]);
|
|
282
283
|
const goNext = (0, _react.useCallback)(() => {
|
|
283
284
|
if (viewMode === 'days') {
|
|
284
285
|
animateMonthChange(1);
|
|
285
286
|
return;
|
|
286
287
|
}
|
|
287
|
-
if (
|
|
288
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('impactLight');
|
|
288
289
|
if (viewMode === 'years') {
|
|
289
290
|
setAnchor(prev => new Date(prev.getFullYear() + GRID_SIZE, prev.getMonth(), 1));
|
|
290
291
|
} else {
|
|
291
292
|
setAnchor(prev => new Date(prev.getFullYear() + GRID_SIZE * DECADE_SPAN, prev.getMonth(), 1));
|
|
292
293
|
}
|
|
293
|
-
}, [animateMonthChange, viewMode,
|
|
294
|
+
}, [animateMonthChange, viewMode, haptic]);
|
|
294
295
|
|
|
295
296
|
// View-mode transition: fade + scale, native driver.
|
|
296
297
|
const animateViewTransition = (0, _react.useCallback)(() => {
|
|
@@ -310,7 +311,8 @@ const DatePicker = props => {
|
|
|
310
311
|
})]).start();
|
|
311
312
|
}, [viewFade, viewScale, theme.components.datePicker, theme.motion.duration.normal]);
|
|
312
313
|
const cycleViewMode = (0, _react.useCallback)(() => {
|
|
313
|
-
|
|
314
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
315
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
314
316
|
const pressDur = theme.components.datePicker?.headerPressDuration ?? 80;
|
|
315
317
|
const releaseDur = theme.components.datePicker?.headerReleaseDuration ?? 100;
|
|
316
318
|
_reactNative.Animated.sequence([_reactNative.Animated.timing(headerScale, {
|
|
@@ -328,23 +330,26 @@ const DatePicker = props => {
|
|
|
328
330
|
return 'years';
|
|
329
331
|
});
|
|
330
332
|
animateViewTransition();
|
|
331
|
-
}, [animateViewTransition, headerScale, theme.components.datePicker]);
|
|
333
|
+
}, [animateViewTransition, headerScale, haptic, theme.components.datePicker]);
|
|
332
334
|
const pickYear = (0, _react.useCallback)(year => {
|
|
333
|
-
|
|
335
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
336
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
334
337
|
setAnchor(prev => new Date(year, prev.getMonth(), 1));
|
|
335
338
|
setViewMode('days');
|
|
336
339
|
animateViewTransition();
|
|
337
|
-
}, [animateViewTransition,
|
|
340
|
+
}, [animateViewTransition, haptic]);
|
|
338
341
|
const pickDecade = (0, _react.useCallback)(decadeStart => {
|
|
339
|
-
|
|
342
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
343
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
340
344
|
// Anchor mid-decade so the year grid centers nicely on this decade.
|
|
341
345
|
setAnchor(prev => new Date(decadeStart + 4, prev.getMonth(), 1));
|
|
342
346
|
setViewMode('years');
|
|
343
347
|
animateViewTransition();
|
|
344
|
-
}, [animateViewTransition,
|
|
348
|
+
}, [animateViewTransition, haptic]);
|
|
345
349
|
const pressDay = (0, _react.useCallback)(cell => {
|
|
346
350
|
if (isDisabled(cell.date)) return;
|
|
347
|
-
|
|
351
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
352
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
348
353
|
setPendingDate(cell.date);
|
|
349
354
|
if (!cell.inMonth) {
|
|
350
355
|
setAnchor(new Date(cell.date.getFullYear(), cell.date.getMonth(), 1));
|
|
@@ -357,7 +362,7 @@ const DatePicker = props => {
|
|
|
357
362
|
mass: theme.motion.spring.bouncy.mass,
|
|
358
363
|
useNativeDriver: true
|
|
359
364
|
}).start();
|
|
360
|
-
}, [isDisabled, selectScale, theme.motion.spring.bouncy,
|
|
365
|
+
}, [isDisabled, selectScale, theme.motion.spring.bouncy, haptic]);
|
|
361
366
|
const finalizeClose = (0, _react.useCallback)(() => {
|
|
362
367
|
if (isControlled) {
|
|
363
368
|
onClose?.();
|
|
@@ -386,15 +391,15 @@ const DatePicker = props => {
|
|
|
386
391
|
});
|
|
387
392
|
}, [backdrop, mode, finalizeClose, sheet, theme.motion.duration.fast]);
|
|
388
393
|
const handleCancel = (0, _react.useCallback)(() => {
|
|
389
|
-
if (
|
|
394
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('selection');
|
|
390
395
|
handleClose();
|
|
391
|
-
}, [handleClose,
|
|
396
|
+
}, [handleClose, haptic]);
|
|
392
397
|
const handleConfirm = (0, _react.useCallback)(() => {
|
|
393
398
|
if (!pendingDate) return;
|
|
394
|
-
if (
|
|
399
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('notificationSuccess');
|
|
395
400
|
onChange?.(pendingDate);
|
|
396
401
|
handleClose();
|
|
397
|
-
}, [handleClose, onChange, pendingDate,
|
|
402
|
+
}, [handleClose, onChange, pendingDate, haptic]);
|
|
398
403
|
const sheetTranslate = sheet.interpolate({
|
|
399
404
|
inputRange: [0, 1],
|
|
400
405
|
outputRange: [320, 0]
|
|
@@ -108,6 +108,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
108
108
|
confirmLabel = 'Confirm',
|
|
109
109
|
cancelLabel = 'Cancel',
|
|
110
110
|
maxRange,
|
|
111
|
+
haptic,
|
|
111
112
|
style,
|
|
112
113
|
containerStyle,
|
|
113
114
|
headerLabelStyle,
|
|
@@ -189,7 +190,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
189
190
|
const headerLabel = (0, _react.useMemo)(() => formatMonthYear(anchor, locale), [anchor, locale]);
|
|
190
191
|
const weekdays = (0, _react.useMemo)(() => weekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
191
192
|
const animateMonthChange = (0, _react.useCallback)(delta => {
|
|
192
|
-
if (
|
|
193
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('impactLight');
|
|
193
194
|
const direction = delta > 0 ? 1 : -1;
|
|
194
195
|
const distance = theme.components.dateRangePicker?.monthSlideDistance ?? 32;
|
|
195
196
|
const outDuration = theme.components.dateRangePicker?.monthSlideOutDuration ?? theme.motion.duration.fast ?? 140;
|
|
@@ -220,12 +221,13 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
220
221
|
const next = addMonths(anchor, delta);
|
|
221
222
|
setAnchor(next);
|
|
222
223
|
_reactNative.AccessibilityInfo.announceForAccessibility(formatMonthYear(next, locale));
|
|
223
|
-
}, [anchor, locale, monthFade, monthSlide, theme.components.dateRangePicker, theme.motion.duration.fast]);
|
|
224
|
+
}, [anchor, haptic, locale, monthFade, monthSlide, theme.components.dateRangePicker, theme.motion.duration.fast]);
|
|
224
225
|
const goPrev = (0, _react.useCallback)(() => animateMonthChange(-1), [animateMonthChange]);
|
|
225
226
|
const goNext = (0, _react.useCallback)(() => animateMonthChange(1), [animateMonthChange]);
|
|
226
227
|
const pressDay = (0, _react.useCallback)(cell => {
|
|
227
228
|
if (isDisabled(cell.date)) return;
|
|
228
|
-
|
|
229
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
230
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
229
231
|
const target = cell.date;
|
|
230
232
|
|
|
231
233
|
// First tap: pick start. Or, when there's already a complete range, restart.
|
|
@@ -244,7 +246,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
244
246
|
} else {
|
|
245
247
|
if (maxRange && daysBetween(pendingStart, target) + 1 > maxRange) {
|
|
246
248
|
// Reject ranges longer than maxRange — restart from the new tap.
|
|
247
|
-
if (
|
|
249
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('notificationWarning');
|
|
248
250
|
setPendingStart(target);
|
|
249
251
|
setPendingEnd(null);
|
|
250
252
|
return;
|
|
@@ -255,7 +257,7 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
255
257
|
if (!cell.inMonth) {
|
|
256
258
|
setAnchor(new Date(cell.date.getFullYear(), cell.date.getMonth(), 1));
|
|
257
259
|
}
|
|
258
|
-
}, [isDisabled, pendingStart, pendingEnd, maxRange,
|
|
260
|
+
}, [isDisabled, pendingStart, pendingEnd, maxRange, haptic]);
|
|
259
261
|
const handleCloseModal = (0, _react.useCallback)(() => {
|
|
260
262
|
if (isControlled) {
|
|
261
263
|
onClose?.();
|
|
@@ -279,18 +281,18 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
|
|
|
279
281
|
});
|
|
280
282
|
}, [backdrop, handleCloseModal, sheet, theme.motion.duration.fast]);
|
|
281
283
|
const handleCancel = (0, _react.useCallback)(() => {
|
|
282
|
-
if (
|
|
284
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('selection');
|
|
283
285
|
handleClose();
|
|
284
|
-
}, [handleClose,
|
|
286
|
+
}, [handleClose, haptic]);
|
|
285
287
|
const handleConfirm = (0, _react.useCallback)(() => {
|
|
286
288
|
if (!pendingStart || !pendingEnd) return;
|
|
287
|
-
if (
|
|
289
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('notificationSuccess');
|
|
288
290
|
onChange?.({
|
|
289
291
|
start: pendingStart,
|
|
290
292
|
end: pendingEnd
|
|
291
293
|
});
|
|
292
294
|
handleClose();
|
|
293
|
-
}, [handleClose, onChange, pendingStart, pendingEnd,
|
|
295
|
+
}, [handleClose, onChange, pendingStart, pendingEnd, haptic]);
|
|
294
296
|
const sheetTranslate = sheet.interpolate({
|
|
295
297
|
inputRange: [0, 1],
|
|
296
298
|
outputRange: [320, 0]
|
|
@@ -30,6 +30,7 @@ const Dialog = props => {
|
|
|
30
30
|
actionsRowStyle,
|
|
31
31
|
actionButtonStyle,
|
|
32
32
|
actionTextStyle,
|
|
33
|
+
haptic,
|
|
33
34
|
testID
|
|
34
35
|
} = props;
|
|
35
36
|
const theme = (0, _index.useTheme)();
|
|
@@ -41,12 +42,13 @@ const Dialog = props => {
|
|
|
41
42
|
const actionButtonMinHeight = dialogTokens?.actionButtonMinHeight ?? 44;
|
|
42
43
|
const handleAction = (0, _react.useCallback)(action => {
|
|
43
44
|
if (action.loading) return;
|
|
44
|
-
|
|
45
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
46
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
45
47
|
action.onPress();
|
|
46
48
|
if (dismissOnAction) {
|
|
47
49
|
onClose();
|
|
48
50
|
}
|
|
49
|
-
}, [dismissOnAction, onClose,
|
|
51
|
+
}, [dismissOnAction, onClose, haptic]);
|
|
50
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
51
53
|
visible: visible,
|
|
52
54
|
onRequestClose: onClose,
|
|
@@ -45,6 +45,7 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
45
45
|
enableSwipe = true,
|
|
46
46
|
enableBackdropPress = true,
|
|
47
47
|
backdropOpacity = 0.5,
|
|
48
|
+
haptic,
|
|
48
49
|
containerStyle,
|
|
49
50
|
children,
|
|
50
51
|
accessibilityLabel,
|
|
@@ -224,9 +225,10 @@ const Drawer = exports.Drawer = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
224
225
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
225
226
|
const handleBackdropPress = (0, _react.useCallback)(() => {
|
|
226
227
|
if (!enableBackdropPress) return;
|
|
227
|
-
|
|
228
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
229
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
228
230
|
close();
|
|
229
|
-
}, [enableBackdropPress, close,
|
|
231
|
+
}, [enableBackdropPress, close, haptic]);
|
|
230
232
|
|
|
231
233
|
// Per-side container layout — must be a hook on every render path so we
|
|
232
234
|
// can't gate it on the lazy-mount early-return below.
|
|
@@ -33,8 +33,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
33
33
|
* - Shake-on-error or any cross-field animation.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
const SIDES = ['top', 'right', 'bottom', 'left'];
|
|
37
|
-
|
|
38
36
|
/** Map a single colour string to all four sides (shorthand expansion). */
|
|
39
37
|
const expandColorSides = value => {
|
|
40
38
|
if (typeof value === 'string') {
|
|
@@ -69,6 +69,7 @@ const FloatingActionButton = exports.FloatingActionButton = /*#__PURE__*/(0, _re
|
|
|
69
69
|
isScrolling = false,
|
|
70
70
|
accessibilityLabel,
|
|
71
71
|
accessibilityHint,
|
|
72
|
+
haptic,
|
|
72
73
|
style,
|
|
73
74
|
containerStyle,
|
|
74
75
|
labelStyle,
|
|
@@ -88,7 +89,6 @@ const FloatingActionButton = exports.FloatingActionButton = /*#__PURE__*/(0, _re
|
|
|
88
89
|
const fabTokens = theme.components.floatingActionButton;
|
|
89
90
|
const edgeOffset = fabTokens?.edgeOffset ?? 24;
|
|
90
91
|
const defaultBottomOffset = fabTokens?.bottomOffset ?? 24;
|
|
91
|
-
const pressHaptic = fabTokens?.pressHaptic ?? false;
|
|
92
92
|
const hideAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
|
|
93
93
|
(0, _react.useEffect)(() => {
|
|
94
94
|
if (!hideOnScroll) {
|
|
@@ -114,7 +114,8 @@ const FloatingActionButton = exports.FloatingActionButton = /*#__PURE__*/(0, _re
|
|
|
114
114
|
});
|
|
115
115
|
const handlePress = _event => {
|
|
116
116
|
if (disabled) return;
|
|
117
|
-
|
|
117
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'impactLight');
|
|
118
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
118
119
|
onPress();
|
|
119
120
|
};
|
|
120
121
|
const renderedIcon = icon;
|
|
@@ -183,7 +184,7 @@ const FloatingActionButton = exports.FloatingActionButton = /*#__PURE__*/(0, _re
|
|
|
183
184
|
borderRadius: sizeStyles.diameter / 2
|
|
184
185
|
}, theme.shadows.lg, {
|
|
185
186
|
backgroundColor,
|
|
186
|
-
opacity: disabled ? 0.
|
|
187
|
+
opacity: disabled ? 0.55 : 1
|
|
187
188
|
}],
|
|
188
189
|
children: [renderedIcon, isExtended ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
189
190
|
style: [styles.label, {
|
|
@@ -229,6 +230,7 @@ const FloatingActionButtonGroup = props => {
|
|
|
229
230
|
bottomOffset,
|
|
230
231
|
size = 'md',
|
|
231
232
|
accessibilityLabel = 'Quick actions',
|
|
233
|
+
haptic,
|
|
232
234
|
containerStyle,
|
|
233
235
|
secondaryActionStyle,
|
|
234
236
|
labelPillStyle,
|
|
@@ -244,7 +246,6 @@ const FloatingActionButtonGroup = props => {
|
|
|
244
246
|
const defaultBottomOffset = fabTokens?.bottomOffset ?? 24;
|
|
245
247
|
const secondaryGap = fabTokens?.secondaryGap ?? 16;
|
|
246
248
|
const staggerMs = fabTokens?.staggerMs ?? 50;
|
|
247
|
-
const pressHaptic = fabTokens?.pressHaptic ?? false;
|
|
248
249
|
const isControlled = typeof controlledOpen === 'boolean';
|
|
249
250
|
const [internalOpen, setInternalOpen] = (0, _react.useState)(defaultOpen);
|
|
250
251
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
@@ -301,20 +302,21 @@ const FloatingActionButtonGroup = props => {
|
|
|
301
302
|
};
|
|
302
303
|
}, [isOpen, progress, theme.motion.duration.normal, theme.motion.easing.standard, actions.length, itemAnimsVersion, staggerMs]);
|
|
303
304
|
const setOpen = (0, _react.useCallback)(next => {
|
|
304
|
-
|
|
305
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'impactLight');
|
|
306
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
305
307
|
if (!isControlled) setInternalOpen(next);
|
|
306
308
|
onOpenChange?.(next);
|
|
307
|
-
}, [isControlled, onOpenChange,
|
|
309
|
+
}, [isControlled, onOpenChange, haptic]);
|
|
308
310
|
const handlePrimaryPress = (0, _react.useCallback)(() => {
|
|
309
311
|
setOpen(!isOpen);
|
|
310
312
|
}, [isOpen, setOpen]);
|
|
311
313
|
const handleActionPress = (0, _react.useCallback)(action => {
|
|
312
|
-
if (
|
|
314
|
+
if (haptic !== false) (0, _hapticUtils.triggerHaptic)('selection');
|
|
313
315
|
action.onPress();
|
|
314
316
|
// Close after action runs
|
|
315
317
|
if (!isControlled) setInternalOpen(false);
|
|
316
318
|
onOpenChange?.(false);
|
|
317
|
-
}, [isControlled, onOpenChange,
|
|
319
|
+
}, [isControlled, onOpenChange, haptic]);
|
|
318
320
|
const handleBackdropPress = (0, _react.useCallback)(() => {
|
|
319
321
|
if (isOpen) setOpen(false);
|
|
320
322
|
}, [isOpen, setOpen]);
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.IconButton = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _index = require("../../theme/index.js");
|
|
10
|
+
var _usePressAnimation = require("../../hooks/usePressAnimation.js");
|
|
11
|
+
var _index2 = require("../../utils/index.js");
|
|
12
|
+
var _index3 = require("../Spinner/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
|
+
diameter: 32,
|
|
18
|
+
icon: 16
|
|
19
|
+
},
|
|
20
|
+
md: {
|
|
21
|
+
diameter: 40,
|
|
22
|
+
icon: 20
|
|
23
|
+
},
|
|
24
|
+
lg: {
|
|
25
|
+
diameter: 48,
|
|
26
|
+
icon: 24
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const toneFor = (theme, tone) => {
|
|
30
|
+
switch (tone) {
|
|
31
|
+
case 'secondary':
|
|
32
|
+
return {
|
|
33
|
+
base: theme.colors.secondary,
|
|
34
|
+
on: theme.colors.onSecondary,
|
|
35
|
+
fg: theme.colors.secondary
|
|
36
|
+
};
|
|
37
|
+
case 'success':
|
|
38
|
+
return {
|
|
39
|
+
base: theme.colors.success,
|
|
40
|
+
on: theme.colors.onSuccess,
|
|
41
|
+
fg: theme.colors.success
|
|
42
|
+
};
|
|
43
|
+
case 'warning':
|
|
44
|
+
return {
|
|
45
|
+
base: theme.colors.warning,
|
|
46
|
+
on: theme.colors.onWarning,
|
|
47
|
+
fg: theme.colors.warning
|
|
48
|
+
};
|
|
49
|
+
case 'error':
|
|
50
|
+
return {
|
|
51
|
+
base: theme.colors.error,
|
|
52
|
+
on: theme.colors.onError,
|
|
53
|
+
fg: theme.colors.error
|
|
54
|
+
};
|
|
55
|
+
case 'neutral':
|
|
56
|
+
return {
|
|
57
|
+
base: theme.colors.background.tertiary,
|
|
58
|
+
on: theme.colors.text.primary,
|
|
59
|
+
fg: theme.colors.text.primary
|
|
60
|
+
};
|
|
61
|
+
case 'primary':
|
|
62
|
+
default:
|
|
63
|
+
return {
|
|
64
|
+
base: theme.colors.primary,
|
|
65
|
+
on: theme.colors.onPrimary,
|
|
66
|
+
fg: theme.colors.primary
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const IconButton = exports.IconButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
71
|
+
const {
|
|
72
|
+
icon,
|
|
73
|
+
onPress,
|
|
74
|
+
accessibilityLabel,
|
|
75
|
+
tone = 'primary',
|
|
76
|
+
variant = 'solid',
|
|
77
|
+
size = 'md',
|
|
78
|
+
shape = 'circle',
|
|
79
|
+
active = false,
|
|
80
|
+
disabled = false,
|
|
81
|
+
loading = false,
|
|
82
|
+
haptic,
|
|
83
|
+
style,
|
|
84
|
+
testID
|
|
85
|
+
} = props;
|
|
86
|
+
const theme = (0, _index.useTheme)();
|
|
87
|
+
const sizeCfg = SIZE_MAP[size];
|
|
88
|
+
const isDisabled = disabled || loading;
|
|
89
|
+
const {
|
|
90
|
+
scale,
|
|
91
|
+
pressIn,
|
|
92
|
+
pressOut
|
|
93
|
+
} = (0, _usePressAnimation.usePressAnimation)({
|
|
94
|
+
scaleTo: 0.92,
|
|
95
|
+
enabled: !isDisabled
|
|
96
|
+
});
|
|
97
|
+
const {
|
|
98
|
+
base,
|
|
99
|
+
on,
|
|
100
|
+
fg
|
|
101
|
+
} = toneFor(theme, tone);
|
|
102
|
+
const effectiveVariant = active ? 'solid' : variant;
|
|
103
|
+
let backgroundColor = 'transparent';
|
|
104
|
+
let borderColor = 'transparent';
|
|
105
|
+
let borderWidth = 0;
|
|
106
|
+
let iconColor = isDisabled ? theme.colors.text.disabled : fg;
|
|
107
|
+
if (effectiveVariant === 'solid') {
|
|
108
|
+
backgroundColor = isDisabled ? theme.colors.surface.disabled : base;
|
|
109
|
+
iconColor = isDisabled ? theme.colors.text.disabled : on;
|
|
110
|
+
} else if (effectiveVariant === 'soft') {
|
|
111
|
+
backgroundColor = isDisabled ? theme.colors.surface.disabled : `${base}22`;
|
|
112
|
+
} else if (effectiveVariant === 'outline') {
|
|
113
|
+
borderColor = isDisabled ? theme.colors.border.primary : base;
|
|
114
|
+
borderWidth = theme.colors.border.width;
|
|
115
|
+
}
|
|
116
|
+
const radius = shape === 'circle' ? sizeCfg.diameter / 2 : theme.radius.md;
|
|
117
|
+
const handlePress = e => {
|
|
118
|
+
if (isDisabled) return;
|
|
119
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
120
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
121
|
+
onPress?.(e);
|
|
122
|
+
};
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
124
|
+
ref: ref,
|
|
125
|
+
onPress: handlePress,
|
|
126
|
+
onPressIn: pressIn,
|
|
127
|
+
onPressOut: pressOut,
|
|
128
|
+
disabled: isDisabled,
|
|
129
|
+
accessibilityRole: "button",
|
|
130
|
+
accessibilityLabel: accessibilityLabel,
|
|
131
|
+
accessibilityState: {
|
|
132
|
+
disabled: isDisabled,
|
|
133
|
+
selected: active
|
|
134
|
+
},
|
|
135
|
+
hitSlop: 6,
|
|
136
|
+
testID: testID,
|
|
137
|
+
style: ({
|
|
138
|
+
pressed
|
|
139
|
+
}) => [styles.base, {
|
|
140
|
+
width: sizeCfg.diameter,
|
|
141
|
+
height: sizeCfg.diameter,
|
|
142
|
+
borderRadius: radius,
|
|
143
|
+
backgroundColor,
|
|
144
|
+
borderColor,
|
|
145
|
+
borderWidth,
|
|
146
|
+
opacity: pressed && effectiveVariant !== 'solid' ? 0.7 : 1
|
|
147
|
+
}, style],
|
|
148
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
149
|
+
style: [styles.content, {
|
|
150
|
+
transform: [{
|
|
151
|
+
scale
|
|
152
|
+
}]
|
|
153
|
+
}],
|
|
154
|
+
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Spinner, {
|
|
155
|
+
size: "sm",
|
|
156
|
+
color: iconColor
|
|
157
|
+
}) : typeof icon === 'function' ? icon({
|
|
158
|
+
color: iconColor,
|
|
159
|
+
size: sizeCfg.icon
|
|
160
|
+
}) : icon
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
IconButton.displayName = 'IconButton';
|
|
165
|
+
const styles = _reactNative.StyleSheet.create({
|
|
166
|
+
base: {
|
|
167
|
+
alignItems: 'center',
|
|
168
|
+
justifyContent: 'center'
|
|
169
|
+
},
|
|
170
|
+
content: {
|
|
171
|
+
alignItems: 'center',
|
|
172
|
+
justifyContent: 'center'
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
var _default = exports.default = IconButton;
|
|
176
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "IconButton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _IconButton.IconButton;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _IconButton = require("./IconButton.js");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -51,6 +51,7 @@ const ImageGallery = ({
|
|
|
51
51
|
enableLightbox = true,
|
|
52
52
|
enablePinchZoom = true,
|
|
53
53
|
onIndexChange,
|
|
54
|
+
haptic,
|
|
54
55
|
loading = false,
|
|
55
56
|
accessibilityLabel,
|
|
56
57
|
containerStyle,
|
|
@@ -58,8 +59,6 @@ const ImageGallery = ({
|
|
|
58
59
|
}) => {
|
|
59
60
|
const theme = (0, _index3.useTheme)();
|
|
60
61
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
61
|
-
const galleryTokens = theme.components.imageGallery;
|
|
62
|
-
const pressHaptic = galleryTokens?.pressHaptic ?? false;
|
|
63
62
|
const [currentIndex, setCurrentIndex] = (0, _react.useState)(clamp(initialIndex, 0, Math.max(0, images.length - 1)));
|
|
64
63
|
const [lightboxOpen, setLightboxOpen] = (0, _react.useState)(false);
|
|
65
64
|
const handleIndexChange = (0, _react.useCallback)(idx => {
|
|
@@ -68,13 +67,15 @@ const ImageGallery = ({
|
|
|
68
67
|
}, [onIndexChange]);
|
|
69
68
|
const openLightbox = (0, _react.useCallback)(() => {
|
|
70
69
|
if (!enableLightbox) return;
|
|
71
|
-
|
|
70
|
+
const h = (0, _index4.resolveHaptic)(haptic, 'selection');
|
|
71
|
+
if (h) (0, _index4.triggerHaptic)(h);
|
|
72
72
|
setLightboxOpen(true);
|
|
73
|
-
}, [enableLightbox,
|
|
73
|
+
}, [enableLightbox, haptic]);
|
|
74
74
|
const closeLightbox = (0, _react.useCallback)(() => {
|
|
75
|
-
|
|
75
|
+
const h = (0, _index4.resolveHaptic)(haptic, 'selection');
|
|
76
|
+
if (h) (0, _index4.triggerHaptic)(h);
|
|
76
77
|
setLightboxOpen(false);
|
|
77
|
-
}, [
|
|
78
|
+
}, [haptic]);
|
|
78
79
|
const renderImage = (0, _react.useCallback)((image, idx) => {
|
|
79
80
|
const a11y = image.alt ?? `Image ${idx + 1} of ${images.length}`;
|
|
80
81
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
@@ -128,7 +129,7 @@ const ImageGallery = ({
|
|
|
128
129
|
showCounter: showCounter,
|
|
129
130
|
onClose: closeLightbox,
|
|
130
131
|
onIndexChange: handleIndexChange,
|
|
131
|
-
|
|
132
|
+
haptic: haptic
|
|
132
133
|
}) : null]
|
|
133
134
|
});
|
|
134
135
|
if (loading) {
|
|
@@ -218,7 +219,7 @@ const Lightbox = ({
|
|
|
218
219
|
showCounter,
|
|
219
220
|
onClose,
|
|
220
221
|
onIndexChange,
|
|
221
|
-
|
|
222
|
+
haptic
|
|
222
223
|
}) => {
|
|
223
224
|
const theme = (0, _index3.useTheme)();
|
|
224
225
|
const styles = (0, _react.useMemo)(() => buildLightboxStyles(theme), [theme]);
|
|
@@ -230,11 +231,12 @@ const Lightbox = ({
|
|
|
230
231
|
const [activeIndex, setActiveIndex] = (0, _react.useState)(initialIndex);
|
|
231
232
|
const handleSwipe = (0, _react.useCallback)(idx => {
|
|
232
233
|
if (idx !== activeIndex) {
|
|
233
|
-
|
|
234
|
+
const h = (0, _index4.resolveHaptic)(haptic, 'selection');
|
|
235
|
+
if (h) (0, _index4.triggerHaptic)(h);
|
|
234
236
|
setActiveIndex(idx);
|
|
235
237
|
onIndexChange(idx);
|
|
236
238
|
}
|
|
237
|
-
}, [activeIndex, onIndexChange,
|
|
239
|
+
}, [activeIndex, onIndexChange, haptic]);
|
|
238
240
|
const renderItem = (0, _react.useCallback)((image, idx) => /*#__PURE__*/(0, _jsxRuntime.jsx)(ZoomableImage, {
|
|
239
241
|
image: image,
|
|
240
242
|
index: idx,
|
|
@@ -244,8 +246,8 @@ const Lightbox = ({
|
|
|
244
246
|
maxScale: maxScale,
|
|
245
247
|
minScale: minScale,
|
|
246
248
|
doubleTapScale: doubleTapScale,
|
|
247
|
-
|
|
248
|
-
}), [activeIndex, enablePinchZoom, images.length, maxScale, minScale, doubleTapScale,
|
|
249
|
+
haptic: haptic
|
|
250
|
+
}), [activeIndex, enablePinchZoom, images.length, maxScale, minScale, doubleTapScale, haptic]);
|
|
249
251
|
const caption = images[activeIndex]?.caption;
|
|
250
252
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
251
253
|
visible: visible,
|
|
@@ -316,7 +318,7 @@ const ZoomableImage = ({
|
|
|
316
318
|
maxScale,
|
|
317
319
|
minScale,
|
|
318
320
|
doubleTapScale,
|
|
319
|
-
|
|
321
|
+
haptic
|
|
320
322
|
}) => {
|
|
321
323
|
const screen = _reactNative.Dimensions.get('window');
|
|
322
324
|
const scale = (0, _reactNativeReanimated.useSharedValue)(1);
|
|
@@ -352,8 +354,8 @@ const ZoomableImage = ({
|
|
|
352
354
|
}
|
|
353
355
|
}, [active, scale, translateX, translateY, savedScale, savedTranslateX, savedTranslateY]);
|
|
354
356
|
const triggerImpact = (0, _react.useCallback)(() => {
|
|
355
|
-
if (
|
|
356
|
-
}, [
|
|
357
|
+
if (haptic !== false) (0, _index4.triggerHaptic)('impactLight');
|
|
358
|
+
}, [haptic]);
|
|
357
359
|
const pinch = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Pinch().enabled(enabled).onStart(() => {
|
|
358
360
|
'worklet';
|
|
359
361
|
|
|
@@ -69,6 +69,7 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
69
69
|
left,
|
|
70
70
|
right,
|
|
71
71
|
onPress,
|
|
72
|
+
haptic,
|
|
72
73
|
selected = false,
|
|
73
74
|
disabled = false,
|
|
74
75
|
size = 'md',
|
|
@@ -88,7 +89,6 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
88
89
|
testID
|
|
89
90
|
} = props;
|
|
90
91
|
const theme = (0, _index.useTheme)();
|
|
91
|
-
const pressHaptic = theme.components.listItem?.pressHaptic ?? false;
|
|
92
92
|
const sz = (0, _react.useMemo)(() => sizeFor(theme, size), [theme, size]);
|
|
93
93
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
94
94
|
const isInteractive = !!onPress && !disabled;
|
|
@@ -101,7 +101,8 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
101
101
|
});
|
|
102
102
|
const handlePress = event => {
|
|
103
103
|
if (!isInteractive) return;
|
|
104
|
-
|
|
104
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
105
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
105
106
|
onPress?.(event);
|
|
106
107
|
};
|
|
107
108
|
const a11yLabel = accessibilityLabel ?? title;
|
|
@@ -296,7 +297,7 @@ const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
|
296
297
|
backgroundColor: theme.colors.surface.pressed
|
|
297
298
|
},
|
|
298
299
|
disabled: {
|
|
299
|
-
opacity: 0.
|
|
300
|
+
opacity: 0.55
|
|
300
301
|
},
|
|
301
302
|
leftSlot: {
|
|
302
303
|
marginRight: theme.spacing.md,
|