@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
|
@@ -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
|
|
|
@@ -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" />
|
|
@@ -22,6 +22,7 @@ The `IconButton` component is used to trigger an action or event, such as openin
|
|
|
22
22
|
- [Usage](#usage)
|
|
23
23
|
- [Props](#props)
|
|
24
24
|
- [Variants](#variants)
|
|
25
|
+
- [Custom Color Overrides](#custom-color-overrides)
|
|
25
26
|
|
|
26
27
|
## Playground
|
|
27
28
|
|
|
@@ -63,16 +64,97 @@ const MyComponent = () => {
|
|
|
63
64
|
|
|
64
65
|
## Props
|
|
65
66
|
|
|
66
|
-
| Property
|
|
67
|
-
|
|
|
68
|
-
| `onPress`
|
|
69
|
-
| `variant`
|
|
70
|
-
| `size`
|
|
71
|
-
| `colorScheme`
|
|
72
|
-
| `loading`
|
|
73
|
-
| `disabled`
|
|
74
|
-
| `pressed`
|
|
67
|
+
| Property | Type | Description | Default |
|
|
68
|
+
| ----------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------- |
|
|
69
|
+
| `onPress` | `() => void` | Callback function to be called when the button is pressed. | - |
|
|
70
|
+
| `variant` | `'emphasis' \| 'solid' \| 'outline' \| 'ghost'` | The variant of the button. | 'solid' |
|
|
71
|
+
| `size` | `'xs' \| 'md' ` | The size of the button. | 'md' |
|
|
72
|
+
| `colorScheme` | `'highlight' \| 'affirmative \| 'destructive' \|`<br />` 'functional' \| 'gold'` | The colour scheme of the button. | 'highlight' |
|
|
73
|
+
| `loading` | `boolean` | Changes the button to a loading state. | `false` |
|
|
74
|
+
| `disabled` | `boolean` | Disables the button. | `false` |
|
|
75
|
+
| `pressed` | `boolean` | Changes the button to a pressed state. | `false` |
|
|
76
|
+
| `backgroundColor` | `ColorValue` | Custom background color override. Use sparingly for specific use cases only. | - |
|
|
77
|
+
| `activeBackgroundColor` | `ColorValue` | Custom active/pressed background color override. Use sparingly for specific use cases only. | - |
|
|
78
|
+
| `shadowColor` | `ColorValue` | Custom shadow color override. Use sparingly for specific use cases only. | - |
|
|
75
79
|
|
|
76
80
|
## Variants
|
|
77
81
|
|
|
78
82
|
<Canvas of={Stories.KitchenSink} />
|
|
83
|
+
|
|
84
|
+
## Custom Color Overrides
|
|
85
|
+
|
|
86
|
+
The `IconButton` component supports custom color overrides through the `backgroundColor`, `activeBackgroundColor`, and `shadowColor` props.
|
|
87
|
+
|
|
88
|
+
**⚠️ Important:** These props should be used **sparingly** and only for specific use cases where brand-specific colors are required, such as service buttons (Electricity, Broadband, Mobile, Insurance, Cashback Card).
|
|
89
|
+
|
|
90
|
+
For most use cases, you should use the standard `colorScheme` and `variant` props which maintain design system consistency.
|
|
91
|
+
|
|
92
|
+
### Example: Service Icon Buttons
|
|
93
|
+
|
|
94
|
+
<Canvas of={Stories.ServiceIconButtons} />
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { IconButton } from '@utilitywarehouse/hearth-react-native';
|
|
98
|
+
import {
|
|
99
|
+
ElectricityMediumIcon,
|
|
100
|
+
BroadbandMediumIcon,
|
|
101
|
+
MobileMediumIcon,
|
|
102
|
+
InsuranceMediumIcon,
|
|
103
|
+
CashbackCardMediumIcon,
|
|
104
|
+
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
105
|
+
|
|
106
|
+
const MyComponent = () => {
|
|
107
|
+
return (
|
|
108
|
+
<>
|
|
109
|
+
<IconButton
|
|
110
|
+
icon={ElectricityMediumIcon}
|
|
111
|
+
backgroundColor="energyBlue200"
|
|
112
|
+
activeBackgroundColor="energyBlue300"
|
|
113
|
+
variant="emphasis"
|
|
114
|
+
shadowColor="energyBlue300"
|
|
115
|
+
onPress={() => console.log('Pressed')}
|
|
116
|
+
/>
|
|
117
|
+
<IconButton
|
|
118
|
+
icon={BroadbandMediumIcon}
|
|
119
|
+
backgroundColor="broadbandGreen200"
|
|
120
|
+
activeBackgroundColor="broadbandGreen300"
|
|
121
|
+
variant="emphasis"
|
|
122
|
+
shadowColor="broadbandGreen300"
|
|
123
|
+
onPress={() => console.log('Pressed')}
|
|
124
|
+
/>
|
|
125
|
+
<IconButton
|
|
126
|
+
icon={MobileMediumIcon}
|
|
127
|
+
backgroundColor="mobileRose200"
|
|
128
|
+
activeBackgroundColor="mobileRose300"
|
|
129
|
+
variant="emphasis"
|
|
130
|
+
shadowColor="mobileRose400"
|
|
131
|
+
onPress={() => console.log('Pressed')}
|
|
132
|
+
/>
|
|
133
|
+
<IconButton
|
|
134
|
+
icon={InsuranceMediumIcon}
|
|
135
|
+
backgroundColor="insuranceOrange300"
|
|
136
|
+
activeBackgroundColor="insuranceOrange400"
|
|
137
|
+
variant="emphasis"
|
|
138
|
+
shadowColor="insuranceOrange400"
|
|
139
|
+
onPress={() => console.log('Pressed')}
|
|
140
|
+
/>
|
|
141
|
+
<IconButton
|
|
142
|
+
icon={CashbackCardMediumIcon}
|
|
143
|
+
backgroundColor="cashbackLilac300"
|
|
144
|
+
activeBackgroundColor="cashbackLilac400"
|
|
145
|
+
variant="emphasis"
|
|
146
|
+
shadowColor="cashbackLilac500"
|
|
147
|
+
onPress={() => console.log('Pressed')}
|
|
148
|
+
/>
|
|
149
|
+
</>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Override Props Behavior
|
|
155
|
+
|
|
156
|
+
- **`backgroundColor`**: Sets the base background color of the button, overriding the color scheme's default background
|
|
157
|
+
- **`activeBackgroundColor`**: Sets the background color when the button is pressed or in an active state
|
|
158
|
+
- **`shadowColor`**: Sets the shadow/elevation color for the button
|
|
159
|
+
|
|
160
|
+
These overrides work alongside the existing `variant` and `colorScheme` props, allowing you to maintain the structural styling while customising colors for specific branding requirements.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { PressableProps } from 'react-native';
|
|
3
3
|
import { ViewProps } from 'react-native-svg/lib/typescript/fabric/utils';
|
|
4
|
+
import { ColorValue } from '../../types';
|
|
4
5
|
import { ButtonVariants } from '../Button/Button.props';
|
|
5
6
|
|
|
6
7
|
export type IconButtonProps = {
|
|
@@ -22,5 +23,23 @@ export type IconButtonProps = {
|
|
|
22
23
|
*/
|
|
23
24
|
loading?: boolean;
|
|
24
25
|
children?: ViewProps['children'];
|
|
26
|
+
/**
|
|
27
|
+
* Custom background color override.
|
|
28
|
+
* ⚠️ Use sparingly and only for specific use cases (e.g., service buttons).
|
|
29
|
+
* @default undefined
|
|
30
|
+
*/
|
|
31
|
+
backgroundColor?: ColorValue;
|
|
32
|
+
/**
|
|
33
|
+
* Custom active/pressed background color override.
|
|
34
|
+
* ⚠️ Use sparingly and only for specific use cases (e.g., service buttons).
|
|
35
|
+
* @default undefined
|
|
36
|
+
*/
|
|
37
|
+
activeBackgroundColor?: ColorValue;
|
|
38
|
+
/**
|
|
39
|
+
* Custom shadow color override.
|
|
40
|
+
* ⚠️ Use sparingly and only for specific use cases (e.g., service buttons).
|
|
41
|
+
* @default undefined
|
|
42
|
+
*/
|
|
43
|
+
shadowColor?: ColorValue;
|
|
25
44
|
} & Omit<PressableProps, 'children'> &
|
|
26
45
|
ButtonVariants;
|