@webority-technologies/mobile 0.0.6 → 0.0.8
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/README.md +3 -463
- package/lib/commonjs/components/Badge/Badge.js +23 -13
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +39 -5
- package/lib/commonjs/components/Button/Button.js +25 -6
- package/lib/commonjs/components/Card/Card.js +13 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js +5 -3
- package/lib/commonjs/components/Chip/Chip.js +12 -3
- package/lib/commonjs/components/Dialog/Dialog.js +15 -8
- package/lib/commonjs/components/EmptyState/EmptyState.js +32 -26
- package/lib/commonjs/components/FormField/FormField.js +3 -3
- package/lib/commonjs/components/Input/Input.js +13 -5
- package/lib/commonjs/components/ListItem/ListItem.js +33 -27
- package/lib/commonjs/components/OTPInput/OTPInput.js +6 -3
- package/lib/commonjs/components/Radio/Radio.js +7 -6
- package/lib/commonjs/components/SearchBar/SearchBar.js +9 -5
- package/lib/commonjs/components/Skeleton/Skeleton.js +20 -12
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +25 -9
- package/lib/commonjs/components/Skeleton/SkeletonList.js +7 -2
- package/lib/commonjs/components/Skeleton/SkeletonProvider.js +48 -0
- package/lib/commonjs/components/Skeleton/SkeletonSkip.js +37 -0
- package/lib/commonjs/components/Skeleton/index.js +20 -0
- package/lib/commonjs/components/Switch/Switch.js +31 -2
- package/lib/commonjs/components/Toast/Toast.js +16 -11
- package/lib/commonjs/components/index.js +18 -0
- package/lib/commonjs/theme/Gradient.js +57 -0
- package/lib/commonjs/theme/index.js +20 -0
- package/lib/commonjs/theme/textStyle.js +37 -0
- package/lib/commonjs/theme/tokens.js +260 -2
- package/lib/module/components/Badge/Badge.js +24 -14
- package/lib/module/components/BottomSheet/BottomSheet.js +40 -6
- package/lib/module/components/Button/Button.js +26 -7
- package/lib/module/components/Card/Card.js +14 -2
- package/lib/module/components/Checkbox/Checkbox.js +5 -3
- package/lib/module/components/Chip/Chip.js +13 -4
- package/lib/module/components/Dialog/Dialog.js +16 -9
- package/lib/module/components/EmptyState/EmptyState.js +33 -27
- package/lib/module/components/FormField/FormField.js +4 -4
- package/lib/module/components/Input/Input.js +14 -6
- package/lib/module/components/ListItem/ListItem.js +34 -28
- package/lib/module/components/OTPInput/OTPInput.js +7 -4
- package/lib/module/components/Radio/Radio.js +7 -6
- package/lib/module/components/SearchBar/SearchBar.js +10 -6
- package/lib/module/components/Skeleton/Skeleton.js +20 -12
- package/lib/module/components/Skeleton/SkeletonContent.js +25 -9
- package/lib/module/components/Skeleton/SkeletonList.js +7 -2
- package/lib/module/components/Skeleton/SkeletonProvider.js +41 -0
- package/lib/module/components/Skeleton/SkeletonSkip.js +31 -0
- package/lib/module/components/Skeleton/index.js +2 -0
- package/lib/module/components/Switch/Switch.js +31 -2
- package/lib/module/components/Toast/Toast.js +17 -12
- package/lib/module/components/index.js +1 -1
- package/lib/module/theme/Gradient.js +50 -0
- package/lib/module/theme/index.js +2 -0
- package/lib/module/theme/textStyle.js +32 -0
- package/lib/module/theme/tokens.js +260 -2
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +10 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +8 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +8 -0
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +5 -0
- package/lib/typescript/commonjs/components/Input/Input.d.ts +12 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +9 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +6 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonList.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +32 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonSkip.d.ts +25 -0
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +5 -0
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +5 -0
- package/lib/typescript/commonjs/components/index.d.ts +2 -2
- package/lib/typescript/commonjs/theme/Gradient.d.ts +11 -0
- package/lib/typescript/commonjs/theme/index.d.ts +5 -1
- package/lib/typescript/commonjs/theme/textStyle.d.ts +18 -0
- package/lib/typescript/commonjs/theme/types.d.ts +178 -0
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +10 -0
- package/lib/typescript/module/components/Button/Button.d.ts +8 -0
- package/lib/typescript/module/components/Card/Card.d.ts +8 -0
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +5 -0
- package/lib/typescript/module/components/Input/Input.d.ts +12 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +9 -0
- package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +6 -0
- package/lib/typescript/module/components/Skeleton/SkeletonList.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +32 -0
- package/lib/typescript/module/components/Skeleton/SkeletonSkip.d.ts +25 -0
- package/lib/typescript/module/components/Skeleton/index.d.ts +4 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +5 -0
- package/lib/typescript/module/components/Toast/Toast.d.ts +5 -0
- package/lib/typescript/module/components/index.d.ts +2 -2
- package/lib/typescript/module/theme/Gradient.d.ts +11 -0
- package/lib/typescript/module/theme/index.d.ts +5 -1
- package/lib/typescript/module/theme/textStyle.d.ts +18 -0
- package/lib/typescript/module/theme/types.d.ts +178 -0
- package/package.json +5 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo } from 'react';
|
|
4
4
|
import { ActivityIndicator, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
5
|
+
import { fontFor, useTheme } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
7
|
import { Modal } from "../Modal/Modal.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -17,11 +17,17 @@ const Dialog = props => {
|
|
|
17
17
|
actions,
|
|
18
18
|
dismissOnAction = true,
|
|
19
19
|
accessibilityLabel,
|
|
20
|
+
contentStyle,
|
|
21
|
+
containerStyle,
|
|
20
22
|
testID
|
|
21
23
|
} = props;
|
|
22
24
|
const theme = useTheme();
|
|
23
25
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
24
26
|
const variantTint = useMemo(() => tintForVariant(theme, variant), [theme, variant]);
|
|
27
|
+
const dialogTokens = theme.components.dialog;
|
|
28
|
+
const iconWrapperSize = dialogTokens?.iconWrapperSize ?? 48;
|
|
29
|
+
const iconWrapperBorderRadius = dialogTokens?.iconWrapperBorderRadius ?? 24;
|
|
30
|
+
const actionButtonMinHeight = dialogTokens?.actionButtonMinHeight ?? 44;
|
|
25
31
|
const handleAction = useCallback(action => {
|
|
26
32
|
if (action.loading) return;
|
|
27
33
|
triggerHaptic('selection');
|
|
@@ -35,13 +41,17 @@ const Dialog = props => {
|
|
|
35
41
|
onRequestClose: onClose,
|
|
36
42
|
presentation: "centered",
|
|
37
43
|
accessibilityLabel: accessibilityLabel ?? title,
|
|
44
|
+
contentStyle: contentStyle,
|
|
38
45
|
testID: testID,
|
|
39
46
|
children: /*#__PURE__*/_jsxs(View, {
|
|
40
47
|
accessibilityRole: 'alertdialog',
|
|
41
48
|
accessibilityLabel: accessibilityLabel ?? title,
|
|
42
|
-
style: styles.container,
|
|
49
|
+
style: [styles.container, containerStyle],
|
|
43
50
|
children: [icon ? /*#__PURE__*/_jsx(View, {
|
|
44
51
|
style: [styles.iconWrapper, {
|
|
52
|
+
width: iconWrapperSize,
|
|
53
|
+
height: iconWrapperSize,
|
|
54
|
+
borderRadius: iconWrapperBorderRadius,
|
|
45
55
|
backgroundColor: variantTint.muted,
|
|
46
56
|
marginBottom: theme.spacing.md
|
|
47
57
|
}],
|
|
@@ -50,7 +60,7 @@ const Dialog = props => {
|
|
|
50
60
|
style: [styles.title, {
|
|
51
61
|
color: theme.colors.text.primary,
|
|
52
62
|
fontSize: theme.typography.fontSize.xl,
|
|
53
|
-
|
|
63
|
+
...fontFor(theme, 'semibold'),
|
|
54
64
|
marginBottom: message ? theme.spacing.sm : theme.spacing.md
|
|
55
65
|
}],
|
|
56
66
|
accessibilityRole: "header",
|
|
@@ -86,6 +96,7 @@ const Dialog = props => {
|
|
|
86
96
|
style: ({
|
|
87
97
|
pressed
|
|
88
98
|
}) => [styles.actionButton, {
|
|
99
|
+
minHeight: actionButtonMinHeight,
|
|
89
100
|
backgroundColor: buttonStyle.backgroundColor,
|
|
90
101
|
borderColor: buttonStyle.borderColor,
|
|
91
102
|
borderWidth: buttonStyle.borderWidth,
|
|
@@ -102,7 +113,7 @@ const Dialog = props => {
|
|
|
102
113
|
style: {
|
|
103
114
|
color: buttonStyle.textColor,
|
|
104
115
|
fontSize: theme.typography.fontSize.base,
|
|
105
|
-
|
|
116
|
+
...fontFor(theme, 'semibold'),
|
|
106
117
|
textAlign: 'center'
|
|
107
118
|
},
|
|
108
119
|
numberOfLines: 1,
|
|
@@ -180,9 +191,6 @@ const buildStyles = _theme => StyleSheet.create({
|
|
|
180
191
|
alignItems: 'stretch'
|
|
181
192
|
},
|
|
182
193
|
iconWrapper: {
|
|
183
|
-
width: 48,
|
|
184
|
-
height: 48,
|
|
185
|
-
borderRadius: 24,
|
|
186
194
|
alignItems: 'center',
|
|
187
195
|
justifyContent: 'center',
|
|
188
196
|
alignSelf: 'center'
|
|
@@ -201,8 +209,7 @@ const buildStyles = _theme => StyleSheet.create({
|
|
|
201
209
|
actionButton: {
|
|
202
210
|
flex: 1,
|
|
203
211
|
alignItems: 'center',
|
|
204
|
-
justifyContent: 'center'
|
|
205
|
-
minHeight: 44
|
|
212
|
+
justifyContent: 'center'
|
|
206
213
|
}
|
|
207
214
|
});
|
|
208
215
|
export { Dialog };
|
|
@@ -2,36 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useMemo } from 'react';
|
|
4
4
|
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
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
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
iconSize: 64,
|
|
29
|
-
titleSize: theme.typography.fontSize.xl,
|
|
30
|
-
descriptionSize: theme.typography.fontSize.base,
|
|
31
|
-
paddingVertical: theme.spacing.xl
|
|
32
|
-
};
|
|
9
|
+
const SIZE_FALLBACK = {
|
|
10
|
+
sm: {
|
|
11
|
+
iconSize: 48,
|
|
12
|
+
titleFontSize: 'lg',
|
|
13
|
+
descriptionFontSize: 'sm',
|
|
14
|
+
paddingVertical: 'lg'
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
iconSize: 64,
|
|
18
|
+
titleFontSize: 'xl',
|
|
19
|
+
descriptionFontSize: 'base',
|
|
20
|
+
paddingVertical: 'xl'
|
|
21
|
+
},
|
|
22
|
+
lg: {
|
|
23
|
+
iconSize: 80,
|
|
24
|
+
titleFontSize: '2xl',
|
|
25
|
+
descriptionFontSize: 'base',
|
|
26
|
+
paddingVertical: '2xl'
|
|
33
27
|
}
|
|
34
28
|
};
|
|
29
|
+
const sizeFor = (theme, size) => {
|
|
30
|
+
const tokens = {
|
|
31
|
+
...SIZE_FALLBACK[size],
|
|
32
|
+
...(theme.components.emptyState?.[size] ?? {})
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
iconSize: tokens.iconSize,
|
|
36
|
+
titleSize: theme.typography.fontSize[tokens.titleFontSize],
|
|
37
|
+
descriptionSize: theme.typography.fontSize[tokens.descriptionFontSize],
|
|
38
|
+
paddingVertical: theme.spacing[tokens.paddingVertical]
|
|
39
|
+
};
|
|
40
|
+
};
|
|
35
41
|
const ActionButton = ({
|
|
36
42
|
action,
|
|
37
43
|
variant
|
|
@@ -110,7 +116,7 @@ const EmptyState = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
110
116
|
}) : null, /*#__PURE__*/_jsx(Text, {
|
|
111
117
|
style: [styles.title, {
|
|
112
118
|
fontSize: sz.titleSize,
|
|
113
|
-
|
|
119
|
+
...fontFor(theme, 'semibold')
|
|
114
120
|
}],
|
|
115
121
|
children: title
|
|
116
122
|
}), description ? /*#__PURE__*/_jsx(Text, {
|
|
@@ -183,7 +189,7 @@ const buildActionStyles = theme => StyleSheet.create({
|
|
|
183
189
|
},
|
|
184
190
|
buttonText: {
|
|
185
191
|
fontSize: theme.typography.fontSize.base,
|
|
186
|
-
|
|
192
|
+
...fontFor(theme, 'semibold')
|
|
187
193
|
},
|
|
188
194
|
buttonTextPrimary: {
|
|
189
195
|
color: theme.colors.text.inverse
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
5
|
+
import { fontFor, useTheme } from "../../theme/index.js";
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
7
|
const FormField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
@@ -92,15 +92,15 @@ const buildStyles = theme => StyleSheet.create({
|
|
|
92
92
|
},
|
|
93
93
|
label: {
|
|
94
94
|
fontSize: theme.typography.fontSize.sm,
|
|
95
|
-
|
|
95
|
+
...fontFor(theme, 'medium'),
|
|
96
96
|
color: theme.colors.text.secondary
|
|
97
97
|
},
|
|
98
98
|
labelInline: {
|
|
99
|
-
width: '35%'
|
|
99
|
+
width: theme.components.formField?.inlineLabelWidth ?? '35%'
|
|
100
100
|
},
|
|
101
101
|
requiredMark: {
|
|
102
102
|
color: theme.colors.error,
|
|
103
|
-
|
|
103
|
+
...fontFor(theme, 'medium')
|
|
104
104
|
},
|
|
105
105
|
inputStacked: {
|
|
106
106
|
width: '100%'
|
|
@@ -5,7 +5,7 @@ import { Animated, Easing, Pressable, StyleSheet, Text, TextInput, View } from '
|
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
6
|
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
7
7
|
import Feather from 'react-native-vector-icons/Feather';
|
|
8
|
-
import { useTheme } from "../../theme/index.js";
|
|
8
|
+
import { fontFor, useTheme } from "../../theme/index.js";
|
|
9
9
|
import { triggerHaptic } from "../../utils/index.js";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
const sizeMap = {
|
|
@@ -55,6 +55,8 @@ const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
55
55
|
variant = 'outlined',
|
|
56
56
|
required = false,
|
|
57
57
|
maxLength,
|
|
58
|
+
format,
|
|
59
|
+
parse,
|
|
58
60
|
style,
|
|
59
61
|
inputStyle,
|
|
60
62
|
labelStyle,
|
|
@@ -67,7 +69,10 @@ const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
67
69
|
} = props;
|
|
68
70
|
const theme = useTheme();
|
|
69
71
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
70
|
-
const sizeStyles =
|
|
72
|
+
const sizeStyles = {
|
|
73
|
+
...sizeMap[size],
|
|
74
|
+
...(theme.components.input?.[size] ?? {})
|
|
75
|
+
};
|
|
71
76
|
const [isFocused, setIsFocused] = useState(false);
|
|
72
77
|
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
73
78
|
const hasValue = typeof value === 'string' && value.length > 0;
|
|
@@ -217,7 +222,7 @@ const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
217
222
|
style: [styles.staticLabel, {
|
|
218
223
|
color: hasError ? theme.colors.error : isFocused ? theme.colors.border.focus : theme.colors.text.secondary,
|
|
219
224
|
fontSize: theme.typography.fontSize.sm,
|
|
220
|
-
|
|
225
|
+
...fontFor(theme, 'medium'),
|
|
221
226
|
marginBottom: theme.spacing.xxs
|
|
222
227
|
}, labelStyle],
|
|
223
228
|
children: [label, required ? /*#__PURE__*/_jsx(Text, {
|
|
@@ -251,7 +256,7 @@ const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
251
256
|
left: leftPad,
|
|
252
257
|
color: labelColor,
|
|
253
258
|
fontSize: sizeStyles.fontSize,
|
|
254
|
-
|
|
259
|
+
...fontFor(theme, 'medium'),
|
|
255
260
|
backgroundColor: shouldFloat && variant === 'outlined' ? theme.colors.background.primary : 'transparent',
|
|
256
261
|
paddingHorizontal: shouldFloat && variant === 'outlined' ? 4 : 0,
|
|
257
262
|
transform: [{
|
|
@@ -277,8 +282,11 @@ const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
277
282
|
}, inputStyle],
|
|
278
283
|
placeholder: showFloatingLabel && !shouldFloat ? undefined : placeholder,
|
|
279
284
|
placeholderTextColor: placeholderTextColor,
|
|
280
|
-
value: value,
|
|
281
|
-
onChangeText:
|
|
285
|
+
value: format && value != null ? format(value) : value,
|
|
286
|
+
onChangeText: text => {
|
|
287
|
+
if (!onChangeText) return;
|
|
288
|
+
onChangeText(parse ? parse(text) : text);
|
|
289
|
+
},
|
|
282
290
|
onFocus: handleFocus,
|
|
283
291
|
onBlur: handleBlur,
|
|
284
292
|
editable: isEditable,
|
|
@@ -2,38 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useMemo } from 'react';
|
|
4
4
|
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
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
8
|
import { Swipeable } from "../Swipeable/index.js";
|
|
9
9
|
import { SkeletonContent } from "../Skeleton/index.js";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
paddingVertical: theme.spacing.md,
|
|
31
|
-
titleSize: theme.typography.fontSize.base,
|
|
32
|
-
subtitleSize: theme.typography.fontSize.sm,
|
|
33
|
-
minHeight: 56
|
|
34
|
-
};
|
|
11
|
+
const SIZE_FALLBACK = {
|
|
12
|
+
sm: {
|
|
13
|
+
paddingVertical: 'sm',
|
|
14
|
+
titleFontSize: 'sm',
|
|
15
|
+
subtitleFontSize: 'xs',
|
|
16
|
+
minHeight: 44
|
|
17
|
+
},
|
|
18
|
+
md: {
|
|
19
|
+
paddingVertical: 'md',
|
|
20
|
+
titleFontSize: 'base',
|
|
21
|
+
subtitleFontSize: 'sm',
|
|
22
|
+
minHeight: 56
|
|
23
|
+
},
|
|
24
|
+
lg: {
|
|
25
|
+
paddingVertical: 'lg',
|
|
26
|
+
titleFontSize: 'lg',
|
|
27
|
+
subtitleFontSize: 'sm',
|
|
28
|
+
minHeight: 72
|
|
35
29
|
}
|
|
36
30
|
};
|
|
31
|
+
const sizeFor = (theme, size) => {
|
|
32
|
+
const tokens = {
|
|
33
|
+
...SIZE_FALLBACK[size],
|
|
34
|
+
...(theme.components.listItem?.[size] ?? {})
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
paddingVertical: theme.spacing[tokens.paddingVertical],
|
|
38
|
+
titleSize: theme.typography.fontSize[tokens.titleFontSize],
|
|
39
|
+
subtitleSize: theme.typography.fontSize[tokens.subtitleFontSize],
|
|
40
|
+
minHeight: tokens.minHeight
|
|
41
|
+
};
|
|
42
|
+
};
|
|
37
43
|
const Chevron = ({
|
|
38
44
|
color
|
|
39
45
|
}) => /*#__PURE__*/_jsx(Text, {
|
|
@@ -101,7 +107,7 @@ const ListItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
101
107
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
102
108
|
style: [styles.title, {
|
|
103
109
|
fontSize: sz.titleSize,
|
|
104
|
-
|
|
110
|
+
...fontFor(theme, 'medium'),
|
|
105
111
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary
|
|
106
112
|
}],
|
|
107
113
|
numberOfLines: 1,
|
|
@@ -232,11 +238,11 @@ const buildStyles = theme => StyleSheet.create({
|
|
|
232
238
|
},
|
|
233
239
|
subtitle: {
|
|
234
240
|
marginTop: 2,
|
|
235
|
-
|
|
241
|
+
...fontFor(theme, 'normal')
|
|
236
242
|
},
|
|
237
243
|
description: {
|
|
238
244
|
marginTop: 2,
|
|
239
|
-
|
|
245
|
+
...fontFor(theme, 'normal')
|
|
240
246
|
}
|
|
241
247
|
});
|
|
242
248
|
export { ListItem };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
5
|
+
import { fontFor, useTheme } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/index.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const sizeMap = {
|
|
@@ -52,7 +52,10 @@ const OTPInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
52
52
|
} = props;
|
|
53
53
|
const theme = useTheme();
|
|
54
54
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
55
|
-
const sizeStyles =
|
|
55
|
+
const sizeStyles = {
|
|
56
|
+
...sizeMap[size],
|
|
57
|
+
...(theme.components.otpInput?.[size] ?? {})
|
|
58
|
+
};
|
|
56
59
|
const inputsRef = useRef([]);
|
|
57
60
|
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
58
61
|
const previousErrorRef = useRef(null);
|
|
@@ -297,7 +300,7 @@ const OTPInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
297
300
|
style: [styles.input, {
|
|
298
301
|
fontSize: sizeStyles.fontSize,
|
|
299
302
|
color: theme.colors.text.primary,
|
|
300
|
-
|
|
303
|
+
...fontFor(theme, 'semibold')
|
|
301
304
|
}, textStyle]
|
|
302
305
|
}), secure && isFilled ? /*#__PURE__*/_jsx(View, {
|
|
303
306
|
pointerEvents: "none",
|
|
@@ -306,7 +309,7 @@ const OTPInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
306
309
|
style: [{
|
|
307
310
|
fontSize: sizeStyles.fontSize,
|
|
308
311
|
color: theme.colors.text.primary,
|
|
309
|
-
|
|
312
|
+
...fontFor(theme, 'semibold')
|
|
310
313
|
}, textStyle],
|
|
311
314
|
children: display
|
|
312
315
|
})
|
|
@@ -56,10 +56,11 @@ const Radio = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
56
56
|
const selected = ctx ? ctx.selectedValue === value : !!selectedProp;
|
|
57
57
|
const disabled = ctx ? ctx.disabled || disabledProp : disabledProp;
|
|
58
58
|
const fillColor = toneColor(theme, tone);
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
const sizeOverrides = theme.components.radio?.[size];
|
|
60
|
+
const outer = sizeOverrides?.outer ?? sizeMap[size].outer;
|
|
61
|
+
const inner = sizeOverrides?.inner ?? sizeMap[size].inner;
|
|
62
|
+
const radioBorderWidth = theme.components.radio?.borderWidth ?? 1.5;
|
|
63
|
+
const radioLabelGap = theme.components.radio?.labelGap ?? 10;
|
|
63
64
|
const progress = useRef(new Animated.Value(selected ? 1 : 0)).current;
|
|
64
65
|
useEffect(() => {
|
|
65
66
|
Animated.spring(progress, {
|
|
@@ -108,6 +109,7 @@ const Radio = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
108
109
|
style: [styles.outer, {
|
|
109
110
|
width: outer,
|
|
110
111
|
height: outer,
|
|
112
|
+
borderWidth: radioBorderWidth,
|
|
111
113
|
borderRadius: outer / 2,
|
|
112
114
|
borderColor
|
|
113
115
|
}, circleStyle],
|
|
@@ -125,6 +127,7 @@ const Radio = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
125
127
|
})
|
|
126
128
|
}), label ? /*#__PURE__*/_jsx(Text, {
|
|
127
129
|
style: [styles.label, {
|
|
130
|
+
marginLeft: radioLabelGap,
|
|
128
131
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary,
|
|
129
132
|
fontSize: theme.typography.fontSize.base
|
|
130
133
|
}],
|
|
@@ -140,13 +143,11 @@ const buildStyles = _theme => StyleSheet.create({
|
|
|
140
143
|
alignItems: 'center'
|
|
141
144
|
},
|
|
142
145
|
outer: {
|
|
143
|
-
borderWidth: 1.5,
|
|
144
146
|
alignItems: 'center',
|
|
145
147
|
justifyContent: 'center'
|
|
146
148
|
},
|
|
147
149
|
inner: {},
|
|
148
150
|
label: {
|
|
149
|
-
marginLeft: 10,
|
|
150
151
|
flexShrink: 1
|
|
151
152
|
}
|
|
152
153
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
5
|
+
import { fontFor, useTheme } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
7
|
import { useDebounce } from "../../hooks/useDebounce.js";
|
|
8
8
|
import { AppIcon } from "../AppIcon/index.js";
|
|
@@ -53,7 +53,11 @@ const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
53
53
|
...rest
|
|
54
54
|
} = props;
|
|
55
55
|
const theme = useTheme();
|
|
56
|
-
const sizeStyles =
|
|
56
|
+
const sizeStyles = {
|
|
57
|
+
...sizeMap[size],
|
|
58
|
+
...(theme.components.searchBar?.[size] ?? {})
|
|
59
|
+
};
|
|
60
|
+
const cancelWidth = theme.components.searchBar?.cancelButtonWidth ?? CANCEL_WIDTH;
|
|
57
61
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
58
62
|
const [isFocused, setIsFocused] = useState(false);
|
|
59
63
|
const [internalValue, setInternalValue] = useState(value);
|
|
@@ -122,7 +126,7 @@ const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
122
126
|
// Container shrinks left to make room for cancel button on right.
|
|
123
127
|
const cancelTranslateX = cancelAnim.interpolate({
|
|
124
128
|
inputRange: [0, 1],
|
|
125
|
-
outputRange: [
|
|
129
|
+
outputRange: [cancelWidth, 0]
|
|
126
130
|
});
|
|
127
131
|
const cancelOpacity = cancelAnim;
|
|
128
132
|
return /*#__PURE__*/_jsxs(View, {
|
|
@@ -139,7 +143,7 @@ const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
139
143
|
opacity: disabled ? 0.55 : 1,
|
|
140
144
|
marginRight: cancelAnim.interpolate({
|
|
141
145
|
inputRange: [0, 1],
|
|
142
|
-
outputRange: [0,
|
|
146
|
+
outputRange: [0, cancelWidth + theme.spacing.sm]
|
|
143
147
|
})
|
|
144
148
|
}],
|
|
145
149
|
accessibilityRole: "search",
|
|
@@ -194,7 +198,7 @@ const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
194
198
|
}), showCancel ? /*#__PURE__*/_jsx(Animated.View, {
|
|
195
199
|
pointerEvents: showCancelButton ? 'auto' : 'none',
|
|
196
200
|
style: [styles.cancelWrap, {
|
|
197
|
-
width:
|
|
201
|
+
width: cancelWidth,
|
|
198
202
|
transform: [{
|
|
199
203
|
translateX: cancelTranslateX
|
|
200
204
|
}],
|
|
@@ -210,7 +214,7 @@ const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
210
214
|
style: [styles.cancelText, {
|
|
211
215
|
color: theme.colors.primary,
|
|
212
216
|
fontSize: sizeStyles.fontSize,
|
|
213
|
-
|
|
217
|
+
...fontFor(theme, 'medium')
|
|
214
218
|
}],
|
|
215
219
|
numberOfLines: 1,
|
|
216
220
|
children: cancelLabel
|
|
@@ -4,6 +4,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
4
4
|
import { Animated, Easing, StyleSheet, View } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
6
|
import { Responsive } from "../../utils/index.js";
|
|
7
|
+
import { useSkeletonDefaults } from "./SkeletonProvider.js";
|
|
7
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
const SPEED_DURATION = {
|
|
9
10
|
slow: 1800,
|
|
@@ -28,23 +29,30 @@ const resolveWidth = width => {
|
|
|
28
29
|
const Skeleton = ({
|
|
29
30
|
width = '100%',
|
|
30
31
|
height = 16,
|
|
31
|
-
radius
|
|
32
|
-
variant
|
|
33
|
-
speed
|
|
32
|
+
radius,
|
|
33
|
+
variant,
|
|
34
|
+
speed,
|
|
35
|
+
colors,
|
|
34
36
|
style,
|
|
35
37
|
testID
|
|
36
38
|
}) => {
|
|
37
39
|
const theme = useTheme();
|
|
40
|
+
const defaults = useSkeletonDefaults();
|
|
41
|
+
const resolvedVariant = variant ?? defaults.variant ?? 'shimmer';
|
|
42
|
+
const resolvedSpeed = speed ?? defaults.speed ?? 'normal';
|
|
43
|
+
const resolvedRadiusToken = radius ?? defaults.radius ?? 'sm';
|
|
44
|
+
const backgroundColor = colors?.background ?? defaults.colors?.background ?? theme.colors.skeleton.background;
|
|
45
|
+
const highlightColor = colors?.highlight ?? defaults.colors?.highlight ?? theme.colors.skeleton.highlight;
|
|
38
46
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
39
|
-
const borderRadius = resolveRadius(theme,
|
|
47
|
+
const borderRadius = resolveRadius(theme, resolvedRadiusToken);
|
|
40
48
|
const resolvedWidth = resolveWidth(width);
|
|
41
49
|
const resolvedHeight = Responsive.size(height);
|
|
42
50
|
const progress = useRef(new Animated.Value(0)).current;
|
|
43
51
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
44
52
|
useEffect(() => {
|
|
45
53
|
progress.setValue(0);
|
|
46
|
-
const duration =
|
|
47
|
-
const animation =
|
|
54
|
+
const duration = resolvedVariant === 'pulse' ? PULSE_DURATION : SPEED_DURATION[resolvedSpeed];
|
|
55
|
+
const animation = resolvedVariant === 'pulse' ? Animated.loop(Animated.sequence([Animated.timing(progress, {
|
|
48
56
|
toValue: 1,
|
|
49
57
|
duration: duration / 2,
|
|
50
58
|
easing: Easing.inOut(Easing.ease),
|
|
@@ -64,17 +72,17 @@ const Skeleton = ({
|
|
|
64
72
|
return () => {
|
|
65
73
|
animation.stop();
|
|
66
74
|
};
|
|
67
|
-
}, [progress,
|
|
75
|
+
}, [progress, resolvedSpeed, resolvedVariant]);
|
|
68
76
|
const handleLayout = event => {
|
|
69
77
|
const next = event.nativeEvent.layout.width;
|
|
70
78
|
if (next !== containerWidth) setContainerWidth(next);
|
|
71
79
|
};
|
|
72
80
|
const overlay = useMemo(() => {
|
|
73
|
-
if (
|
|
81
|
+
if (resolvedVariant === 'pulse') {
|
|
74
82
|
return /*#__PURE__*/_jsx(Animated.View, {
|
|
75
83
|
pointerEvents: "none",
|
|
76
84
|
style: [StyleSheet.absoluteFillObject, {
|
|
77
|
-
backgroundColor:
|
|
85
|
+
backgroundColor: highlightColor,
|
|
78
86
|
opacity: progress.interpolate({
|
|
79
87
|
inputRange: [0, 1],
|
|
80
88
|
outputRange: [0, 0.6]
|
|
@@ -92,13 +100,13 @@ const Skeleton = ({
|
|
|
92
100
|
pointerEvents: "none",
|
|
93
101
|
style: [styles.shimmer, {
|
|
94
102
|
width: highlightWidth,
|
|
95
|
-
backgroundColor:
|
|
103
|
+
backgroundColor: highlightColor,
|
|
96
104
|
transform: [{
|
|
97
105
|
translateX
|
|
98
106
|
}]
|
|
99
107
|
}]
|
|
100
108
|
});
|
|
101
|
-
}, [containerWidth, progress, styles.shimmer,
|
|
109
|
+
}, [containerWidth, progress, styles.shimmer, highlightColor, resolvedVariant]);
|
|
102
110
|
return /*#__PURE__*/_jsx(View, {
|
|
103
111
|
onLayout: handleLayout,
|
|
104
112
|
accessible: true,
|
|
@@ -110,7 +118,7 @@ const Skeleton = ({
|
|
|
110
118
|
width: resolvedWidth,
|
|
111
119
|
height: resolvedHeight,
|
|
112
120
|
borderRadius,
|
|
113
|
-
backgroundColor
|
|
121
|
+
backgroundColor
|
|
114
122
|
}, style],
|
|
115
123
|
children: overlay
|
|
116
124
|
});
|