@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
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import * as Icons from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import {
|
|
4
|
+
BroadbandMediumIcon,
|
|
5
|
+
CashbackCardMediumIcon,
|
|
6
|
+
ElectricityMediumIcon,
|
|
7
|
+
InsuranceMediumIcon,
|
|
8
|
+
MobileMediumIcon,
|
|
9
|
+
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
10
|
import { ComponentType } from 'react';
|
|
4
11
|
import { IconButton, IconButtonProps } from '.';
|
|
5
12
|
import { VariantTitle } from '../../../docs/components';
|
|
@@ -87,7 +94,7 @@ export const Variants: Story = {
|
|
|
87
94
|
// @ts-expect-error - This is a playground
|
|
88
95
|
const icon = _icon === 'none' ? undefined : Icons[_icon];
|
|
89
96
|
return (
|
|
90
|
-
<ButtonGroup flexDirection="column"
|
|
97
|
+
<ButtonGroup flexDirection="column" spacing="md">
|
|
91
98
|
<>
|
|
92
99
|
{args.colorScheme === 'highlight' && (
|
|
93
100
|
<VariantTitle title="Emphasis" invert={args.inverted}>
|
|
@@ -130,9 +137,9 @@ export const KitchenSink: Story = {
|
|
|
130
137
|
const schemes: Array<ColorScheme> = ['highlight', 'destructive', 'affirmative', 'functional'];
|
|
131
138
|
const variants: Array<Variant> = ['emphasis', 'solid', 'outline', 'ghost'];
|
|
132
139
|
return (
|
|
133
|
-
<Flex direction="row"
|
|
140
|
+
<Flex direction="row" spacing="lg" wrap="wrap">
|
|
134
141
|
{schemes.map(scheme => (
|
|
135
|
-
<Flex direction="column"
|
|
142
|
+
<Flex direction="column" spacing="lg" key={scheme}>
|
|
136
143
|
{variants
|
|
137
144
|
.filter(variant => {
|
|
138
145
|
if (inverted) {
|
|
@@ -159,7 +166,7 @@ export const KitchenSink: Story = {
|
|
|
159
166
|
{scheme} - {variant}
|
|
160
167
|
</DetailText>
|
|
161
168
|
</Box>
|
|
162
|
-
<Flex direction="column"
|
|
169
|
+
<Flex direction="column" spacing="lg">
|
|
163
170
|
<VariantTitle title="Default" invert={inverted}>
|
|
164
171
|
{/* @ts-expect-error - story loop types don't match */}
|
|
165
172
|
<IconButton
|
|
@@ -213,3 +220,52 @@ export const KitchenSink: Story = {
|
|
|
213
220
|
);
|
|
214
221
|
},
|
|
215
222
|
};
|
|
223
|
+
|
|
224
|
+
export const ServiceIconButtons: Story = {
|
|
225
|
+
render: () => {
|
|
226
|
+
return (
|
|
227
|
+
<ButtonGroup spacing="md">
|
|
228
|
+
<IconButton
|
|
229
|
+
icon={ElectricityMediumIcon}
|
|
230
|
+
backgroundColor="energyBlue200"
|
|
231
|
+
activeBackgroundColor="energyBlue300"
|
|
232
|
+
variant="emphasis"
|
|
233
|
+
shadowColor="energyBlue300"
|
|
234
|
+
onPress={() => console.log('Pressed')}
|
|
235
|
+
/>
|
|
236
|
+
<IconButton
|
|
237
|
+
icon={BroadbandMediumIcon}
|
|
238
|
+
backgroundColor="broadbandGreen200"
|
|
239
|
+
activeBackgroundColor="broadbandGreen300"
|
|
240
|
+
variant="emphasis"
|
|
241
|
+
shadowColor="broadbandGreen300"
|
|
242
|
+
onPress={() => console.log('Pressed')}
|
|
243
|
+
/>
|
|
244
|
+
<IconButton
|
|
245
|
+
icon={MobileMediumIcon}
|
|
246
|
+
backgroundColor="mobileRose200"
|
|
247
|
+
activeBackgroundColor="mobileRose300"
|
|
248
|
+
variant="emphasis"
|
|
249
|
+
shadowColor="mobileRose400"
|
|
250
|
+
onPress={() => console.log('Pressed')}
|
|
251
|
+
/>
|
|
252
|
+
<IconButton
|
|
253
|
+
icon={InsuranceMediumIcon}
|
|
254
|
+
backgroundColor="insuranceOrange300"
|
|
255
|
+
activeBackgroundColor="insuranceOrange400"
|
|
256
|
+
variant="emphasis"
|
|
257
|
+
shadowColor="insuranceOrange400"
|
|
258
|
+
onPress={() => console.log('Pressed')}
|
|
259
|
+
/>
|
|
260
|
+
<IconButton
|
|
261
|
+
icon={CashbackCardMediumIcon}
|
|
262
|
+
backgroundColor="cashbackLilac300"
|
|
263
|
+
activeBackgroundColor="cashbackLilac400"
|
|
264
|
+
variant="emphasis"
|
|
265
|
+
shadowColor="cashbackLilac500"
|
|
266
|
+
onPress={() => console.log('Pressed')}
|
|
267
|
+
/>
|
|
268
|
+
</ButtonGroup>
|
|
269
|
+
);
|
|
270
|
+
},
|
|
271
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { Pressable, ViewStyle } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import { getFlattenedColorValue } from '../../utils';
|
|
4
5
|
import { IconButtonContext } from './IconButton.context';
|
|
5
6
|
import type { IconButtonProps } from './IconButton.props';
|
|
6
7
|
|
|
@@ -11,6 +12,9 @@ const IconButtonRoot = ({
|
|
|
11
12
|
size = 'md',
|
|
12
13
|
inverted = false,
|
|
13
14
|
states,
|
|
15
|
+
backgroundColor,
|
|
16
|
+
activeBackgroundColor,
|
|
17
|
+
shadowColor,
|
|
14
18
|
...props
|
|
15
19
|
}: IconButtonProps & { states?: { active?: boolean; disabled?: boolean } }) => {
|
|
16
20
|
const { active, disabled } = states || {};
|
|
@@ -21,7 +25,20 @@ const IconButtonRoot = ({
|
|
|
21
25
|
);
|
|
22
26
|
return (
|
|
23
27
|
<IconButtonContext.Provider value={value}>
|
|
24
|
-
<Pressable
|
|
28
|
+
<Pressable
|
|
29
|
+
{...props}
|
|
30
|
+
style={[
|
|
31
|
+
styles.container,
|
|
32
|
+
styles.overrides({
|
|
33
|
+
backgroundColor,
|
|
34
|
+
activeBackgroundColor,
|
|
35
|
+
shadowColor,
|
|
36
|
+
active,
|
|
37
|
+
variant,
|
|
38
|
+
}),
|
|
39
|
+
props.style as ViewStyle,
|
|
40
|
+
]}
|
|
41
|
+
>
|
|
25
42
|
{children}
|
|
26
43
|
</Pressable>
|
|
27
44
|
</IconButtonContext.Provider>
|
|
@@ -420,6 +437,42 @@ const styles = StyleSheet.create(theme => ({
|
|
|
420
437
|
},
|
|
421
438
|
],
|
|
422
439
|
},
|
|
440
|
+
overrides: ({ backgroundColor, activeBackgroundColor, shadowColor, active, variant }) => ({
|
|
441
|
+
...(backgroundColor
|
|
442
|
+
? {
|
|
443
|
+
backgroundColor: getFlattenedColorValue(backgroundColor, theme.color),
|
|
444
|
+
_web: {
|
|
445
|
+
_hover: {
|
|
446
|
+
backgroundColor: getFlattenedColorValue(
|
|
447
|
+
activeBackgroundColor ?? backgroundColor,
|
|
448
|
+
theme.color
|
|
449
|
+
),
|
|
450
|
+
},
|
|
451
|
+
_active: {
|
|
452
|
+
backgroundColor: getFlattenedColorValue(
|
|
453
|
+
activeBackgroundColor ?? backgroundColor,
|
|
454
|
+
theme.color
|
|
455
|
+
),
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
}
|
|
459
|
+
: {}),
|
|
460
|
+
...(active && activeBackgroundColor
|
|
461
|
+
? {
|
|
462
|
+
backgroundColor: getFlattenedColorValue(activeBackgroundColor, theme.color),
|
|
463
|
+
}
|
|
464
|
+
: {}),
|
|
465
|
+
...(shadowColor && variant === 'emphasis'
|
|
466
|
+
? {
|
|
467
|
+
boxShadow: `${theme.shadow.mobile.sm.x}px ${theme.shadow.mobile.sm.y}px ${theme.shadow.mobile.sm.spread}px ${getFlattenedColorValue(shadowColor, theme.color)}`,
|
|
468
|
+
}
|
|
469
|
+
: {}),
|
|
470
|
+
...(active && shadowColor && variant === 'emphasis'
|
|
471
|
+
? {
|
|
472
|
+
boxShadow: 'none',
|
|
473
|
+
}
|
|
474
|
+
: {}),
|
|
475
|
+
}),
|
|
423
476
|
}));
|
|
424
477
|
|
|
425
478
|
export default IconButtonRoot;
|
|
@@ -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) => (
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { BodyText, BodyTextProps } from '../../BodyText';
|
|
3
3
|
|
|
4
|
-
const ListItemHelperText = ({ children, ...props }: BodyTextProps) => {
|
|
4
|
+
const ListItemHelperText = ({ children, style, ...props }: BodyTextProps) => {
|
|
5
5
|
return (
|
|
6
|
-
<BodyText size="md"
|
|
6
|
+
<BodyText size="md" style={[styles.text, style]} {...props}>
|
|
7
7
|
{children}
|
|
8
8
|
</BodyText>
|
|
9
9
|
);
|
|
@@ -328,21 +328,35 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
328
328
|
variants: {
|
|
329
329
|
bothButtons: {
|
|
330
330
|
true: {
|
|
331
|
-
paddingBottom:
|
|
331
|
+
paddingBottom:
|
|
332
|
+
166 +
|
|
333
|
+
rt.insets.bottom -
|
|
334
|
+
theme.components.modal.padding +
|
|
335
|
+
theme.components.bottomSheet.padding,
|
|
332
336
|
},
|
|
333
337
|
false: {
|
|
334
|
-
paddingBottom:
|
|
338
|
+
paddingBottom:
|
|
339
|
+
102 +
|
|
340
|
+
rt.insets.bottom -
|
|
341
|
+
theme.components.modal.padding +
|
|
342
|
+
theme.components.bottomSheet.padding,
|
|
335
343
|
},
|
|
336
344
|
},
|
|
337
345
|
noButtons: {
|
|
338
346
|
true: {
|
|
339
|
-
paddingBottom:
|
|
347
|
+
paddingBottom:
|
|
348
|
+
rt.insets.bottom +
|
|
349
|
+
theme.components.modal.padding +
|
|
350
|
+
theme.components.bottomSheet.padding,
|
|
340
351
|
},
|
|
341
352
|
},
|
|
342
353
|
stickyFooter: {
|
|
343
354
|
true: {},
|
|
344
355
|
false: {
|
|
345
|
-
paddingBottom:
|
|
356
|
+
paddingBottom:
|
|
357
|
+
rt.insets.bottom +
|
|
358
|
+
theme.components.modal.padding +
|
|
359
|
+
theme.components.bottomSheet.padding,
|
|
346
360
|
},
|
|
347
361
|
},
|
|
348
362
|
},
|
|
@@ -54,30 +54,30 @@ export const PillStates: Story = {
|
|
|
54
54
|
const selectedValue = '2';
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<Flex
|
|
57
|
+
<Flex spacing="xl" direction="column" align="center">
|
|
58
58
|
<VariantTitle title="Unselected">
|
|
59
|
-
<Flex direction="row"
|
|
59
|
+
<Flex direction="row" spacing="sm">
|
|
60
60
|
<PillGroup value={selectedValue} onChange={() => {}}>
|
|
61
61
|
<Pill value="1" label="Label" />
|
|
62
62
|
</PillGroup>
|
|
63
63
|
</Flex>
|
|
64
64
|
</VariantTitle>
|
|
65
65
|
<VariantTitle title="Selected">
|
|
66
|
-
<Flex direction="row"
|
|
66
|
+
<Flex direction="row" spacing="sm">
|
|
67
67
|
<PillGroup value={selectedValue} onChange={() => {}}>
|
|
68
68
|
<Pill value="2" label="Label" />
|
|
69
69
|
</PillGroup>
|
|
70
70
|
</Flex>
|
|
71
71
|
</VariantTitle>
|
|
72
72
|
<VariantTitle title="With Icon - Unselected">
|
|
73
|
-
<Flex direction="row"
|
|
73
|
+
<Flex direction="row" spacing="sm">
|
|
74
74
|
<PillGroup value={selectedValue} onChange={() => {}}>
|
|
75
75
|
<Pill value="1" label="New" icon={HeartMediumIcon} />
|
|
76
76
|
</PillGroup>
|
|
77
77
|
</Flex>
|
|
78
78
|
</VariantTitle>
|
|
79
79
|
<VariantTitle title="With Icon - Selected">
|
|
80
|
-
<Flex direction="row"
|
|
80
|
+
<Flex direction="row" spacing="sm">
|
|
81
81
|
<PillGroup value={selectedValue} onChange={() => {}}>
|
|
82
82
|
<Pill value="2" label="New" icon={HeartMediumIcon} />
|
|
83
83
|
</PillGroup>
|
|
@@ -101,7 +101,7 @@ export const WrapBehavior: Story = {
|
|
|
101
101
|
const [value2, setValue2] = useState<string>('7');
|
|
102
102
|
|
|
103
103
|
return (
|
|
104
|
-
<Flex
|
|
104
|
+
<Flex spacing="xl" direction="column" align="center">
|
|
105
105
|
<VariantTitle title="Wrap: False">
|
|
106
106
|
<PillGroup wrap={false} value={value1} onChange={setValue1}>
|
|
107
107
|
<Pill value="1" label="New" />
|
|
@@ -139,7 +139,7 @@ export const Multiple: Story = {
|
|
|
139
139
|
const [selectedCategories, setSelectedCategories] = useState<string[]>(['new', 'read']);
|
|
140
140
|
|
|
141
141
|
return (
|
|
142
|
-
<Flex
|
|
142
|
+
<Flex spacing="lg" direction="column" align="center" style={{ maxWidth: 400 }}>
|
|
143
143
|
<PillGroup wrap={true} multiple value={selectedCategories} onChange={setSelectedCategories}>
|
|
144
144
|
<Pill value="unread" label="Unread" />
|
|
145
145
|
<Pill value="new" label="New" icon={HeartMediumIcon} />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import {
|
|
2
|
+
import { ProgressStep, ProgressStepper } from '.';
|
|
4
3
|
import { VariantTitle } from '../../../docs/components';
|
|
5
4
|
import { BodyText } from '../BodyText';
|
|
6
5
|
import { Flex } from '../Flex';
|
|
@@ -20,20 +19,20 @@ type Story = StoryObj<typeof meta>;
|
|
|
20
19
|
export const Playground: Story = {
|
|
21
20
|
args: {
|
|
22
21
|
children: (
|
|
23
|
-
<Flex
|
|
22
|
+
<Flex spacing="xl" direction="column" align="center" style={{ flex: 1, minWidth: 200 }}>
|
|
24
23
|
<ProgressStepper>
|
|
25
24
|
<ProgressStep id={'1'} status="complete" />
|
|
26
25
|
<ProgressStep id={'2'} status="complete" />
|
|
27
26
|
<ProgressStep id={'3'} status="active" />
|
|
28
27
|
<ProgressStep id={'4'} status="incomplete" />
|
|
29
28
|
</ProgressStepper>
|
|
30
|
-
<Flex direction="row"
|
|
29
|
+
<Flex direction="row" spacing="lg" style={{ width: '100%' }}>
|
|
31
30
|
<ProgressStep id={'1'} status="complete" />
|
|
32
31
|
</Flex>
|
|
33
|
-
<Flex direction="row"
|
|
32
|
+
<Flex direction="row" spacing="lg" style={{ width: '100%' }}>
|
|
34
33
|
<ProgressStep id={'3'} status="active" />
|
|
35
34
|
</Flex>
|
|
36
|
-
<Flex direction="row"
|
|
35
|
+
<Flex direction="row" spacing="lg" style={{ width: '100%' }}>
|
|
37
36
|
<ProgressStep id={'5'} status="incomplete" />
|
|
38
37
|
</Flex>
|
|
39
38
|
</Flex>
|
|
@@ -50,7 +49,7 @@ export const StepStatuses: Story = {
|
|
|
50
49
|
},
|
|
51
50
|
render: props => {
|
|
52
51
|
return (
|
|
53
|
-
<Flex
|
|
52
|
+
<Flex spacing="xl" direction="column" align="center">
|
|
54
53
|
<VariantTitle title="All Uncompleted Steps">
|
|
55
54
|
<ProgressStepper {...props}>
|
|
56
55
|
<ProgressStep id={'1'} status="incomplete" />
|
|
@@ -91,7 +90,7 @@ export const BasicExample: Story = {
|
|
|
91
90
|
},
|
|
92
91
|
render: props => {
|
|
93
92
|
return (
|
|
94
|
-
<Flex
|
|
93
|
+
<Flex spacing="lg" direction="column" align="center">
|
|
95
94
|
<Heading size="md">Progress Stepper</Heading>
|
|
96
95
|
<BodyText>Shows progress through multi-step processes</BodyText>
|
|
97
96
|
<ProgressStepper {...props}>
|
|
@@ -147,7 +147,7 @@ export const Variants: Story = {
|
|
|
147
147
|
render: ({ value: _, children: __, label: ___, disabled: _____, onChange: ______, ...args }) => {
|
|
148
148
|
const [value, setValue] = useState('Option 1');
|
|
149
149
|
return (
|
|
150
|
-
<Flex
|
|
150
|
+
<Flex spacing="lg">
|
|
151
151
|
<VariantTitle title="Default">
|
|
152
152
|
<RadioGroup
|
|
153
153
|
aria-label="Radio Group"
|
|
@@ -96,7 +96,7 @@ export const WithGrid: Story = {
|
|
|
96
96
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
97
97
|
render: ({ value: _, ...args }) => (
|
|
98
98
|
<RadioGroup {...args}>
|
|
99
|
-
<Grid columns={2}
|
|
99
|
+
<Grid columns={2} spacing="md">
|
|
100
100
|
<Radio aria-label="Label 1" label="Option 1" value="Option 1" nativeID="Radio-1" />
|
|
101
101
|
<Radio
|
|
102
102
|
aria-label="Label 2 (with added option)"
|
|
@@ -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 RadioGroupTextContent = ({ 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 RadioTextContent = ({ children, style, ...props }: FlexProps) => {
|
|
6
6
|
return (
|
|
7
|
-
<Flex direction="column"
|
|
7
|
+
<Flex direction="column" spacing="none" style={[styles.content, style]} {...props}>
|
|
8
8
|
{children}
|
|
9
9
|
</Flex>
|
|
10
10
|
);
|
|
@@ -39,7 +39,7 @@ export const KitchenSink: Story = {
|
|
|
39
39
|
},
|
|
40
40
|
render: () => {
|
|
41
41
|
return (
|
|
42
|
-
<Flex
|
|
42
|
+
<Flex spacing="xl" direction="column" style={{ width: '100%' }}>
|
|
43
43
|
<VariantTitle title="Default SectionHeader with helper text and link">
|
|
44
44
|
<SectionHeader
|
|
45
45
|
heading="Heading"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { Center, Switch, Flex, Label, FormField, FormFieldLabel, FormFieldLabelText } from '../../';
|
|
1
|
+
import { Canvas, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { Center, Flex, FormField, FormFieldLabel, FormFieldLabelText, Label, Switch } from '../../';
|
|
4
3
|
import {
|
|
5
|
-
ViewFigmaButton,
|
|
6
4
|
BackToTopButton,
|
|
7
|
-
UsageWrap,
|
|
8
|
-
SwitchList,
|
|
9
5
|
SwitchExample,
|
|
6
|
+
SwitchList,
|
|
7
|
+
UsageWrap,
|
|
8
|
+
ViewFigmaButton,
|
|
10
9
|
} from '../../../docs/components';
|
|
10
|
+
import * as Stories from './Switch.stories';
|
|
11
11
|
|
|
12
12
|
<Meta title="Components / Switch" />
|
|
13
13
|
|
|
@@ -76,7 +76,7 @@ the [`FormField` docs](/?path=/docs/native-ui-components-form-field--docs) for m
|
|
|
76
76
|
|
|
77
77
|
<UsageWrap>
|
|
78
78
|
<FormField>
|
|
79
|
-
<Flex
|
|
79
|
+
<Flex spacing="sm" direction="row" align="center" justify="center">
|
|
80
80
|
<SwitchExample />
|
|
81
81
|
<FormFieldLabel>
|
|
82
82
|
<FormFieldLabelText>Enable notifications</FormFieldLabelText>
|
|
@@ -95,7 +95,7 @@ const MyComponent = () => {
|
|
|
95
95
|
|
|
96
96
|
return (
|
|
97
97
|
<FormField>
|
|
98
|
-
<Flex
|
|
98
|
+
<Flex spacing="sm" direction="row" align="center">
|
|
99
99
|
<Switch value={notifications} onValueChange={handleChange} />
|
|
100
100
|
<FormFieldLabel>
|
|
101
101
|
<FormFieldLabelText>Enable notifications</FormFieldLabelText>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
1
2
|
import React, { useEffect } from 'react';
|
|
2
3
|
import { Switch } from '.';
|
|
3
|
-
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
4
|
import { VariantTitle } from '../../../docs/components';
|
|
5
5
|
import { Flex } from '../Flex';
|
|
6
6
|
|
|
@@ -50,7 +50,7 @@ export const Playground: Story = {
|
|
|
50
50
|
|
|
51
51
|
export const Variants: Story = {
|
|
52
52
|
render: () => (
|
|
53
|
-
<Flex direction="column"
|
|
53
|
+
<Flex direction="column" spacing="sm">
|
|
54
54
|
<VariantTitle title="Off - medium">
|
|
55
55
|
<Switch value={false} />
|
|
56
56
|
</VariantTitle>
|
|
@@ -245,7 +245,7 @@ export const Controlled: Story = {
|
|
|
245
245
|
setValue(tabs[nextIndex]);
|
|
246
246
|
};
|
|
247
247
|
return (
|
|
248
|
-
<Flex align={Platform.OS === 'web' ? 'flex-start' : 'stretch'}
|
|
248
|
+
<Flex align={Platform.OS === 'web' ? 'flex-start' : 'stretch'} spacing="lg">
|
|
249
249
|
<Tabs value={value}>
|
|
250
250
|
<TabsList>
|
|
251
251
|
<Tab value="account">Account</Tab>
|
|
@@ -115,8 +115,8 @@ import { Textarea } from '@utilitywarehouse/hearth-react-native';
|
|
|
115
115
|
|
|
116
116
|
const MyComponent = () => {
|
|
117
117
|
const [value, setValue] = useState('');
|
|
118
|
-
const handleChange =
|
|
119
|
-
setValue(
|
|
118
|
+
const handleChange = text => {
|
|
119
|
+
setValue(text);
|
|
120
120
|
};
|
|
121
121
|
return (
|
|
122
122
|
<Textarea
|
|
@@ -124,7 +124,7 @@ const MyComponent = () => {
|
|
|
124
124
|
helperText="Provide a detailed description"
|
|
125
125
|
placeholder="Enter your text here..."
|
|
126
126
|
value={value}
|
|
127
|
-
|
|
127
|
+
onChangeText={handleChange}
|
|
128
128
|
/>
|
|
129
129
|
);
|
|
130
130
|
};
|