@webority-technologies/mobile 0.0.15 → 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 +78 -53
- 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 +80 -55
- 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
|
@@ -93,6 +93,8 @@ const Accordion = props => {
|
|
|
93
93
|
style,
|
|
94
94
|
headerStyle,
|
|
95
95
|
contentStyle,
|
|
96
|
+
contentWrapperStyle,
|
|
97
|
+
containerStyle,
|
|
96
98
|
testID,
|
|
97
99
|
loading = false
|
|
98
100
|
} = props;
|
|
@@ -139,7 +141,9 @@ const Accordion = props => {
|
|
|
139
141
|
}, [measuredHeight]);
|
|
140
142
|
const handlePress = (0, _react.useCallback)(() => {
|
|
141
143
|
if (disabled) return;
|
|
142
|
-
(
|
|
144
|
+
if (theme.components.accordion?.pressHaptic ?? false) {
|
|
145
|
+
(0, _hapticUtils.triggerHaptic)('selection');
|
|
146
|
+
}
|
|
143
147
|
if (group && id) {
|
|
144
148
|
group.toggle(id);
|
|
145
149
|
onChange?.(!expanded);
|
|
@@ -147,7 +151,7 @@ const Accordion = props => {
|
|
|
147
151
|
}
|
|
148
152
|
if (!isControlled) setInternalExpanded(!expanded);
|
|
149
153
|
onChange?.(!expanded);
|
|
150
|
-
}, [disabled, group, id, expanded, isControlled, onChange]);
|
|
154
|
+
}, [disabled, group, id, expanded, isControlled, onChange, theme.components.accordion]);
|
|
151
155
|
const rotate = rotateAnim.interpolate({
|
|
152
156
|
inputRange: [0, 1],
|
|
153
157
|
outputRange: ['0deg', '180deg']
|
|
@@ -161,24 +165,12 @@ const Accordion = props => {
|
|
|
161
165
|
borderRadius: theme.radius.md
|
|
162
166
|
}] : null;
|
|
163
167
|
if (loading) {
|
|
164
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
165
|
-
|
|
166
|
-
mode: "auto",
|
|
167
|
-
style: [cardStyle, style],
|
|
168
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
169
|
-
style: styles.header,
|
|
170
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
171
|
-
style: [styles.title, {
|
|
172
|
-
fontSize: theme.typography.fontSize.base
|
|
173
|
-
}],
|
|
174
|
-
numberOfLines: 1,
|
|
175
|
-
children: title ?? ' '
|
|
176
|
-
})
|
|
177
|
-
})
|
|
168
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AccordionSkeleton, {
|
|
169
|
+
...props
|
|
178
170
|
});
|
|
179
171
|
}
|
|
180
172
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
181
|
-
style: [cardStyle, style],
|
|
173
|
+
style: [cardStyle, style, containerStyle],
|
|
182
174
|
testID: testID,
|
|
183
175
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
184
176
|
onPress: handlePress,
|
|
@@ -224,7 +216,7 @@ const Accordion = props => {
|
|
|
224
216
|
} : {
|
|
225
217
|
height: animatedHeight,
|
|
226
218
|
opacity: opacityAnim
|
|
227
|
-
}]
|
|
219
|
+
}, contentWrapperStyle]
|
|
228
220
|
// Re-measure if children change size by listening to layout of inner
|
|
229
221
|
,
|
|
230
222
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -238,12 +230,61 @@ const Accordion = props => {
|
|
|
238
230
|
exports.Accordion = Accordion;
|
|
239
231
|
Accordion.displayName = 'Accordion';
|
|
240
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Placeholder shape for `<Accordion>`. Header pill with a title-line
|
|
235
|
+
* skeleton; content is collapsed (matches the closed-by-default behaviour).
|
|
236
|
+
*/
|
|
237
|
+
const AccordionSkeleton = ({
|
|
238
|
+
variant = 'plain',
|
|
239
|
+
style
|
|
240
|
+
}) => {
|
|
241
|
+
const theme = (0, _index.useTheme)();
|
|
242
|
+
const isCard = variant === 'card';
|
|
243
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
244
|
+
style: [isCard ? {
|
|
245
|
+
paddingHorizontal: theme.spacing.md,
|
|
246
|
+
paddingVertical: theme.spacing.sm,
|
|
247
|
+
backgroundColor: theme.colors.background.elevated,
|
|
248
|
+
borderRadius: theme.radius.md
|
|
249
|
+
} : {
|
|
250
|
+
paddingVertical: theme.spacing.sm
|
|
251
|
+
}, style],
|
|
252
|
+
accessibilityRole: "progressbar",
|
|
253
|
+
accessibilityState: {
|
|
254
|
+
busy: true
|
|
255
|
+
},
|
|
256
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
257
|
+
style: {
|
|
258
|
+
flexDirection: 'row',
|
|
259
|
+
alignItems: 'center'
|
|
260
|
+
},
|
|
261
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
|
|
262
|
+
shape: "text",
|
|
263
|
+
width: "60%",
|
|
264
|
+
height: 18,
|
|
265
|
+
style: {
|
|
266
|
+
flex: 1
|
|
267
|
+
}
|
|
268
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
|
|
269
|
+
width: 16,
|
|
270
|
+
height: 16,
|
|
271
|
+
radius: "sm",
|
|
272
|
+
style: {
|
|
273
|
+
marginLeft: theme.spacing.sm
|
|
274
|
+
}
|
|
275
|
+
})]
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
AccordionSkeleton.displayName = 'AccordionSkeleton';
|
|
280
|
+
Accordion.Skeleton = AccordionSkeleton;
|
|
281
|
+
|
|
241
282
|
// Suppress unused warnings on platforms that don't support LayoutAnimation
|
|
242
283
|
void _reactNative.LayoutAnimation;
|
|
243
284
|
const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
244
285
|
card: {
|
|
245
286
|
paddingHorizontal: theme.spacing.md,
|
|
246
|
-
paddingVertical: 4,
|
|
287
|
+
paddingVertical: theme.components.accordion?.cardPaddingVertical ?? 4,
|
|
247
288
|
marginVertical: theme.spacing.xs
|
|
248
289
|
},
|
|
249
290
|
header: {
|
|
@@ -40,7 +40,8 @@ const variantSize = (theme, variant) => {
|
|
|
40
40
|
};
|
|
41
41
|
const ActionButton = ({
|
|
42
42
|
action,
|
|
43
|
-
side
|
|
43
|
+
side,
|
|
44
|
+
badgeStyle
|
|
44
45
|
}) => {
|
|
45
46
|
const theme = (0, _index.useTheme)();
|
|
46
47
|
const {
|
|
@@ -52,7 +53,9 @@ const ActionButton = ({
|
|
|
52
53
|
});
|
|
53
54
|
const styles = (0, _react.useMemo)(() => buildActionStyles(theme), [theme]);
|
|
54
55
|
const onPress = () => {
|
|
55
|
-
(
|
|
56
|
+
if (theme.components.appBar?.pressHaptic ?? false) {
|
|
57
|
+
(0, _hapticUtils.triggerHaptic)('selection');
|
|
58
|
+
}
|
|
56
59
|
action.onPress();
|
|
57
60
|
};
|
|
58
61
|
const badgeValue = action.badge;
|
|
@@ -81,7 +84,7 @@ const ActionButton = ({
|
|
|
81
84
|
style: styles.iconWrap,
|
|
82
85
|
children: action.icon
|
|
83
86
|
}), badgeValue !== undefined && !badgeIsDot ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
84
|
-
style: styles.badge,
|
|
87
|
+
style: [styles.badge, badgeStyle],
|
|
85
88
|
pointerEvents: "none",
|
|
86
89
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
87
90
|
style: styles.badgeText,
|
|
@@ -106,6 +109,10 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
106
109
|
transparent = false,
|
|
107
110
|
scrollY,
|
|
108
111
|
style,
|
|
112
|
+
containerStyle,
|
|
113
|
+
titleStyle,
|
|
114
|
+
subtitleStyle,
|
|
115
|
+
badgeStyle,
|
|
109
116
|
testID
|
|
110
117
|
} = props;
|
|
111
118
|
const theme = (0, _index.useTheme)();
|
|
@@ -117,6 +124,7 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
117
124
|
// Interpolations for the collapsing-app-bar behaviour. Native driver supports
|
|
118
125
|
// transform/opacity; height + borderBottomWidth must run on the JS driver and
|
|
119
126
|
// are wired through the same scrollY (RN coalesces the listener).
|
|
127
|
+
const collapseTranslateDistance = theme.components.appBar?.collapseTranslateDistance ?? -20;
|
|
120
128
|
const collapse = (0, _react.useMemo)(() => {
|
|
121
129
|
if (!scrollY) return null;
|
|
122
130
|
const clamp = {
|
|
@@ -132,7 +140,7 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
132
140
|
// area. Approximate vertical travel = (large 96 - default 56) / 2.
|
|
133
141
|
titleTranslateY: scrollY.interpolate({
|
|
134
142
|
...clamp,
|
|
135
|
-
outputRange: [0,
|
|
143
|
+
outputRange: [0, collapseTranslateDistance]
|
|
136
144
|
}),
|
|
137
145
|
titleTranslateX: scrollY.interpolate({
|
|
138
146
|
...clamp,
|
|
@@ -153,7 +161,7 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
153
161
|
outputRange: [0, 1]
|
|
154
162
|
})
|
|
155
163
|
};
|
|
156
|
-
}, [scrollY, titleAlignment]);
|
|
164
|
+
}, [scrollY, titleAlignment, collapseTranslateDistance]);
|
|
157
165
|
const titleNode = title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.Text, {
|
|
158
166
|
style: [styles.title, {
|
|
159
167
|
fontSize: v.titleSize,
|
|
@@ -167,7 +175,7 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
167
175
|
}, {
|
|
168
176
|
scale: collapse.titleScale
|
|
169
177
|
}]
|
|
170
|
-
} : null],
|
|
178
|
+
} : null, titleStyle],
|
|
171
179
|
numberOfLines: 1,
|
|
172
180
|
children: title
|
|
173
181
|
}) : null;
|
|
@@ -176,7 +184,7 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
176
184
|
textAlign: titleAlignment === 'center' ? 'center' : 'left'
|
|
177
185
|
}, isCollapsing && collapse ? {
|
|
178
186
|
opacity: collapse.subtitleOpacity
|
|
179
|
-
} : null],
|
|
187
|
+
} : null, subtitleStyle],
|
|
180
188
|
numberOfLines: 1,
|
|
181
189
|
children: subtitle
|
|
182
190
|
}) : null;
|
|
@@ -207,7 +215,7 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
207
215
|
!isCollapsing ? {
|
|
208
216
|
borderBottomWidth: transparent ? 0 : _reactNative.StyleSheet.hairlineWidth,
|
|
209
217
|
borderBottomColor: theme.colors.border.primary
|
|
210
|
-
} : null, style],
|
|
218
|
+
} : null, style, containerStyle],
|
|
211
219
|
children: [isCollapsing && collapse && !transparent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
212
220
|
pointerEvents: "none",
|
|
213
221
|
style: [styles.animatedBorder, {
|
|
@@ -231,7 +239,8 @@ const AppBar = exports.AppBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
231
239
|
style: [styles.sideSlot, styles.sideSlotRight],
|
|
232
240
|
children: rightActions?.map((action, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionButton, {
|
|
233
241
|
action: action,
|
|
234
|
-
side: "right"
|
|
242
|
+
side: "right",
|
|
243
|
+
badgeStyle: badgeStyle
|
|
235
244
|
}, `appbar-right-${index}`))
|
|
236
245
|
})]
|
|
237
246
|
})]
|
|
@@ -254,7 +263,7 @@ const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
|
254
263
|
sideSlot: {
|
|
255
264
|
flexDirection: 'row',
|
|
256
265
|
alignItems: 'center',
|
|
257
|
-
minWidth: 48
|
|
266
|
+
minWidth: theme.components.appBar?.sideSlotMinWidth ?? 48
|
|
258
267
|
},
|
|
259
268
|
sideSlotRight: {
|
|
260
269
|
justifyContent: 'flex-end'
|
|
@@ -282,7 +291,7 @@ const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
|
282
291
|
color: theme.colors.text.primary
|
|
283
292
|
},
|
|
284
293
|
subtitle: {
|
|
285
|
-
marginTop: 2,
|
|
294
|
+
marginTop: theme.components.appBar?.subtitleMarginTop ?? 2,
|
|
286
295
|
color: theme.colors.text.tertiary,
|
|
287
296
|
fontSize: theme.typography.fontSize.sm,
|
|
288
297
|
fontWeight: theme.typography.fontWeight.normal
|
|
@@ -297,8 +306,8 @@ const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
|
297
306
|
});
|
|
298
307
|
const buildActionStyles = theme => _reactNative.StyleSheet.create({
|
|
299
308
|
actionButton: {
|
|
300
|
-
width: 40,
|
|
301
|
-
height: 40,
|
|
309
|
+
width: theme.components.appBar?.actionButtonSize ?? 40,
|
|
310
|
+
height: theme.components.appBar?.actionButtonSize ?? 40,
|
|
302
311
|
borderRadius: theme.radius.full,
|
|
303
312
|
alignItems: 'center',
|
|
304
313
|
justifyContent: 'center'
|
|
@@ -318,11 +327,11 @@ const buildActionStyles = theme => _reactNative.StyleSheet.create({
|
|
|
318
327
|
},
|
|
319
328
|
badge: {
|
|
320
329
|
position: 'absolute',
|
|
321
|
-
top: 4,
|
|
322
|
-
right: 4,
|
|
323
|
-
minWidth: 16,
|
|
324
|
-
height: 16,
|
|
325
|
-
paddingHorizontal: 4,
|
|
330
|
+
top: theme.components.appBar?.badgeOffset ?? 4,
|
|
331
|
+
right: theme.components.appBar?.badgeOffset ?? 4,
|
|
332
|
+
minWidth: theme.components.appBar?.badgeMinWidth ?? 16,
|
|
333
|
+
height: theme.components.appBar?.badgeHeight ?? 16,
|
|
334
|
+
paddingHorizontal: theme.components.appBar?.badgePaddingHorizontal ?? 4,
|
|
326
335
|
borderRadius: theme.radius.full,
|
|
327
336
|
backgroundColor: theme.colors.error,
|
|
328
337
|
alignItems: 'center',
|
|
@@ -330,9 +339,9 @@ const buildActionStyles = theme => _reactNative.StyleSheet.create({
|
|
|
330
339
|
},
|
|
331
340
|
badgeText: {
|
|
332
341
|
color: theme.colors.text.inverse,
|
|
333
|
-
fontSize: 10,
|
|
342
|
+
fontSize: theme.components.appBar?.badgeFontSize ?? 10,
|
|
334
343
|
fontWeight: theme.typography.fontWeight.semibold,
|
|
335
|
-
lineHeight: 12
|
|
344
|
+
lineHeight: theme.components.appBar?.badgeLineHeight ?? 12
|
|
336
345
|
}
|
|
337
346
|
});
|
|
338
347
|
var _default = exports.default = AppBar;
|
|
@@ -70,6 +70,7 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
70
70
|
statusPosition = 'bottomRight',
|
|
71
71
|
backgroundColor,
|
|
72
72
|
color,
|
|
73
|
+
fontSize: fontSizeProp,
|
|
73
74
|
loading = false,
|
|
74
75
|
accessibilityLabel,
|
|
75
76
|
style,
|
|
@@ -77,9 +78,14 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
77
78
|
testID
|
|
78
79
|
} = props;
|
|
79
80
|
const theme = (0, _index.useTheme)();
|
|
81
|
+
const avatarTokens = theme.components.avatar;
|
|
80
82
|
const [imageFailed, setImageFailed] = (0, _react.useState)(false);
|
|
81
83
|
const dimension = (0, _react.useMemo)(() => resolveSize(size), [size]);
|
|
82
84
|
const borderRadius = (0, _react.useMemo)(() => resolveRadius(shape, dimension), [shape, dimension]);
|
|
85
|
+
const borderWidth = avatarTokens?.borderWidth ?? 0;
|
|
86
|
+
const borderColor = avatarTokens?.borderColor ?? theme.colors.border.primary;
|
|
87
|
+
const statusBorder = avatarTokens?.statusBorderWidth ?? 2;
|
|
88
|
+
const statusBorderColor = avatarTokens?.statusBorderColor ?? theme.colors.background.elevated;
|
|
83
89
|
const initials = (0, _react.useMemo)(() => initialsFromName(name), [name]);
|
|
84
90
|
const resolvedBackground = (0, _react.useMemo)(() => {
|
|
85
91
|
if (backgroundColor) return backgroundColor;
|
|
@@ -87,9 +93,11 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
87
93
|
}, [backgroundColor, name]);
|
|
88
94
|
const resolvedTextColor = color ?? theme.colors.text.inverse;
|
|
89
95
|
const showImage = !!source && !imageFailed;
|
|
90
|
-
|
|
96
|
+
// Font size resolution: per-instance prop → absolute theme token → ratio
|
|
97
|
+
// token → library default (40% of avatar dimension, floored at 10px).
|
|
98
|
+
const fontSizeRatio = avatarTokens?.fontSizeRatio ?? 0.4;
|
|
99
|
+
const fontSize = fontSizeProp ?? avatarTokens?.fontSize ?? Math.max(10, Math.round(dimension * fontSizeRatio));
|
|
91
100
|
const statusSize = Math.max(8, Math.round(dimension * 0.25));
|
|
92
|
-
const statusBorder = 2;
|
|
93
101
|
const a11yLabel = accessibilityLabel ?? (name ? `${name}'s avatar` : 'Avatar');
|
|
94
102
|
const rendered = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
95
103
|
ref: ref,
|
|
@@ -97,6 +105,8 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
97
105
|
width: dimension,
|
|
98
106
|
height: dimension,
|
|
99
107
|
borderRadius,
|
|
108
|
+
borderWidth,
|
|
109
|
+
borderColor,
|
|
100
110
|
backgroundColor: showImage ? theme.colors.background.tertiary : resolvedBackground
|
|
101
111
|
}, style],
|
|
102
112
|
accessible: true,
|
|
@@ -117,7 +127,7 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
117
127
|
style: [styles.initials, {
|
|
118
128
|
color: resolvedTextColor,
|
|
119
129
|
fontSize,
|
|
120
|
-
fontWeight: theme.typography.fontWeight
|
|
130
|
+
fontWeight: theme.typography.fontWeight[avatarTokens?.fontWeight ?? 'semibold']
|
|
121
131
|
}, textStyle],
|
|
122
132
|
numberOfLines: 1,
|
|
123
133
|
allowFontScaling: false,
|
|
@@ -129,22 +139,42 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
129
139
|
borderRadius: statusSize / 2,
|
|
130
140
|
backgroundColor: statusColor(theme, status),
|
|
131
141
|
borderWidth: statusBorder,
|
|
132
|
-
borderColor:
|
|
142
|
+
borderColor: statusBorderColor
|
|
133
143
|
}],
|
|
134
144
|
accessible: false,
|
|
135
145
|
pointerEvents: "none"
|
|
136
146
|
}) : null]
|
|
137
147
|
});
|
|
138
148
|
if (loading) {
|
|
139
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
140
|
-
|
|
141
|
-
mode: "auto",
|
|
142
|
-
children: rendered
|
|
149
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AvatarSkeleton, {
|
|
150
|
+
...props
|
|
143
151
|
});
|
|
144
152
|
}
|
|
145
153
|
return rendered;
|
|
146
154
|
});
|
|
147
155
|
Avatar.displayName = 'Avatar';
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Authored placeholder for `<Avatar>`. Matches the real shape (circle /
|
|
159
|
+
* rounded / square at the requested size), so the layout doesn't shift
|
|
160
|
+
* when the image / name resolves.
|
|
161
|
+
*/
|
|
162
|
+
const AvatarSkeleton = ({
|
|
163
|
+
size = 'md',
|
|
164
|
+
shape = 'circle',
|
|
165
|
+
style
|
|
166
|
+
}) => {
|
|
167
|
+
const dim = resolveSize(size);
|
|
168
|
+
const skeletonShape = shape === 'circle' ? 'circle' : shape === 'rounded' ? 'rounded' : 'rect';
|
|
169
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
|
|
170
|
+
shape: skeletonShape,
|
|
171
|
+
width: dim,
|
|
172
|
+
height: dim,
|
|
173
|
+
style: style
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
AvatarSkeleton.displayName = 'AvatarSkeleton';
|
|
177
|
+
Avatar.Skeleton = AvatarSkeleton;
|
|
148
178
|
const styles = _reactNative.StyleSheet.create({
|
|
149
179
|
root: {
|
|
150
180
|
alignItems: 'center',
|
|
@@ -201,15 +201,77 @@ const Badge = exports.Badge = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
201
201
|
children: badgeContent
|
|
202
202
|
});
|
|
203
203
|
if (loading) {
|
|
204
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
205
|
-
|
|
206
|
-
mode: "auto",
|
|
207
|
-
children: rendered
|
|
204
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BadgeSkeleton, {
|
|
205
|
+
...props
|
|
208
206
|
});
|
|
209
207
|
}
|
|
210
208
|
return rendered;
|
|
211
209
|
});
|
|
212
210
|
Badge.displayName = 'Badge';
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Placeholder shape for `<Badge>`. Dot variant renders a small circle at
|
|
214
|
+
* the dot size; standard variant renders a pill shape at the badge's
|
|
215
|
+
* resolved height. Anchored badges (with `children`) overlay the badge
|
|
216
|
+
* shape on a wrapper that hosts the children below.
|
|
217
|
+
*/
|
|
218
|
+
const BadgeSkeleton = ({
|
|
219
|
+
variant = 'standard',
|
|
220
|
+
size = 'md',
|
|
221
|
+
children,
|
|
222
|
+
anchor,
|
|
223
|
+
style,
|
|
224
|
+
badgeStyle
|
|
225
|
+
}) => {
|
|
226
|
+
const sz = sizeMap[size];
|
|
227
|
+
if (variant === 'dot') {
|
|
228
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
|
|
229
|
+
shape: "circle",
|
|
230
|
+
width: sz.dot,
|
|
231
|
+
height: sz.dot,
|
|
232
|
+
style: [badgeStyle, style]
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
const pillRadius = sz.height / 2;
|
|
236
|
+
// Anchored badge: render the children underneath, overlay the badge.
|
|
237
|
+
if (children !== undefined) {
|
|
238
|
+
const offsetStyle = anchor === 'topLeft' ? {
|
|
239
|
+
top: -sz.height / 2,
|
|
240
|
+
left: -sz.height / 2
|
|
241
|
+
} : anchor === 'bottomRight' ? {
|
|
242
|
+
bottom: -sz.height / 2,
|
|
243
|
+
right: -sz.height / 2
|
|
244
|
+
} : anchor === 'bottomLeft' ? {
|
|
245
|
+
bottom: -sz.height / 2,
|
|
246
|
+
left: -sz.height / 2
|
|
247
|
+
} : {
|
|
248
|
+
top: -sz.height / 2,
|
|
249
|
+
right: -sz.height / 2
|
|
250
|
+
};
|
|
251
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
252
|
+
style: [styles.wrapper, style],
|
|
253
|
+
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
254
|
+
style: [{
|
|
255
|
+
position: 'absolute'
|
|
256
|
+
}, offsetStyle],
|
|
257
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
|
|
258
|
+
width: sz.minWidth + sz.paddingH,
|
|
259
|
+
height: sz.height,
|
|
260
|
+
radius: pillRadius,
|
|
261
|
+
style: badgeStyle
|
|
262
|
+
})
|
|
263
|
+
})]
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
|
|
267
|
+
width: sz.minWidth + sz.paddingH,
|
|
268
|
+
height: sz.height,
|
|
269
|
+
radius: pillRadius,
|
|
270
|
+
style: [badgeStyle, style]
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
BadgeSkeleton.displayName = 'BadgeSkeleton';
|
|
274
|
+
Badge.Skeleton = BadgeSkeleton;
|
|
213
275
|
const styles = _reactNative.StyleSheet.create({
|
|
214
276
|
wrapper: {
|
|
215
277
|
position: 'relative',
|