@utilitywarehouse/hearth-react-native 0.18.0 → 0.19.1
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/.storybook/preview.tsx +1 -0
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +24 -21
- package/CHANGELOG.md +128 -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/Menu/Menu.d.ts +1 -1
- package/build/components/Menu/Menu.js +2 -2
- package/build/components/Menu/Menu.props.d.ts +2 -6
- package/build/components/Modal/Modal.d.ts +1 -1
- package/build/components/Modal/Modal.js +16 -6
- package/build/components/Modal/Modal.props.d.ts +1 -0
- package/build/components/Modal/Modal.web.d.ts +1 -1
- package/build/components/Modal/Modal.web.js +2 -2
- 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 +5 -2
- 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/changelog.mdx +687 -0
- package/docs/components/AllComponents.web.tsx +9 -9
- package/docs/layout-components.docs.mdx +3 -3
- package/package.json +7 -7
- package/scripts/copyChangelog.js +50 -0
- 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/Menu/Menu.docs.mdx +8 -5
- package/src/components/Menu/Menu.figma.tsx +27 -27
- package/src/components/Menu/Menu.props.ts +2 -6
- package/src/components/Menu/Menu.tsx +3 -6
- package/src/components/Menu/MenuItem.figma.tsx +26 -18
- package/src/components/Modal/Modal.docs.mdx +22 -21
- package/src/components/Modal/Modal.figma.tsx +58 -47
- package/src/components/Modal/Modal.props.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +4 -0
- package/src/components/Modal/Modal.tsx +20 -5
- package/src/components/Modal/Modal.web.tsx +2 -1
- 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 +7 -2
- 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
|
@@ -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
|
|
|
@@ -9,7 +9,8 @@ const Flex = ({
|
|
|
9
9
|
align = 'flex-start',
|
|
10
10
|
justify = 'flex-start',
|
|
11
11
|
wrap = 'nowrap',
|
|
12
|
-
|
|
12
|
+
spacing = 'md',
|
|
13
|
+
space,
|
|
13
14
|
...rest
|
|
14
15
|
}: FlexProps) => {
|
|
15
16
|
const propStyle: ViewStyle = {
|
|
@@ -19,7 +20,7 @@ const Flex = ({
|
|
|
19
20
|
flexWrap: wrap,
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
styles.useVariants({ space });
|
|
23
|
+
styles.useVariants({ spacing: space ?? spacing });
|
|
23
24
|
|
|
24
25
|
return (
|
|
25
26
|
<View style={[propStyle, styles.flex, style]} {...rest}>
|
|
@@ -34,7 +35,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
34
35
|
flex: {
|
|
35
36
|
display: 'flex',
|
|
36
37
|
variants: {
|
|
37
|
-
|
|
38
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
38
39
|
},
|
|
39
40
|
},
|
|
40
41
|
}));
|
|
@@ -313,7 +313,7 @@ const MyComponent = () => {
|
|
|
313
313
|
<FormField validationStatus="invalid">
|
|
314
314
|
<Checkbox alignItems="flex-start">
|
|
315
315
|
<CheckboxIndicator />
|
|
316
|
-
<Flex direction="column"
|
|
316
|
+
<Flex direction="column" spacing="xs">
|
|
317
317
|
<CheckboxLabel nested={false}>I accept the terms and conditions</CheckboxLabel>
|
|
318
318
|
<FormFieldHelper>
|
|
319
319
|
<FormFieldHelperText>Read and accept the terms and conditions</FormFieldHelperText>
|
|
@@ -25,7 +25,7 @@ The Grid component helps you create responsive grid layouts with configurable co
|
|
|
25
25
|
|
|
26
26
|
<UsageWrap>
|
|
27
27
|
<Center>
|
|
28
|
-
<Grid columns={2}
|
|
28
|
+
<Grid columns={2} spacing="md" width={300}>
|
|
29
29
|
<Box backgroundColor="green400" height={100} padding="200">
|
|
30
30
|
<BodyText color="white">Item 1</BodyText>
|
|
31
31
|
</Box>
|
|
@@ -46,7 +46,7 @@ The Grid component helps you create responsive grid layouts with configurable co
|
|
|
46
46
|
import { Grid, Box, BodyText } from '@utilitywarehouse/hearth-react-native';
|
|
47
47
|
|
|
48
48
|
const MyComponent = () => (
|
|
49
|
-
<Grid columns={2}
|
|
49
|
+
<Grid columns={2} spacing="md" width={300}>
|
|
50
50
|
<Box backgroundColor="green400" height={100} padding="200">
|
|
51
51
|
<BodyText color="white">Item 1</BodyText>
|
|
52
52
|
</Box>
|
|
@@ -76,7 +76,7 @@ The Grid component supports responsive column layouts based on screen size break
|
|
|
76
76
|
md: 3,
|
|
77
77
|
lg: 4,
|
|
78
78
|
}}
|
|
79
|
-
|
|
79
|
+
spacing="md"
|
|
80
80
|
width="100%"
|
|
81
81
|
>
|
|
82
82
|
<Box backgroundColor="green400" height={100} padding="200">
|
|
@@ -106,7 +106,7 @@ const MyComponent = () => (
|
|
|
106
106
|
md: 3,
|
|
107
107
|
lg: 4,
|
|
108
108
|
}}
|
|
109
|
-
|
|
109
|
+
spacing="md"
|
|
110
110
|
width="100%"
|
|
111
111
|
>
|
|
112
112
|
<Box backgroundColor="green400" height={100} padding="200">
|
|
@@ -176,7 +176,7 @@ The Grid component extends all the props from the [View component](https://react
|
|
|
176
176
|
| Name | Type | Default | Description |
|
|
177
177
|
| ---------------- | ------------------------------------------------------------------ | ------- | ------------------------------------------------------------- |
|
|
178
178
|
| `columns` | `number` or `GridColumns` | 2 | Number of columns or responsive object with breakpoint values |
|
|
179
|
-
| `
|
|
179
|
+
| `spacing` | `'none' \| '2xs' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl'` | - | Spacing between grid items (both rows and columns) |
|
|
180
180
|
| `columnGap` | `number` | - | Gap between columns (overrides spacing if provided) |
|
|
181
181
|
| `rowGap` | `number` | - | Gap between rows (overrides spacing if provided) |
|
|
182
182
|
| `containerStyle` | `StyleProp\<ViewStyle\>` | - | Style for the grid container |
|
|
@@ -17,6 +17,12 @@ export interface GridProps extends ViewProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* Spacing between grid items (applies to both rows and columns)
|
|
19
19
|
*/
|
|
20
|
+
spacing?: SpacingValues;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Spacing between grid items (applies to both rows and columns)
|
|
24
|
+
* @deprecated Use `spacing` instead. The `space` prop will be removed in a future release.
|
|
25
|
+
*/
|
|
20
26
|
space?: SpacingValues;
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -13,7 +13,7 @@ const meta = {
|
|
|
13
13
|
control: 'object',
|
|
14
14
|
description: 'Number of columns or responsive object with breakpoints',
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
spacing: {
|
|
17
17
|
options: ['none', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'],
|
|
18
18
|
control: 'radio',
|
|
19
19
|
description: 'Responsive spacing between grid items (applied to both rows and columns).',
|
|
@@ -33,7 +33,7 @@ const meta = {
|
|
|
33
33
|
},
|
|
34
34
|
args: {
|
|
35
35
|
columns: 2,
|
|
36
|
-
|
|
36
|
+
spacing: 'md',
|
|
37
37
|
},
|
|
38
38
|
} satisfies Meta<typeof Grid>;
|
|
39
39
|
|
|
@@ -69,7 +69,7 @@ export const Playground: Story = {
|
|
|
69
69
|
controls: {
|
|
70
70
|
include: [
|
|
71
71
|
'columns',
|
|
72
|
-
'
|
|
72
|
+
'spacing',
|
|
73
73
|
'gap',
|
|
74
74
|
'columnGap',
|
|
75
75
|
'rowGap',
|
|
@@ -81,7 +81,7 @@ export const Playground: Story = {
|
|
|
81
81
|
},
|
|
82
82
|
args: {
|
|
83
83
|
columns: 2,
|
|
84
|
-
|
|
84
|
+
spacing: 'md',
|
|
85
85
|
},
|
|
86
86
|
render: args => (
|
|
87
87
|
<Grid {...args} style={{ width: 400 }}>
|
|
@@ -98,7 +98,7 @@ export const Playground: Story = {
|
|
|
98
98
|
export const ThreeColumns: Story = {
|
|
99
99
|
args: {
|
|
100
100
|
columns: 3,
|
|
101
|
-
|
|
101
|
+
spacing: 'md',
|
|
102
102
|
},
|
|
103
103
|
render: args => (
|
|
104
104
|
<Grid {...args} style={{ width: 500 }}>
|
|
@@ -124,7 +124,7 @@ export const ResponsiveColumns: Story = {
|
|
|
124
124
|
lg: 4,
|
|
125
125
|
xl: 5,
|
|
126
126
|
},
|
|
127
|
-
|
|
127
|
+
spacing: 'md',
|
|
128
128
|
},
|
|
129
129
|
render: args => (
|
|
130
130
|
<Grid {...args} style={{ width: '100%' }}>
|
|
@@ -145,7 +145,7 @@ export const ResponsiveColumns: Story = {
|
|
|
145
145
|
export const DifferentSizes: Story = {
|
|
146
146
|
args: {
|
|
147
147
|
columns: 3,
|
|
148
|
-
|
|
148
|
+
spacing: 'sm',
|
|
149
149
|
},
|
|
150
150
|
render: args => (
|
|
151
151
|
<Grid {...args} style={{ width: 500 }}>
|
|
@@ -178,7 +178,7 @@ export const CustomGaps: Story = {
|
|
|
178
178
|
export const WithContent: Story = {
|
|
179
179
|
args: {
|
|
180
180
|
columns: 2,
|
|
181
|
-
|
|
181
|
+
spacing: 'md',
|
|
182
182
|
},
|
|
183
183
|
render: args => (
|
|
184
184
|
<Grid {...args} style={{ width: 400 }}>
|
|
@@ -9,6 +9,7 @@ const Grid = ({
|
|
|
9
9
|
containerStyle,
|
|
10
10
|
itemStyle,
|
|
11
11
|
rowStyle,
|
|
12
|
+
spacing,
|
|
12
13
|
space,
|
|
13
14
|
children,
|
|
14
15
|
...props
|
|
@@ -19,7 +20,7 @@ const Grid = ({
|
|
|
19
20
|
const { width } = useWindowDimensions();
|
|
20
21
|
const { gap, columnGap, rowGap } = { ...remainingProps, ...computedStyles };
|
|
21
22
|
|
|
22
|
-
styles.useVariants({ space });
|
|
23
|
+
styles.useVariants({ spacing: space ?? spacing });
|
|
23
24
|
|
|
24
25
|
const getColumnsForWidth = useMemo(() => {
|
|
25
26
|
// If columns is a number, use that number
|
|
@@ -124,14 +125,14 @@ const styles = StyleSheet.create(theme => ({
|
|
|
124
125
|
rowsContainer: {
|
|
125
126
|
width: '100%',
|
|
126
127
|
variants: {
|
|
127
|
-
|
|
128
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
128
129
|
},
|
|
129
130
|
},
|
|
130
131
|
row: {
|
|
131
132
|
flexDirection: 'row',
|
|
132
133
|
width: '100%',
|
|
133
134
|
variants: {
|
|
134
|
-
|
|
135
|
+
spacing: theme.globalStyle.variants.spacing,
|
|
135
136
|
},
|
|
136
137
|
},
|
|
137
138
|
item: {
|
|
@@ -83,7 +83,7 @@ const MyComponent = () => (
|
|
|
83
83
|
| button | `ReactElement` | Optional Button component displayed below description | `-` |
|
|
84
84
|
| variant | `'emphasis' \| 'subtle'` | Visual style variant with strong or subtle borders | `'emphasis'` |
|
|
85
85
|
|
|
86
|
-
The component also accepts all standard Card props except `noPadding`, `colorScheme`, `
|
|
86
|
+
The component also accepts all standard Card props except `noPadding`, `colorScheme`, `spacing`, `gap`, `rowGap`, `columnGap`, `flexDirection`, `flexWrap`, `alignItems`, and `justifyContent`.
|
|
87
87
|
|
|
88
88
|
### `HighlightBannerImage` Props
|
|
89
89
|
|
|
@@ -103,7 +103,7 @@ export const ColorVariants: Story = {
|
|
|
103
103
|
render: args => {
|
|
104
104
|
return (
|
|
105
105
|
<View style={{ width: 400 }}>
|
|
106
|
-
<Flex
|
|
106
|
+
<Flex spacing="lg" direction="column" align="stretch">
|
|
107
107
|
<HighlightBanner
|
|
108
108
|
{...args}
|
|
109
109
|
heading="Energy Blue"
|
|
@@ -237,7 +237,7 @@ export const SubtleCard: Story = {
|
|
|
237
237
|
export const DifferentImages: Story = {
|
|
238
238
|
render: args => {
|
|
239
239
|
return (
|
|
240
|
-
<Flex
|
|
240
|
+
<Flex spacing="lg" direction="column">
|
|
241
241
|
<View style={{ width: 400 }}>
|
|
242
242
|
<HighlightBanner
|
|
243
243
|
{...args}
|
|
@@ -38,7 +38,7 @@ The following example shows how to use the icons directly from the `@utilityware
|
|
|
38
38
|
|
|
39
39
|
<UsageWrap>
|
|
40
40
|
<Center>
|
|
41
|
-
<Flex
|
|
41
|
+
<Flex spacing="lg" direction="row" alignItems="center">
|
|
42
42
|
<ElectricityMediumIcon color={lightTheme.color.energyBlue['700']} />
|
|
43
43
|
<MobileMediumIcon color={lightTheme.color.mobileRose['700']} />
|
|
44
44
|
<BroadbandMediumIcon color={lightTheme.color.broadbandGreen['700']} />
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
const MyComponent = () => {
|
|
60
60
|
const { color } = useTheme();
|
|
61
61
|
return (
|
|
62
|
-
<Flex
|
|
62
|
+
<Flex spacing="lg" direction="row" alignItems="center">
|
|
63
63
|
<ElectricityMediumIcon color={color.energyBlue['700']} />
|
|
64
64
|
<MobileMediumIcon color={color.mobileRose['700']} />
|
|
65
65
|
<BroadbandMediumIcon color={color.broadbandGreen['700']} />
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
|
|
83
83
|
const MyComponent = () => {
|
|
84
84
|
return (
|
|
85
|
-
<Flex
|
|
85
|
+
<Flex spacing="lg" direction="row" alignItems="center">
|
|
86
86
|
<Icon as={ElectricityMediumIcon} color="energyBlue700" />
|
|
87
87
|
<Icon as={MobileMediumIcon} color="mobileRose700" />
|
|
88
88
|
<Icon as={BroadbandMediumIcon} color="broadbandGreen700" />
|
|
@@ -94,7 +94,7 @@ export const Variants: Story = {
|
|
|
94
94
|
// @ts-expect-error - This is a playground
|
|
95
95
|
const icon = _icon === 'none' ? undefined : Icons[_icon];
|
|
96
96
|
return (
|
|
97
|
-
<ButtonGroup flexDirection="column"
|
|
97
|
+
<ButtonGroup flexDirection="column" spacing="md">
|
|
98
98
|
<>
|
|
99
99
|
{args.colorScheme === 'highlight' && (
|
|
100
100
|
<VariantTitle title="Emphasis" invert={args.inverted}>
|
|
@@ -137,9 +137,9 @@ export const KitchenSink: Story = {
|
|
|
137
137
|
const schemes: Array<ColorScheme> = ['highlight', 'destructive', 'affirmative', 'functional'];
|
|
138
138
|
const variants: Array<Variant> = ['emphasis', 'solid', 'outline', 'ghost'];
|
|
139
139
|
return (
|
|
140
|
-
<Flex direction="row"
|
|
140
|
+
<Flex direction="row" spacing="lg" wrap="wrap">
|
|
141
141
|
{schemes.map(scheme => (
|
|
142
|
-
<Flex direction="column"
|
|
142
|
+
<Flex direction="column" spacing="lg" key={scheme}>
|
|
143
143
|
{variants
|
|
144
144
|
.filter(variant => {
|
|
145
145
|
if (inverted) {
|
|
@@ -166,7 +166,7 @@ export const KitchenSink: Story = {
|
|
|
166
166
|
{scheme} - {variant}
|
|
167
167
|
</DetailText>
|
|
168
168
|
</Box>
|
|
169
|
-
<Flex direction="column"
|
|
169
|
+
<Flex direction="column" spacing="lg">
|
|
170
170
|
<VariantTitle title="Default" invert={inverted}>
|
|
171
171
|
{/* @ts-expect-error - story loop types don't match */}
|
|
172
172
|
<IconButton
|
|
@@ -224,7 +224,7 @@ export const KitchenSink: Story = {
|
|
|
224
224
|
export const ServiceIconButtons: Story = {
|
|
225
225
|
render: () => {
|
|
226
226
|
return (
|
|
227
|
-
<ButtonGroup
|
|
227
|
+
<ButtonGroup spacing="md">
|
|
228
228
|
<IconButton
|
|
229
229
|
icon={ElectricityMediumIcon}
|
|
230
230
|
backgroundColor="energyBlue200"
|
|
@@ -36,7 +36,7 @@ Wrap an icon with the `IconContainer` to apply sizing + background styles withou
|
|
|
36
36
|
|
|
37
37
|
<UsageWrap>
|
|
38
38
|
<Center>
|
|
39
|
-
<Flex direction="row"
|
|
39
|
+
<Flex direction="row" spacing="lg" alignItems="center">
|
|
40
40
|
<IconContainer icon={ElectricityMediumIcon} size="md" variant="emphasis" color="energy" />
|
|
41
41
|
<IconContainer icon={BroadbandMediumIcon} size="md" variant="emphasis" color="broadband" />
|
|
42
42
|
<IconContainer icon={MobileMediumIcon} size="md" variant="emphasis" color="mobile" />
|
|
@@ -92,11 +92,11 @@ export const KitchenSink: Story = {
|
|
|
92
92
|
'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight'
|
|
93
93
|
> = ['pig', 'energy', 'broadband', 'mobile', 'insurance', 'cashback', 'highlight'];
|
|
94
94
|
return (
|
|
95
|
-
<Flex direction="column"
|
|
95
|
+
<Flex direction="column" spacing="lg">
|
|
96
96
|
{sizes.map(size => (
|
|
97
97
|
<Box key={size} gap="300">
|
|
98
98
|
<VariantTitle title={`Size: ${size.toUpperCase()} / Subtle`}> </VariantTitle>
|
|
99
|
-
<Flex direction="row" wrap="wrap"
|
|
99
|
+
<Flex direction="row" wrap="wrap" spacing="md">
|
|
100
100
|
{colors.map(color => (
|
|
101
101
|
<IconContainer
|
|
102
102
|
key={`${size}-subtle-${color}`}
|
|
@@ -108,7 +108,7 @@ export const KitchenSink: Story = {
|
|
|
108
108
|
))}
|
|
109
109
|
</Flex>
|
|
110
110
|
<VariantTitle title={`Size: ${size.toUpperCase()} / Emphasis`}> </VariantTitle>
|
|
111
|
-
<Flex direction="row" wrap="wrap"
|
|
111
|
+
<Flex direction="row" wrap="wrap" spacing="md">
|
|
112
112
|
{colors.map(
|
|
113
113
|
color =>
|
|
114
114
|
color !== 'highlight' && (
|
|
@@ -2,9 +2,9 @@ import { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import * as Icons from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
import { VariantTitle } from '../../../docs/components';
|
|
5
|
+
import { useTheme } from '../../hooks';
|
|
5
6
|
import { Box } from '../Box';
|
|
6
7
|
import { Flex } from '../Flex';
|
|
7
|
-
import { useTheme } from '../../hooks';
|
|
8
8
|
import IndicatorIconButton from './IndicatorIconButton';
|
|
9
9
|
|
|
10
10
|
const meta = {
|
|
@@ -57,8 +57,8 @@ export const Variants: Story = {
|
|
|
57
57
|
render: args => {
|
|
58
58
|
const icon = typeof args.icon === 'string' ? Icons[args.icon as keyof typeof Icons] : args.icon;
|
|
59
59
|
return (
|
|
60
|
-
<Flex direction="column"
|
|
61
|
-
<Flex direction="row"
|
|
60
|
+
<Flex direction="column" spacing="xl">
|
|
61
|
+
<Flex direction="row" spacing="lg">
|
|
62
62
|
<Box>
|
|
63
63
|
<VariantTitle title="Without Indicator" invert={args.inverted}>
|
|
64
64
|
<IndicatorIconButton {...args} icon={icon} indicator={false} />
|
|
@@ -70,7 +70,7 @@ export const Variants: Story = {
|
|
|
70
70
|
</VariantTitle>
|
|
71
71
|
</Box>
|
|
72
72
|
</Flex>
|
|
73
|
-
<Flex direction="row"
|
|
73
|
+
<Flex direction="row" spacing="lg">
|
|
74
74
|
<Box style={{ backgroundColor: 'purple', padding: 10, borderRadius: 8 }}>
|
|
75
75
|
<VariantTitle title="Inverted" invert={!args.inverted}>
|
|
76
76
|
<IndicatorIconButton {...args} icon={icon} inverted={true} />
|
|
@@ -88,13 +88,21 @@ export const Colourful: Story = {
|
|
|
88
88
|
const theme = useTheme();
|
|
89
89
|
|
|
90
90
|
return (
|
|
91
|
-
<Flex direction="column"
|
|
92
|
-
<Flex direction="row"
|
|
91
|
+
<Flex direction="column" spacing="xl">
|
|
92
|
+
<Flex direction="row" spacing="lg">
|
|
93
93
|
<Box>
|
|
94
|
-
<IndicatorIconButton
|
|
94
|
+
<IndicatorIconButton
|
|
95
|
+
{...args}
|
|
96
|
+
icon={icon}
|
|
97
|
+
iconStyle={{ color: theme.color.energyBlue[500] }}
|
|
98
|
+
/>
|
|
95
99
|
</Box>
|
|
96
100
|
<Box>
|
|
97
|
-
<IndicatorIconButton
|
|
101
|
+
<IndicatorIconButton
|
|
102
|
+
{...args}
|
|
103
|
+
icon={icon}
|
|
104
|
+
iconStyle={{ color: theme.color.cashbackLilac[500] }}
|
|
105
|
+
/>
|
|
98
106
|
</Box>
|
|
99
107
|
</Flex>
|
|
100
108
|
</Flex>
|
|
@@ -105,7 +113,7 @@ export const Colourful: Story = {
|
|
|
105
113
|
export const WithAccessibilityLabel: Story = {
|
|
106
114
|
render: args => {
|
|
107
115
|
return (
|
|
108
|
-
<Flex direction="column"
|
|
116
|
+
<Flex direction="column" spacing="xl">
|
|
109
117
|
<Box>
|
|
110
118
|
<VariantTitle title="Notification label" invert={args.inverted}>
|
|
111
119
|
<IndicatorIconButton
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InlineLink } from '.';
|
|
2
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { InlineLink } from '.';
|
|
3
3
|
import { BodyText } from '../BodyText';
|
|
4
4
|
import { Flex } from '../Flex';
|
|
5
5
|
import { List } from '../List';
|
|
@@ -55,7 +55,7 @@ export const Playground: Story = {};
|
|
|
55
55
|
export const Variants: Story = {
|
|
56
56
|
render: ({ children }) => {
|
|
57
57
|
return (
|
|
58
|
-
<Flex direction="column"
|
|
58
|
+
<Flex direction="column" spacing="sm">
|
|
59
59
|
<List></List>
|
|
60
60
|
<BodyText>
|
|
61
61
|
This is the body text style, and it contains an{' '}
|
|
@@ -107,7 +107,7 @@ export const Variants: Story = {
|
|
|
107
107
|
setClearableSearchValue('');
|
|
108
108
|
};
|
|
109
109
|
return (
|
|
110
|
-
<Flex direction="column"
|
|
110
|
+
<Flex direction="column" spacing="lg">
|
|
111
111
|
<VariantTitle title="Default">
|
|
112
112
|
<Input />
|
|
113
113
|
</VariantTitle>
|
|
@@ -202,7 +202,7 @@ export const RefTest: Story = {
|
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
return (
|
|
205
|
-
<Flex direction="column"
|
|
205
|
+
<Flex direction="column" spacing="lg">
|
|
206
206
|
<VariantTitle title="Ref Test">
|
|
207
207
|
<Input
|
|
208
208
|
ref={inputRef}
|
|
@@ -211,8 +211,8 @@ export const RefTest: Story = {
|
|
|
211
211
|
/>
|
|
212
212
|
</VariantTitle>
|
|
213
213
|
<VariantTitle title="Status">
|
|
214
|
-
<Flex direction="column"
|
|
215
|
-
<Flex direction="row"
|
|
214
|
+
<Flex direction="column" spacing="sm">
|
|
215
|
+
<Flex direction="row" spacing="sm">
|
|
216
216
|
<Button onPress={handleFocus}>Focus Input</Button>
|
|
217
217
|
<Button onPress={handleBlur}>Blur Input</Button>
|
|
218
218
|
<Button onPress={handleClear}>Clear Input</Button>
|
|
@@ -408,7 +408,7 @@ export const KitchenSink: Story = {
|
|
|
408
408
|
{ text: 'List Item 3', helperText: 'Supporting Text 3' },
|
|
409
409
|
];
|
|
410
410
|
return (
|
|
411
|
-
<Flex
|
|
411
|
+
<Flex spacing="sm" direction="column" style={{ width: '100%' }}>
|
|
412
412
|
<VariantTitle title="List with title and supporting text">
|
|
413
413
|
<List heading="List Heading" helperText="Supporting Text">
|
|
414
414
|
{list.map((item, index) => (
|
|
@@ -67,11 +67,14 @@ const MyComponent = () => {
|
|
|
67
67
|
|
|
68
68
|
### Menu
|
|
69
69
|
|
|
70
|
-
| Prop
|
|
71
|
-
|
|
|
72
|
-
| `heading`
|
|
73
|
-
| `children`
|
|
74
|
-
|
|
70
|
+
| Prop | Type | Default | Description |
|
|
71
|
+
| ---------- | ----------- | ------- | --------------------------------------------- |
|
|
72
|
+
| `heading` | `string` | - | Heading text displayed at the top of the menu |
|
|
73
|
+
| `children` | `ReactNode` | - | Menu items to display |
|
|
74
|
+
|
|
75
|
+
The rest of the props are passed down to the underlying `BottomSheetModal` component, so you can use any of its
|
|
76
|
+
props for additional configuration (e.g. `snapPoints`, `backgroundStyle`, etc.).
|
|
77
|
+
See the [BottomSheetModal docs](/?path=/docs/components-bottomsheet--docs) for more details.
|
|
75
78
|
|
|
76
79
|
### MenuItem
|
|
77
80
|
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { Button, Menu, MenuTrigger } from '../';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
figma.connect(Menu, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3263%3A18832', {
|
|
6
|
+
props: {
|
|
7
|
+
menuItems: figma.children('Menu Item'),
|
|
8
|
+
heading: figma.boolean('Heading?', {
|
|
9
|
+
true: figma.string('Heading'),
|
|
10
|
+
}),
|
|
11
|
+
showHandle: figma.boolean('Grabber?', {
|
|
12
|
+
true: true,
|
|
13
|
+
}),
|
|
14
|
+
},
|
|
15
|
+
example: props => {
|
|
16
|
+
const menuRef = useRef(null);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<MenuTrigger onPress={() => menuRef.current?.present()}>
|
|
21
|
+
<Button>Open Menu</Button>
|
|
22
|
+
</MenuTrigger>
|
|
11
23
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// These props were automatically mapped based on your linked code:
|
|
18
|
-
heading: figma.string("Heading"),
|
|
19
|
-
// No matching props could be found for these Figma properties:
|
|
20
|
-
// "heading": figma.string('Heading'),
|
|
21
|
-
// "heading": figma.boolean('Heading?'),
|
|
22
|
-
// "grabber": figma.boolean('Grabber?'),
|
|
23
|
-
// "deviceType": figma.enum('Device type', {
|
|
24
|
-
// "Web": "web",
|
|
25
|
-
// "App": "app"
|
|
26
|
-
// })
|
|
27
|
-
},
|
|
28
|
-
example: (props) => <Menu heading={props.heading} />,
|
|
24
|
+
<Menu ref={menuRef} heading={props.heading} showHandle={props.showHandle}>
|
|
25
|
+
{props.menuItems}
|
|
26
|
+
</Menu>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
29
|
},
|
|
30
|
-
)
|
|
30
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { BottomSheetModalProps } from '@gorhom/bottom-sheet';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import { BottomSheetProps } from '../BottomSheet';
|
|
3
3
|
|
|
4
4
|
export interface MenuMethods {
|
|
5
5
|
present: () => void;
|
|
6
6
|
dismiss: () => void;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface MenuProps {
|
|
9
|
+
export interface MenuProps extends BottomSheetProps {
|
|
10
10
|
/**
|
|
11
11
|
* Heading text displayed at the top of the menu
|
|
12
12
|
*/
|
|
@@ -15,10 +15,6 @@ export interface MenuProps {
|
|
|
15
15
|
* Menu items to display
|
|
16
16
|
*/
|
|
17
17
|
children: ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* Optional bottom sheet modal props to customise the menu behavior
|
|
20
|
-
*/
|
|
21
|
-
bottomSheetProps?: Partial<BottomSheetModalProps>;
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
export default MenuProps;
|