@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
|
@@ -43,7 +43,7 @@ const BodyText = ({
|
|
|
43
43
|
: {})}
|
|
44
44
|
style={[
|
|
45
45
|
styles.text,
|
|
46
|
-
|
|
46
|
+
props.style,
|
|
47
47
|
{
|
|
48
48
|
...(textTransform && { textTransform }),
|
|
49
49
|
...(textAlign && { textAlign }),
|
|
@@ -53,7 +53,7 @@ const BodyText = ({
|
|
|
53
53
|
...(userSelect && { userSelect }),
|
|
54
54
|
...(textAlignVertical && { textAlignVertical }),
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
styles.getColours(color, textDecorationColor),
|
|
57
57
|
]}
|
|
58
58
|
>
|
|
59
59
|
{children}
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
ColorValue,
|
|
7
7
|
OpacityValue,
|
|
8
8
|
SpaceValue,
|
|
9
|
+
SpacingValues,
|
|
9
10
|
} from '../../types';
|
|
10
11
|
|
|
11
12
|
export type OmittedStyles = Omit<
|
|
@@ -223,12 +224,18 @@ export interface ThemedBoxViewStyleProps {
|
|
|
223
224
|
borderWidth?: BordeWidthValue;
|
|
224
225
|
}
|
|
225
226
|
|
|
227
|
+
interface CustomBoxProps {
|
|
228
|
+
// Custom props
|
|
229
|
+
as?: React.ElementType;
|
|
230
|
+
spacing?: SpacingValues;
|
|
231
|
+
}
|
|
232
|
+
|
|
226
233
|
export interface BoxProps
|
|
227
|
-
extends
|
|
234
|
+
extends
|
|
235
|
+
BoxStyleMappingValues,
|
|
228
236
|
ThemedBoxViewStyleProps,
|
|
229
237
|
OtherBoxViewStyles,
|
|
230
|
-
ViewProps
|
|
231
|
-
|
|
232
|
-
}
|
|
238
|
+
ViewProps,
|
|
239
|
+
CustomBoxProps {}
|
|
233
240
|
|
|
234
241
|
export default BoxProps;
|
|
@@ -164,12 +164,12 @@ const MyComponent = () => {
|
|
|
164
164
|
|
|
165
165
|
| Property | Type | Description | Default |
|
|
166
166
|
| --------------- | -------------------------------------------------------- | -------------------------------------------------------------- | ------- |
|
|
167
|
-
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Set the direction of Button group to vertical or horizontal | 'row'
|
|
167
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Set the direction of Button group to vertical or horizontal | `'row'` |
|
|
168
168
|
| `disabled` | `boolean` | When true, this will disable all the buttons in a ButtonGroup. | `false` |
|
|
169
169
|
| `loading` | `boolean` | When true, this will show a loading spinner in all buttons. | `false` |
|
|
170
170
|
| `attached` | `boolean` | When attached, all buttons will be attached to each other. | `false` |
|
|
171
171
|
| `reversed` | `boolean` | To reverse the order of components. | `false` |
|
|
172
|
-
| `
|
|
172
|
+
| `spacing` | `string` | It sets the space between different buttons. | `'md'` |
|
|
173
173
|
|
|
174
174
|
### `ButtonIcon`
|
|
175
175
|
|
|
@@ -108,7 +108,7 @@ export const Variants: Story = {
|
|
|
108
108
|
// @ts-expect-error - This is a playground
|
|
109
109
|
const icon = _icon === 'none' ? undefined : Icons[_icon];
|
|
110
110
|
return (
|
|
111
|
-
<ButtonGroup flexDirection="column"
|
|
111
|
+
<ButtonGroup flexDirection="column" spacing="md">
|
|
112
112
|
<>
|
|
113
113
|
{args.colorScheme === 'highlight' && (
|
|
114
114
|
<VariantTitle title="Emphasis" invert={args.inverted}>
|
|
@@ -149,9 +149,9 @@ export const KitchenSink: Story = {
|
|
|
149
149
|
const schemes: Array<ColorScheme> = ['highlight', 'destructive', 'affirmative', 'functional'];
|
|
150
150
|
const variants: Array<Variant> = ['emphasis', 'solid', 'outline', 'ghost'];
|
|
151
151
|
return (
|
|
152
|
-
<Flex direction="row"
|
|
152
|
+
<Flex direction="row" spacing="lg" wrap="wrap">
|
|
153
153
|
{schemes.map(scheme => (
|
|
154
|
-
<Flex direction="column"
|
|
154
|
+
<Flex direction="column" spacing="lg" key={scheme}>
|
|
155
155
|
{variants
|
|
156
156
|
.filter(variant => {
|
|
157
157
|
if (inverted) {
|
|
@@ -178,7 +178,7 @@ export const KitchenSink: Story = {
|
|
|
178
178
|
{scheme} - {variant}
|
|
179
179
|
</DetailText>
|
|
180
180
|
</Box>
|
|
181
|
-
<Flex direction="column"
|
|
181
|
+
<Flex direction="column" spacing="lg">
|
|
182
182
|
<VariantTitle title="Default" invert={inverted}>
|
|
183
183
|
{/* @ts-expect-error - story loop types don't match */}
|
|
184
184
|
<Button
|
|
@@ -7,13 +7,18 @@ const ButtonGroupRoot = ({
|
|
|
7
7
|
attached = false,
|
|
8
8
|
flexDirection = 'row',
|
|
9
9
|
reversed = false,
|
|
10
|
-
|
|
10
|
+
spacing = 'md',
|
|
11
|
+
space,
|
|
11
12
|
...props
|
|
12
13
|
}: ViewProps & {
|
|
13
14
|
flexDirection?: ViewStyle['flexDirection'];
|
|
14
15
|
reversed?: boolean;
|
|
15
16
|
attached?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release
|
|
19
|
+
*/
|
|
16
20
|
space?: SpacingValues;
|
|
21
|
+
spacing?: SpacingValues;
|
|
17
22
|
}) => {
|
|
18
23
|
let direction = flexDirection;
|
|
19
24
|
if (reversed) {
|
|
@@ -24,7 +29,7 @@ const ButtonGroupRoot = ({
|
|
|
24
29
|
}
|
|
25
30
|
styles.useVariants({
|
|
26
31
|
attached,
|
|
27
|
-
space,
|
|
32
|
+
spacing: space ?? spacing,
|
|
28
33
|
});
|
|
29
34
|
return (
|
|
30
35
|
<View
|
|
@@ -41,7 +46,7 @@ ButtonGroupRoot.displayName = 'ButtonGroupRoot';
|
|
|
41
46
|
const styles = StyleSheet.create(theme => ({
|
|
42
47
|
text: {
|
|
43
48
|
variants: {
|
|
44
|
-
|
|
49
|
+
spacing: {
|
|
45
50
|
none: {
|
|
46
51
|
gap: theme.layout.mobile.spacing.none,
|
|
47
52
|
},
|
|
@@ -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;
|