@utilitywarehouse/hearth-react-native 0.18.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 +102 -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/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/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/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.stories.tsx +5 -5
- 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/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
|
@@ -137,7 +137,7 @@ import {
|
|
|
137
137
|
|
|
138
138
|
const MyComponent = () => (
|
|
139
139
|
<Card variant="emphasis" colorScheme="neutralSubtle">
|
|
140
|
-
<Flex
|
|
140
|
+
<Flex spacing="md" direction="column" align="stretch">
|
|
141
141
|
<Heading size="md">Heading</Heading>
|
|
142
142
|
<BodyText>Content</BodyText>
|
|
143
143
|
<CardPressHandler>
|
|
@@ -24,6 +24,8 @@ interface CardProps extends PressableProps {
|
|
|
24
24
|
| 'pig';
|
|
25
25
|
noPadding?: boolean;
|
|
26
26
|
disabled?: boolean;
|
|
27
|
+
spacing?: SpacingValues;
|
|
28
|
+
/** @deprecated Use `spacing` instead. The `gap` prop will be removed in a future release. */
|
|
27
29
|
space?: SpacingValues;
|
|
28
30
|
alignItems?: ViewStyle['alignItems'];
|
|
29
31
|
justifyContent?: ViewStyle['justifyContent'];
|
|
@@ -77,7 +77,7 @@ export const Playground: Story = {
|
|
|
77
77
|
export const WithActions: Story = {
|
|
78
78
|
render: ({ children, ...props }) => {
|
|
79
79
|
return (
|
|
80
|
-
<Card {...props} flexDirection="column" alignItems="stretch"
|
|
80
|
+
<Card {...props} flexDirection="column" alignItems="stretch" spacing="md" variant="emphasis">
|
|
81
81
|
<BodyText>{children as string}</BodyText>
|
|
82
82
|
<CardActions>
|
|
83
83
|
<CardAction
|
|
@@ -110,7 +110,7 @@ export const WithOnlyAction: Story = {
|
|
|
110
110
|
},
|
|
111
111
|
render: ({ ...props }) => {
|
|
112
112
|
return (
|
|
113
|
-
<Card {...props} flexDirection="column" alignItems="stretch"
|
|
113
|
+
<Card {...props} flexDirection="column" alignItems="stretch" spacing="md">
|
|
114
114
|
<CardActions>
|
|
115
115
|
<CardAction
|
|
116
116
|
onPress={() => console.log('Card action pressed')}
|
|
@@ -130,7 +130,7 @@ export const Variants: Story = {
|
|
|
130
130
|
},
|
|
131
131
|
render: ({ children, ...props }) => {
|
|
132
132
|
return (
|
|
133
|
-
<Flex
|
|
133
|
+
<Flex spacing="lg">
|
|
134
134
|
<VariantTitle title="Subtle - White">
|
|
135
135
|
<Card {...props} variant="subtle" colorScheme="neutralStrong">
|
|
136
136
|
<BodyText>{children as string}</BodyText>
|
|
@@ -235,7 +235,7 @@ export const WithShadow: Story = {
|
|
|
235
235
|
},
|
|
236
236
|
render: ({ children, ...props }) => {
|
|
237
237
|
return (
|
|
238
|
-
<Flex
|
|
238
|
+
<Flex spacing="lg">
|
|
239
239
|
<VariantTitle title="Subtle - White - Shadow">
|
|
240
240
|
<Card {...props} variant="subtle">
|
|
241
241
|
<BodyText>{children as string}</BodyText>
|
|
@@ -257,14 +257,14 @@ export const Interactive: Story = {
|
|
|
257
257
|
},
|
|
258
258
|
render: ({ children, ...props }) => {
|
|
259
259
|
return (
|
|
260
|
-
<Flex
|
|
260
|
+
<Flex spacing="lg">
|
|
261
261
|
<VariantTitle title="Pressable - Subtle - White">
|
|
262
262
|
<Card
|
|
263
263
|
{...props}
|
|
264
264
|
onPress={() => console.log('pressed')}
|
|
265
265
|
variant="subtle"
|
|
266
266
|
colorScheme="neutralStrong"
|
|
267
|
-
|
|
267
|
+
spacing="md"
|
|
268
268
|
flexDirection="column"
|
|
269
269
|
alignItems="stretch"
|
|
270
270
|
>
|
|
@@ -279,7 +279,7 @@ export const Interactive: Story = {
|
|
|
279
279
|
onPress={() => console.log('pressed')}
|
|
280
280
|
variant="emphasis"
|
|
281
281
|
colorScheme="neutralStrong"
|
|
282
|
-
|
|
282
|
+
spacing="md"
|
|
283
283
|
flexDirection="column"
|
|
284
284
|
alignItems="stretch"
|
|
285
285
|
>
|
|
@@ -294,7 +294,7 @@ export const Interactive: Story = {
|
|
|
294
294
|
onPress={() => console.log('pressed')}
|
|
295
295
|
variant="subtle"
|
|
296
296
|
colorScheme="neutralSubtle"
|
|
297
|
-
|
|
297
|
+
spacing="md"
|
|
298
298
|
flexDirection="column"
|
|
299
299
|
alignItems="stretch"
|
|
300
300
|
>
|
|
@@ -308,7 +308,7 @@ export const Interactive: Story = {
|
|
|
308
308
|
{...props}
|
|
309
309
|
variant="emphasis"
|
|
310
310
|
colorScheme="neutralSubtle"
|
|
311
|
-
|
|
311
|
+
spacing="md"
|
|
312
312
|
flexDirection="column"
|
|
313
313
|
alignItems="stretch"
|
|
314
314
|
>
|
|
@@ -175,7 +175,7 @@ export const WithBadge: Story = {
|
|
|
175
175
|
controls: { include: [] },
|
|
176
176
|
},
|
|
177
177
|
render: () => (
|
|
178
|
-
<Flex direction="column"
|
|
178
|
+
<Flex direction="column" spacing="md" style={{ width: '100%', maxWidth: 400 }}>
|
|
179
179
|
<Card variant="emphasis">
|
|
180
180
|
<CardActions>
|
|
181
181
|
<CardAction
|
|
@@ -221,7 +221,7 @@ export const Sizes: Story = {
|
|
|
221
221
|
controls: { include: [] },
|
|
222
222
|
},
|
|
223
223
|
render: () => (
|
|
224
|
-
<Flex direction="column"
|
|
224
|
+
<Flex direction="column" spacing="md" style={{ width: '100%', maxWidth: 400 }}>
|
|
225
225
|
<Card variant="emphasis">
|
|
226
226
|
<CardActions>
|
|
227
227
|
<CardAction
|
|
@@ -3,10 +3,10 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
3
3
|
import { useCardContext } from './Card.context';
|
|
4
4
|
|
|
5
5
|
const CardContent = ({ children, style, ...props }: ViewProps) => {
|
|
6
|
-
const { noPadding,
|
|
6
|
+
const { noPadding, spacing } = useCardContext();
|
|
7
7
|
styles.useVariants({
|
|
8
8
|
noPadding,
|
|
9
|
-
|
|
9
|
+
spacing,
|
|
10
10
|
});
|
|
11
11
|
return (
|
|
12
12
|
<View style={[styles.container, style]} {...props}>
|
|
@@ -20,7 +20,7 @@ CardContent.displayName = 'CardContent';
|
|
|
20
20
|
const styles = StyleSheet.create(theme => ({
|
|
21
21
|
container: {
|
|
22
22
|
variants: {
|
|
23
|
-
|
|
23
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
24
24
|
noPadding: {
|
|
25
25
|
true: {
|
|
26
26
|
padding: theme.components.card.mobile.paddingNone,
|
|
@@ -22,10 +22,10 @@ const Card = ({
|
|
|
22
22
|
noPadding = false,
|
|
23
23
|
style,
|
|
24
24
|
states,
|
|
25
|
+
spacing,
|
|
25
26
|
space,
|
|
26
27
|
disabled = false,
|
|
27
28
|
onPress,
|
|
28
|
-
|
|
29
29
|
...rest
|
|
30
30
|
}: CardProps & { states?: { active?: boolean; disabled?: boolean } }) => {
|
|
31
31
|
const { active } = states || { active: false };
|
|
@@ -57,10 +57,20 @@ const Card = ({
|
|
|
57
57
|
hasActions,
|
|
58
58
|
hasContent,
|
|
59
59
|
hasOnlyActions,
|
|
60
|
-
space,
|
|
60
|
+
spacing: space ?? spacing,
|
|
61
61
|
variant,
|
|
62
62
|
}),
|
|
63
|
-
[
|
|
63
|
+
[
|
|
64
|
+
showPressed,
|
|
65
|
+
active,
|
|
66
|
+
hasActions,
|
|
67
|
+
hasContent,
|
|
68
|
+
hasOnlyActions,
|
|
69
|
+
noPadding,
|
|
70
|
+
space,
|
|
71
|
+
spacing,
|
|
72
|
+
variant,
|
|
73
|
+
]
|
|
64
74
|
);
|
|
65
75
|
|
|
66
76
|
styles.useVariants({
|
|
@@ -70,7 +80,7 @@ const Card = ({
|
|
|
70
80
|
active,
|
|
71
81
|
showPressed,
|
|
72
82
|
disabled,
|
|
73
|
-
|
|
83
|
+
spacing: hasActions || hasContent || hasOnlyActions ? 'none' : spacing,
|
|
74
84
|
shadowColor,
|
|
75
85
|
});
|
|
76
86
|
|
|
@@ -116,7 +126,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
116
126
|
alignItems: 'flex-start',
|
|
117
127
|
borderRadius: theme.components.card.borderRadius,
|
|
118
128
|
variants: {
|
|
119
|
-
|
|
129
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
120
130
|
variant: {
|
|
121
131
|
subtle: {
|
|
122
132
|
borderWidth: theme.components.card.neutral.subtle.borderWidth,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import FlexProps from '../Flex/Flex.props';
|
|
2
1
|
import { Flex } from '../Flex';
|
|
2
|
+
import FlexProps from '../Flex/Flex.props';
|
|
3
3
|
|
|
4
4
|
const CheckboxGroupTextContent = ({ children, ...props }: FlexProps) => {
|
|
5
5
|
return (
|
|
6
|
-
<Flex direction="column"
|
|
6
|
+
<Flex direction="column" spacing="none" {...props}>
|
|
7
7
|
{children}
|
|
8
8
|
</Flex>
|
|
9
9
|
);
|
|
@@ -4,7 +4,7 @@ import FlexProps from '../Flex/Flex.props';
|
|
|
4
4
|
|
|
5
5
|
const CheckboxTextContent = ({ children, style, ...props }: FlexProps) => {
|
|
6
6
|
return (
|
|
7
|
-
<Flex style={[styles.content, style]} direction="column"
|
|
7
|
+
<Flex style={[styles.content, style]} direction="column" spacing="none" {...props}>
|
|
8
8
|
{children}
|
|
9
9
|
</Flex>
|
|
10
10
|
);
|
|
@@ -90,7 +90,7 @@ const MyComponent = () => (
|
|
|
90
90
|
|
|
91
91
|
### With Custom Spacing
|
|
92
92
|
|
|
93
|
-
The Container component supports a `
|
|
93
|
+
The Container component supports a `spacing` prop for controlling gap between child elements, as well as directional padding and margin props:
|
|
94
94
|
|
|
95
95
|
<Canvas of={Stories.WithCustomSpacing} />
|
|
96
96
|
|
|
@@ -98,7 +98,7 @@ The Container component supports a `space` prop for controlling gap between chil
|
|
|
98
98
|
import { Container, Box, BodyText } from '@utilitywarehouse/hearth-react-native';
|
|
99
99
|
|
|
100
100
|
const MyComponent = () => (
|
|
101
|
-
<Container
|
|
101
|
+
<Container spacing="xl" paddingHorizontal="200" paddingVertical="300">
|
|
102
102
|
<Box bg="cyan400" p="200" borderRadius="md">
|
|
103
103
|
<BodyText>Item 1</BodyText>
|
|
104
104
|
</Box>
|
|
@@ -74,8 +74,13 @@ interface ContainerProps extends ViewProps {
|
|
|
74
74
|
mb?: SpaceValue;
|
|
75
75
|
ml?: SpaceValue;
|
|
76
76
|
mr?: SpaceValue;
|
|
77
|
+
/**
|
|
78
|
+
* The spacing between child elements (gap).
|
|
79
|
+
*/
|
|
80
|
+
spacing?: SpacingValues;
|
|
77
81
|
/**
|
|
78
82
|
* The space between child elements (gap).
|
|
83
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
79
84
|
*/
|
|
80
85
|
space?: SpacingValues;
|
|
81
86
|
/**
|
|
@@ -154,10 +154,10 @@ const meta = {
|
|
|
154
154
|
control: 'select',
|
|
155
155
|
description: 'The right margin of the container.',
|
|
156
156
|
},
|
|
157
|
-
|
|
157
|
+
spacing: {
|
|
158
158
|
options: ['none', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'],
|
|
159
159
|
control: 'radio',
|
|
160
|
-
description: 'The
|
|
160
|
+
description: 'The spacing between child elements (gap).',
|
|
161
161
|
},
|
|
162
162
|
gap: {
|
|
163
163
|
options: Object.keys(lightTheme.space),
|
|
@@ -3,10 +3,10 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
3
3
|
import { useStyleProps } from '../../hooks';
|
|
4
4
|
import type ContainerProps from './Container.props';
|
|
5
5
|
|
|
6
|
-
const Container = ({ style, children,
|
|
6
|
+
const Container = ({ style, children, spacing = 'md', space, ...props }: ContainerProps) => {
|
|
7
7
|
const { computedStyles, remainingProps } = useStyleProps(props);
|
|
8
8
|
|
|
9
|
-
styles.useVariants({ space });
|
|
9
|
+
styles.useVariants({ spacing: space ?? spacing });
|
|
10
10
|
return (
|
|
11
11
|
<View style={[styles.container(computedStyles), style]} {...remainingProps}>
|
|
12
12
|
{children}
|
|
@@ -44,7 +44,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
44
44
|
: undefined,
|
|
45
45
|
...extra,
|
|
46
46
|
variants: {
|
|
47
|
-
|
|
47
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
48
48
|
},
|
|
49
49
|
}),
|
|
50
50
|
}));
|
|
@@ -64,7 +64,7 @@ When using `CurrencyInput`, the component inherits React Native TextInput props
|
|
|
64
64
|
| focused | `boolean` | `false` | Forces the focused visual state |
|
|
65
65
|
| inBottomSheet | `boolean` | `false` | Use BottomSheetTextInput when true |
|
|
66
66
|
| placeholder | `string` | `'0.00'` | Placeholder text |
|
|
67
|
-
| disableGroupSeparator | `boolean` | `false` | Disables automatic inserting of thousand separators while the user types _(Formatting only works with controlled components via
|
|
67
|
+
| disableGroupSeparator | `boolean` | `false` | Disables automatic inserting of thousand separators while the user types _(Formatting only works with controlled components via onChangeText)_ |
|
|
68
68
|
|
|
69
69
|
Note: When used inside `FormField`, `validationStatus` and `disabled` are read from the context unless explicitly overridden.
|
|
70
70
|
|
|
@@ -69,7 +69,7 @@ const meta = {
|
|
|
69
69
|
disableGroupSeparator: {
|
|
70
70
|
control: 'boolean',
|
|
71
71
|
description:
|
|
72
|
-
'Disable automatic adding of thousand separators while typing _(Formatting only works with controlled components via
|
|
72
|
+
'Disable automatic adding of thousand separators while typing _(Formatting only works with controlled components via onChangeText)_',
|
|
73
73
|
defaultValue: false,
|
|
74
74
|
},
|
|
75
75
|
},
|
|
@@ -110,7 +110,7 @@ export const States: Story = {
|
|
|
110
110
|
},
|
|
111
111
|
render: () => {
|
|
112
112
|
return (
|
|
113
|
-
<Flex direction="column"
|
|
113
|
+
<Flex direction="column" spacing="lg">
|
|
114
114
|
<VariantTitle title="Default">
|
|
115
115
|
<CurrencyInput />
|
|
116
116
|
</VariantTitle>
|
|
@@ -212,7 +212,7 @@ export const FlexibleSegments: Story = {
|
|
|
212
212
|
|
|
213
213
|
export const GroupingInputs: Story = {
|
|
214
214
|
render: () => (
|
|
215
|
-
<Flex
|
|
215
|
+
<Flex spacing="sm">
|
|
216
216
|
<Heading size="lg">Event Registration</Heading>
|
|
217
217
|
<Card variant="subtle" gap="250">
|
|
218
218
|
<DateInput label="Date of birth" helperText="Enter your date of birth" required />
|
|
@@ -246,7 +246,7 @@ export const WithState: Story = {
|
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
return (
|
|
249
|
-
<Flex
|
|
249
|
+
<Flex spacing="md">
|
|
250
250
|
<DateInput
|
|
251
251
|
label="Date"
|
|
252
252
|
helperText="Select or enter a date"
|
|
@@ -257,7 +257,7 @@ export const WithState: Story = {
|
|
|
257
257
|
onMonthChange={setMonth}
|
|
258
258
|
onYearChange={setYear}
|
|
259
259
|
/>
|
|
260
|
-
<Flex
|
|
260
|
+
<Flex spacing="xs">
|
|
261
261
|
<Button onPress={handleSetToday}>Set to Today</Button>
|
|
262
262
|
<Button onPress={handleReset} variant="solid">
|
|
263
263
|
Reset
|
|
@@ -130,7 +130,7 @@ export const States: Story = {
|
|
|
130
130
|
const [formFieldDate, setFormFieldDate] = useState<DateType>();
|
|
131
131
|
|
|
132
132
|
return (
|
|
133
|
-
<Flex direction="column"
|
|
133
|
+
<Flex direction="column" spacing="lg">
|
|
134
134
|
<VariantTitle title="Default">
|
|
135
135
|
<DatePickerInput placeholder="DD/MM/YYYY" />
|
|
136
136
|
</VariantTitle>
|
|
@@ -94,7 +94,7 @@ export const Column: Story = {
|
|
|
94
94
|
export const KitchenSink: Story = {
|
|
95
95
|
parameters: { controls: { include: [] } },
|
|
96
96
|
render: () => (
|
|
97
|
-
<Flex direction="column"
|
|
97
|
+
<Flex direction="column" spacing="lg" style={{ width: '100%' }}>
|
|
98
98
|
<VariantTitle title="Row direction">
|
|
99
99
|
<DescriptionList direction="row">
|
|
100
100
|
{sampleData.map(item => (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Canvas, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { BodyText, Center, Divider } from '../../';
|
|
3
|
+
import { BackToTopButton, UsageWrap, ViewFigmaButton } from '../../../docs/components';
|
|
2
4
|
import * as Stories from './Divider.stories';
|
|
3
|
-
import { Divider, BodyText, Center } from '../../';
|
|
4
|
-
import { ViewFigmaButton, BackToTopButton, UsageWrap } from '../../../docs/components';
|
|
5
5
|
|
|
6
6
|
<Meta title="Components / Divider" />
|
|
7
7
|
|
|
@@ -35,7 +35,7 @@ Dividers can help establish a visual hierarchy on your designs. They can indicat
|
|
|
35
35
|
<UsageWrap>
|
|
36
36
|
<Center>
|
|
37
37
|
<BodyText>This text is divided</BodyText>
|
|
38
|
-
<Divider
|
|
38
|
+
<Divider spacing="sm" />
|
|
39
39
|
<BodyText>From this text</BodyText>
|
|
40
40
|
</Center>
|
|
41
41
|
</UsageWrap>
|
|
@@ -46,7 +46,7 @@ import { Spinner, Center } from '@utilitywarehouse/hearth-react-native';
|
|
|
46
46
|
const MyComponent = () => (
|
|
47
47
|
<Center>
|
|
48
48
|
<BodyText>This text is divided</BodyText>
|
|
49
|
-
<Divider
|
|
49
|
+
<Divider spacing="sm" />
|
|
50
50
|
<BodyText>From this text</BodyText>
|
|
51
51
|
</Center>
|
|
52
52
|
);
|
|
@@ -58,7 +58,7 @@ const MyComponent = () => (
|
|
|
58
58
|
| ------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
|
|
59
59
|
| `orientation` | `'horizontal' \| 'vertical'` | The orientation of the Divider. | `'horizontal'` |
|
|
60
60
|
| `color` | `string` | The color of the spinner. | `-` |
|
|
61
|
-
| `
|
|
61
|
+
| `spacing` | `'none' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | The space between the Divider items. | `none` |
|
|
62
62
|
| `width` | `number` | The width of the Divider. | `100%` |
|
|
63
63
|
| `height` | `number` | The height of the Divider. | `100%` |
|
|
64
64
|
| `flexItem` | `boolean` | If true, a vertical divider will have the correct height when used in flex container. (By default, a vertical divider will have a calculated height of 0px if it is the child of a flex container.) | false |
|
|
@@ -3,6 +3,12 @@ import type { ColorValue, SpacingValues } from '../../types';
|
|
|
3
3
|
|
|
4
4
|
interface DividerProps extends Omit<ViewProps, 'children'> {
|
|
5
5
|
color?: ColorValue;
|
|
6
|
+
backgroundColor?: ColorValue;
|
|
7
|
+
spacing?: SpacingValues;
|
|
8
|
+
/**
|
|
9
|
+
* The space between child elements (gap).
|
|
10
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
11
|
+
*/
|
|
6
12
|
space?: SpacingValues;
|
|
7
13
|
orientation?: 'horizontal' | 'vertical';
|
|
8
14
|
height?: DimensionValue;
|
|
@@ -8,13 +8,14 @@ import type DividerProps from './Divider.props';
|
|
|
8
8
|
const Divider = ({
|
|
9
9
|
orientation = 'horizontal',
|
|
10
10
|
color,
|
|
11
|
+
spacing,
|
|
11
12
|
space,
|
|
12
13
|
height,
|
|
13
14
|
width,
|
|
14
15
|
flexItem,
|
|
15
16
|
...props
|
|
16
17
|
}: DividerProps) => {
|
|
17
|
-
styles.useVariants({ orientation, space, flexItem });
|
|
18
|
+
styles.useVariants({ orientation, spacing: space ?? spacing, flexItem });
|
|
18
19
|
const { color: themeColor, colorMode } = useTheme();
|
|
19
20
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
21
|
const colorValue = useMemo(() => getFlattenedColorValue(color, themeColor), [color, colorMode]);
|
|
@@ -42,7 +43,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
42
43
|
width: theme.components.divider.borderWidth,
|
|
43
44
|
},
|
|
44
45
|
},
|
|
45
|
-
|
|
46
|
+
spacing: {
|
|
46
47
|
none: {},
|
|
47
48
|
'2xs': {},
|
|
48
49
|
xs: {},
|
|
@@ -61,14 +62,14 @@ const styles = StyleSheet.create(theme => ({
|
|
|
61
62
|
compoundVariants: [
|
|
62
63
|
{
|
|
63
64
|
orientation: 'horizontal',
|
|
64
|
-
|
|
65
|
+
spacing: 'none',
|
|
65
66
|
styles: {
|
|
66
67
|
marginVertical: 0,
|
|
67
68
|
},
|
|
68
69
|
},
|
|
69
70
|
{
|
|
70
71
|
orientation: 'horizontal',
|
|
71
|
-
|
|
72
|
+
spacing: '2xs',
|
|
72
73
|
styles: {
|
|
73
74
|
marginVertical: {
|
|
74
75
|
base: theme.layout.mobile.spacing['2xs'],
|
|
@@ -79,7 +80,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
82
|
orientation: 'horizontal',
|
|
82
|
-
|
|
83
|
+
spacing: 'xs',
|
|
83
84
|
styles: {
|
|
84
85
|
marginVertical: {
|
|
85
86
|
base: theme.layout.mobile.spacing.xs,
|
|
@@ -90,7 +91,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
90
91
|
},
|
|
91
92
|
{
|
|
92
93
|
orientation: 'horizontal',
|
|
93
|
-
|
|
94
|
+
spacing: 'sm',
|
|
94
95
|
styles: {
|
|
95
96
|
marginVertical: {
|
|
96
97
|
base: theme.layout.mobile.spacing.sm,
|
|
@@ -101,7 +102,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
101
102
|
},
|
|
102
103
|
{
|
|
103
104
|
orientation: 'horizontal',
|
|
104
|
-
|
|
105
|
+
spacing: 'md',
|
|
105
106
|
styles: {
|
|
106
107
|
marginVertical: {
|
|
107
108
|
base: theme.layout.mobile.spacing.md,
|
|
@@ -112,7 +113,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
112
113
|
},
|
|
113
114
|
{
|
|
114
115
|
orientation: 'horizontal',
|
|
115
|
-
|
|
116
|
+
spacing: 'lg',
|
|
116
117
|
styles: {
|
|
117
118
|
marginVertical: {
|
|
118
119
|
base: theme.layout.mobile.spacing.lg,
|
|
@@ -123,7 +124,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
123
124
|
},
|
|
124
125
|
{
|
|
125
126
|
orientation: 'horizontal',
|
|
126
|
-
|
|
127
|
+
spacing: 'xl',
|
|
127
128
|
styles: {
|
|
128
129
|
marginVertical: {
|
|
129
130
|
base: theme.layout.mobile.spacing.xl,
|
|
@@ -134,7 +135,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
134
135
|
},
|
|
135
136
|
{
|
|
136
137
|
orientation: 'horizontal',
|
|
137
|
-
|
|
138
|
+
spacing: '2xl',
|
|
138
139
|
styles: {
|
|
139
140
|
marginVertical: {
|
|
140
141
|
base: theme.layout.mobile.spacing['2xl'],
|
|
@@ -145,14 +146,14 @@ const styles = StyleSheet.create(theme => ({
|
|
|
145
146
|
},
|
|
146
147
|
{
|
|
147
148
|
orientation: 'vertical',
|
|
148
|
-
|
|
149
|
+
spacing: 'none',
|
|
149
150
|
styles: {
|
|
150
151
|
marginHorizontal: 0,
|
|
151
152
|
},
|
|
152
153
|
},
|
|
153
154
|
{
|
|
154
155
|
orientation: 'vertical',
|
|
155
|
-
|
|
156
|
+
spacing: '2xs',
|
|
156
157
|
styles: {
|
|
157
158
|
marginHorizontal: {
|
|
158
159
|
base: theme.layout.mobile.spacing['2xs'],
|
|
@@ -163,7 +164,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
163
164
|
},
|
|
164
165
|
{
|
|
165
166
|
orientation: 'vertical',
|
|
166
|
-
|
|
167
|
+
spacing: 'xs',
|
|
167
168
|
styles: {
|
|
168
169
|
marginHorizontal: {
|
|
169
170
|
base: theme.layout.mobile.spacing.xs,
|
|
@@ -174,7 +175,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
174
175
|
},
|
|
175
176
|
{
|
|
176
177
|
orientation: 'vertical',
|
|
177
|
-
|
|
178
|
+
spacing: 'sm',
|
|
178
179
|
styles: {
|
|
179
180
|
marginHorizontal: {
|
|
180
181
|
base: theme.layout.mobile.spacing.sm,
|
|
@@ -185,7 +186,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
185
186
|
},
|
|
186
187
|
{
|
|
187
188
|
orientation: 'vertical',
|
|
188
|
-
|
|
189
|
+
spacing: 'md',
|
|
189
190
|
styles: {
|
|
190
191
|
marginHorizontal: {
|
|
191
192
|
base: theme.layout.mobile.spacing.md,
|
|
@@ -196,7 +197,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
196
197
|
},
|
|
197
198
|
{
|
|
198
199
|
orientation: 'vertical',
|
|
199
|
-
|
|
200
|
+
spacing: 'lg',
|
|
200
201
|
styles: {
|
|
201
202
|
marginHorizontal: {
|
|
202
203
|
base: theme.layout.mobile.spacing.lg,
|
|
@@ -207,7 +208,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
207
208
|
},
|
|
208
209
|
{
|
|
209
210
|
orientation: 'vertical',
|
|
210
|
-
|
|
211
|
+
spacing: 'xl',
|
|
211
212
|
styles: {
|
|
212
213
|
marginHorizontal: {
|
|
213
214
|
base: theme.layout.mobile.spacing.xl,
|
|
@@ -218,7 +219,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
218
219
|
},
|
|
219
220
|
{
|
|
220
221
|
orientation: 'vertical',
|
|
221
|
-
|
|
222
|
+
spacing: '2xl',
|
|
222
223
|
styles: {
|
|
223
224
|
marginHorizontal: {
|
|
224
225
|
base: theme.layout.mobile.spacing['2xl'],
|
|
@@ -20,7 +20,7 @@ const ExpandableCardExpandedContent = ({
|
|
|
20
20
|
<View style={styles.container}>
|
|
21
21
|
<Expandable expanded={isExpanded} duration={duration} animateOpacity={animateOpacity}>
|
|
22
22
|
<View>
|
|
23
|
-
<Divider
|
|
23
|
+
<Divider spacing="none" />
|
|
24
24
|
<View style={styles.content}>{children}</View>
|
|
25
25
|
</View>
|
|
26
26
|
</Expandable>
|
|
@@ -25,7 +25,7 @@ When you need to center-align content, the Center component comes in handy. It i
|
|
|
25
25
|
|
|
26
26
|
<UsageWrap>
|
|
27
27
|
<Center>
|
|
28
|
-
<Flex
|
|
28
|
+
<Flex spacing="lg">
|
|
29
29
|
<BodyText>Spaced out text</BodyText>
|
|
30
30
|
<BodyText>Spaced out text</BodyText>
|
|
31
31
|
<BodyText>Flexed</BodyText>
|
|
@@ -39,7 +39,7 @@ When you need to center-align content, the Center component comes in handy. It i
|
|
|
39
39
|
import { Flex, BodyText } from '@utilitywarehouse/hearth-react-native';
|
|
40
40
|
|
|
41
41
|
const MyComponent = () => (
|
|
42
|
-
<Flex
|
|
42
|
+
<Flex spacing="lg">
|
|
43
43
|
<BodyText>Spaced out text</BodyText>
|
|
44
44
|
<BodyText>Spaced out text</BodyText>
|
|
45
45
|
<BodyText>Flexed</BodyText>
|
|
@@ -57,4 +57,4 @@ const MyComponent = () => (
|
|
|
57
57
|
| `wrap` | `'wrap' \| 'nowrap' \| 'wrap-reverse'` | `nowrap` | The wrap of the flex container. |
|
|
58
58
|
| `justify` | `'flex-start' \| 'flex-end' \| 'center' \| `<br />`'space-between' \| 'space-around' \| 'space-evenly'` | `flex-start` | The justify content of the flex container. |
|
|
59
59
|
| `align` | `'flex-start' \| 'flex-end' \| 'center' \| 'stretch' \| 'baseline'` | `flex-start` | The align items of the flex container. |
|
|
60
|
-
| `
|
|
60
|
+
| `spacing` | `'none' \| '2xs' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl'` | `md` | The space between the content. |
|
|
@@ -6,6 +6,11 @@ interface FlexProps extends ViewProps {
|
|
|
6
6
|
align?: FlexAlignType;
|
|
7
7
|
justify?: ViewStyle['justifyContent'];
|
|
8
8
|
wrap?: ViewStyle['flexWrap'];
|
|
9
|
+
spacing?: SpacingValues;
|
|
10
|
+
/**
|
|
11
|
+
* The space between child elements (gap).
|
|
12
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
13
|
+
*/
|
|
9
14
|
space?: SpacingValues;
|
|
10
15
|
}
|
|
11
16
|
|
|
@@ -39,7 +39,7 @@ const meta = {
|
|
|
39
39
|
control: 'select',
|
|
40
40
|
description: 'The justify of the flex container.',
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
spacing: {
|
|
43
43
|
options: ['none', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'],
|
|
44
44
|
control: 'radio',
|
|
45
45
|
description: 'The space of the flex container.',
|
|
@@ -51,7 +51,7 @@ const meta = {
|
|
|
51
51
|
align: 'center',
|
|
52
52
|
wrap: 'wrap',
|
|
53
53
|
justify: 'flex-start',
|
|
54
|
-
|
|
54
|
+
spacing: 'sm',
|
|
55
55
|
},
|
|
56
56
|
} satisfies Meta<typeof Flex>;
|
|
57
57
|
|