@webority-technologies/mobile 0.0.14 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Accordion/Accordion.js +60 -19
- package/lib/commonjs/components/AppBar/AppBar.js +29 -20
- package/lib/commonjs/components/Avatar/Avatar.js +38 -8
- package/lib/commonjs/components/Badge/Badge.js +66 -4
- package/lib/commonjs/components/Banner/Banner.js +146 -66
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +85 -50
- package/lib/commonjs/components/Button/Button.js +12 -5
- package/lib/commonjs/components/Card/Card.js +106 -16
- package/lib/commonjs/components/Carousel/Carousel.js +66 -12
- package/lib/commonjs/components/Checkbox/Checkbox.js +11 -7
- package/lib/commonjs/components/Chip/Chip.js +44 -12
- package/lib/commonjs/components/DatePicker/DatePicker.js +185 -76
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +133 -59
- package/lib/commonjs/components/Dialog/Dialog.js +16 -10
- package/lib/commonjs/components/Drawer/Drawer.js +13 -10
- package/lib/commonjs/components/FieldBase/FieldBase.js +306 -0
- package/lib/commonjs/components/FieldBase/index.js +32 -0
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/commonjs/components/FormField/FormField.js +3 -2
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +132 -44
- package/lib/commonjs/components/Input/Input.js +144 -181
- package/lib/commonjs/components/ListItem/ListItem.js +90 -11
- package/lib/commonjs/components/Modal/Modal.js +55 -27
- package/lib/commonjs/components/NumberInput/NumberInput.js +60 -106
- package/lib/commonjs/components/OTPInput/OTPInput.js +65 -58
- package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +185 -0
- package/lib/commonjs/components/{AppIcon → PickerTrigger}/index.js +4 -4
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/commonjs/components/Radio/Radio.js +11 -6
- package/lib/commonjs/components/Rating/Rating.js +85 -19
- package/lib/commonjs/components/SearchBar/SearchBar.js +84 -107
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/commonjs/components/Select/Select.js +62 -91
- package/lib/commonjs/components/Skeleton/Skeleton.js +131 -174
- package/lib/commonjs/components/Skeleton/SkeletonClock.js +117 -0
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +164 -81
- package/lib/commonjs/components/Skeleton/SkeletonProvider.js +72 -10
- package/lib/commonjs/components/Skeleton/index.js +17 -16
- package/lib/commonjs/components/Slider/Slider.js +44 -25
- package/lib/commonjs/components/Stepper/Stepper.js +199 -29
- package/lib/commonjs/components/Swipeable/Swipeable.js +36 -19
- package/lib/commonjs/components/Switch/Switch.js +9 -2
- package/lib/commonjs/components/Tabs/Tabs.js +84 -21
- package/lib/commonjs/components/TimePicker/TimePicker.js +123 -45
- package/lib/commonjs/components/Toast/Toast.js +27 -16
- package/lib/commonjs/components/Tooltip/Tooltip.js +56 -32
- package/lib/commonjs/components/index.js +37 -37
- package/lib/commonjs/theme/tokens.js +55 -7
- package/lib/module/components/Accordion/Accordion.js +61 -20
- package/lib/module/components/AppBar/AppBar.js +29 -20
- package/lib/module/components/Avatar/Avatar.js +39 -9
- package/lib/module/components/Badge/Badge.js +67 -5
- package/lib/module/components/Banner/Banner.js +147 -67
- package/lib/module/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/module/components/BottomSheet/BottomSheet.js +87 -52
- package/lib/module/components/Button/Button.js +12 -5
- package/lib/module/components/Card/Card.js +107 -17
- package/lib/module/components/Carousel/Carousel.js +67 -13
- package/lib/module/components/Checkbox/Checkbox.js +11 -7
- package/lib/module/components/Chip/Chip.js +45 -13
- package/lib/module/components/DatePicker/DatePicker.js +185 -76
- package/lib/module/components/DateRangePicker/DateRangePicker.js +134 -60
- package/lib/module/components/Dialog/Dialog.js +16 -10
- package/lib/module/components/Drawer/Drawer.js +13 -10
- package/lib/module/components/FieldBase/FieldBase.js +297 -0
- package/lib/module/components/FieldBase/index.js +4 -0
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/module/components/FormField/FormField.js +3 -2
- package/lib/module/components/ImageGallery/ImageGallery.js +128 -40
- package/lib/module/components/Input/Input.js +144 -179
- package/lib/module/components/ListItem/ListItem.js +91 -12
- package/lib/module/components/Modal/Modal.js +55 -27
- package/lib/module/components/NumberInput/NumberInput.js +60 -106
- package/lib/module/components/OTPInput/OTPInput.js +65 -58
- package/lib/module/components/PickerTrigger/PickerTrigger.js +181 -0
- package/lib/module/components/PickerTrigger/index.js +4 -0
- package/lib/module/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/module/components/Radio/Radio.js +11 -6
- package/lib/module/components/Rating/Rating.js +86 -20
- package/lib/module/components/SearchBar/SearchBar.js +84 -107
- package/lib/module/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/module/components/Select/Select.js +62 -91
- package/lib/module/components/Skeleton/Skeleton.js +135 -175
- package/lib/module/components/Skeleton/SkeletonClock.js +110 -0
- package/lib/module/components/Skeleton/SkeletonContent.js +167 -84
- package/lib/module/components/Skeleton/SkeletonProvider.js +71 -10
- package/lib/module/components/Skeleton/index.js +3 -2
- package/lib/module/components/Slider/Slider.js +44 -25
- package/lib/module/components/Stepper/Stepper.js +201 -31
- package/lib/module/components/Swipeable/Swipeable.js +36 -19
- package/lib/module/components/Switch/Switch.js +9 -2
- package/lib/module/components/Tabs/Tabs.js +84 -21
- package/lib/module/components/TimePicker/TimePicker.js +123 -45
- package/lib/module/components/Toast/Toast.js +27 -16
- package/lib/module/components/Tooltip/Tooltip.js +56 -32
- package/lib/module/components/index.js +2 -2
- package/lib/module/theme/tokens.js +55 -7
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/commonjs/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +17 -6
- package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/commonjs/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/commonjs/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/commonjs/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/commonjs/components/Input/Input.d.ts +6 -0
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/commonjs/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/commonjs/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/commonjs/components/index.d.ts +5 -5
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +553 -11
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/module/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/module/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/module/components/Card/Card.d.ts +17 -6
- package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/module/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/module/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/module/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/module/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/module/components/Input/Input.d.ts +6 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/module/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/module/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/module/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/module/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/module/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/module/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/module/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/module/components/index.d.ts +5 -5
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/theme/index.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +553 -11
- package/package.json +2 -6
- package/lib/commonjs/components/AppIcon/AppIcon.js +0 -120
- package/lib/commonjs/types/vector-icons.d.js +0 -2
- package/lib/module/components/AppIcon/AppIcon.js +0 -111
- package/lib/module/components/AppIcon/index.js +0 -4
- package/lib/module/types/vector-icons.d.js +0 -2
- package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/commonjs/components/AppIcon/index.d.ts +0 -3
- package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/module/components/AppIcon/index.d.ts +0 -3
|
@@ -230,41 +230,48 @@ const toneFor = (theme, tone) => {
|
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
+
// Every variant carries the SAME borderWidth (with a transparent colour on
|
|
234
|
+
// the non-outline ones). RN's layout treats border as part of the outer box,
|
|
235
|
+
// so a 1-px border on outline-only would make outline buttons 2 px wider /
|
|
236
|
+
// taller than solid / ghost buttons of identical content. Painting a
|
|
237
|
+
// transparent border on the others equalises the geometry without visible
|
|
238
|
+
// effect. Match the value with `BUTTON_BORDER_WIDTH` everywhere.
|
|
239
|
+
const BUTTON_BORDER_WIDTH = 1;
|
|
233
240
|
const variantFor = (theme, variant, toneSet, disabled) => {
|
|
234
241
|
switch (variant) {
|
|
235
242
|
case 'solid':
|
|
236
243
|
return {
|
|
237
244
|
backgroundColor: disabled ? theme.colors.surface.disabled : toneSet.base,
|
|
238
245
|
borderColor: 'transparent',
|
|
239
|
-
borderWidth:
|
|
246
|
+
borderWidth: BUTTON_BORDER_WIDTH,
|
|
240
247
|
textColor: disabled ? theme.colors.text.disabled : toneSet.on
|
|
241
248
|
};
|
|
242
249
|
case 'outline':
|
|
243
250
|
return {
|
|
244
251
|
backgroundColor: 'transparent',
|
|
245
252
|
borderColor: disabled ? theme.colors.border.primary : toneSet.base,
|
|
246
|
-
borderWidth:
|
|
253
|
+
borderWidth: BUTTON_BORDER_WIDTH,
|
|
247
254
|
textColor: disabled ? theme.colors.text.disabled : toneSet.base
|
|
248
255
|
};
|
|
249
256
|
case 'ghost':
|
|
250
257
|
return {
|
|
251
258
|
backgroundColor: 'transparent',
|
|
252
259
|
borderColor: 'transparent',
|
|
253
|
-
borderWidth:
|
|
260
|
+
borderWidth: BUTTON_BORDER_WIDTH,
|
|
254
261
|
textColor: disabled ? theme.colors.text.disabled : toneSet.base
|
|
255
262
|
};
|
|
256
263
|
case 'link':
|
|
257
264
|
return {
|
|
258
265
|
backgroundColor: 'transparent',
|
|
259
266
|
borderColor: 'transparent',
|
|
260
|
-
borderWidth:
|
|
267
|
+
borderWidth: BUTTON_BORDER_WIDTH,
|
|
261
268
|
textColor: disabled ? theme.colors.text.disabled : theme.colors.text.link
|
|
262
269
|
};
|
|
263
270
|
default:
|
|
264
271
|
return {
|
|
265
272
|
backgroundColor: toneSet.base,
|
|
266
273
|
borderColor: 'transparent',
|
|
267
|
-
borderWidth:
|
|
274
|
+
borderWidth: BUTTON_BORDER_WIDTH,
|
|
268
275
|
textColor: toneSet.on
|
|
269
276
|
};
|
|
270
277
|
}
|
|
@@ -5,7 +5,7 @@ import { Animated, Image, Pressable, StyleSheet, View } from 'react-native';
|
|
|
5
5
|
import { Gradient, useTheme } from "../../theme/index.js";
|
|
6
6
|
import { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
7
7
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { Skeleton, SkeletonText } from "../Skeleton/index.js";
|
|
9
9
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const paddingMap = {
|
|
11
11
|
none: 'none',
|
|
@@ -35,6 +35,11 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
35
35
|
accessibilityHint,
|
|
36
36
|
accessibilityRole,
|
|
37
37
|
style,
|
|
38
|
+
containerStyle,
|
|
39
|
+
headerStyle,
|
|
40
|
+
bodyStyle,
|
|
41
|
+
footerStyle,
|
|
42
|
+
borderRadius,
|
|
38
43
|
testID,
|
|
39
44
|
...rest
|
|
40
45
|
} = props;
|
|
@@ -55,9 +60,10 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
55
60
|
if (typeof gradient === 'string') return theme.gradients[gradient] ?? null;
|
|
56
61
|
return gradient;
|
|
57
62
|
}, [gradient, theme.gradients]);
|
|
58
|
-
const
|
|
63
|
+
const resolvedBorderRadius = borderRadius ?? theme.radius[radius];
|
|
64
|
+
const computedContainerStyle = useMemo(() => {
|
|
59
65
|
const base = {
|
|
60
|
-
borderRadius:
|
|
66
|
+
borderRadius: resolvedBorderRadius,
|
|
61
67
|
// When an image header is present we move padding to the inner content
|
|
62
68
|
// wrapper so the image can occupy the card's full top edge.
|
|
63
69
|
padding: hasImage ? 0 : contentPadding,
|
|
@@ -68,7 +74,7 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
68
74
|
return {
|
|
69
75
|
...base,
|
|
70
76
|
backgroundColor: theme.colors.background.elevated,
|
|
71
|
-
borderWidth:
|
|
77
|
+
borderWidth: theme.colors.border.width,
|
|
72
78
|
borderColor: theme.colors.border.primary
|
|
73
79
|
};
|
|
74
80
|
case 'filled':
|
|
@@ -84,9 +90,9 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
84
90
|
...theme.shadows[elevation]
|
|
85
91
|
};
|
|
86
92
|
}
|
|
87
|
-
}, [theme, variant, elevation,
|
|
93
|
+
}, [theme, variant, elevation, resolvedBorderRadius, padding, hasImage, contentPadding]);
|
|
88
94
|
const imageStyle = useMemo(() => {
|
|
89
|
-
const topRadius =
|
|
95
|
+
const topRadius = resolvedBorderRadius;
|
|
90
96
|
const dimensions = typeof imageAspectRatio === 'number' ? {
|
|
91
97
|
width: '100%',
|
|
92
98
|
aspectRatio: imageAspectRatio
|
|
@@ -101,16 +107,16 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
101
107
|
borderBottomLeftRadius: 0,
|
|
102
108
|
borderBottomRightRadius: 0
|
|
103
109
|
};
|
|
104
|
-
}, [
|
|
110
|
+
}, [resolvedBorderRadius, imageAspectRatio, imageHeight]);
|
|
105
111
|
const innerContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
106
112
|
children: [header ? /*#__PURE__*/_jsx(View, {
|
|
107
|
-
style: styles.header,
|
|
113
|
+
style: [styles.header, headerStyle],
|
|
108
114
|
children: header
|
|
109
115
|
}) : null, /*#__PURE__*/_jsx(View, {
|
|
110
|
-
style: header || footer ? styles.body : null,
|
|
116
|
+
style: [header || footer ? styles.body : null, bodyStyle],
|
|
111
117
|
children: children
|
|
112
118
|
}), footer ? /*#__PURE__*/_jsx(View, {
|
|
113
|
-
style: styles.footer,
|
|
119
|
+
style: [styles.footer, footerStyle],
|
|
114
120
|
children: footer
|
|
115
121
|
}) : null]
|
|
116
122
|
});
|
|
@@ -144,7 +150,9 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
144
150
|
let rendered;
|
|
145
151
|
if (isInteractive) {
|
|
146
152
|
const handlePress = event => {
|
|
147
|
-
|
|
153
|
+
if (theme.components.card?.pressHaptic ?? false) {
|
|
154
|
+
triggerHaptic('selection');
|
|
155
|
+
}
|
|
148
156
|
onPress?.(event);
|
|
149
157
|
};
|
|
150
158
|
rendered = /*#__PURE__*/_jsx(Animated.View, {
|
|
@@ -166,7 +174,7 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
166
174
|
accessibilityLabel: accessibilityLabel,
|
|
167
175
|
accessibilityHint: accessibilityHint,
|
|
168
176
|
testID: testID,
|
|
169
|
-
style: [
|
|
177
|
+
style: [computedContainerStyle, style, containerStyle],
|
|
170
178
|
...rest,
|
|
171
179
|
children: content
|
|
172
180
|
})
|
|
@@ -178,20 +186,102 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
178
186
|
accessibilityHint: accessibilityHint,
|
|
179
187
|
accessibilityRole: accessibilityRole,
|
|
180
188
|
testID: testID,
|
|
181
|
-
style: [
|
|
189
|
+
style: [computedContainerStyle, style, containerStyle],
|
|
182
190
|
children: content
|
|
183
191
|
});
|
|
184
192
|
}
|
|
185
193
|
if (loading) {
|
|
186
|
-
return /*#__PURE__*/_jsx(
|
|
187
|
-
|
|
188
|
-
mode: "auto",
|
|
189
|
-
children: rendered
|
|
194
|
+
return /*#__PURE__*/_jsx(CardSkeleton, {
|
|
195
|
+
...props
|
|
190
196
|
});
|
|
191
197
|
}
|
|
192
198
|
return rendered;
|
|
193
199
|
});
|
|
194
200
|
Card.displayName = 'Card';
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Placeholder shape for `<Card>`. Preserves outer chrome (variant, radius,
|
|
204
|
+
* padding, image area) and fills the interior with header / body / footer
|
|
205
|
+
* skeletons proportional to whichever slots the consumer actually uses.
|
|
206
|
+
*/
|
|
207
|
+
const CardSkeleton = ({
|
|
208
|
+
variant = 'elevated',
|
|
209
|
+
elevation: _elevation,
|
|
210
|
+
radius = 'lg',
|
|
211
|
+
padding = 'md',
|
|
212
|
+
header,
|
|
213
|
+
footer,
|
|
214
|
+
imageSource,
|
|
215
|
+
imageHeight = 160,
|
|
216
|
+
imageAspectRatio,
|
|
217
|
+
borderRadius,
|
|
218
|
+
containerStyle,
|
|
219
|
+
headerStyle,
|
|
220
|
+
bodyStyle,
|
|
221
|
+
footerStyle,
|
|
222
|
+
style
|
|
223
|
+
}) => {
|
|
224
|
+
const theme = useTheme();
|
|
225
|
+
const padToken = paddingMap[padding];
|
|
226
|
+
const padValue = theme.spacing[padToken];
|
|
227
|
+
const cornerRadius = borderRadius ?? theme.radius[radius];
|
|
228
|
+
const backgroundColor = variant === 'outlined' || variant === 'filled' ? theme.colors.background.elevated : theme.colors.background.elevated;
|
|
229
|
+
const borderWidth = variant === 'outlined' ? 1 : 0;
|
|
230
|
+
const borderColor = variant === 'outlined' ? theme.colors.border.primary : undefined;
|
|
231
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
232
|
+
style: [{
|
|
233
|
+
backgroundColor,
|
|
234
|
+
borderRadius: cornerRadius,
|
|
235
|
+
borderWidth,
|
|
236
|
+
borderColor,
|
|
237
|
+
overflow: 'hidden'
|
|
238
|
+
}, containerStyle, style],
|
|
239
|
+
accessibilityRole: "progressbar",
|
|
240
|
+
accessibilityState: {
|
|
241
|
+
busy: true
|
|
242
|
+
},
|
|
243
|
+
children: [imageSource !== undefined ? /*#__PURE__*/_jsx(Skeleton, {
|
|
244
|
+
width: "100%",
|
|
245
|
+
height: imageAspectRatio ? undefined : imageHeight,
|
|
246
|
+
style: imageAspectRatio ? {
|
|
247
|
+
aspectRatio: imageAspectRatio,
|
|
248
|
+
width: '100%'
|
|
249
|
+
} : undefined
|
|
250
|
+
}) : null, header !== undefined ? /*#__PURE__*/_jsx(View, {
|
|
251
|
+
style: [{
|
|
252
|
+
padding: padValue,
|
|
253
|
+
paddingBottom: theme.spacing.sm
|
|
254
|
+
}, headerStyle],
|
|
255
|
+
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
256
|
+
shape: "text",
|
|
257
|
+
width: "60%",
|
|
258
|
+
height: 18
|
|
259
|
+
})
|
|
260
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
261
|
+
style: [{
|
|
262
|
+
padding: padValue
|
|
263
|
+
}, bodyStyle],
|
|
264
|
+
children: /*#__PURE__*/_jsx(SkeletonText, {
|
|
265
|
+
lines: 3,
|
|
266
|
+
fontSize: 14,
|
|
267
|
+
lastLineWidth: "55%"
|
|
268
|
+
})
|
|
269
|
+
}), footer !== undefined ? /*#__PURE__*/_jsx(View, {
|
|
270
|
+
style: [{
|
|
271
|
+
padding: padValue,
|
|
272
|
+
paddingTop: theme.spacing.sm,
|
|
273
|
+
flexDirection: 'row'
|
|
274
|
+
}, footerStyle],
|
|
275
|
+
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
276
|
+
width: 88,
|
|
277
|
+
height: 32,
|
|
278
|
+
shape: "rounded"
|
|
279
|
+
})
|
|
280
|
+
}) : null]
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
CardSkeleton.displayName = 'CardSkeleton';
|
|
284
|
+
Card.Skeleton = CardSkeleton;
|
|
195
285
|
const buildStyles = theme => StyleSheet.create({
|
|
196
286
|
header: {
|
|
197
287
|
marginBottom: theme.spacing.md
|
|
@@ -26,7 +26,7 @@ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo
|
|
|
26
26
|
import { Animated, Dimensions, FlatList, Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
27
27
|
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
28
28
|
import { triggerHaptic } from "../../utils/index.js";
|
|
29
|
-
import {
|
|
29
|
+
import { Skeleton } from "../Skeleton/index.js";
|
|
30
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
31
|
// We intentionally use a generic forwardRef wrapper — the inner component is
|
|
32
32
|
// untyped at the generic level (forwardRef can't preserve generics in TS yet),
|
|
@@ -213,18 +213,9 @@ const CarouselInner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
213
213
|
index: i
|
|
214
214
|
}), [slideStride]);
|
|
215
215
|
if (loading) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
mode: "auto",
|
|
220
|
-
style: [styles.container, containerStyle],
|
|
221
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
222
|
-
style: {
|
|
223
|
-
width: slideWidth,
|
|
224
|
-
height: 160,
|
|
225
|
-
borderRadius: 12
|
|
226
|
-
}
|
|
227
|
-
})
|
|
216
|
+
return /*#__PURE__*/_jsx(CarouselSkeleton, {
|
|
217
|
+
...props,
|
|
218
|
+
containerWidth: containerWidth
|
|
228
219
|
});
|
|
229
220
|
}
|
|
230
221
|
return /*#__PURE__*/_jsxs(View, {
|
|
@@ -285,8 +276,71 @@ const CarouselInner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
285
276
|
});
|
|
286
277
|
CarouselInner.displayName = 'Carousel';
|
|
287
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Placeholder shape for `<Carousel>`. Renders one full-width slide skeleton
|
|
281
|
+
* plus pagination dots underneath, so the visual footprint matches the
|
|
282
|
+
* loaded state. `containerWidth` is forwarded from the live component when
|
|
283
|
+
* known; otherwise falls back to a 320 default.
|
|
284
|
+
*/
|
|
285
|
+
const CarouselSkeleton = ({
|
|
286
|
+
itemWidth = 'screen',
|
|
287
|
+
showPagination = true,
|
|
288
|
+
paginationStyle = 'dots',
|
|
289
|
+
containerStyle,
|
|
290
|
+
containerWidth
|
|
291
|
+
}) => {
|
|
292
|
+
const slideWidth = itemWidth === 'screen' ? containerWidth || 320 : itemWidth;
|
|
293
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
294
|
+
style: [carouselSkeletonStyles.container, containerStyle],
|
|
295
|
+
children: [/*#__PURE__*/_jsx(Skeleton, {
|
|
296
|
+
width: slideWidth,
|
|
297
|
+
height: 160,
|
|
298
|
+
radius: "md"
|
|
299
|
+
}), showPagination ? /*#__PURE__*/_jsx(View, {
|
|
300
|
+
style: [carouselSkeletonStyles.paginationRow, {
|
|
301
|
+
marginTop: 12
|
|
302
|
+
}],
|
|
303
|
+
children: Array.from({
|
|
304
|
+
length: 3
|
|
305
|
+
}).map((_, i) => paginationStyle === 'numbers' ? /*#__PURE__*/_jsx(Skeleton, {
|
|
306
|
+
width: 24,
|
|
307
|
+
height: 16,
|
|
308
|
+
radius: "sm",
|
|
309
|
+
style: {
|
|
310
|
+
marginHorizontal: 4
|
|
311
|
+
}
|
|
312
|
+
}, `sk-pg-${i}`) : paginationStyle === 'bars' ? /*#__PURE__*/_jsx(Skeleton, {
|
|
313
|
+
width: 20,
|
|
314
|
+
height: 4,
|
|
315
|
+
radius: 2,
|
|
316
|
+
style: {
|
|
317
|
+
marginHorizontal: 3
|
|
318
|
+
}
|
|
319
|
+
}, `sk-pg-${i}`) : /*#__PURE__*/_jsx(Skeleton, {
|
|
320
|
+
shape: "circle",
|
|
321
|
+
width: 8,
|
|
322
|
+
height: 8,
|
|
323
|
+
style: {
|
|
324
|
+
marginHorizontal: 4
|
|
325
|
+
}
|
|
326
|
+
}, `sk-pg-${i}`))
|
|
327
|
+
}) : null]
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
CarouselSkeleton.displayName = 'CarouselSkeleton';
|
|
331
|
+
const carouselSkeletonStyles = StyleSheet.create({
|
|
332
|
+
container: {
|
|
333
|
+
alignItems: 'center'
|
|
334
|
+
},
|
|
335
|
+
paginationRow: {
|
|
336
|
+
flexDirection: 'row',
|
|
337
|
+
justifyContent: 'center'
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
288
341
|
// Public typed factory — preserves the generic signature.
|
|
289
342
|
const Carousel = CarouselInner;
|
|
343
|
+
Carousel.Skeleton = CarouselSkeleton;
|
|
290
344
|
|
|
291
345
|
// ───────── Pagination ─────────
|
|
292
346
|
|
|
@@ -36,13 +36,17 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
36
36
|
haptic = 'selection',
|
|
37
37
|
style,
|
|
38
38
|
boxStyle,
|
|
39
|
+
checkIconStyle,
|
|
40
|
+
indeterminateBarStyle,
|
|
41
|
+
containerStyle,
|
|
42
|
+
labelStyle,
|
|
39
43
|
testID,
|
|
40
44
|
...rest
|
|
41
45
|
} = props;
|
|
42
46
|
const theme = useTheme();
|
|
43
47
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
44
48
|
const boxSize = theme.components.checkbox?.[size]?.boxSize ?? sizeMap[size];
|
|
45
|
-
const checkboxBorderWidth = theme.
|
|
49
|
+
const checkboxBorderWidth = theme.colors.border.width;
|
|
46
50
|
const checkboxLabelGap = theme.components.checkbox?.labelGap ?? 10;
|
|
47
51
|
const fillColor = toneColor(theme, tone);
|
|
48
52
|
const isActive = checked || indeterminate;
|
|
@@ -62,7 +66,7 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
62
66
|
});
|
|
63
67
|
const handlePress = event => {
|
|
64
68
|
if (disabled) return;
|
|
65
|
-
if (haptic !== false) triggerHaptic(haptic);
|
|
69
|
+
if (haptic !== false && theme.components.checkbox?.pressHaptic) triggerHaptic(haptic);
|
|
66
70
|
onChange(!checked);
|
|
67
71
|
rest.onPressOut?.(event);
|
|
68
72
|
};
|
|
@@ -90,7 +94,7 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
90
94
|
pressed
|
|
91
95
|
}) => [styles.row, {
|
|
92
96
|
opacity: disabled ? 0.55 : pressed ? 0.85 : 1
|
|
93
|
-
}, style],
|
|
97
|
+
}, containerStyle, style],
|
|
94
98
|
children: [/*#__PURE__*/_jsx(View, {
|
|
95
99
|
style: [styles.box, {
|
|
96
100
|
width: boxSize,
|
|
@@ -108,18 +112,18 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
108
112
|
}]
|
|
109
113
|
}],
|
|
110
114
|
children: indeterminate ? /*#__PURE__*/_jsx(View, {
|
|
111
|
-
style: {
|
|
115
|
+
style: [{
|
|
112
116
|
width: indeterminateBarWidth,
|
|
113
117
|
height: indeterminateBarHeight,
|
|
114
118
|
borderRadius: indeterminateBarHeight / 2,
|
|
115
119
|
backgroundColor: glyphColor
|
|
116
|
-
}
|
|
120
|
+
}, indeterminateBarStyle]
|
|
117
121
|
}) : /*#__PURE__*/_jsx(Text, {
|
|
118
122
|
style: [styles.check, {
|
|
119
123
|
color: glyphColor,
|
|
120
124
|
fontSize: glyphFontSize,
|
|
121
125
|
lineHeight: glyphFontSize + 2
|
|
122
|
-
}],
|
|
126
|
+
}, checkIconStyle],
|
|
123
127
|
allowFontScaling: false,
|
|
124
128
|
children: '✓'
|
|
125
129
|
})
|
|
@@ -129,7 +133,7 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
129
133
|
marginLeft: checkboxLabelGap,
|
|
130
134
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary,
|
|
131
135
|
fontSize: theme.typography.fontSize.base
|
|
132
|
-
}],
|
|
136
|
+
}, labelStyle],
|
|
133
137
|
numberOfLines: 2,
|
|
134
138
|
children: label
|
|
135
139
|
}) : null]
|
|
@@ -5,7 +5,7 @@ import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
|
5
5
|
import { fontFor, useTheme } from "../../theme/index.js";
|
|
6
6
|
import { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
7
7
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { Skeleton } from "../Skeleton/index.js";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const toneFor = (theme, tone) => {
|
|
11
11
|
switch (tone) {
|
|
@@ -101,6 +101,9 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
101
101
|
accessibilityLabel,
|
|
102
102
|
style,
|
|
103
103
|
textStyle,
|
|
104
|
+
containerStyle,
|
|
105
|
+
closeButtonStyle,
|
|
106
|
+
closeIconStyle,
|
|
104
107
|
testID
|
|
105
108
|
} = props;
|
|
106
109
|
const theme = useTheme();
|
|
@@ -139,15 +142,15 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
139
142
|
if (selected) return tones.selectedOn;
|
|
140
143
|
return tones.on;
|
|
141
144
|
})();
|
|
142
|
-
const borderWidth = isFilled ?
|
|
145
|
+
const borderWidth = isFilled ? 0 : theme.colors.border.width;
|
|
143
146
|
const handlePress = () => {
|
|
144
147
|
if (!isPressable) return;
|
|
145
|
-
triggerHaptic('selection');
|
|
148
|
+
if (theme.components.chip?.pressHaptic) triggerHaptic('selection');
|
|
146
149
|
onPress?.();
|
|
147
150
|
};
|
|
148
151
|
const handleClose = () => {
|
|
149
152
|
if (disabled) return;
|
|
150
|
-
triggerHaptic('impactLight');
|
|
153
|
+
if (theme.components.chip?.closeHaptic) triggerHaptic('impactLight');
|
|
151
154
|
onClose?.();
|
|
152
155
|
};
|
|
153
156
|
const a11yLabel = accessibilityLabel ?? label;
|
|
@@ -183,14 +186,14 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
183
186
|
borderRadius: sz.closeSize / 2,
|
|
184
187
|
marginLeft: sz.gap,
|
|
185
188
|
backgroundColor: pressed ? theme.colors.surface.pressed : theme.colors.surface.hovered
|
|
186
|
-
}],
|
|
189
|
+
}, closeButtonStyle],
|
|
187
190
|
children: /*#__PURE__*/_jsx(Text, {
|
|
188
|
-
style: {
|
|
191
|
+
style: [{
|
|
189
192
|
color: textColor,
|
|
190
193
|
fontSize: sz.closeFont,
|
|
191
194
|
...fontFor(theme, 'bold'),
|
|
192
195
|
lineHeight: sz.closeFont + 2
|
|
193
|
-
},
|
|
196
|
+
}, closeIconStyle],
|
|
194
197
|
allowFontScaling: false,
|
|
195
198
|
children: '×'
|
|
196
199
|
})
|
|
@@ -236,14 +239,14 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
236
239
|
pressed
|
|
237
240
|
}) => [styles.base, baseStyle, pressed && !isFilled ? {
|
|
238
241
|
backgroundColor: theme.colors.surface.pressed
|
|
239
|
-
} : null, style],
|
|
242
|
+
} : null, containerStyle, style],
|
|
240
243
|
children: content
|
|
241
244
|
})
|
|
242
245
|
});
|
|
243
246
|
} else {
|
|
244
247
|
rendered = /*#__PURE__*/_jsx(View, {
|
|
245
248
|
ref: ref,
|
|
246
|
-
style: [styles.base, baseStyle, style],
|
|
249
|
+
style: [styles.base, baseStyle, containerStyle, style],
|
|
247
250
|
accessible: true,
|
|
248
251
|
accessibilityRole: "text",
|
|
249
252
|
accessibilityLabel: a11yLabel,
|
|
@@ -256,15 +259,44 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
256
259
|
});
|
|
257
260
|
}
|
|
258
261
|
if (loading) {
|
|
259
|
-
return /*#__PURE__*/_jsx(
|
|
260
|
-
|
|
261
|
-
mode: "auto",
|
|
262
|
-
children: rendered
|
|
262
|
+
return /*#__PURE__*/_jsx(ChipSkeleton, {
|
|
263
|
+
...props
|
|
263
264
|
});
|
|
264
265
|
}
|
|
265
266
|
return rendered;
|
|
266
267
|
});
|
|
267
268
|
Chip.displayName = 'Chip';
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Placeholder shape for `<Chip>`. Pill of the configured size with a label
|
|
272
|
+
* skeleton inside; leading icon and close button are reserved when the
|
|
273
|
+
* consumer would normally provide them, so the chip width matches what it
|
|
274
|
+
* would be when loaded.
|
|
275
|
+
*/
|
|
276
|
+
const ChipSkeleton = ({
|
|
277
|
+
label,
|
|
278
|
+
size = 'md',
|
|
279
|
+
leftIcon,
|
|
280
|
+
onClose,
|
|
281
|
+
style,
|
|
282
|
+
containerStyle
|
|
283
|
+
}) => {
|
|
284
|
+
const sz = sizeMap[size];
|
|
285
|
+
const labelWidth = Math.max(40, Math.min(120, (label ?? '').length * 7));
|
|
286
|
+
const pillHeight = sz.minHeight;
|
|
287
|
+
const pillRadius = pillHeight / 2;
|
|
288
|
+
const totalWidth = labelWidth + sz.paddingH * 2 + (leftIcon !== undefined ? sz.gap + 14 : 0) + (onClose !== undefined ? sz.gap + sz.closeSize : 0);
|
|
289
|
+
return /*#__PURE__*/_jsx(Skeleton, {
|
|
290
|
+
width: totalWidth,
|
|
291
|
+
height: pillHeight,
|
|
292
|
+
radius: pillRadius,
|
|
293
|
+
style: [{
|
|
294
|
+
alignSelf: 'flex-start'
|
|
295
|
+
}, containerStyle, style]
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
ChipSkeleton.displayName = 'ChipSkeleton';
|
|
299
|
+
Chip.Skeleton = ChipSkeleton;
|
|
268
300
|
const styles = StyleSheet.create({
|
|
269
301
|
base: {
|
|
270
302
|
alignSelf: 'flex-start',
|