@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
|
@@ -34,6 +34,7 @@ const Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
34
34
|
imageAspectRatio,
|
|
35
35
|
imageOverlay,
|
|
36
36
|
loading = false,
|
|
37
|
+
gradient,
|
|
37
38
|
onPress,
|
|
38
39
|
accessibilityLabel,
|
|
39
40
|
accessibilityHint,
|
|
@@ -54,6 +55,11 @@ const Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
54
55
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
55
56
|
const hasImage = Boolean(imageSource);
|
|
56
57
|
const contentPadding = theme.spacing[paddingMap[padding]];
|
|
58
|
+
const resolvedGradient = (0, _react.useMemo)(() => {
|
|
59
|
+
if (!gradient) return null;
|
|
60
|
+
if (typeof gradient === 'string') return theme.gradients[gradient] ?? null;
|
|
61
|
+
return gradient;
|
|
62
|
+
}, [gradient, theme.gradients]);
|
|
57
63
|
const containerStyle = (0, _react.useMemo)(() => {
|
|
58
64
|
const base = {
|
|
59
65
|
borderRadius: theme.radius[radius],
|
|
@@ -113,7 +119,7 @@ const Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
113
119
|
children: footer
|
|
114
120
|
}) : null]
|
|
115
121
|
});
|
|
116
|
-
const
|
|
122
|
+
const baseContent = hasImage ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
117
123
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
118
124
|
style: styles.imageWrapper,
|
|
119
125
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
@@ -134,6 +140,12 @@ const Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
134
140
|
children: innerContent
|
|
135
141
|
})]
|
|
136
142
|
}) : innerContent;
|
|
143
|
+
const content = resolvedGradient ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
144
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Gradient, {
|
|
145
|
+
gradient: resolvedGradient,
|
|
146
|
+
style: _reactNative.StyleSheet.absoluteFillObject
|
|
147
|
+
}), baseContent]
|
|
148
|
+
}) : baseContent;
|
|
137
149
|
let rendered;
|
|
138
150
|
if (isInteractive) {
|
|
139
151
|
const handlePress = event => {
|
|
@@ -46,7 +46,9 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
46
46
|
} = props;
|
|
47
47
|
const theme = (0, _index.useTheme)();
|
|
48
48
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
49
|
-
const boxSize = sizeMap[size];
|
|
49
|
+
const boxSize = theme.components.checkbox?.[size]?.boxSize ?? sizeMap[size];
|
|
50
|
+
const checkboxBorderWidth = theme.components.checkbox?.borderWidth ?? 1.5;
|
|
51
|
+
const checkboxLabelGap = theme.components.checkbox?.labelGap ?? 10;
|
|
50
52
|
const fillColor = toneColor(theme, tone);
|
|
51
53
|
const isActive = checked || indeterminate;
|
|
52
54
|
const progress = (0, _react.useRef)(new _reactNative.Animated.Value(isActive ? 1 : 0)).current;
|
|
@@ -98,6 +100,7 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
98
100
|
style: [styles.box, {
|
|
99
101
|
width: boxSize,
|
|
100
102
|
height: boxSize,
|
|
103
|
+
borderWidth: checkboxBorderWidth,
|
|
101
104
|
borderRadius: theme.radius.xs,
|
|
102
105
|
borderColor,
|
|
103
106
|
backgroundColor
|
|
@@ -128,6 +131,7 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
128
131
|
})
|
|
129
132
|
}), label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
130
133
|
style: [styles.label, {
|
|
134
|
+
marginLeft: checkboxLabelGap,
|
|
131
135
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary,
|
|
132
136
|
fontSize: theme.typography.fontSize.base
|
|
133
137
|
}],
|
|
@@ -143,7 +147,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
143
147
|
alignItems: 'center'
|
|
144
148
|
},
|
|
145
149
|
box: {
|
|
146
|
-
borderWidth: 1.5,
|
|
147
150
|
alignItems: 'center',
|
|
148
151
|
justifyContent: 'center'
|
|
149
152
|
},
|
|
@@ -157,7 +160,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
157
160
|
includeFontPadding: false
|
|
158
161
|
},
|
|
159
162
|
label: {
|
|
160
|
-
marginLeft: 10,
|
|
161
163
|
flexShrink: 1
|
|
162
164
|
}
|
|
163
165
|
});
|
|
@@ -118,7 +118,16 @@ const Chip = exports.Chip = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
118
118
|
enabled: isPressable
|
|
119
119
|
});
|
|
120
120
|
const tones = (0, _react.useMemo)(() => toneFor(theme, tone), [theme, tone]);
|
|
121
|
-
const
|
|
121
|
+
const overrides = theme.components.chip?.[size];
|
|
122
|
+
const sz = {
|
|
123
|
+
paddingH: overrides?.paddingHorizontal ?? sizeMap[size].paddingH,
|
|
124
|
+
paddingV: overrides?.paddingVertical ?? sizeMap[size].paddingV,
|
|
125
|
+
fontSize: overrides?.fontSize ?? sizeMap[size].fontSize,
|
|
126
|
+
minHeight: overrides?.minHeight ?? sizeMap[size].minHeight,
|
|
127
|
+
closeSize: overrides?.closeSize ?? sizeMap[size].closeSize,
|
|
128
|
+
closeFont: overrides?.closeFontSize ?? sizeMap[size].closeFont,
|
|
129
|
+
gap: overrides?.gap ?? sizeMap[size].gap
|
|
130
|
+
};
|
|
122
131
|
const isFilled = variant === 'filled';
|
|
123
132
|
const backgroundColor = (() => {
|
|
124
133
|
if (selected) return isFilled ? tones.selectedBg : 'transparent';
|
|
@@ -158,7 +167,7 @@ const Chip = exports.Chip = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
158
167
|
style: [styles.label, {
|
|
159
168
|
color: textColor,
|
|
160
169
|
fontSize: sz.fontSize,
|
|
161
|
-
|
|
170
|
+
...(0, _index.fontFor)(theme, 'medium')
|
|
162
171
|
}, textStyle],
|
|
163
172
|
numberOfLines: 1,
|
|
164
173
|
children: label ?? ' '
|
|
@@ -184,7 +193,7 @@ const Chip = exports.Chip = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
184
193
|
style: {
|
|
185
194
|
color: textColor,
|
|
186
195
|
fontSize: sz.closeFont,
|
|
187
|
-
|
|
196
|
+
...(0, _index.fontFor)(theme, 'bold'),
|
|
188
197
|
lineHeight: sz.closeFont + 2
|
|
189
198
|
},
|
|
190
199
|
allowFontScaling: false,
|
|
@@ -22,11 +22,17 @@ const Dialog = props => {
|
|
|
22
22
|
actions,
|
|
23
23
|
dismissOnAction = true,
|
|
24
24
|
accessibilityLabel,
|
|
25
|
+
contentStyle,
|
|
26
|
+
containerStyle,
|
|
25
27
|
testID
|
|
26
28
|
} = props;
|
|
27
29
|
const theme = (0, _index.useTheme)();
|
|
28
30
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
29
31
|
const variantTint = (0, _react.useMemo)(() => tintForVariant(theme, variant), [theme, variant]);
|
|
32
|
+
const dialogTokens = theme.components.dialog;
|
|
33
|
+
const iconWrapperSize = dialogTokens?.iconWrapperSize ?? 48;
|
|
34
|
+
const iconWrapperBorderRadius = dialogTokens?.iconWrapperBorderRadius ?? 24;
|
|
35
|
+
const actionButtonMinHeight = dialogTokens?.actionButtonMinHeight ?? 44;
|
|
30
36
|
const handleAction = (0, _react.useCallback)(action => {
|
|
31
37
|
if (action.loading) return;
|
|
32
38
|
(0, _hapticUtils.triggerHaptic)('selection');
|
|
@@ -40,13 +46,17 @@ const Dialog = props => {
|
|
|
40
46
|
onRequestClose: onClose,
|
|
41
47
|
presentation: "centered",
|
|
42
48
|
accessibilityLabel: accessibilityLabel ?? title,
|
|
49
|
+
contentStyle: contentStyle,
|
|
43
50
|
testID: testID,
|
|
44
51
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
45
52
|
accessibilityRole: 'alertdialog',
|
|
46
53
|
accessibilityLabel: accessibilityLabel ?? title,
|
|
47
|
-
style: styles.container,
|
|
54
|
+
style: [styles.container, containerStyle],
|
|
48
55
|
children: [icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
49
56
|
style: [styles.iconWrapper, {
|
|
57
|
+
width: iconWrapperSize,
|
|
58
|
+
height: iconWrapperSize,
|
|
59
|
+
borderRadius: iconWrapperBorderRadius,
|
|
50
60
|
backgroundColor: variantTint.muted,
|
|
51
61
|
marginBottom: theme.spacing.md
|
|
52
62
|
}],
|
|
@@ -55,7 +65,7 @@ const Dialog = props => {
|
|
|
55
65
|
style: [styles.title, {
|
|
56
66
|
color: theme.colors.text.primary,
|
|
57
67
|
fontSize: theme.typography.fontSize.xl,
|
|
58
|
-
|
|
68
|
+
...(0, _index.fontFor)(theme, 'semibold'),
|
|
59
69
|
marginBottom: message ? theme.spacing.sm : theme.spacing.md
|
|
60
70
|
}],
|
|
61
71
|
accessibilityRole: "header",
|
|
@@ -91,6 +101,7 @@ const Dialog = props => {
|
|
|
91
101
|
style: ({
|
|
92
102
|
pressed
|
|
93
103
|
}) => [styles.actionButton, {
|
|
104
|
+
minHeight: actionButtonMinHeight,
|
|
94
105
|
backgroundColor: buttonStyle.backgroundColor,
|
|
95
106
|
borderColor: buttonStyle.borderColor,
|
|
96
107
|
borderWidth: buttonStyle.borderWidth,
|
|
@@ -107,7 +118,7 @@ const Dialog = props => {
|
|
|
107
118
|
style: {
|
|
108
119
|
color: buttonStyle.textColor,
|
|
109
120
|
fontSize: theme.typography.fontSize.base,
|
|
110
|
-
|
|
121
|
+
...(0, _index.fontFor)(theme, 'semibold'),
|
|
111
122
|
textAlign: 'center'
|
|
112
123
|
},
|
|
113
124
|
numberOfLines: 1,
|
|
@@ -186,9 +197,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
186
197
|
alignItems: 'stretch'
|
|
187
198
|
},
|
|
188
199
|
iconWrapper: {
|
|
189
|
-
width: 48,
|
|
190
|
-
height: 48,
|
|
191
|
-
borderRadius: 24,
|
|
192
200
|
alignItems: 'center',
|
|
193
201
|
justifyContent: 'center',
|
|
194
202
|
alignSelf: 'center'
|
|
@@ -207,8 +215,7 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
207
215
|
actionButton: {
|
|
208
216
|
flex: 1,
|
|
209
217
|
alignItems: 'center',
|
|
210
|
-
justifyContent: 'center'
|
|
211
|
-
minHeight: 44
|
|
218
|
+
justifyContent: 'center'
|
|
212
219
|
}
|
|
213
220
|
});
|
|
214
221
|
var _default = exports.default = Dialog;
|
|
@@ -11,32 +11,38 @@ var _usePressAnimation = require("../../hooks/usePressAnimation.js");
|
|
|
11
11
|
var _hapticUtils = require("../../utils/hapticUtils.js");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
iconSize: 64,
|
|
34
|
-
titleSize: theme.typography.fontSize.xl,
|
|
35
|
-
descriptionSize: theme.typography.fontSize.base,
|
|
36
|
-
paddingVertical: theme.spacing.xl
|
|
37
|
-
};
|
|
14
|
+
const SIZE_FALLBACK = {
|
|
15
|
+
sm: {
|
|
16
|
+
iconSize: 48,
|
|
17
|
+
titleFontSize: 'lg',
|
|
18
|
+
descriptionFontSize: 'sm',
|
|
19
|
+
paddingVertical: 'lg'
|
|
20
|
+
},
|
|
21
|
+
md: {
|
|
22
|
+
iconSize: 64,
|
|
23
|
+
titleFontSize: 'xl',
|
|
24
|
+
descriptionFontSize: 'base',
|
|
25
|
+
paddingVertical: 'xl'
|
|
26
|
+
},
|
|
27
|
+
lg: {
|
|
28
|
+
iconSize: 80,
|
|
29
|
+
titleFontSize: '2xl',
|
|
30
|
+
descriptionFontSize: 'base',
|
|
31
|
+
paddingVertical: '2xl'
|
|
38
32
|
}
|
|
39
33
|
};
|
|
34
|
+
const sizeFor = (theme, size) => {
|
|
35
|
+
const tokens = {
|
|
36
|
+
...SIZE_FALLBACK[size],
|
|
37
|
+
...(theme.components.emptyState?.[size] ?? {})
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
iconSize: tokens.iconSize,
|
|
41
|
+
titleSize: theme.typography.fontSize[tokens.titleFontSize],
|
|
42
|
+
descriptionSize: theme.typography.fontSize[tokens.descriptionFontSize],
|
|
43
|
+
paddingVertical: theme.spacing[tokens.paddingVertical]
|
|
44
|
+
};
|
|
45
|
+
};
|
|
40
46
|
const ActionButton = ({
|
|
41
47
|
action,
|
|
42
48
|
variant
|
|
@@ -115,7 +121,7 @@ const EmptyState = exports.EmptyState = /*#__PURE__*/(0, _react.forwardRef)((pro
|
|
|
115
121
|
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
116
122
|
style: [styles.title, {
|
|
117
123
|
fontSize: sz.titleSize,
|
|
118
|
-
|
|
124
|
+
...(0, _index.fontFor)(theme, 'semibold')
|
|
119
125
|
}],
|
|
120
126
|
children: title
|
|
121
127
|
}), description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -188,7 +194,7 @@ const buildActionStyles = theme => _reactNative.StyleSheet.create({
|
|
|
188
194
|
},
|
|
189
195
|
buttonText: {
|
|
190
196
|
fontSize: theme.typography.fontSize.base,
|
|
191
|
-
|
|
197
|
+
...(0, _index.fontFor)(theme, 'semibold')
|
|
192
198
|
},
|
|
193
199
|
buttonTextPrimary: {
|
|
194
200
|
color: theme.colors.text.inverse
|
|
@@ -97,15 +97,15 @@ const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
|
97
97
|
},
|
|
98
98
|
label: {
|
|
99
99
|
fontSize: theme.typography.fontSize.sm,
|
|
100
|
-
|
|
100
|
+
...(0, _index.fontFor)(theme, 'medium'),
|
|
101
101
|
color: theme.colors.text.secondary
|
|
102
102
|
},
|
|
103
103
|
labelInline: {
|
|
104
|
-
width: '35%'
|
|
104
|
+
width: theme.components.formField?.inlineLabelWidth ?? '35%'
|
|
105
105
|
},
|
|
106
106
|
requiredMark: {
|
|
107
107
|
color: theme.colors.error,
|
|
108
|
-
|
|
108
|
+
...(0, _index.fontFor)(theme, 'medium')
|
|
109
109
|
},
|
|
110
110
|
inputStacked: {
|
|
111
111
|
width: '100%'
|
|
@@ -62,6 +62,8 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
62
62
|
variant = 'outlined',
|
|
63
63
|
required = false,
|
|
64
64
|
maxLength,
|
|
65
|
+
format,
|
|
66
|
+
parse,
|
|
65
67
|
style,
|
|
66
68
|
inputStyle,
|
|
67
69
|
labelStyle,
|
|
@@ -74,7 +76,10 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
74
76
|
} = props;
|
|
75
77
|
const theme = (0, _index.useTheme)();
|
|
76
78
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
77
|
-
const sizeStyles =
|
|
79
|
+
const sizeStyles = {
|
|
80
|
+
...sizeMap[size],
|
|
81
|
+
...(theme.components.input?.[size] ?? {})
|
|
82
|
+
};
|
|
78
83
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
79
84
|
const [isPasswordVisible, setIsPasswordVisible] = (0, _react.useState)(false);
|
|
80
85
|
const hasValue = typeof value === 'string' && value.length > 0;
|
|
@@ -224,7 +229,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
224
229
|
style: [styles.staticLabel, {
|
|
225
230
|
color: hasError ? theme.colors.error : isFocused ? theme.colors.border.focus : theme.colors.text.secondary,
|
|
226
231
|
fontSize: theme.typography.fontSize.sm,
|
|
227
|
-
|
|
232
|
+
...(0, _index.fontFor)(theme, 'medium'),
|
|
228
233
|
marginBottom: theme.spacing.xxs
|
|
229
234
|
}, labelStyle],
|
|
230
235
|
children: [label, required ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -258,7 +263,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
258
263
|
left: leftPad,
|
|
259
264
|
color: labelColor,
|
|
260
265
|
fontSize: sizeStyles.fontSize,
|
|
261
|
-
|
|
266
|
+
...(0, _index.fontFor)(theme, 'medium'),
|
|
262
267
|
backgroundColor: shouldFloat && variant === 'outlined' ? theme.colors.background.primary : 'transparent',
|
|
263
268
|
paddingHorizontal: shouldFloat && variant === 'outlined' ? 4 : 0,
|
|
264
269
|
transform: [{
|
|
@@ -284,8 +289,11 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
284
289
|
}, inputStyle],
|
|
285
290
|
placeholder: showFloatingLabel && !shouldFloat ? undefined : placeholder,
|
|
286
291
|
placeholderTextColor: placeholderTextColor,
|
|
287
|
-
value: value,
|
|
288
|
-
onChangeText:
|
|
292
|
+
value: format && value != null ? format(value) : value,
|
|
293
|
+
onChangeText: text => {
|
|
294
|
+
if (!onChangeText) return;
|
|
295
|
+
onChangeText(parse ? parse(text) : text);
|
|
296
|
+
},
|
|
289
297
|
onFocus: handleFocus,
|
|
290
298
|
onBlur: handleBlur,
|
|
291
299
|
editable: isEditable,
|
|
@@ -13,32 +13,38 @@ var _index2 = require("../Swipeable/index.js");
|
|
|
13
13
|
var _index3 = require("../Skeleton/index.js");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
paddingVertical: theme.spacing.md,
|
|
36
|
-
titleSize: theme.typography.fontSize.base,
|
|
37
|
-
subtitleSize: theme.typography.fontSize.sm,
|
|
38
|
-
minHeight: 56
|
|
39
|
-
};
|
|
16
|
+
const SIZE_FALLBACK = {
|
|
17
|
+
sm: {
|
|
18
|
+
paddingVertical: 'sm',
|
|
19
|
+
titleFontSize: 'sm',
|
|
20
|
+
subtitleFontSize: 'xs',
|
|
21
|
+
minHeight: 44
|
|
22
|
+
},
|
|
23
|
+
md: {
|
|
24
|
+
paddingVertical: 'md',
|
|
25
|
+
titleFontSize: 'base',
|
|
26
|
+
subtitleFontSize: 'sm',
|
|
27
|
+
minHeight: 56
|
|
28
|
+
},
|
|
29
|
+
lg: {
|
|
30
|
+
paddingVertical: 'lg',
|
|
31
|
+
titleFontSize: 'lg',
|
|
32
|
+
subtitleFontSize: 'sm',
|
|
33
|
+
minHeight: 72
|
|
40
34
|
}
|
|
41
35
|
};
|
|
36
|
+
const sizeFor = (theme, size) => {
|
|
37
|
+
const tokens = {
|
|
38
|
+
...SIZE_FALLBACK[size],
|
|
39
|
+
...(theme.components.listItem?.[size] ?? {})
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
paddingVertical: theme.spacing[tokens.paddingVertical],
|
|
43
|
+
titleSize: theme.typography.fontSize[tokens.titleFontSize],
|
|
44
|
+
subtitleSize: theme.typography.fontSize[tokens.subtitleFontSize],
|
|
45
|
+
minHeight: tokens.minHeight
|
|
46
|
+
};
|
|
47
|
+
};
|
|
42
48
|
const Chevron = ({
|
|
43
49
|
color
|
|
44
50
|
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -106,7 +112,7 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
106
112
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
107
113
|
style: [styles.title, {
|
|
108
114
|
fontSize: sz.titleSize,
|
|
109
|
-
|
|
115
|
+
...(0, _index.fontFor)(theme, 'medium'),
|
|
110
116
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary
|
|
111
117
|
}],
|
|
112
118
|
numberOfLines: 1,
|
|
@@ -237,11 +243,11 @@ const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
|
237
243
|
},
|
|
238
244
|
subtitle: {
|
|
239
245
|
marginTop: 2,
|
|
240
|
-
|
|
246
|
+
...(0, _index.fontFor)(theme, 'normal')
|
|
241
247
|
},
|
|
242
248
|
description: {
|
|
243
249
|
marginTop: 2,
|
|
244
|
-
|
|
250
|
+
...(0, _index.fontFor)(theme, 'normal')
|
|
245
251
|
}
|
|
246
252
|
});
|
|
247
253
|
var _default = exports.default = ListItem;
|
|
@@ -57,7 +57,10 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
57
57
|
} = props;
|
|
58
58
|
const theme = (0, _index.useTheme)();
|
|
59
59
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
60
|
-
const sizeStyles =
|
|
60
|
+
const sizeStyles = {
|
|
61
|
+
...sizeMap[size],
|
|
62
|
+
...(theme.components.otpInput?.[size] ?? {})
|
|
63
|
+
};
|
|
61
64
|
const inputsRef = (0, _react.useRef)([]);
|
|
62
65
|
const [focusedIndex, setFocusedIndex] = (0, _react.useState)(-1);
|
|
63
66
|
const previousErrorRef = (0, _react.useRef)(null);
|
|
@@ -302,7 +305,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
302
305
|
style: [styles.input, {
|
|
303
306
|
fontSize: sizeStyles.fontSize,
|
|
304
307
|
color: theme.colors.text.primary,
|
|
305
|
-
|
|
308
|
+
...(0, _index.fontFor)(theme, 'semibold')
|
|
306
309
|
}, textStyle]
|
|
307
310
|
}), secure && isFilled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
308
311
|
pointerEvents: "none",
|
|
@@ -311,7 +314,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
311
314
|
style: [{
|
|
312
315
|
fontSize: sizeStyles.fontSize,
|
|
313
316
|
color: theme.colors.text.primary,
|
|
314
|
-
|
|
317
|
+
...(0, _index.fontFor)(theme, 'semibold')
|
|
315
318
|
}, textStyle],
|
|
316
319
|
children: display
|
|
317
320
|
})
|
|
@@ -62,10 +62,11 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
62
62
|
const selected = ctx ? ctx.selectedValue === value : !!selectedProp;
|
|
63
63
|
const disabled = ctx ? ctx.disabled || disabledProp : disabledProp;
|
|
64
64
|
const fillColor = toneColor(theme, tone);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const sizeOverrides = theme.components.radio?.[size];
|
|
66
|
+
const outer = sizeOverrides?.outer ?? sizeMap[size].outer;
|
|
67
|
+
const inner = sizeOverrides?.inner ?? sizeMap[size].inner;
|
|
68
|
+
const radioBorderWidth = theme.components.radio?.borderWidth ?? 1.5;
|
|
69
|
+
const radioLabelGap = theme.components.radio?.labelGap ?? 10;
|
|
69
70
|
const progress = (0, _react.useRef)(new _reactNative.Animated.Value(selected ? 1 : 0)).current;
|
|
70
71
|
(0, _react.useEffect)(() => {
|
|
71
72
|
_reactNative.Animated.spring(progress, {
|
|
@@ -114,6 +115,7 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
114
115
|
style: [styles.outer, {
|
|
115
116
|
width: outer,
|
|
116
117
|
height: outer,
|
|
118
|
+
borderWidth: radioBorderWidth,
|
|
117
119
|
borderRadius: outer / 2,
|
|
118
120
|
borderColor
|
|
119
121
|
}, circleStyle],
|
|
@@ -131,6 +133,7 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
131
133
|
})
|
|
132
134
|
}), label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
133
135
|
style: [styles.label, {
|
|
136
|
+
marginLeft: radioLabelGap,
|
|
134
137
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary,
|
|
135
138
|
fontSize: theme.typography.fontSize.base
|
|
136
139
|
}],
|
|
@@ -146,13 +149,11 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
146
149
|
alignItems: 'center'
|
|
147
150
|
},
|
|
148
151
|
outer: {
|
|
149
|
-
borderWidth: 1.5,
|
|
150
152
|
alignItems: 'center',
|
|
151
153
|
justifyContent: 'center'
|
|
152
154
|
},
|
|
153
155
|
inner: {},
|
|
154
156
|
label: {
|
|
155
|
-
marginLeft: 10,
|
|
156
157
|
flexShrink: 1
|
|
157
158
|
}
|
|
158
159
|
});
|
|
@@ -58,7 +58,11 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
58
58
|
...rest
|
|
59
59
|
} = props;
|
|
60
60
|
const theme = (0, _index.useTheme)();
|
|
61
|
-
const sizeStyles =
|
|
61
|
+
const sizeStyles = {
|
|
62
|
+
...sizeMap[size],
|
|
63
|
+
...(theme.components.searchBar?.[size] ?? {})
|
|
64
|
+
};
|
|
65
|
+
const cancelWidth = theme.components.searchBar?.cancelButtonWidth ?? CANCEL_WIDTH;
|
|
62
66
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
63
67
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
64
68
|
const [internalValue, setInternalValue] = (0, _react.useState)(value);
|
|
@@ -127,7 +131,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
127
131
|
// Container shrinks left to make room for cancel button on right.
|
|
128
132
|
const cancelTranslateX = cancelAnim.interpolate({
|
|
129
133
|
inputRange: [0, 1],
|
|
130
|
-
outputRange: [
|
|
134
|
+
outputRange: [cancelWidth, 0]
|
|
131
135
|
});
|
|
132
136
|
const cancelOpacity = cancelAnim;
|
|
133
137
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
@@ -144,7 +148,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
144
148
|
opacity: disabled ? 0.55 : 1,
|
|
145
149
|
marginRight: cancelAnim.interpolate({
|
|
146
150
|
inputRange: [0, 1],
|
|
147
|
-
outputRange: [0,
|
|
151
|
+
outputRange: [0, cancelWidth + theme.spacing.sm]
|
|
148
152
|
})
|
|
149
153
|
}],
|
|
150
154
|
accessibilityRole: "search",
|
|
@@ -199,7 +203,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
199
203
|
}), showCancel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
200
204
|
pointerEvents: showCancelButton ? 'auto' : 'none',
|
|
201
205
|
style: [styles.cancelWrap, {
|
|
202
|
-
width:
|
|
206
|
+
width: cancelWidth,
|
|
203
207
|
transform: [{
|
|
204
208
|
translateX: cancelTranslateX
|
|
205
209
|
}],
|
|
@@ -215,7 +219,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
215
219
|
style: [styles.cancelText, {
|
|
216
220
|
color: theme.colors.primary,
|
|
217
221
|
fontSize: sizeStyles.fontSize,
|
|
218
|
-
|
|
222
|
+
...(0, _index.fontFor)(theme, 'medium')
|
|
219
223
|
}],
|
|
220
224
|
numberOfLines: 1,
|
|
221
225
|
children: cancelLabel
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _index = require("../../theme/index.js");
|
|
10
10
|
var _index2 = require("../../utils/index.js");
|
|
11
|
+
var _SkeletonProvider = require("./SkeletonProvider.js");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
14
|
const SPEED_DURATION = {
|
|
@@ -33,23 +34,30 @@ const resolveWidth = width => {
|
|
|
33
34
|
const Skeleton = ({
|
|
34
35
|
width = '100%',
|
|
35
36
|
height = 16,
|
|
36
|
-
radius
|
|
37
|
-
variant
|
|
38
|
-
speed
|
|
37
|
+
radius,
|
|
38
|
+
variant,
|
|
39
|
+
speed,
|
|
40
|
+
colors,
|
|
39
41
|
style,
|
|
40
42
|
testID
|
|
41
43
|
}) => {
|
|
42
44
|
const theme = (0, _index.useTheme)();
|
|
45
|
+
const defaults = (0, _SkeletonProvider.useSkeletonDefaults)();
|
|
46
|
+
const resolvedVariant = variant ?? defaults.variant ?? 'shimmer';
|
|
47
|
+
const resolvedSpeed = speed ?? defaults.speed ?? 'normal';
|
|
48
|
+
const resolvedRadiusToken = radius ?? defaults.radius ?? 'sm';
|
|
49
|
+
const backgroundColor = colors?.background ?? defaults.colors?.background ?? theme.colors.skeleton.background;
|
|
50
|
+
const highlightColor = colors?.highlight ?? defaults.colors?.highlight ?? theme.colors.skeleton.highlight;
|
|
43
51
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
44
|
-
const borderRadius = resolveRadius(theme,
|
|
52
|
+
const borderRadius = resolveRadius(theme, resolvedRadiusToken);
|
|
45
53
|
const resolvedWidth = resolveWidth(width);
|
|
46
54
|
const resolvedHeight = _index2.Responsive.size(height);
|
|
47
55
|
const progress = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
48
56
|
const [containerWidth, setContainerWidth] = (0, _react.useState)(0);
|
|
49
57
|
(0, _react.useEffect)(() => {
|
|
50
58
|
progress.setValue(0);
|
|
51
|
-
const duration =
|
|
52
|
-
const animation =
|
|
59
|
+
const duration = resolvedVariant === 'pulse' ? PULSE_DURATION : SPEED_DURATION[resolvedSpeed];
|
|
60
|
+
const animation = resolvedVariant === 'pulse' ? _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(progress, {
|
|
53
61
|
toValue: 1,
|
|
54
62
|
duration: duration / 2,
|
|
55
63
|
easing: _reactNative.Easing.inOut(_reactNative.Easing.ease),
|
|
@@ -69,17 +77,17 @@ const Skeleton = ({
|
|
|
69
77
|
return () => {
|
|
70
78
|
animation.stop();
|
|
71
79
|
};
|
|
72
|
-
}, [progress,
|
|
80
|
+
}, [progress, resolvedSpeed, resolvedVariant]);
|
|
73
81
|
const handleLayout = event => {
|
|
74
82
|
const next = event.nativeEvent.layout.width;
|
|
75
83
|
if (next !== containerWidth) setContainerWidth(next);
|
|
76
84
|
};
|
|
77
85
|
const overlay = (0, _react.useMemo)(() => {
|
|
78
|
-
if (
|
|
86
|
+
if (resolvedVariant === 'pulse') {
|
|
79
87
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
80
88
|
pointerEvents: "none",
|
|
81
89
|
style: [_reactNative.StyleSheet.absoluteFillObject, {
|
|
82
|
-
backgroundColor:
|
|
90
|
+
backgroundColor: highlightColor,
|
|
83
91
|
opacity: progress.interpolate({
|
|
84
92
|
inputRange: [0, 1],
|
|
85
93
|
outputRange: [0, 0.6]
|
|
@@ -97,13 +105,13 @@ const Skeleton = ({
|
|
|
97
105
|
pointerEvents: "none",
|
|
98
106
|
style: [styles.shimmer, {
|
|
99
107
|
width: highlightWidth,
|
|
100
|
-
backgroundColor:
|
|
108
|
+
backgroundColor: highlightColor,
|
|
101
109
|
transform: [{
|
|
102
110
|
translateX
|
|
103
111
|
}]
|
|
104
112
|
}]
|
|
105
113
|
});
|
|
106
|
-
}, [containerWidth, progress, styles.shimmer,
|
|
114
|
+
}, [containerWidth, progress, styles.shimmer, highlightColor, resolvedVariant]);
|
|
107
115
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
108
116
|
onLayout: handleLayout,
|
|
109
117
|
accessible: true,
|
|
@@ -115,7 +123,7 @@ const Skeleton = ({
|
|
|
115
123
|
width: resolvedWidth,
|
|
116
124
|
height: resolvedHeight,
|
|
117
125
|
borderRadius,
|
|
118
|
-
backgroundColor
|
|
126
|
+
backgroundColor
|
|
119
127
|
}, style],
|
|
120
128
|
children: overlay
|
|
121
129
|
});
|