@webority-technologies/mobile 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Accordion/Accordion.js +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/Banner/Banner.js +12 -2
- 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/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/FloatingActionButton/FloatingActionButton.js +10 -8
- 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 -3
- package/lib/commonjs/components/NumberInput/NumberInput.js +7 -5
- package/lib/commonjs/components/OTPInput/OTPInput.js +7 -7
- 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/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 +121 -114
- 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/Banner/Banner.js +12 -2
- 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/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/FloatingActionButton/FloatingActionButton.js +11 -9
- 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 -4
- package/lib/module/components/NumberInput/NumberInput.js +8 -6
- package/lib/module/components/OTPInput/OTPInput.js +8 -8
- 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/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 +1 -0
- package/lib/module/utils/hapticUtils.js +9 -0
- package/lib/module/utils/index.js +1 -1
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +3 -0
- package/lib/typescript/commonjs/components/AnimatePresence/AnimatePresence.d.ts +30 -0
- package/lib/typescript/commonjs/components/AnimatePresence/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +6 -0
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +3 -0
- package/lib/typescript/commonjs/components/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/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/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/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/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 +2 -0
- 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/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/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/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/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/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 +2 -0
- 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
|
@@ -62,6 +62,7 @@ const Swipeable = props => {
|
|
|
62
62
|
onSwipeOpen,
|
|
63
63
|
onSwipeClose,
|
|
64
64
|
disabled = false,
|
|
65
|
+
haptic,
|
|
65
66
|
containerStyle,
|
|
66
67
|
contentStyle: contentSlotStyle,
|
|
67
68
|
actionStyle,
|
|
@@ -80,9 +81,6 @@ const Swipeable = props => {
|
|
|
80
81
|
stiffness: swipeTheme?.springStiffness ?? SPRING_CONFIG.stiffness,
|
|
81
82
|
mass: swipeTheme?.springMass ?? SPRING_CONFIG.mass
|
|
82
83
|
};
|
|
83
|
-
const fullSwipeHapticEnabled = swipeTheme?.fullSwipeHaptic ?? true;
|
|
84
|
-
const actionPressHapticEnabled = swipeTheme?.actionPressHaptic ?? true;
|
|
85
|
-
const a11yActionHapticEnabled = swipeTheme?.a11yActionHaptic ?? true;
|
|
86
84
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
87
85
|
const hasLeft = !!leftActions && leftActions.length > 0;
|
|
88
86
|
const hasRight = !!rightActions && rightActions.length > 0;
|
|
@@ -122,22 +120,23 @@ const Swipeable = props => {
|
|
|
122
120
|
const list = side === 'left' ? leftActions : rightActions;
|
|
123
121
|
const first = list?.[0];
|
|
124
122
|
if (!first) return;
|
|
125
|
-
if (
|
|
123
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('notificationSuccess');
|
|
126
124
|
first.onPress();
|
|
127
125
|
// After the off-screen slide, snap back to 0 silently.
|
|
128
126
|
translateX.value = (0, _reactNativeReanimated.withSpring)(0, springConfig);
|
|
129
127
|
openSideRef.current = null;
|
|
130
128
|
onSwipeClose?.();
|
|
131
|
-
}, [leftActions, rightActions, translateX, onSwipeClose, springConfig,
|
|
129
|
+
}, [leftActions, rightActions, translateX, onSwipeClose, springConfig, haptic]);
|
|
132
130
|
const close = (0, _react.useCallback)(() => {
|
|
133
131
|
translateX.value = (0, _reactNativeReanimated.withSpring)(0, springConfig);
|
|
134
132
|
notifyClose();
|
|
135
133
|
}, [translateX, notifyClose, springConfig]);
|
|
136
134
|
const handleActionPress = (0, _react.useCallback)(action => {
|
|
137
|
-
|
|
135
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
136
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
138
137
|
action.onPress();
|
|
139
138
|
close();
|
|
140
|
-
}, [close,
|
|
139
|
+
}, [close, haptic]);
|
|
141
140
|
|
|
142
141
|
// ───────── Pan gesture (UI thread) ─────────
|
|
143
142
|
const panGesture = (0, _react.useMemo)(() => {
|
|
@@ -243,10 +242,10 @@ const Swipeable = props => {
|
|
|
243
242
|
const all = [...(leftActions ?? []), ...(rightActions ?? [])];
|
|
244
243
|
const match = all.find(a => a.key === name);
|
|
245
244
|
if (match) {
|
|
246
|
-
if (
|
|
245
|
+
if (haptic !== false) (0, _index2.triggerHaptic)('selection');
|
|
247
246
|
match.onPress();
|
|
248
247
|
}
|
|
249
|
-
}, [leftActions, rightActions,
|
|
248
|
+
}, [leftActions, rightActions, haptic]);
|
|
250
249
|
|
|
251
250
|
// ───────── Render ─────────
|
|
252
251
|
// No actions configured → render children directly; zero gesture overhead.
|
|
@@ -38,6 +38,7 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
38
38
|
dividerStyle,
|
|
39
39
|
indicatorStyle,
|
|
40
40
|
progress,
|
|
41
|
+
haptic,
|
|
41
42
|
accessibilityLabel,
|
|
42
43
|
testID
|
|
43
44
|
} = props;
|
|
@@ -51,7 +52,6 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
51
52
|
const pillInset = tabsTokens?.pillInset ?? 4;
|
|
52
53
|
const disabledOpacity = tabsTokens?.disabledOpacity ?? 0.45;
|
|
53
54
|
const badgeGap = tabsTokens?.badgeGap ?? 6;
|
|
54
|
-
const hapticOnPress = tabsTokens?.hapticOnPress ?? false;
|
|
55
55
|
|
|
56
56
|
// Per-tab measured layouts (key → {x, width}).
|
|
57
57
|
const [layouts, setLayouts] = (0, _react.useState)({});
|
|
@@ -127,9 +127,10 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
127
127
|
const handlePress = (0, _react.useCallback)(tab => {
|
|
128
128
|
if (tab.disabled) return;
|
|
129
129
|
if (tab.key === activeKey) return;
|
|
130
|
-
|
|
130
|
+
const h = (0, _index2.resolveHaptic)(haptic, 'selection');
|
|
131
|
+
if (h) (0, _index2.triggerHaptic)(h);
|
|
131
132
|
onChange(tab.key);
|
|
132
|
-
}, [activeKey, onChange,
|
|
133
|
+
}, [activeKey, onChange, haptic]);
|
|
133
134
|
const indicatorIsPill = variant === 'pills';
|
|
134
135
|
|
|
135
136
|
// Indicator visual.
|
|
@@ -76,6 +76,7 @@ const Wheel = ({
|
|
|
76
76
|
onIndexChange,
|
|
77
77
|
formatItem,
|
|
78
78
|
theme,
|
|
79
|
+
haptic,
|
|
79
80
|
testID
|
|
80
81
|
}) => {
|
|
81
82
|
const listRef = (0, _react.useRef)(null);
|
|
@@ -98,7 +99,6 @@ const Wheel = ({
|
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
}, [selectedIndex, scrollY]);
|
|
101
|
-
const hapticEnabled = theme.components.timePicker?.haptic ?? false;
|
|
102
102
|
const hapticDebounceMs = theme.components.timePicker?.hapticDebounceMs ?? HAPTIC_DEBOUNCE_MS;
|
|
103
103
|
const onScroll = (0, _react.useMemo)(() => _reactNative.Animated.event([{
|
|
104
104
|
nativeEvent: {
|
|
@@ -113,14 +113,15 @@ const Wheel = ({
|
|
|
113
113
|
const idx = Math.round(y / ITEM_HEIGHT);
|
|
114
114
|
if (idx !== lastIndexRef.current && idx >= 0 && idx < data.length) {
|
|
115
115
|
const now = Date.now();
|
|
116
|
-
if (
|
|
117
|
-
(0, _hapticUtils.
|
|
116
|
+
if (now - lastHapticAtRef.current >= hapticDebounceMs) {
|
|
117
|
+
const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
|
|
118
|
+
if (h) (0, _hapticUtils.triggerHaptic)(h);
|
|
118
119
|
lastHapticAtRef.current = now;
|
|
119
120
|
}
|
|
120
121
|
lastIndexRef.current = idx;
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
}), [scrollY, data.length,
|
|
124
|
+
}), [scrollY, data.length, haptic, hapticDebounceMs]);
|
|
124
125
|
const onMomentumScrollEnd = (0, _react.useCallback)(event => {
|
|
125
126
|
const y = event.nativeEvent.contentOffset.y;
|
|
126
127
|
const idx = Math.max(0, Math.min(data.length - 1, Math.round(y / ITEM_HEIGHT)));
|
|
@@ -246,7 +247,8 @@ const TimePicker = props => {
|
|
|
246
247
|
clearable,
|
|
247
248
|
onClear,
|
|
248
249
|
formatValue,
|
|
249
|
-
triggerStyle
|
|
250
|
+
triggerStyle,
|
|
251
|
+
haptic
|
|
250
252
|
} = props;
|
|
251
253
|
const isControlled = props.visible !== undefined;
|
|
252
254
|
const [internalOpen, setInternalOpen] = (0, _react.useState)(false);
|
|
@@ -351,21 +353,21 @@ const TimePicker = props => {
|
|
|
351
353
|
announce(periods[idx] ?? '');
|
|
352
354
|
}, [periods, announce]);
|
|
353
355
|
const handleCancel = (0, _react.useCallback)(() => {
|
|
354
|
-
if (
|
|
356
|
+
if (haptic !== false) (0, _hapticUtils.triggerHaptic)('selection');
|
|
355
357
|
handleCloseModal();
|
|
356
|
-
}, [handleCloseModal,
|
|
358
|
+
}, [handleCloseModal, haptic]);
|
|
357
359
|
const handleConfirm = (0, _react.useCallback)(() => {
|
|
358
360
|
const displayHour = hours[hourIndex] ?? 0;
|
|
359
361
|
const period = periods[periodIndex] ?? 'AM';
|
|
360
362
|
const hour24 = to24h(displayHour, period, format);
|
|
361
363
|
const minute = minutes[minuteIndex] ?? 0;
|
|
362
|
-
if (
|
|
364
|
+
if (haptic !== false) (0, _hapticUtils.triggerHaptic)('notificationSuccess');
|
|
363
365
|
onChange?.({
|
|
364
366
|
hour: hour24,
|
|
365
367
|
minute
|
|
366
368
|
});
|
|
367
369
|
handleCloseModal();
|
|
368
|
-
}, [hours, hourIndex, periods, periodIndex, minutes, minuteIndex, format, onChange, handleCloseModal,
|
|
370
|
+
}, [hours, hourIndex, periods, periodIndex, minutes, minuteIndex, format, onChange, handleCloseModal, haptic]);
|
|
369
371
|
const summary = (0, _react.useMemo)(() => {
|
|
370
372
|
const displayHour = hours[hourIndex] ?? 0;
|
|
371
373
|
const minute = minutes[minuteIndex] ?? 0;
|
|
@@ -449,6 +451,7 @@ const TimePicker = props => {
|
|
|
449
451
|
onIndexChange: handleHourIndex,
|
|
450
452
|
formatItem: formatHourItem,
|
|
451
453
|
theme: theme,
|
|
454
|
+
haptic: haptic,
|
|
452
455
|
testID: "time-picker-hour"
|
|
453
456
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
454
457
|
style: styles.separator,
|
|
@@ -461,6 +464,7 @@ const TimePicker = props => {
|
|
|
461
464
|
onIndexChange: handleMinuteIndex,
|
|
462
465
|
formatItem: formatMinuteItem,
|
|
463
466
|
theme: theme,
|
|
467
|
+
haptic: haptic,
|
|
464
468
|
testID: "time-picker-minute"
|
|
465
469
|
}), format === '12h' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
466
470
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -473,6 +477,7 @@ const TimePicker = props => {
|
|
|
473
477
|
onIndexChange: handlePeriodIndex,
|
|
474
478
|
formatItem: formatPeriodItem,
|
|
475
479
|
theme: theme,
|
|
480
|
+
haptic: haptic,
|
|
476
481
|
testID: "time-picker-period"
|
|
477
482
|
})]
|
|
478
483
|
}) : null]
|