@webority-technologies/mobile 0.0.7 → 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/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/Switch/Switch.js +31 -2
- package/lib/commonjs/components/Toast/Toast.js +16 -11
- 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/Switch/Switch.js +31 -2
- package/lib/module/components/Toast/Toast.js +17 -12
- 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/Switch/Switch.d.ts +5 -0
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +5 -0
- 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/Switch/Switch.d.ts +5 -0
- package/lib/typescript/module/components/Toast/Toast.d.ts +5 -0
- 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
|
@@ -61,28 +61,29 @@ const sizeMap = {
|
|
|
61
61
|
dot: 10
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
const anchorPosition = anchor => {
|
|
64
|
+
const anchorPosition = (anchor, offset) => {
|
|
65
|
+
const o = -offset;
|
|
65
66
|
switch (anchor) {
|
|
66
67
|
case 'topLeft':
|
|
67
68
|
return {
|
|
68
|
-
top:
|
|
69
|
-
left:
|
|
69
|
+
top: o,
|
|
70
|
+
left: o
|
|
70
71
|
};
|
|
71
72
|
case 'bottomRight':
|
|
72
73
|
return {
|
|
73
|
-
bottom:
|
|
74
|
-
right:
|
|
74
|
+
bottom: o,
|
|
75
|
+
right: o
|
|
75
76
|
};
|
|
76
77
|
case 'bottomLeft':
|
|
77
78
|
return {
|
|
78
|
-
bottom:
|
|
79
|
-
left:
|
|
79
|
+
bottom: o,
|
|
80
|
+
left: o
|
|
80
81
|
};
|
|
81
82
|
case 'topRight':
|
|
82
83
|
default:
|
|
83
84
|
return {
|
|
84
|
-
top:
|
|
85
|
-
right:
|
|
85
|
+
top: o,
|
|
86
|
+
right: o
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
};
|
|
@@ -115,7 +116,16 @@ const Badge = exports.Badge = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
115
116
|
} = props;
|
|
116
117
|
const theme = (0, _index.useTheme)();
|
|
117
118
|
const tones = (0, _react.useMemo)(() => toneFor(theme, tone), [theme, tone]);
|
|
118
|
-
const
|
|
119
|
+
const overrides = theme.components.badge?.[size];
|
|
120
|
+
const sz = {
|
|
121
|
+
fontSize: overrides?.fontSize ?? sizeMap[size].fontSize,
|
|
122
|
+
minWidth: overrides?.minWidth ?? sizeMap[size].minWidth,
|
|
123
|
+
height: overrides?.height ?? sizeMap[size].height,
|
|
124
|
+
paddingH: overrides?.paddingHorizontal ?? sizeMap[size].paddingH,
|
|
125
|
+
dot: overrides?.dotSize ?? sizeMap[size].dot
|
|
126
|
+
};
|
|
127
|
+
const badgeBorderWidth = theme.components.badge?.borderWidth ?? 1.5;
|
|
128
|
+
const badgeAnchorOffset = theme.components.badge?.anchorOffset ?? 4;
|
|
119
129
|
const formatted = variant === 'dot' ? null : formatValue(value, max);
|
|
120
130
|
const shouldRender = !invisible && (variant === 'dot' || formatted !== null);
|
|
121
131
|
const pulseScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
|
|
@@ -161,9 +171,9 @@ const Badge = exports.Badge = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
161
171
|
}]
|
|
162
172
|
}, children ? {
|
|
163
173
|
position: 'absolute',
|
|
164
|
-
borderWidth:
|
|
174
|
+
borderWidth: badgeBorderWidth,
|
|
165
175
|
borderColor: theme.colors.background.elevated,
|
|
166
|
-
...anchorPosition(anchor)
|
|
176
|
+
...anchorPosition(anchor, badgeAnchorOffset)
|
|
167
177
|
} : null, badgeStyle],
|
|
168
178
|
accessible: true,
|
|
169
179
|
accessibilityRole: a11yRole,
|
|
@@ -172,7 +182,7 @@ const Badge = exports.Badge = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
172
182
|
style: [styles.text, {
|
|
173
183
|
color: tones.text,
|
|
174
184
|
fontSize: sz.fontSize,
|
|
175
|
-
|
|
185
|
+
...(0, _index.fontFor)(theme, 'bold')
|
|
176
186
|
}, textStyle],
|
|
177
187
|
numberOfLines: 1,
|
|
178
188
|
allowFontScaling: false,
|
|
@@ -48,6 +48,7 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
48
48
|
enablePanDownToClose = true,
|
|
49
49
|
enableBackdropPress = true,
|
|
50
50
|
backdropOpacity = 0.5,
|
|
51
|
+
keyboardBehavior = 'none',
|
|
51
52
|
handleIndicatorStyle,
|
|
52
53
|
containerStyle,
|
|
53
54
|
children,
|
|
@@ -240,12 +241,45 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.forwardRef)((p
|
|
|
240
241
|
});
|
|
241
242
|
}, [closedY, dragStartY, enablePanDownToClose, handleSnapEnd, minTopY, snapTargets, translateY]);
|
|
242
243
|
|
|
244
|
+
// ───────── Keyboard tracking ─────────
|
|
245
|
+
// keyboardOffset is added to translateY in sheetStyle so we don't disturb
|
|
246
|
+
// snap-point math. iOS gets keyboardWillShow/Hide (smoother), Android only
|
|
247
|
+
// emits keyboardDidShow/Hide.
|
|
248
|
+
const keyboardOffset = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
249
|
+
(0, _react.useEffect)(() => {
|
|
250
|
+
if (keyboardBehavior === 'none') return;
|
|
251
|
+
const showEvt = _reactNative.Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
|
|
252
|
+
const hideEvt = _reactNative.Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
253
|
+
const onShow = e => {
|
|
254
|
+
const h = e.endCoordinates?.height ?? 0;
|
|
255
|
+
keyboardOffset.value = (0, _reactNativeReanimated.withTiming)(-h, {
|
|
256
|
+
duration: 220
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
const onHide = () => {
|
|
260
|
+
keyboardOffset.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
261
|
+
duration: 220
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
const showSub = _reactNative.Keyboard.addListener(showEvt, onShow);
|
|
265
|
+
const hideSub = _reactNative.Keyboard.addListener(hideEvt, onHide);
|
|
266
|
+
return () => {
|
|
267
|
+
showSub.remove();
|
|
268
|
+
hideSub.remove();
|
|
269
|
+
};
|
|
270
|
+
}, [keyboardBehavior, keyboardOffset]);
|
|
271
|
+
|
|
243
272
|
// ───────── Animated styles ─────────
|
|
244
|
-
const sheetStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() =>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
273
|
+
const sheetStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
274
|
+
// Don't push past the screen top — keyboard offset is clamped to minTopY.
|
|
275
|
+
const yWithKb = translateY.value + keyboardOffset.value;
|
|
276
|
+
const clamped = yWithKb < minTopY ? minTopY : yWithKb;
|
|
277
|
+
return {
|
|
278
|
+
transform: [{
|
|
279
|
+
translateY: clamped
|
|
280
|
+
}]
|
|
281
|
+
};
|
|
282
|
+
});
|
|
249
283
|
const backdropStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
250
284
|
// 0 opacity when sheet is closed, full backdropOpacity at minSnap height (and above).
|
|
251
285
|
const closedAt = screenHeight;
|
|
@@ -26,6 +26,7 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
26
26
|
rightIcon,
|
|
27
27
|
haptic = 'selection',
|
|
28
28
|
rounded = false,
|
|
29
|
+
gradient,
|
|
29
30
|
style,
|
|
30
31
|
textStyle,
|
|
31
32
|
pressAnimation = true,
|
|
@@ -45,9 +46,22 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
45
46
|
enabled: pressAnimation && isInteractive
|
|
46
47
|
});
|
|
47
48
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
48
|
-
const sizeStyles =
|
|
49
|
+
const sizeStyles = {
|
|
50
|
+
...sizeMap[size],
|
|
51
|
+
...(theme.components.button?.[size] ?? {})
|
|
52
|
+
};
|
|
49
53
|
const toneColors = (0, _react.useMemo)(() => toneFor(theme, tone), [theme, tone]);
|
|
50
54
|
const variantStyles = (0, _react.useMemo)(() => variantFor(theme, variant, toneColors, disabled), [theme, variant, toneColors, disabled]);
|
|
55
|
+
|
|
56
|
+
// Resolve gradient: string token → theme.gradients[token]; literal passes through.
|
|
57
|
+
// Skipped when disabled (parity with disabled flat-color treatment).
|
|
58
|
+
const resolvedGradient = (0, _react.useMemo)(() => {
|
|
59
|
+
if (!gradient || disabled || variant !== 'solid') return null;
|
|
60
|
+
if (typeof gradient === 'string') {
|
|
61
|
+
return theme.gradients[gradient] ?? null;
|
|
62
|
+
}
|
|
63
|
+
return gradient;
|
|
64
|
+
}, [gradient, disabled, variant, theme.gradients]);
|
|
51
65
|
const handlePress = event => {
|
|
52
66
|
if (!isInteractive) return;
|
|
53
67
|
if (haptic !== false) (0, _hapticUtils.triggerHaptic)(haptic);
|
|
@@ -69,7 +83,7 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
69
83
|
style: [styles.label, {
|
|
70
84
|
color: variantStyles.textColor,
|
|
71
85
|
fontSize: sizeStyles.fontSize,
|
|
72
|
-
|
|
86
|
+
...(0, _index.fontFor)(theme, 'semibold')
|
|
73
87
|
}, textStyle],
|
|
74
88
|
numberOfLines: 1,
|
|
75
89
|
children: title
|
|
@@ -85,7 +99,7 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
85
99
|
scale
|
|
86
100
|
}]
|
|
87
101
|
}, fullWidth ? styles.fullWidth : null],
|
|
88
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
102
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
89
103
|
ref: ref,
|
|
90
104
|
onPress: handlePress,
|
|
91
105
|
onPressIn: pressIn,
|
|
@@ -113,15 +127,20 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
113
127
|
paddingVertical: sizeStyles.paddingVertical,
|
|
114
128
|
minHeight: sizeStyles.minHeight,
|
|
115
129
|
borderRadius: rounded ? theme.radius.full : sizeStyles.borderRadius,
|
|
116
|
-
|
|
130
|
+
// Hide solid bg when a gradient layer covers it; preserve outline borders.
|
|
131
|
+
backgroundColor: resolvedGradient ? 'transparent' : variantStyles.backgroundColor,
|
|
117
132
|
borderWidth: variantStyles.borderWidth,
|
|
118
133
|
borderColor: variantStyles.borderColor,
|
|
119
|
-
opacity: !isInteractive ? 0.55 : 1
|
|
134
|
+
opacity: !isInteractive ? 0.55 : 1,
|
|
135
|
+
overflow: resolvedGradient ? 'hidden' : undefined
|
|
120
136
|
}, pressed && variant !== 'solid' ? {
|
|
121
137
|
backgroundColor: theme.colors.surface.pressed
|
|
122
138
|
} : null, fullWidth ? styles.fullWidth : null, style],
|
|
123
139
|
...rest,
|
|
124
|
-
children:
|
|
140
|
+
children: [resolvedGradient ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Gradient, {
|
|
141
|
+
gradient: resolvedGradient,
|
|
142
|
+
style: _reactNative.StyleSheet.absoluteFill
|
|
143
|
+
}) : null, content]
|
|
125
144
|
})
|
|
126
145
|
});
|
|
127
146
|
});
|
|
@@ -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;
|