@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
|
@@ -183,7 +183,7 @@ const AllComponents: React.FC = () => {
|
|
|
183
183
|
return (
|
|
184
184
|
<div className="sb-unstyled">
|
|
185
185
|
<ScrollView contentContainerStyle={styles.container}>
|
|
186
|
-
<Flex direction="row" wrap="wrap"
|
|
186
|
+
<Flex direction="row" wrap="wrap" spacing="md" style={styles.grid}>
|
|
187
187
|
<ComponentWrapper name="Accordion" link="/?path=/docs/components-accordion--docs">
|
|
188
188
|
<Center flex={1} p="200">
|
|
189
189
|
<Accordion type="single">
|
|
@@ -339,7 +339,7 @@ const AllComponents: React.FC = () => {
|
|
|
339
339
|
</Center>
|
|
340
340
|
</ComponentWrapper>
|
|
341
341
|
<ComponentWrapper name="Container" link="/?path=/docs/primitives-container--docs">
|
|
342
|
-
<Container
|
|
342
|
+
<Container spacing="md" backgroundColor="backgroundSecondary">
|
|
343
343
|
<Box h={20} bg="blue300" />
|
|
344
344
|
<Box h={20} bg="blue400" />
|
|
345
345
|
<Box h={20} bg="blue500" />
|
|
@@ -399,7 +399,7 @@ const AllComponents: React.FC = () => {
|
|
|
399
399
|
<ComponentWrapper name="Divider" link="/?path=/docs/components-divider--docs">
|
|
400
400
|
<Center flex={1} p="300">
|
|
401
401
|
<BodyText>This text is divided</BodyText>
|
|
402
|
-
<Divider
|
|
402
|
+
<Divider spacing="sm" />
|
|
403
403
|
<BodyText>From this text</BodyText>
|
|
404
404
|
</Center>
|
|
405
405
|
</ComponentWrapper>
|
|
@@ -444,7 +444,7 @@ const AllComponents: React.FC = () => {
|
|
|
444
444
|
|
|
445
445
|
<ComponentWrapper name="Flex" link="/?path=/docs/primitives-flex--docs">
|
|
446
446
|
<Center flex={1}>
|
|
447
|
-
<Flex direction="row"
|
|
447
|
+
<Flex direction="row" spacing="md">
|
|
448
448
|
<Box w={40} h={40} bg="blue300" />
|
|
449
449
|
<Box w={40} h={40} bg="blue400" />
|
|
450
450
|
<Box w={40} h={40} bg="blue500" />
|
|
@@ -467,7 +467,7 @@ const AllComponents: React.FC = () => {
|
|
|
467
467
|
<ComponentWrapper name="Grid" link="/?path=/docs/primitives-grid--docs">
|
|
468
468
|
<Center flex={1}>
|
|
469
469
|
<Box width={100}>
|
|
470
|
-
<Grid columns={2}
|
|
470
|
+
<Grid columns={2} spacing="md">
|
|
471
471
|
<Box w={40} h={40} bg="blue300" />
|
|
472
472
|
<Box w={40} h={40} bg="blue400" />
|
|
473
473
|
<Box w={40} h={40} bg="blue500" />
|
|
@@ -519,7 +519,7 @@ const AllComponents: React.FC = () => {
|
|
|
519
519
|
link="/?path=/docs/components-icon-container--docs"
|
|
520
520
|
>
|
|
521
521
|
<Center flex={1}>
|
|
522
|
-
<Flex direction="row"
|
|
522
|
+
<Flex direction="row" spacing="sm">
|
|
523
523
|
<IconContainer
|
|
524
524
|
icon={ElectricityMediumIcon}
|
|
525
525
|
size="sm"
|
|
@@ -556,7 +556,7 @@ const AllComponents: React.FC = () => {
|
|
|
556
556
|
|
|
557
557
|
<ComponentWrapper name="Icons" link="/?path=/docs/components-icons--docs">
|
|
558
558
|
<Center flex={1}>
|
|
559
|
-
<Flex direction="row"
|
|
559
|
+
<Flex direction="row" spacing="lg">
|
|
560
560
|
<Icon as={ElectricityMediumIcon} color="energyBlue700" />
|
|
561
561
|
<Icon as={MobileMediumIcon} color="mobileRose700" />
|
|
562
562
|
<Icon as={BroadbandMediumIcon} color="broadbandGreen700" />
|
|
@@ -727,9 +727,9 @@ const AllComponents: React.FC = () => {
|
|
|
727
727
|
</ComponentWrapper>
|
|
728
728
|
<ComponentWrapper name="Skeleton" link="/?path=/docs/components-skeleton--docs">
|
|
729
729
|
<Center flex={1}>
|
|
730
|
-
<Flex direction="row"
|
|
730
|
+
<Flex direction="row" spacing="sm">
|
|
731
731
|
<Skeleton width={30} height={30} />
|
|
732
|
-
<Flex
|
|
732
|
+
<Flex spacing="sm">
|
|
733
733
|
<Skeleton width={120} height={15} />
|
|
734
734
|
<Skeleton width={100} height={15} />
|
|
735
735
|
</Flex>
|
|
@@ -48,7 +48,7 @@ appropriate margin and padding based on the current breakpoint, making it ideal
|
|
|
48
48
|
wrapping page content or major sections.
|
|
49
49
|
|
|
50
50
|
```tsx
|
|
51
|
-
<Container
|
|
51
|
+
<Container spacing="lg">
|
|
52
52
|
<Box>{...}</Box>
|
|
53
53
|
<Box>{...}</Box>
|
|
54
54
|
</Container>
|
|
@@ -60,7 +60,7 @@ the convenience of the component:
|
|
|
60
60
|
```tsx
|
|
61
61
|
<Container
|
|
62
62
|
marginHorizontal="none"
|
|
63
|
-
|
|
63
|
+
spacing="xl"
|
|
64
64
|
>
|
|
65
65
|
{...}
|
|
66
66
|
</Container>
|
|
@@ -96,7 +96,7 @@ styling props, and to all the properties needed to build a grid layout.
|
|
|
96
96
|
You can easily build responsive layouts using Design System defaults.
|
|
97
97
|
|
|
98
98
|
```tsx
|
|
99
|
-
<Grid columns={2}
|
|
99
|
+
<Grid columns={2} spacing="md">
|
|
100
100
|
<Box>{...}</Box>
|
|
101
101
|
<Box>{...}</Box>
|
|
102
102
|
<Box>{...}</Box>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilitywarehouse/hearth-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Utility Warehouse React Native UI library",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"vite-plugin-svgr": "^4.5.0",
|
|
57
57
|
"vitest": "^3.2.4",
|
|
58
58
|
"@utilitywarehouse/hearth-fonts": "^0.0.4",
|
|
59
|
-
"@utilitywarehouse/hearth-react-icons": "^0.
|
|
60
|
-
"@utilitywarehouse/hearth-react-native-icons": "^0.
|
|
59
|
+
"@utilitywarehouse/hearth-react-icons": "^0.8.0",
|
|
60
|
+
"@utilitywarehouse/hearth-react-native-icons": "^0.8.0",
|
|
61
61
|
"@utilitywarehouse/hearth-svg-assets": "^0.3.0",
|
|
62
62
|
"@utilitywarehouse/hearth-tokens": "^0.2.2"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
66
|
-
"@utilitywarehouse/hearth-react-native-icons": "0.
|
|
66
|
+
"@utilitywarehouse/hearth-react-native-icons": "0.8.0",
|
|
67
67
|
"react": ">=17 || ^18.0.0 || ^19.0.0",
|
|
68
68
|
"react-native": ">=0.77",
|
|
69
69
|
"react-native-gesture-handler": "^2.22.0",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"clean": "rm -rf node_modules rm -rf build .turbo",
|
|
77
77
|
"generateColours": "node ./scripts/generateColours.js",
|
|
78
78
|
"copyTokens": "node ./scripts/copyTokens.js",
|
|
79
|
+
"copyChangelog": "node ./scripts/copyChangelog.js",
|
|
79
80
|
"lint:fix": "TIMING=1 eslint --fix .",
|
|
80
81
|
"lint": "TIMING=1 eslint .",
|
|
81
82
|
"build": "tsc",
|
|
@@ -83,9 +84,8 @@
|
|
|
83
84
|
"figma:create": "figma connect create",
|
|
84
85
|
"figma:publish": "figma connect publish",
|
|
85
86
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
86
|
-
"dev": "storybook dev -p 6006",
|
|
87
|
-
"build:storybook": "storybook build",
|
|
88
|
-
"build-storybook": "storybook build",
|
|
87
|
+
"dev": "npm run copyChangelog && storybook dev -p 6006",
|
|
88
|
+
"build:storybook": "npm run copyChangelog && storybook build",
|
|
89
89
|
"chromatic": "npx chromatic --project-token=chpt_cce0fb1ebd95d2a --build-script-name build:storybook"
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script to copy CHANGELOG.md to docs folder and convert it to changelog.mdx
|
|
3
|
+
* with proper Meta and BackToTopButton components
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
|
|
10
|
+
// Get the directory name in ES modules
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
|
|
14
|
+
// Define paths
|
|
15
|
+
const sourceFile = path.resolve(__dirname, '../CHANGELOG.md');
|
|
16
|
+
const targetFile = path.resolve(__dirname, '../docs/changelog.mdx');
|
|
17
|
+
|
|
18
|
+
// Read the changelog content
|
|
19
|
+
console.log('Reading CHANGELOG.md...');
|
|
20
|
+
if (!fs.existsSync(sourceFile)) {
|
|
21
|
+
console.error('Error: CHANGELOG.md not found at', sourceFile);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let changelogContent = fs.readFileSync(sourceFile, 'utf-8');
|
|
26
|
+
|
|
27
|
+
// Remove the first line (package name heading)
|
|
28
|
+
changelogContent = changelogContent.split('\n').slice(1).join('\n');
|
|
29
|
+
|
|
30
|
+
// Create the MDX content with imports and components
|
|
31
|
+
const mdxContent = `import { Meta } from '@storybook/addon-docs/blocks';
|
|
32
|
+
import { BackToTopButton } from './components';
|
|
33
|
+
|
|
34
|
+
<Meta title="Changelog" />
|
|
35
|
+
<BackToTopButton />
|
|
36
|
+
|
|
37
|
+
# Changelog - ${'`@utilitywarehouse/hearth-react-native`'}
|
|
38
|
+
|
|
39
|
+
The changelog for the Hearth React Native library. Here you can find all the changes, improvements, and bug fixes for each version.
|
|
40
|
+
|
|
41
|
+
${changelogContent}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
// Write the new MDX file
|
|
45
|
+
console.log('Writing changelog.mdx...');
|
|
46
|
+
fs.writeFileSync(targetFile, mdxContent);
|
|
47
|
+
|
|
48
|
+
console.log('✅ Changelog copied and transformed successfully!');
|
|
49
|
+
console.log(` Source: ${sourceFile}`);
|
|
50
|
+
console.log(` Target: ${targetFile}`);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { Avatar } from '.';
|
|
4
|
-
import { Flex } from '../Flex';
|
|
5
3
|
import { VariantTitle } from '../../../docs/components';
|
|
4
|
+
import { Flex } from '../Flex';
|
|
6
5
|
|
|
7
6
|
const meta = {
|
|
8
7
|
title: 'Stories / Avatar',
|
|
@@ -61,13 +60,13 @@ export const Image: Story = {
|
|
|
61
60
|
|
|
62
61
|
export const Sizes: Story = {
|
|
63
62
|
render: () => (
|
|
64
|
-
<Flex direction="row"
|
|
65
|
-
<Flex direction="column"
|
|
63
|
+
<Flex direction="row" spacing="xl" align="center">
|
|
64
|
+
<Flex direction="column" spacing="md" align="center">
|
|
66
65
|
<VariantTitle title="SM">
|
|
67
66
|
<Avatar size="sm" name="Jane Doe" />
|
|
68
67
|
</VariantTitle>
|
|
69
68
|
</Flex>
|
|
70
|
-
<Flex direction="column"
|
|
69
|
+
<Flex direction="column" spacing="md" align="center">
|
|
71
70
|
<VariantTitle title="MD">
|
|
72
71
|
<Avatar size="md" name="Jane Doe" />
|
|
73
72
|
</VariantTitle>
|
|
@@ -132,7 +132,7 @@ export const KitchenSink: Story = {
|
|
|
132
132
|
const sizes: Array<BadgeProps['size']> = ['sm', 'md'];
|
|
133
133
|
|
|
134
134
|
return (
|
|
135
|
-
<Flex direction="column"
|
|
135
|
+
<Flex direction="column" spacing="lg" style={{ width: '100%' }}>
|
|
136
136
|
{colorSchemes.map(cs => {
|
|
137
137
|
// Determine allowed variants per color scheme based on design constraints:
|
|
138
138
|
// - Remove 'outline' for energy, broadband, mobile, insurance, cashback, pig, highlight
|
|
@@ -158,9 +158,9 @@ export const KitchenSink: Story = {
|
|
|
158
158
|
return (
|
|
159
159
|
<Box key={cs} gap="200">
|
|
160
160
|
<VariantTitle title={cs.charAt(0).toUpperCase() + cs.slice(1)}>
|
|
161
|
-
<Flex direction="column"
|
|
161
|
+
<Flex direction="column" spacing="sm">
|
|
162
162
|
{sizes.map(sz => (
|
|
163
|
-
<Flex key={sz} direction="row" align="center"
|
|
163
|
+
<Flex key={sz} direction="row" align="center" spacing="md">
|
|
164
164
|
{variantsForScheme.map(variant => (
|
|
165
165
|
<Badge
|
|
166
166
|
key={`${cs}-${sz}-${variant}`}
|
|
@@ -81,7 +81,7 @@ const MyComponent = () => (
|
|
|
81
81
|
| variant | `'subtle' \| 'emphasis'` | Card visual style variant | `'subtle'` |
|
|
82
82
|
| colorScheme | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | Color scheme for buttons | `'pig'` |
|
|
83
83
|
|
|
84
|
-
The component also accepts all standard Card props except `noPadding`, `
|
|
84
|
+
The component also accepts all standard Card props except `noPadding`, `spacing`, `gap`, `rowGap`, `columnGap`, `flexDirection`, `flexWrap`, `alignItems`, and `justifyContent`.
|
|
85
85
|
|
|
86
86
|
### `BannerImage` & `BannerIllustration` Props
|
|
87
87
|
|
|
@@ -3,21 +3,19 @@ import type CardProps from '../Card/Card.props';
|
|
|
3
3
|
|
|
4
4
|
export type BannerDirection = 'horizontal' | 'vertical';
|
|
5
5
|
|
|
6
|
-
export interface BannerProps
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| 'justifyContent'
|
|
20
|
-
> {
|
|
6
|
+
export interface BannerProps extends Omit<
|
|
7
|
+
CardProps,
|
|
8
|
+
| 'noPadding'
|
|
9
|
+
| 'variant'
|
|
10
|
+
| 'space'
|
|
11
|
+
| 'gap'
|
|
12
|
+
| 'rowGap'
|
|
13
|
+
| 'columnGap'
|
|
14
|
+
| 'flexDirection'
|
|
15
|
+
| 'flexWrap'
|
|
16
|
+
| 'alignItems'
|
|
17
|
+
| 'justifyContent'
|
|
18
|
+
> {
|
|
21
19
|
/**
|
|
22
20
|
* Icon component to display in the banner
|
|
23
21
|
* Mutually exclusive with image
|
|
@@ -89,11 +87,6 @@ export interface BannerProps
|
|
|
89
87
|
* @default 'subtle'
|
|
90
88
|
*/
|
|
91
89
|
variant?: 'subtle' | 'emphasis';
|
|
92
|
-
/**
|
|
93
|
-
* Color scheme for the banner
|
|
94
|
-
* @default 'pig'
|
|
95
|
-
*/
|
|
96
|
-
colorScheme?: 'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight';
|
|
97
90
|
}
|
|
98
91
|
|
|
99
92
|
export default BannerProps;
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
BroadbandMediumIcon,
|
|
4
4
|
CashbackCardMediumIcon,
|
|
5
5
|
ElectricityMediumIcon,
|
|
6
|
+
HomeMediumIcon,
|
|
6
7
|
InsuranceMediumIcon,
|
|
7
8
|
MobileMediumIcon,
|
|
8
9
|
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
@@ -44,7 +45,17 @@ const meta = {
|
|
|
44
45
|
colorScheme: {
|
|
45
46
|
control: 'select',
|
|
46
47
|
description: 'The color scheme for the banner',
|
|
47
|
-
options: [
|
|
48
|
+
options: [
|
|
49
|
+
'neutralStrong',
|
|
50
|
+
'neutralSubtle',
|
|
51
|
+
'brand',
|
|
52
|
+
'energy',
|
|
53
|
+
'broadband',
|
|
54
|
+
'mobile',
|
|
55
|
+
'insurance',
|
|
56
|
+
'cashback',
|
|
57
|
+
'pig',
|
|
58
|
+
],
|
|
48
59
|
},
|
|
49
60
|
iconContainerVariant: {
|
|
50
61
|
control: 'select',
|
|
@@ -76,7 +87,7 @@ const meta = {
|
|
|
76
87
|
description: 'This is a banner component that can display an icon or image with content.',
|
|
77
88
|
direction: 'horizontal',
|
|
78
89
|
variant: 'subtle',
|
|
79
|
-
colorScheme: '
|
|
90
|
+
colorScheme: 'neutralStrong',
|
|
80
91
|
},
|
|
81
92
|
} satisfies Meta<typeof Banner>;
|
|
82
93
|
|
|
@@ -97,7 +108,7 @@ export const WithIcon: Story = {
|
|
|
97
108
|
render: () => {
|
|
98
109
|
return (
|
|
99
110
|
<View style={{ width: 400 }}>
|
|
100
|
-
<Flex
|
|
111
|
+
<Flex spacing="lg" direction="column">
|
|
101
112
|
<Banner
|
|
102
113
|
icon={ElectricityMediumIcon}
|
|
103
114
|
iconContainerColor="energy"
|
|
@@ -128,7 +139,7 @@ export const WithIllustration: Story = {
|
|
|
128
139
|
render: () => {
|
|
129
140
|
return (
|
|
130
141
|
<View style={{ width: 400 }}>
|
|
131
|
-
<Flex
|
|
142
|
+
<Flex spacing="lg" direction="column">
|
|
132
143
|
<Banner
|
|
133
144
|
illustration={
|
|
134
145
|
<BannerIllustration
|
|
@@ -172,7 +183,7 @@ export const WithImage: Story = {
|
|
|
172
183
|
render: () => {
|
|
173
184
|
return (
|
|
174
185
|
<View style={{ width: 400 }}>
|
|
175
|
-
<Flex
|
|
186
|
+
<Flex spacing="lg" direction="column">
|
|
176
187
|
<Banner
|
|
177
188
|
image={
|
|
178
189
|
<BannerImage
|
|
@@ -212,7 +223,7 @@ export const WithButton: Story = {
|
|
|
212
223
|
render: () => {
|
|
213
224
|
return (
|
|
214
225
|
<View style={{ width: 400 }}>
|
|
215
|
-
<Flex
|
|
226
|
+
<Flex spacing="lg" direction="column">
|
|
216
227
|
<Banner
|
|
217
228
|
icon={InsuranceMediumIcon}
|
|
218
229
|
iconContainerColor="insurance"
|
|
@@ -229,7 +240,7 @@ export const WithButton: Story = {
|
|
|
229
240
|
iconContainerColor="cashback"
|
|
230
241
|
heading="Cashback Rewards"
|
|
231
242
|
description="Earn cashback on every purchase."
|
|
232
|
-
colorScheme="
|
|
243
|
+
colorScheme="neutralSubtle"
|
|
233
244
|
button={
|
|
234
245
|
<Button size="sm" onPress={() => console.log('Learn More pressed')}>
|
|
235
246
|
Learn More
|
|
@@ -246,7 +257,7 @@ export const WithLink: Story = {
|
|
|
246
257
|
render: () => {
|
|
247
258
|
return (
|
|
248
259
|
<View style={{ width: 400 }}>
|
|
249
|
-
<Flex
|
|
260
|
+
<Flex spacing="lg" direction="column">
|
|
250
261
|
<Banner
|
|
251
262
|
icon={ElectricityMediumIcon}
|
|
252
263
|
iconContainerColor="energy"
|
|
@@ -271,7 +282,7 @@ export const Pressable: Story = {
|
|
|
271
282
|
render: () => {
|
|
272
283
|
return (
|
|
273
284
|
<View style={{ width: 400 }}>
|
|
274
|
-
<Flex
|
|
285
|
+
<Flex spacing="lg" direction="column">
|
|
275
286
|
<Banner
|
|
276
287
|
icon={ElectricityMediumIcon}
|
|
277
288
|
iconContainerColor="energy"
|
|
@@ -304,7 +315,7 @@ export const WithClose: Story = {
|
|
|
304
315
|
render: () => {
|
|
305
316
|
return (
|
|
306
317
|
<View style={{ width: 400 }}>
|
|
307
|
-
<Flex
|
|
318
|
+
<Flex spacing="lg" direction="column">
|
|
308
319
|
<Banner
|
|
309
320
|
icon={ElectricityMediumIcon}
|
|
310
321
|
iconContainerColor="energy"
|
|
@@ -335,7 +346,7 @@ export const VerticalLayout: Story = {
|
|
|
335
346
|
render: () => {
|
|
336
347
|
return (
|
|
337
348
|
<View style={{ width: 400 }}>
|
|
338
|
-
<Flex
|
|
349
|
+
<Flex spacing="lg" direction="column">
|
|
339
350
|
<Banner
|
|
340
351
|
icon={ElectricityMediumIcon}
|
|
341
352
|
iconContainerColor="energy"
|
|
@@ -375,10 +386,62 @@ export const ColorSchemes: Story = {
|
|
|
375
386
|
render: () => {
|
|
376
387
|
return (
|
|
377
388
|
<View style={{ width: 400 }}>
|
|
378
|
-
<Flex
|
|
389
|
+
<Flex spacing="lg" direction="column">
|
|
390
|
+
<Banner
|
|
391
|
+
icon={HomeMediumIcon}
|
|
392
|
+
iconContainerColor="highlight"
|
|
393
|
+
colorScheme="neutralStrong"
|
|
394
|
+
variant="subtle"
|
|
395
|
+
heading="Neutral Strong"
|
|
396
|
+
description="Banner with neutral strong color scheme and subtle variant."
|
|
397
|
+
button={
|
|
398
|
+
<Button size="sm" onPress={() => console.log('Action pressed')}>
|
|
399
|
+
Action
|
|
400
|
+
</Button>
|
|
401
|
+
}
|
|
402
|
+
/>
|
|
403
|
+
<Banner
|
|
404
|
+
icon={HomeMediumIcon}
|
|
405
|
+
iconContainerColor="highlight"
|
|
406
|
+
colorScheme="neutralStrong"
|
|
407
|
+
variant="emphasis"
|
|
408
|
+
heading="Neutral Strong"
|
|
409
|
+
description="Banner with neutral strong color scheme and emphasis variant."
|
|
410
|
+
button={
|
|
411
|
+
<Button size="sm" onPress={() => console.log('Action pressed')}>
|
|
412
|
+
Action
|
|
413
|
+
</Button>
|
|
414
|
+
}
|
|
415
|
+
/>
|
|
416
|
+
<Banner
|
|
417
|
+
icon={HomeMediumIcon}
|
|
418
|
+
iconContainerColor="highlight"
|
|
419
|
+
colorScheme="neutralSubtle"
|
|
420
|
+
heading="Neutral Subtle"
|
|
421
|
+
description="Banner with neutral subtle color scheme and subtle variant."
|
|
422
|
+
button={
|
|
423
|
+
<Button size="sm" onPress={() => console.log('Action pressed')}>
|
|
424
|
+
Action
|
|
425
|
+
</Button>
|
|
426
|
+
}
|
|
427
|
+
/>
|
|
428
|
+
<Banner
|
|
429
|
+
icon={HomeMediumIcon}
|
|
430
|
+
iconContainerColor="highlight"
|
|
431
|
+
colorScheme="neutralSubtle"
|
|
432
|
+
variant="emphasis"
|
|
433
|
+
heading="Neutral Subtle"
|
|
434
|
+
description="Banner with neutral subtle color scheme and emphasis variant."
|
|
435
|
+
button={
|
|
436
|
+
<Button size="sm" onPress={() => console.log('Action pressed')}>
|
|
437
|
+
Action
|
|
438
|
+
</Button>
|
|
439
|
+
}
|
|
440
|
+
/>
|
|
379
441
|
<Banner
|
|
380
442
|
icon={ElectricityMediumIcon}
|
|
381
443
|
iconContainerColor="pig"
|
|
444
|
+
iconContainerVariant="emphasis"
|
|
382
445
|
colorScheme="pig"
|
|
383
446
|
heading="Pig Pink"
|
|
384
447
|
description="Banner with pig color scheme."
|
|
@@ -391,6 +454,7 @@ export const ColorSchemes: Story = {
|
|
|
391
454
|
<Banner
|
|
392
455
|
icon={ElectricityMediumIcon}
|
|
393
456
|
iconContainerColor="energy"
|
|
457
|
+
iconContainerVariant="emphasis"
|
|
394
458
|
colorScheme="energy"
|
|
395
459
|
heading="Energy Blue"
|
|
396
460
|
description="Banner with energy color scheme."
|
|
@@ -403,6 +467,7 @@ export const ColorSchemes: Story = {
|
|
|
403
467
|
<Banner
|
|
404
468
|
icon={BroadbandMediumIcon}
|
|
405
469
|
iconContainerColor="broadband"
|
|
470
|
+
iconContainerVariant="emphasis"
|
|
406
471
|
colorScheme="broadband"
|
|
407
472
|
heading="Broadband Green"
|
|
408
473
|
description="Banner with broadband color scheme."
|
|
@@ -415,6 +480,7 @@ export const ColorSchemes: Story = {
|
|
|
415
480
|
<Banner
|
|
416
481
|
icon={MobileMediumIcon}
|
|
417
482
|
iconContainerColor="mobile"
|
|
483
|
+
iconContainerVariant="emphasis"
|
|
418
484
|
colorScheme="mobile"
|
|
419
485
|
heading="Mobile Rose"
|
|
420
486
|
description="Banner with mobile color scheme."
|
|
@@ -427,6 +493,7 @@ export const ColorSchemes: Story = {
|
|
|
427
493
|
<Banner
|
|
428
494
|
icon={InsuranceMediumIcon}
|
|
429
495
|
iconContainerColor="insurance"
|
|
496
|
+
iconContainerVariant="emphasis"
|
|
430
497
|
colorScheme="insurance"
|
|
431
498
|
heading="Insurance Orange"
|
|
432
499
|
description="Banner with insurance color scheme."
|
|
@@ -439,6 +506,7 @@ export const ColorSchemes: Story = {
|
|
|
439
506
|
<Banner
|
|
440
507
|
icon={CashbackCardMediumIcon}
|
|
441
508
|
iconContainerColor="cashback"
|
|
509
|
+
iconContainerVariant="emphasis"
|
|
442
510
|
colorScheme="cashback"
|
|
443
511
|
heading="Cashback Lilac"
|
|
444
512
|
description="Banner with cashback color scheme."
|
|
@@ -458,7 +526,7 @@ export const EmphasisVariant: Story = {
|
|
|
458
526
|
render: () => {
|
|
459
527
|
return (
|
|
460
528
|
<View style={{ width: 400 }}>
|
|
461
|
-
<Flex
|
|
529
|
+
<Flex spacing="lg" direction="column">
|
|
462
530
|
<Banner
|
|
463
531
|
icon={ElectricityMediumIcon}
|
|
464
532
|
iconContainerColor="energy"
|
|
@@ -497,12 +565,12 @@ export const ComplexExample: Story = {
|
|
|
497
565
|
render: () => {
|
|
498
566
|
return (
|
|
499
567
|
<View style={{ width: 400 }}>
|
|
500
|
-
<Flex
|
|
568
|
+
<Flex spacing="lg" direction="column">
|
|
501
569
|
<Banner
|
|
502
570
|
icon={InsuranceMediumIcon}
|
|
503
571
|
iconContainerColor="insurance"
|
|
504
572
|
iconContainerVariant="emphasis"
|
|
505
|
-
colorScheme="
|
|
573
|
+
colorScheme="neutralStrong"
|
|
506
574
|
heading="Home Insurance Alert"
|
|
507
575
|
description="Your policy renewal is coming up. Review your coverage and make any necessary changes."
|
|
508
576
|
button={
|
|
@@ -25,8 +25,6 @@ const Banner = ({
|
|
|
25
25
|
onPress,
|
|
26
26
|
onClose,
|
|
27
27
|
variant = 'subtle',
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
-
colorScheme: _,
|
|
30
28
|
style,
|
|
31
29
|
...props
|
|
32
30
|
}: BannerProps) => {
|
|
@@ -66,7 +64,11 @@ const Banner = ({
|
|
|
66
64
|
return <View style={styles.action}>{link}</View>;
|
|
67
65
|
}
|
|
68
66
|
if (button) {
|
|
69
|
-
return
|
|
67
|
+
return (
|
|
68
|
+
<View style={[styles.action, styles.buttonWrap]}>
|
|
69
|
+
<View style={styles.buttonInner}>{button}</View>
|
|
70
|
+
</View>
|
|
71
|
+
);
|
|
70
72
|
}
|
|
71
73
|
return null;
|
|
72
74
|
};
|
|
@@ -256,6 +258,28 @@ const styles = StyleSheet.create(theme => ({
|
|
|
256
258
|
action: {
|
|
257
259
|
alignSelf: 'flex-start',
|
|
258
260
|
},
|
|
261
|
+
buttonWrap: {
|
|
262
|
+
variants: {
|
|
263
|
+
direction: {
|
|
264
|
+
horizontal: {},
|
|
265
|
+
vertical: {
|
|
266
|
+
flexDirection: 'row',
|
|
267
|
+
justifyContent: 'center',
|
|
268
|
+
alignItems: 'stretch',
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
buttonInner: {
|
|
274
|
+
variants: {
|
|
275
|
+
direction: {
|
|
276
|
+
horizontal: {},
|
|
277
|
+
vertical: {
|
|
278
|
+
flex: 1,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
259
283
|
chevron: {
|
|
260
284
|
alignSelf: 'center',
|
|
261
285
|
},
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
ColorValue,
|
|
7
7
|
OpacityValue,
|
|
8
8
|
SpaceValue,
|
|
9
|
+
SpacingValues,
|
|
9
10
|
} from '../../types';
|
|
10
11
|
|
|
11
12
|
export type OmittedStyles = Omit<
|
|
@@ -223,12 +224,18 @@ export interface ThemedBoxViewStyleProps {
|
|
|
223
224
|
borderWidth?: BordeWidthValue;
|
|
224
225
|
}
|
|
225
226
|
|
|
227
|
+
interface CustomBoxProps {
|
|
228
|
+
// Custom props
|
|
229
|
+
as?: React.ElementType;
|
|
230
|
+
spacing?: SpacingValues;
|
|
231
|
+
}
|
|
232
|
+
|
|
226
233
|
export interface BoxProps
|
|
227
|
-
extends
|
|
234
|
+
extends
|
|
235
|
+
BoxStyleMappingValues,
|
|
228
236
|
ThemedBoxViewStyleProps,
|
|
229
237
|
OtherBoxViewStyles,
|
|
230
|
-
ViewProps
|
|
231
|
-
|
|
232
|
-
}
|
|
238
|
+
ViewProps,
|
|
239
|
+
CustomBoxProps {}
|
|
233
240
|
|
|
234
241
|
export default BoxProps;
|
|
@@ -164,12 +164,12 @@ const MyComponent = () => {
|
|
|
164
164
|
|
|
165
165
|
| Property | Type | Description | Default |
|
|
166
166
|
| --------------- | -------------------------------------------------------- | -------------------------------------------------------------- | ------- |
|
|
167
|
-
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Set the direction of Button group to vertical or horizontal | 'row'
|
|
167
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Set the direction of Button group to vertical or horizontal | `'row'` |
|
|
168
168
|
| `disabled` | `boolean` | When true, this will disable all the buttons in a ButtonGroup. | `false` |
|
|
169
169
|
| `loading` | `boolean` | When true, this will show a loading spinner in all buttons. | `false` |
|
|
170
170
|
| `attached` | `boolean` | When attached, all buttons will be attached to each other. | `false` |
|
|
171
171
|
| `reversed` | `boolean` | To reverse the order of components. | `false` |
|
|
172
|
-
| `
|
|
172
|
+
| `spacing` | `string` | It sets the space between different buttons. | `'md'` |
|
|
173
173
|
|
|
174
174
|
### `ButtonIcon`
|
|
175
175
|
|