@utilitywarehouse/hearth-react-native 0.17.0 → 0.19.0
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +21 -18
- package/CHANGELOG.md +144 -0
- package/build/components/Banner/Banner.d.ts +1 -1
- package/build/components/Banner/Banner.js +24 -4
- package/build/components/Banner/Banner.props.d.ts +1 -6
- package/build/components/BodyText/BodyText.js +2 -2
- package/build/components/Box/Box.props.d.ts +5 -2
- package/build/components/Button/Button.d.ts +2 -0
- package/build/components/Button/ButtonGroupRoot.d.ts +5 -1
- package/build/components/Button/ButtonGroupRoot.js +3 -3
- package/build/components/Card/Card.context.d.ts +1 -1
- package/build/components/Card/Card.props.d.ts +2 -0
- package/build/components/Card/CardContent.js +3 -3
- package/build/components/Card/CardRoot.d.ts +1 -1
- package/build/components/Card/CardRoot.js +14 -4
- package/build/components/Checkbox/CheckboxGroupTextContent.js +1 -1
- package/build/components/Checkbox/CheckboxTextContent.js +1 -1
- package/build/components/Container/Container.d.ts +1 -1
- package/build/components/Container/Container.js +3 -3
- package/build/components/Container/Container.props.d.ts +5 -0
- package/build/components/Divider/Divider.d.ts +1 -1
- package/build/components/Divider/Divider.js +19 -19
- package/build/components/Divider/Divider.props.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardExpandedContent.js +1 -1
- package/build/components/Flex/Flex.d.ts +1 -1
- package/build/components/Flex/Flex.js +3 -3
- package/build/components/Flex/Flex.props.d.ts +5 -0
- package/build/components/Grid/Grid.d.ts +1 -1
- package/build/components/Grid/Grid.js +4 -4
- package/build/components/Grid/Grid.props.d.ts +5 -0
- package/build/components/IconButton/IconButton.props.d.ts +19 -0
- package/build/components/IconButton/IconButtonRoot.d.ts +1 -1
- package/build/components/IconButton/IconButtonRoot.js +43 -2
- package/build/components/List/ListItem/ListItemHelperText.d.ts +1 -1
- package/build/components/List/ListItem/ListItemHelperText.js +2 -2
- package/build/components/Modal/Modal.js +14 -4
- package/build/components/Radio/RadioGroupTextContent.js +1 -1
- package/build/components/Radio/RadioTextContent.js +1 -1
- package/build/components/Toast/Toast.context.d.ts +2 -4
- package/build/components/Toast/Toast.context.js +14 -2
- package/build/components/Toast/Toast.props.d.ts +4 -0
- package/build/components/Toast/ToastItem.js +2 -1
- package/build/components/VerificationInput/VerificationInput.d.ts +2 -5
- package/build/components/VerificationInput/VerificationInput.js +20 -7
- package/build/components/VerificationInput/VerificationInput.props.d.ts +10 -0
- package/build/components/VerificationInput/index.d.ts +1 -1
- package/build/components/VerificationInput/useVerificationInput.d.ts +1 -0
- package/build/components/VerificationInput/useVerificationInput.js +24 -9
- package/build/core/themes.d.ts +4 -4
- package/build/core/themes.js +1 -1
- package/build/types/values.d.ts +1 -1
- package/docs/components/AllComponents.web.tsx +9 -9
- package/docs/layout-components.docs.mdx +3 -3
- package/package.json +4 -4
- package/src/components/Alert/Alert.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +4 -5
- package/src/components/Badge/Badge.stories.tsx +3 -3
- package/src/components/Banner/Banner.docs.mdx +1 -1
- package/src/components/Banner/Banner.props.ts +13 -20
- package/src/components/Banner/Banner.stories.tsx +83 -15
- package/src/components/Banner/Banner.tsx +27 -3
- package/src/components/BodyText/BodyText.tsx +2 -2
- package/src/components/Box/Box.props.ts +11 -4
- package/src/components/Button/Button.docs.mdx +2 -2
- package/src/components/Button/Button.stories.tsx +4 -4
- package/src/components/Button/ButtonGroupRoot.tsx +8 -3
- package/src/components/Card/Card.context.ts +1 -1
- package/src/components/Card/Card.docs.mdx +1 -1
- package/src/components/Card/Card.props.ts +2 -0
- package/src/components/Card/Card.stories.tsx +9 -9
- package/src/components/Card/CardAction/CardAction.stories.tsx +2 -2
- package/src/components/Card/CardContent.tsx +3 -3
- package/src/components/Card/CardRoot.tsx +15 -5
- package/src/components/Checkbox/CheckboxGroupTextContent.tsx +2 -2
- package/src/components/Checkbox/CheckboxTextContent.tsx +1 -1
- package/src/components/Container/Container.docs.mdx +2 -2
- package/src/components/Container/Container.props.ts +5 -0
- package/src/components/Container/Container.stories.tsx +2 -2
- package/src/components/Container/Container.tsx +3 -3
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +1 -1
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +2 -2
- package/src/components/DateInput/DateInput.stories.tsx +3 -3
- package/src/components/DatePickerInput/DatePickerInput.stories.tsx +1 -1
- package/src/components/DescriptionList/DescriptionList.stories.tsx +1 -1
- package/src/components/Divider/Divider.docs.mdx +6 -6
- package/src/components/Divider/Divider.props.ts +6 -0
- package/src/components/Divider/Divider.tsx +19 -18
- package/src/components/ExpandableCard/ExpandableCardExpandedContent.tsx +1 -1
- package/src/components/Flex/Flex.docs.mdx +3 -3
- package/src/components/Flex/Flex.props.ts +5 -0
- package/src/components/Flex/Flex.stories.tsx +2 -2
- package/src/components/Flex/Flex.tsx +4 -3
- package/src/components/FormField/FormField.docs.mdx +1 -1
- package/src/components/FormField/FormField.stories.tsx +1 -1
- package/src/components/Grid/Grid.docs.mdx +5 -5
- package/src/components/Grid/Grid.props.ts +6 -0
- package/src/components/Grid/Grid.stories.tsx +8 -8
- package/src/components/Grid/Grid.tsx +4 -3
- package/src/components/HighlightBanner/HighlightBanner.docs.mdx +1 -1
- package/src/components/HighlightBanner/HighlightBanner.stories.tsx +2 -2
- package/src/components/Icon/Icon.docs.mdx +3 -3
- package/src/components/IconButton/IconButton.docs.mdx +91 -9
- package/src/components/IconButton/IconButton.props.ts +19 -0
- package/src/components/IconButton/IconButton.stories.tsx +60 -4
- package/src/components/IconButton/IconButtonRoot.tsx +54 -1
- package/src/components/IconContainer/IconContainer.docs.mdx +1 -1
- package/src/components/IconContainer/IconContainer.stories.tsx +3 -3
- package/src/components/IndicatorIconButton/IndicatorIconButton.stories.tsx +17 -9
- package/src/components/InlineLink/InlineLink.stories.tsx +2 -2
- package/src/components/Input/Input.stories.tsx +4 -4
- package/src/components/List/List.stories.tsx +1 -1
- package/src/components/List/ListItem/ListItemHelperText.tsx +2 -2
- package/src/components/Modal/Modal.tsx +18 -4
- package/src/components/PillGroup/PillGroup.stories.tsx +7 -7
- package/src/components/ProgressStepper/ProgressStepper.stories.tsx +7 -8
- package/src/components/Radio/Radio.stories.tsx +1 -1
- package/src/components/Radio/RadioGroup.stories.tsx +1 -1
- package/src/components/Radio/RadioGroupTextContent.tsx +2 -2
- package/src/components/Radio/RadioTextContent.tsx +1 -1
- package/src/components/SectionHeader/SectionHeader.stories.tsx +1 -1
- package/src/components/Switch/Switch.docs.mdx +8 -8
- package/src/components/Switch/Switch.stories.tsx +2 -2
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.docs.mdx +3 -3
- package/src/components/Toast/Toast.context.tsx +24 -3
- package/src/components/Toast/Toast.props.ts +5 -0
- package/src/components/Toast/Toast.stories.tsx +29 -0
- package/src/components/Toast/ToastItem.tsx +4 -1
- package/src/components/UnstyledIconButton/UnstyledIconButton.stories.tsx +5 -5
- package/src/components/VerificationInput/VerificationInput.docs.mdx +31 -8
- package/src/components/VerificationInput/VerificationInput.props.ts +11 -0
- package/src/components/VerificationInput/VerificationInput.stories.tsx +79 -3
- package/src/components/VerificationInput/VerificationInput.tsx +94 -62
- package/src/components/VerificationInput/index.ts +4 -2
- package/src/components/VerificationInput/useVerificationInput.ts +26 -10
- package/src/core/themes.ts +1 -1
- package/src/types/values.ts +1 -1
|
@@ -4,8 +4,8 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
import { getFlattenedColorValue } from '../../utils';
|
|
7
|
-
const Divider = ({ orientation = 'horizontal', color, space, height, width, flexItem, ...props }) => {
|
|
8
|
-
styles.useVariants({ orientation, space, flexItem });
|
|
7
|
+
const Divider = ({ orientation = 'horizontal', color, spacing, space, height, width, flexItem, ...props }) => {
|
|
8
|
+
styles.useVariants({ orientation, spacing: space ?? spacing, flexItem });
|
|
9
9
|
const { color: themeColor, colorMode } = useTheme();
|
|
10
10
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11
11
|
const colorValue = useMemo(() => getFlattenedColorValue(color, themeColor), [color, colorMode]);
|
|
@@ -26,7 +26,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
26
26
|
width: theme.components.divider.borderWidth,
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
spacing: {
|
|
30
30
|
none: {},
|
|
31
31
|
'2xs': {},
|
|
32
32
|
xs: {},
|
|
@@ -45,14 +45,14 @@ const styles = StyleSheet.create(theme => ({
|
|
|
45
45
|
compoundVariants: [
|
|
46
46
|
{
|
|
47
47
|
orientation: 'horizontal',
|
|
48
|
-
|
|
48
|
+
spacing: 'none',
|
|
49
49
|
styles: {
|
|
50
50
|
marginVertical: 0,
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
orientation: 'horizontal',
|
|
55
|
-
|
|
55
|
+
spacing: '2xs',
|
|
56
56
|
styles: {
|
|
57
57
|
marginVertical: {
|
|
58
58
|
base: theme.layout.mobile.spacing['2xs'],
|
|
@@ -63,7 +63,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
orientation: 'horizontal',
|
|
66
|
-
|
|
66
|
+
spacing: 'xs',
|
|
67
67
|
styles: {
|
|
68
68
|
marginVertical: {
|
|
69
69
|
base: theme.layout.mobile.spacing.xs,
|
|
@@ -74,7 +74,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
orientation: 'horizontal',
|
|
77
|
-
|
|
77
|
+
spacing: 'sm',
|
|
78
78
|
styles: {
|
|
79
79
|
marginVertical: {
|
|
80
80
|
base: theme.layout.mobile.spacing.sm,
|
|
@@ -85,7 +85,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
orientation: 'horizontal',
|
|
88
|
-
|
|
88
|
+
spacing: 'md',
|
|
89
89
|
styles: {
|
|
90
90
|
marginVertical: {
|
|
91
91
|
base: theme.layout.mobile.spacing.md,
|
|
@@ -96,7 +96,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
orientation: 'horizontal',
|
|
99
|
-
|
|
99
|
+
spacing: 'lg',
|
|
100
100
|
styles: {
|
|
101
101
|
marginVertical: {
|
|
102
102
|
base: theme.layout.mobile.spacing.lg,
|
|
@@ -107,7 +107,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
orientation: 'horizontal',
|
|
110
|
-
|
|
110
|
+
spacing: 'xl',
|
|
111
111
|
styles: {
|
|
112
112
|
marginVertical: {
|
|
113
113
|
base: theme.layout.mobile.spacing.xl,
|
|
@@ -118,7 +118,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
orientation: 'horizontal',
|
|
121
|
-
|
|
121
|
+
spacing: '2xl',
|
|
122
122
|
styles: {
|
|
123
123
|
marginVertical: {
|
|
124
124
|
base: theme.layout.mobile.spacing['2xl'],
|
|
@@ -129,14 +129,14 @@ const styles = StyleSheet.create(theme => ({
|
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
orientation: 'vertical',
|
|
132
|
-
|
|
132
|
+
spacing: 'none',
|
|
133
133
|
styles: {
|
|
134
134
|
marginHorizontal: 0,
|
|
135
135
|
},
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
orientation: 'vertical',
|
|
139
|
-
|
|
139
|
+
spacing: '2xs',
|
|
140
140
|
styles: {
|
|
141
141
|
marginHorizontal: {
|
|
142
142
|
base: theme.layout.mobile.spacing['2xs'],
|
|
@@ -147,7 +147,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
orientation: 'vertical',
|
|
150
|
-
|
|
150
|
+
spacing: 'xs',
|
|
151
151
|
styles: {
|
|
152
152
|
marginHorizontal: {
|
|
153
153
|
base: theme.layout.mobile.spacing.xs,
|
|
@@ -158,7 +158,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
orientation: 'vertical',
|
|
161
|
-
|
|
161
|
+
spacing: 'sm',
|
|
162
162
|
styles: {
|
|
163
163
|
marginHorizontal: {
|
|
164
164
|
base: theme.layout.mobile.spacing.sm,
|
|
@@ -169,7 +169,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
orientation: 'vertical',
|
|
172
|
-
|
|
172
|
+
spacing: 'md',
|
|
173
173
|
styles: {
|
|
174
174
|
marginHorizontal: {
|
|
175
175
|
base: theme.layout.mobile.spacing.md,
|
|
@@ -180,7 +180,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
180
180
|
},
|
|
181
181
|
{
|
|
182
182
|
orientation: 'vertical',
|
|
183
|
-
|
|
183
|
+
spacing: 'lg',
|
|
184
184
|
styles: {
|
|
185
185
|
marginHorizontal: {
|
|
186
186
|
base: theme.layout.mobile.spacing.lg,
|
|
@@ -191,7 +191,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
193
|
orientation: 'vertical',
|
|
194
|
-
|
|
194
|
+
spacing: 'xl',
|
|
195
195
|
styles: {
|
|
196
196
|
marginHorizontal: {
|
|
197
197
|
base: theme.layout.mobile.spacing.xl,
|
|
@@ -202,7 +202,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
204
|
orientation: 'vertical',
|
|
205
|
-
|
|
205
|
+
spacing: '2xl',
|
|
206
206
|
styles: {
|
|
207
207
|
marginHorizontal: {
|
|
208
208
|
base: theme.layout.mobile.spacing['2xl'],
|
|
@@ -2,6 +2,12 @@ import type { DimensionValue, ViewProps } from 'react-native';
|
|
|
2
2
|
import type { ColorValue, SpacingValues } from '../../types';
|
|
3
3
|
interface DividerProps extends Omit<ViewProps, 'children'> {
|
|
4
4
|
color?: ColorValue;
|
|
5
|
+
backgroundColor?: ColorValue;
|
|
6
|
+
spacing?: SpacingValues;
|
|
7
|
+
/**
|
|
8
|
+
* The space between child elements (gap).
|
|
9
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
10
|
+
*/
|
|
5
11
|
space?: SpacingValues;
|
|
6
12
|
orientation?: 'horizontal' | 'vertical';
|
|
7
13
|
height?: DimensionValue;
|
|
@@ -4,7 +4,7 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { Divider } from '../Divider';
|
|
5
5
|
import { Expandable } from '../Expandable';
|
|
6
6
|
const ExpandableCardExpandedContent = ({ children, isExpanded, duration = 200, animateOpacity = true, }) => {
|
|
7
|
-
return (_jsx(View, { style: styles.container, children: _jsx(Expandable, { expanded: isExpanded, duration: duration, animateOpacity: animateOpacity, children: _jsxs(View, { children: [_jsx(Divider, {
|
|
7
|
+
return (_jsx(View, { style: styles.container, children: _jsx(Expandable, { expanded: isExpanded, duration: duration, animateOpacity: animateOpacity, children: _jsxs(View, { children: [_jsx(Divider, { spacing: "none" }), _jsx(View, { style: styles.content, children: children })] }) }) }));
|
|
8
8
|
};
|
|
9
9
|
ExpandableCardExpandedContent.displayName = 'ExpandableCardExpandedContent';
|
|
10
10
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import FlexProps from './Flex.props';
|
|
2
2
|
declare const Flex: {
|
|
3
|
-
({ style, children, direction, align, justify, wrap, space, ...rest }: FlexProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ style, children, direction, align, justify, wrap, spacing, space, ...rest }: FlexProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Flex;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
-
const Flex = ({ style, children, direction = 'column', align = 'flex-start', justify = 'flex-start', wrap = 'nowrap',
|
|
4
|
+
const Flex = ({ style, children, direction = 'column', align = 'flex-start', justify = 'flex-start', wrap = 'nowrap', spacing = 'md', space, ...rest }) => {
|
|
5
5
|
const propStyle = {
|
|
6
6
|
flexDirection: direction,
|
|
7
7
|
alignItems: align,
|
|
8
8
|
justifyContent: justify,
|
|
9
9
|
flexWrap: wrap,
|
|
10
10
|
};
|
|
11
|
-
styles.useVariants({ space });
|
|
11
|
+
styles.useVariants({ spacing: space ?? spacing });
|
|
12
12
|
return (_jsx(View, { style: [propStyle, styles.flex, style], ...rest, children: children }));
|
|
13
13
|
};
|
|
14
14
|
Flex.displayName = 'Flex';
|
|
@@ -16,7 +16,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
16
16
|
flex: {
|
|
17
17
|
display: 'flex',
|
|
18
18
|
variants: {
|
|
19
|
-
|
|
19
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
}));
|
|
@@ -5,6 +5,11 @@ interface FlexProps extends ViewProps {
|
|
|
5
5
|
align?: FlexAlignType;
|
|
6
6
|
justify?: ViewStyle['justifyContent'];
|
|
7
7
|
wrap?: ViewStyle['flexWrap'];
|
|
8
|
+
spacing?: SpacingValues;
|
|
9
|
+
/**
|
|
10
|
+
* The space between child elements (gap).
|
|
11
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
12
|
+
*/
|
|
8
13
|
space?: SpacingValues;
|
|
9
14
|
}
|
|
10
15
|
export default FlexProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GridProps } from './Grid.props';
|
|
2
2
|
declare const Grid: {
|
|
3
|
-
({ columns, containerStyle, itemStyle, rowStyle, space, children, ...props }: GridProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ columns, containerStyle, itemStyle, rowStyle, spacing, space, children, ...props }: GridProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Grid;
|
|
@@ -3,13 +3,13 @@ import React, { useMemo } from 'react';
|
|
|
3
3
|
import { useWindowDimensions, View } from 'react-native';
|
|
4
4
|
import { StyleSheet, UnistylesRuntime } from 'react-native-unistyles';
|
|
5
5
|
import { useStyleProps, useTheme } from '../../hooks';
|
|
6
|
-
const Grid = ({ columns = 2, containerStyle, itemStyle, rowStyle, space, children, ...props }) => {
|
|
6
|
+
const Grid = ({ columns = 2, containerStyle, itemStyle, rowStyle, spacing, space, children, ...props }) => {
|
|
7
7
|
const { breakpoints } = useTheme();
|
|
8
8
|
const { computedStyles, remainingProps } = useStyleProps(props);
|
|
9
9
|
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
10
10
|
const { width } = useWindowDimensions();
|
|
11
11
|
const { gap, columnGap, rowGap } = { ...remainingProps, ...computedStyles };
|
|
12
|
-
styles.useVariants({ space });
|
|
12
|
+
styles.useVariants({ spacing: space ?? spacing });
|
|
13
13
|
const getColumnsForWidth = useMemo(() => {
|
|
14
14
|
// If columns is a number, use that number
|
|
15
15
|
if (typeof columns === 'number') {
|
|
@@ -78,14 +78,14 @@ const styles = StyleSheet.create(theme => ({
|
|
|
78
78
|
rowsContainer: {
|
|
79
79
|
width: '100%',
|
|
80
80
|
variants: {
|
|
81
|
-
|
|
81
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
row: {
|
|
85
85
|
flexDirection: 'row',
|
|
86
86
|
width: '100%',
|
|
87
87
|
variants: {
|
|
88
|
-
|
|
88
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
91
|
item: {
|
|
@@ -13,6 +13,11 @@ export interface GridProps extends ViewProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* Spacing between grid items (applies to both rows and columns)
|
|
15
15
|
*/
|
|
16
|
+
spacing?: SpacingValues;
|
|
17
|
+
/**
|
|
18
|
+
* Spacing between grid items (applies to both rows and columns)
|
|
19
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
20
|
+
*/
|
|
16
21
|
space?: SpacingValues;
|
|
17
22
|
/**
|
|
18
23
|
* Gap between items (overrides spacing if provided)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { PressableProps } from 'react-native';
|
|
3
3
|
import { ViewProps } from 'react-native-svg/lib/typescript/fabric/utils';
|
|
4
|
+
import { ColorValue } from '../../types';
|
|
4
5
|
import { ButtonVariants } from '../Button/Button.props';
|
|
5
6
|
export type IconButtonProps = {
|
|
6
7
|
disabled?: boolean;
|
|
@@ -9,4 +10,22 @@ export type IconButtonProps = {
|
|
|
9
10
|
icon: ComponentType;
|
|
10
11
|
loading?: boolean;
|
|
11
12
|
children?: ViewProps['children'];
|
|
13
|
+
/**
|
|
14
|
+
* Custom background color override.
|
|
15
|
+
* ⚠️ Use sparingly and only for specific use cases (e.g., service buttons).
|
|
16
|
+
* @default undefined
|
|
17
|
+
*/
|
|
18
|
+
backgroundColor?: ColorValue;
|
|
19
|
+
/**
|
|
20
|
+
* Custom active/pressed background color override.
|
|
21
|
+
* ⚠️ Use sparingly and only for specific use cases (e.g., service buttons).
|
|
22
|
+
* @default undefined
|
|
23
|
+
*/
|
|
24
|
+
activeBackgroundColor?: ColorValue;
|
|
25
|
+
/**
|
|
26
|
+
* Custom shadow color override.
|
|
27
|
+
* ⚠️ Use sparingly and only for specific use cases (e.g., service buttons).
|
|
28
|
+
* @default undefined
|
|
29
|
+
*/
|
|
30
|
+
shadowColor?: ColorValue;
|
|
12
31
|
} & Omit<PressableProps, 'children'> & ButtonVariants;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IconButtonProps } from './IconButton.props';
|
|
2
2
|
declare const IconButtonRoot: {
|
|
3
|
-
({ children, colorScheme, variant, size, inverted, states, ...props }: IconButtonProps & {
|
|
3
|
+
({ children, colorScheme, variant, size, inverted, states, backgroundColor, activeBackgroundColor, shadowColor, ...props }: IconButtonProps & {
|
|
4
4
|
states?: {
|
|
5
5
|
active?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
@@ -2,12 +2,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
+
import { getFlattenedColorValue } from '../../utils';
|
|
5
6
|
import { IconButtonContext } from './IconButton.context';
|
|
6
|
-
const IconButtonRoot = ({ children, colorScheme = 'highlight', variant = 'solid', size = 'md', inverted = false, states, ...props }) => {
|
|
7
|
+
const IconButtonRoot = ({ children, colorScheme = 'highlight', variant = 'solid', size = 'md', inverted = false, states, backgroundColor, activeBackgroundColor, shadowColor, ...props }) => {
|
|
7
8
|
const { active, disabled } = states || {};
|
|
8
9
|
styles.useVariants({ colorScheme, variant, size, inverted, disabled, active });
|
|
9
10
|
const value = useMemo(() => ({ colorScheme, variant, size, inverted, disabled, active }), [colorScheme, variant, size, inverted, disabled, active]);
|
|
10
|
-
return (_jsx(IconButtonContext.Provider, { value: value, children: _jsx(Pressable, { ...props, style: [
|
|
11
|
+
return (_jsx(IconButtonContext.Provider, { value: value, children: _jsx(Pressable, { ...props, style: [
|
|
12
|
+
styles.container,
|
|
13
|
+
styles.overrides({
|
|
14
|
+
backgroundColor,
|
|
15
|
+
activeBackgroundColor,
|
|
16
|
+
shadowColor,
|
|
17
|
+
active,
|
|
18
|
+
variant,
|
|
19
|
+
}),
|
|
20
|
+
props.style,
|
|
21
|
+
], children: children }) }));
|
|
11
22
|
};
|
|
12
23
|
IconButtonRoot.displayName = 'IconButtonRoot';
|
|
13
24
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -394,5 +405,35 @@ const styles = StyleSheet.create(theme => ({
|
|
|
394
405
|
},
|
|
395
406
|
],
|
|
396
407
|
},
|
|
408
|
+
overrides: ({ backgroundColor, activeBackgroundColor, shadowColor, active, variant }) => ({
|
|
409
|
+
...(backgroundColor
|
|
410
|
+
? {
|
|
411
|
+
backgroundColor: getFlattenedColorValue(backgroundColor, theme.color),
|
|
412
|
+
_web: {
|
|
413
|
+
_hover: {
|
|
414
|
+
backgroundColor: getFlattenedColorValue(activeBackgroundColor ?? backgroundColor, theme.color),
|
|
415
|
+
},
|
|
416
|
+
_active: {
|
|
417
|
+
backgroundColor: getFlattenedColorValue(activeBackgroundColor ?? backgroundColor, theme.color),
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
}
|
|
421
|
+
: {}),
|
|
422
|
+
...(active && activeBackgroundColor
|
|
423
|
+
? {
|
|
424
|
+
backgroundColor: getFlattenedColorValue(activeBackgroundColor, theme.color),
|
|
425
|
+
}
|
|
426
|
+
: {}),
|
|
427
|
+
...(shadowColor && variant === 'emphasis'
|
|
428
|
+
? {
|
|
429
|
+
boxShadow: `${theme.shadow.mobile.sm.x}px ${theme.shadow.mobile.sm.y}px ${theme.shadow.mobile.sm.spread}px ${getFlattenedColorValue(shadowColor, theme.color)}`,
|
|
430
|
+
}
|
|
431
|
+
: {}),
|
|
432
|
+
...(active && shadowColor && variant === 'emphasis'
|
|
433
|
+
? {
|
|
434
|
+
boxShadow: 'none',
|
|
435
|
+
}
|
|
436
|
+
: {}),
|
|
437
|
+
}),
|
|
397
438
|
}));
|
|
398
439
|
export default IconButtonRoot;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BodyTextProps } from '../../BodyText';
|
|
2
2
|
declare const ListItemHelperText: {
|
|
3
|
-
({ children, ...props }: BodyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, style, ...props }: BodyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default ListItemHelperText;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
import { BodyText } from '../../BodyText';
|
|
4
|
-
const ListItemHelperText = ({ children, ...props }) => {
|
|
5
|
-
return (_jsx(BodyText, { size: "md",
|
|
4
|
+
const ListItemHelperText = ({ children, style, ...props }) => {
|
|
5
|
+
return (_jsx(BodyText, { size: "md", style: [styles.text, style], ...props, children: children }));
|
|
6
6
|
};
|
|
7
7
|
ListItemHelperText.displayName = 'ListItemHelperText';
|
|
8
8
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -138,21 +138,31 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
138
138
|
variants: {
|
|
139
139
|
bothButtons: {
|
|
140
140
|
true: {
|
|
141
|
-
paddingBottom: 166 +
|
|
141
|
+
paddingBottom: 166 +
|
|
142
|
+
rt.insets.bottom -
|
|
143
|
+
theme.components.modal.padding +
|
|
144
|
+
theme.components.bottomSheet.padding,
|
|
142
145
|
},
|
|
143
146
|
false: {
|
|
144
|
-
paddingBottom: 102 +
|
|
147
|
+
paddingBottom: 102 +
|
|
148
|
+
rt.insets.bottom -
|
|
149
|
+
theme.components.modal.padding +
|
|
150
|
+
theme.components.bottomSheet.padding,
|
|
145
151
|
},
|
|
146
152
|
},
|
|
147
153
|
noButtons: {
|
|
148
154
|
true: {
|
|
149
|
-
paddingBottom: rt.insets.bottom +
|
|
155
|
+
paddingBottom: rt.insets.bottom +
|
|
156
|
+
theme.components.modal.padding +
|
|
157
|
+
theme.components.bottomSheet.padding,
|
|
150
158
|
},
|
|
151
159
|
},
|
|
152
160
|
stickyFooter: {
|
|
153
161
|
true: {},
|
|
154
162
|
false: {
|
|
155
|
-
paddingBottom: rt.insets.bottom +
|
|
163
|
+
paddingBottom: rt.insets.bottom +
|
|
164
|
+
theme.components.modal.padding +
|
|
165
|
+
theme.components.bottomSheet.padding,
|
|
156
166
|
},
|
|
157
167
|
},
|
|
158
168
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Flex } from '../Flex';
|
|
3
3
|
const RadioGroupTextContent = ({ children, ...props }) => {
|
|
4
|
-
return (_jsx(Flex, { direction: "column",
|
|
4
|
+
return (_jsx(Flex, { direction: "column", spacing: "none", ...props, children: children }));
|
|
5
5
|
};
|
|
6
6
|
RadioGroupTextContent.displayName = 'RadioGroupTextContent';
|
|
7
7
|
export default RadioGroupTextContent;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
import { Flex } from '../Flex';
|
|
4
4
|
const RadioTextContent = ({ children, style, ...props }) => {
|
|
5
|
-
return (_jsx(Flex, { direction: "column",
|
|
5
|
+
return (_jsx(Flex, { direction: "column", spacing: "none", style: [styles.content, style], ...props, children: children }));
|
|
6
6
|
};
|
|
7
7
|
const styles = StyleSheet.create({
|
|
8
8
|
content: {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ToastContextValue } from './Toast.props';
|
|
2
|
+
import type { ToastContextValue, ToastProviderProps } from './Toast.props';
|
|
3
3
|
declare const ToastContext: React.Context<ToastContextValue | undefined>;
|
|
4
4
|
export declare const useToastContext: () => ToastContextValue;
|
|
5
|
-
export declare const ToastProvider: React.FC<
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
}>;
|
|
5
|
+
export declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
8
6
|
export declare const useToast: () => ToastContextValue;
|
|
9
7
|
export default ToastContext;
|
|
@@ -10,7 +10,7 @@ export const useToastContext = () => {
|
|
|
10
10
|
throw new Error('useToastContext must be used within ToastProvider');
|
|
11
11
|
return ctx;
|
|
12
12
|
};
|
|
13
|
-
export const ToastProvider = ({ children }) => {
|
|
13
|
+
export const ToastProvider = ({ children, safeAreaPadding = true, }) => {
|
|
14
14
|
const [toasts, setToasts] = useState([]);
|
|
15
15
|
const timers = useRef({});
|
|
16
16
|
const toastRefs = useRef({});
|
|
@@ -53,6 +53,9 @@ export const ToastProvider = ({ children }) => {
|
|
|
53
53
|
}
|
|
54
54
|
return id;
|
|
55
55
|
}, [removeToast]);
|
|
56
|
+
styles.useVariants({
|
|
57
|
+
safeAreaPadding,
|
|
58
|
+
});
|
|
56
59
|
useEffect(() => {
|
|
57
60
|
return () => {
|
|
58
61
|
// cleanup timers on unmount
|
|
@@ -71,7 +74,7 @@ export const useToast = () => {
|
|
|
71
74
|
return ctx;
|
|
72
75
|
};
|
|
73
76
|
export default ToastContext;
|
|
74
|
-
const styles = StyleSheet.create(theme => ({
|
|
77
|
+
const styles = StyleSheet.create((theme, rt) => ({
|
|
75
78
|
container: {
|
|
76
79
|
position: 'absolute',
|
|
77
80
|
left: 0,
|
|
@@ -80,6 +83,15 @@ const styles = StyleSheet.create(theme => ({
|
|
|
80
83
|
alignItems: 'stretch',
|
|
81
84
|
paddingBottom: theme.space['200'],
|
|
82
85
|
pointerEvents: 'box-none',
|
|
86
|
+
variants: {
|
|
87
|
+
safeAreaPadding: {
|
|
88
|
+
true: {
|
|
89
|
+
paddingBottom: theme.space['200'] + rt.insets.bottom,
|
|
90
|
+
paddingTop: rt.insets.top,
|
|
91
|
+
},
|
|
92
|
+
false: {},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
83
95
|
},
|
|
84
96
|
stack: {
|
|
85
97
|
width: '100%',
|
|
@@ -22,6 +22,10 @@ export interface ToastInstance extends ToastOptions {
|
|
|
22
22
|
/** resolved duration */
|
|
23
23
|
duration: number;
|
|
24
24
|
}
|
|
25
|
+
export interface ToastProviderProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
safeAreaPadding?: boolean;
|
|
28
|
+
}
|
|
25
29
|
export interface ToastContextValue {
|
|
26
30
|
addToast: (opts: ToastOptions) => string;
|
|
27
31
|
removeToast: (id: string) => void;
|
|
@@ -81,7 +81,7 @@ const ToastItem = forwardRef(({ toast, onClose }, ref) => {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
const toastContent = (_jsxs(View, { style: styles.inner, children: [_jsxs(View, { style: styles.content, children: [IconComp ? (_jsx(View, { style: styles.iconWrap, children: _jsx(Icon, { as: IconComp, style: styles.icon }) })) : null, _jsx(BodyText, { inverted: true, children: toast.text })] }), toast.actionText ? (_jsx(Link, { onPress: handlePress, showIcon: false, inverted: true, children: toast.actionText })) : null, showDismissIcon ? (_jsx(View, { style: styles.actions, children: _jsx(UnstyledIconButton, { icon: CloseSmallIcon, accessibilityLabel: "Dismiss", inverted: true, onPress: () => handleDismiss(false) }) })) : null] }));
|
|
84
|
+
const toastContent = (_jsxs(View, { style: styles.inner, children: [_jsxs(View, { style: styles.content, children: [IconComp ? (_jsx(View, { style: styles.iconWrap, children: _jsx(Icon, { as: IconComp, style: styles.icon }) })) : null, _jsx(BodyText, { inverted: true, style: styles.text, children: toast.text })] }), toast.actionText ? (_jsx(Link, { onPress: handlePress, showIcon: false, inverted: true, children: toast.actionText })) : null, showDismissIcon ? (_jsx(View, { style: styles.actions, children: _jsx(UnstyledIconButton, { icon: CloseSmallIcon, accessibilityLabel: "Dismiss", inverted: true, onPress: () => handleDismiss(false) }) })) : null] }));
|
|
85
85
|
return (_jsx(GestureDetector, { gesture: panGesture, children: _jsx(AnimatedView, { style: [styles.toast, animatedStyle], ...(Platform.OS === 'ios' && {
|
|
86
86
|
accessible: true,
|
|
87
87
|
accessibilityRole: 'alert',
|
|
@@ -122,6 +122,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
122
122
|
alignItems: 'center',
|
|
123
123
|
minWidth: 0,
|
|
124
124
|
},
|
|
125
|
+
text: { flexShrink: 1 },
|
|
125
126
|
actions: {
|
|
126
127
|
flexShrink: 0,
|
|
127
128
|
},
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import VerificationInputProps from './VerificationInput.props';
|
|
2
|
-
declare const VerificationInput:
|
|
3
|
-
({ value, onChangeText, label, labelVariant, helperText, helperIcon, validationStatus, validText, invalidText, disabled, readonly, secureTextEntry, style, ...props }: VerificationInputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
displayName: string;
|
|
5
|
-
};
|
|
1
|
+
import type { VerificationInputHandle, VerificationInputProps } from './VerificationInput.props';
|
|
2
|
+
declare const VerificationInput: import("react").ForwardRefExoticComponent<VerificationInputProps & import("react").RefAttributes<VerificationInputHandle>>;
|
|
6
3
|
export default VerificationInput;
|
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle } from 'react';
|
|
2
3
|
import { View } from 'react-native';
|
|
3
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
5
|
import { FormField } from '../FormField';
|
|
5
6
|
import { useVerificationInput } from './useVerificationInput';
|
|
6
7
|
import { VerificationInputSlot } from './VerificationInputSlot';
|
|
7
|
-
const VerificationInput = ({ value = '', onChangeText, label, labelVariant = 'body', helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled = false, readonly = false, secureTextEntry = false, style, ...props }) => {
|
|
8
|
+
const VerificationInput = forwardRef(({ value = '', onChangeText, label, labelVariant = 'body', helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled = false, readonly = false, secureTextEntry = false, autoFocus = false, style, ...props }, ref) => {
|
|
8
9
|
const length = 6;
|
|
9
|
-
const { inputRefs, focusedIndex, handleFocus, handleBlur, handleChangeText, handleKeyPress } = useVerificationInput({
|
|
10
|
+
const { inputRefs, displayValue, focusedIndex, handleFocus, handleBlur, handleChangeText, handleKeyPress, } = useVerificationInput({
|
|
10
11
|
value,
|
|
11
12
|
onChangeText,
|
|
12
13
|
});
|
|
14
|
+
useImperativeHandle(ref, () => ({
|
|
15
|
+
focus: () => inputRefs.current[0]?.focus(),
|
|
16
|
+
blur: () => {
|
|
17
|
+
inputRefs.current.forEach(input => input?.blur());
|
|
18
|
+
},
|
|
19
|
+
clear: () => onChangeText?.(''),
|
|
20
|
+
focusIndex: (index) => {
|
|
21
|
+
if (index >= 0 && index < length) {
|
|
22
|
+
inputRefs.current[index]?.focus();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
}), [length, onChangeText]);
|
|
13
26
|
const slots = Array.from({ length }, (_, index) => index);
|
|
14
27
|
return (_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatus, validText: validText, invalidText: invalidText, disabled: disabled, readonly: readonly, style: [styles.root, style], ...props, children: _jsx(View, { style: styles.slotsContainer, children: slots.map(index => {
|
|
15
|
-
const char =
|
|
28
|
+
const char = displayValue[index] || '';
|
|
16
29
|
const isActive = focusedIndex === index;
|
|
17
|
-
return (_jsx(VerificationInputSlot, { ref:
|
|
18
|
-
inputRefs.current[index] =
|
|
19
|
-
}, value: char, isActive: isActive, validationStatus: validationStatus, disabled: disabled, readonly: readonly, secureTextEntry: secureTextEntry, onChangeText: text => handleChangeText(text, index), onKeyPress: e => handleKeyPress(e, index), onFocus: () => handleFocus(index), onBlur: handleBlur }, index));
|
|
30
|
+
return (_jsx(VerificationInputSlot, { ref: inputRef => {
|
|
31
|
+
inputRefs.current[index] = inputRef;
|
|
32
|
+
}, autoFocus: index === 0 && autoFocus, value: char, isActive: isActive, validationStatus: validationStatus, disabled: disabled, readonly: readonly, secureTextEntry: secureTextEntry, onChangeText: text => handleChangeText(text, index), onKeyPress: e => handleKeyPress(e, index), onFocus: () => handleFocus(index), onBlur: handleBlur }, index));
|
|
20
33
|
}) }) }));
|
|
21
|
-
};
|
|
34
|
+
});
|
|
22
35
|
const styles = StyleSheet.create(theme => ({
|
|
23
36
|
root: {
|
|
24
37
|
gap: theme.components.input.verification.gap,
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
+
export interface VerificationInputHandle {
|
|
4
|
+
focus: () => void;
|
|
5
|
+
blur: () => void;
|
|
6
|
+
clear: () => void;
|
|
7
|
+
focusIndex: (index: number) => void;
|
|
8
|
+
}
|
|
3
9
|
export interface VerificationInputProps extends ViewProps {
|
|
4
10
|
/**
|
|
5
11
|
* The value of the input.
|
|
@@ -49,5 +55,9 @@ export interface VerificationInputProps extends ViewProps {
|
|
|
49
55
|
* Whether to obscure the text entry (e.g. for passwords/OTPs).
|
|
50
56
|
*/
|
|
51
57
|
secureTextEntry?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the input should auto-focus when mounted.
|
|
60
|
+
*/
|
|
61
|
+
autoFocus?: boolean;
|
|
52
62
|
}
|
|
53
63
|
export default VerificationInputProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import VerificationInput from './VerificationInput';
|
|
2
2
|
export { default as VerificationInput } from './VerificationInput';
|
|
3
|
-
export type { default as VerificationInputProps } from './VerificationInput.props';
|
|
3
|
+
export type { VerificationInputHandle, default as VerificationInputProps, } from './VerificationInput.props';
|
|
4
4
|
export default VerificationInput;
|
|
@@ -5,6 +5,7 @@ interface UseVerificationInputProps {
|
|
|
5
5
|
}
|
|
6
6
|
export declare const useVerificationInput: ({ value, onChangeText }: UseVerificationInputProps) => {
|
|
7
7
|
inputRefs: import("react").RefObject<(TextInput | null)[]>;
|
|
8
|
+
displayValue: string;
|
|
8
9
|
focusedIndex: number | null;
|
|
9
10
|
handleFocus: (index: number) => void;
|
|
10
11
|
handleBlur: () => void;
|