@utilitywarehouse/hearth-react-native 0.2.0 → 0.3.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 +1 -1
- package/CHANGELOG.md +22 -0
- package/build/components/Badge/Badge.js +101 -14
- package/build/components/Badge/Badge.props.d.ts +2 -2
- package/build/components/Badge/BadgeIcon.js +5 -79
- package/build/components/Badge/BadgeText.js +7 -81
- package/build/components/Button/Button.d.ts +2 -2
- package/build/components/Button/ButtonGroupRoot.d.ts +3 -2
- package/build/components/Button/ButtonGroupRoot.js +9 -0
- package/build/components/Card/Card.props.d.ts +2 -2
- package/build/components/CurrencyInput/CurrencyInput.d.ts +6 -0
- package/build/components/CurrencyInput/CurrencyInput.js +47 -0
- package/build/components/CurrencyInput/CurrencyInput.props.d.ts +14 -0
- package/build/components/CurrencyInput/CurrencyInput.props.js +1 -0
- package/build/components/CurrencyInput/index.d.ts +1 -0
- package/build/components/CurrencyInput/index.js +1 -0
- package/build/components/DescriptionList/DescriptionList.context.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionList.context.js +9 -0
- package/build/components/DescriptionList/DescriptionList.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionList.js +25 -0
- package/build/components/DescriptionList/DescriptionList.props.d.ts +18 -0
- package/build/components/DescriptionList/DescriptionList.props.js +1 -0
- package/build/components/DescriptionList/DescriptionListItem.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionListItem.js +49 -0
- package/build/components/DescriptionList/DescriptionListItem.props.d.ts +17 -0
- package/build/components/DescriptionList/DescriptionListItem.props.js +1 -0
- package/build/components/DescriptionList/index.d.ts +4 -0
- package/build/components/DescriptionList/index.js +2 -0
- package/build/components/Divider/Divider.js +46 -0
- package/build/components/Divider/Divider.props.d.ts +2 -2
- package/build/components/Flex/Flex.props.d.ts +3 -2
- package/build/components/Grid/Grid.props.d.ts +2 -2
- package/build/components/IconContainer/IconContainer.d.ts +5 -0
- package/build/components/IconContainer/IconContainer.js +161 -0
- package/build/components/IconContainer/IconContainer.props.d.ts +15 -0
- package/build/components/IconContainer/IconContainer.props.js +1 -0
- package/build/components/IconContainer/index.d.ts +2 -0
- package/build/components/IconContainer/index.js +1 -0
- package/build/components/Icons/CircleIcon.js +3 -3
- package/build/components/Input/Input.js +2 -34
- package/build/components/Input/Input.props.d.ts +1 -17
- package/build/components/Input/InputField.js +0 -7
- package/build/components/Modal/Modal.js +17 -1
- package/build/components/SectionHeader/SectionHeader.js +1 -0
- package/build/components/Tabs/Tab.d.ts +18 -0
- package/build/components/Tabs/Tab.js +74 -0
- package/build/components/Tabs/Tab.props.d.ts +14 -0
- package/build/components/Tabs/Tab.props.js +1 -0
- package/build/components/Tabs/TabPanel.d.ts +3 -0
- package/build/components/Tabs/TabPanel.js +34 -0
- package/build/components/Tabs/TabPanel.props.d.ts +8 -0
- package/build/components/Tabs/TabPanel.props.js +1 -0
- package/build/components/Tabs/Tabs.context.d.ts +23 -0
- package/build/components/Tabs/Tabs.context.js +8 -0
- package/build/components/Tabs/Tabs.d.ts +6 -0
- package/build/components/Tabs/Tabs.js +114 -0
- package/build/components/Tabs/Tabs.props.d.ts +19 -0
- package/build/components/Tabs/Tabs.props.js +1 -0
- package/build/components/Tabs/TabsList.d.ts +6 -0
- package/build/components/Tabs/TabsList.js +112 -0
- package/build/components/Tabs/TabsList.props.d.ts +6 -0
- package/build/components/Tabs/TabsList.props.js +1 -0
- package/build/components/Tabs/index.d.ts +8 -0
- package/build/components/Tabs/index.js +4 -0
- package/build/components/index.d.ts +4 -0
- package/build/components/index.js +4 -0
- package/build/core/themes.d.ts +416 -148
- package/build/core/themes.js +57 -1
- package/build/tokens/color.d.ts +76 -68
- package/build/tokens/color.js +38 -34
- package/build/tokens/components/dark/button.d.ts +1 -0
- package/build/tokens/components/dark/button.js +1 -0
- package/build/tokens/components/dark/checkbox.d.ts +1 -1
- package/build/tokens/components/dark/checkbox.js +1 -1
- package/build/tokens/components/dark/icon-button.d.ts +3 -3
- package/build/tokens/components/dark/icon-button.js +3 -3
- package/build/tokens/components/dark/radio.d.ts +1 -1
- package/build/tokens/components/dark/radio.js +1 -1
- package/build/tokens/components/dark/tabs.d.ts +2 -0
- package/build/tokens/components/dark/tabs.js +2 -0
- package/build/tokens/components/light/badge.d.ts +1 -1
- package/build/tokens/components/light/badge.js +1 -1
- package/build/tokens/components/light/button.d.ts +1 -0
- package/build/tokens/components/light/button.js +1 -0
- package/build/tokens/components/light/checkbox.d.ts +3 -3
- package/build/tokens/components/light/checkbox.js +3 -3
- package/build/tokens/components/light/icon-button.d.ts +1 -1
- package/build/tokens/components/light/icon-button.js +1 -1
- package/build/tokens/components/light/radio.d.ts +3 -3
- package/build/tokens/components/light/radio.js +3 -3
- package/build/tokens/components/light/tabs.d.ts +2 -0
- package/build/tokens/components/light/tabs.js +2 -0
- package/build/tokens/layout.d.ts +48 -30
- package/build/tokens/layout.js +24 -15
- package/build/tokens/semantic-dark.d.ts +21 -19
- package/build/tokens/semantic-dark.js +21 -19
- package/build/tokens/semantic-light.d.ts +17 -15
- package/build/tokens/semantic-light.js +17 -15
- package/build/types/values.d.ts +2 -1
- package/build/utils/formatThousands.d.ts +2 -0
- package/build/utils/formatThousands.js +16 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/docs/components/AllComponents.web.tsx +97 -8
- package/docs/components/NextPrevPage.tsx +11 -3
- package/docs/components/UsageWrap.tsx +2 -2
- package/docs/heplers/addReactNativePrefix.ts +8 -0
- package/docs/heplers/index.ts +1 -0
- package/docs/theme-tokens.mdx +42 -0
- package/package.json +2 -3
- package/src/components/Badge/Badge.docs.mdx +7 -7
- package/src/components/Badge/Badge.props.ts +3 -2
- package/src/components/Badge/Badge.stories.tsx +81 -92
- package/src/components/Badge/Badge.tsx +101 -14
- package/src/components/Badge/BadgeIcon.tsx +5 -79
- package/src/components/Badge/BadgeText.tsx +7 -81
- package/src/components/Button/ButtonGroupRoot.tsx +12 -2
- package/src/components/Card/Card.docs.mdx +1 -1
- package/src/components/Card/Card.props.ts +2 -2
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +120 -0
- package/src/components/CurrencyInput/CurrencyInput.props.ts +19 -0
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +116 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +91 -0
- package/src/components/CurrencyInput/index.ts +1 -0
- package/src/components/DescriptionList/DescriptionList.context.ts +18 -0
- package/src/components/DescriptionList/DescriptionList.docs.mdx +98 -0
- package/src/components/DescriptionList/DescriptionList.props.ts +20 -0
- package/src/components/DescriptionList/DescriptionList.stories.tsx +154 -0
- package/src/components/DescriptionList/DescriptionList.tsx +64 -0
- package/src/components/DescriptionList/DescriptionListItem.props.ts +19 -0
- package/src/components/DescriptionList/DescriptionListItem.tsx +101 -0
- package/src/components/DescriptionList/index.ts +4 -0
- package/src/components/Divider/Divider.props.ts +2 -2
- package/src/components/Divider/Divider.stories.tsx +3 -3
- package/src/components/Divider/Divider.tsx +46 -0
- package/src/components/Flex/Flex.docs.mdx +4 -4
- package/src/components/Flex/Flex.props.ts +3 -2
- package/src/components/Flex/Flex.stories.tsx +1 -1
- package/src/components/Grid/Grid.docs.mdx +12 -12
- package/src/components/Grid/Grid.props.ts +2 -2
- package/src/components/Grid/Grid.stories.tsx +2 -2
- package/src/components/IconContainer/IconContainer.docs.mdx +90 -0
- package/src/components/IconContainer/IconContainer.props.ts +17 -0
- package/src/components/IconContainer/IconContainer.stories.tsx +130 -0
- package/src/components/IconContainer/IconContainer.tsx +180 -0
- package/src/components/IconContainer/index.tsx +2 -0
- package/src/components/Icons/CircleIcon.tsx +9 -11
- package/src/components/Input/Input.docs.mdx +3 -3
- package/src/components/Input/Input.props.ts +0 -20
- package/src/components/Input/Input.stories.tsx +0 -6
- package/src/components/Input/Input.tsx +2 -49
- package/src/components/Input/InputField.tsx +0 -7
- package/src/components/Modal/Modal.tsx +18 -0
- package/src/components/SectionHeader/SectionHeader.tsx +1 -0
- package/src/components/Tabs/Tab.props.ts +16 -0
- package/src/components/Tabs/Tab.tsx +113 -0
- package/src/components/Tabs/TabPanel.props.ts +10 -0
- package/src/components/Tabs/TabPanel.tsx +46 -0
- package/src/components/Tabs/Tabs.context.ts +26 -0
- package/src/components/Tabs/Tabs.docs.mdx +214 -0
- package/src/components/Tabs/Tabs.props.ts +21 -0
- package/src/components/Tabs/Tabs.stories.tsx +270 -0
- package/src/components/Tabs/Tabs.tsx +139 -0
- package/src/components/Tabs/TabsList.props.ts +8 -0
- package/src/components/Tabs/TabsList.tsx +194 -0
- package/src/components/Tabs/index.ts +8 -0
- package/src/components/index.ts +4 -0
- package/src/core/themes.ts +57 -1
- package/src/tokens/color.ts +38 -34
- package/src/tokens/components/dark/button.ts +1 -0
- package/src/tokens/components/dark/checkbox.ts +1 -1
- package/src/tokens/components/dark/icon-button.ts +3 -3
- package/src/tokens/components/dark/radio.ts +1 -1
- package/src/tokens/components/dark/tabs.ts +2 -0
- package/src/tokens/components/light/badge.ts +1 -1
- package/src/tokens/components/light/button.ts +1 -0
- package/src/tokens/components/light/checkbox.ts +3 -3
- package/src/tokens/components/light/icon-button.ts +1 -1
- package/src/tokens/components/light/radio.ts +3 -3
- package/src/tokens/components/light/tabs.ts +2 -0
- package/src/tokens/layout.ts +24 -15
- package/src/tokens/semantic-dark.ts +21 -19
- package/src/tokens/semantic-light.ts +17 -15
- package/src/types/values.ts +3 -1
- package/src/utils/formatThousands.ts +14 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface IconContainerProps extends ViewProps {
|
|
5
|
+
/** Icon component to render inside the container */
|
|
6
|
+
icon: ComponentType;
|
|
7
|
+
/** Size of the container */
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
|
+
/** If true, removes border radius from the container */
|
|
10
|
+
radiusNone?: boolean;
|
|
11
|
+
/** Background style of the container */
|
|
12
|
+
variant?: 'subtle' | 'emphasis';
|
|
13
|
+
/** Background color token of the container */
|
|
14
|
+
color?: 'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default IconContainerProps;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import * as Icons from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import { IconContainer } from '.';
|
|
4
|
+
import { VariantTitle } from '../../../docs/components';
|
|
5
|
+
import { Box } from '../Box';
|
|
6
|
+
import { Flex } from '../Flex';
|
|
7
|
+
|
|
8
|
+
type IconKey = keyof typeof Icons;
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof IconContainer> = {
|
|
11
|
+
title: 'Stories / IconContainer',
|
|
12
|
+
component: IconContainer,
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: 'centered',
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
icon: {
|
|
18
|
+
control: 'select',
|
|
19
|
+
options: Object.keys(Icons),
|
|
20
|
+
mapping: Icons,
|
|
21
|
+
description: 'Icon component rendered inside the container',
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['sm', 'md', 'lg'],
|
|
26
|
+
description: 'Size variant',
|
|
27
|
+
},
|
|
28
|
+
radiusNone: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Remove border radius (square edges)',
|
|
31
|
+
},
|
|
32
|
+
variant: {
|
|
33
|
+
control: 'select',
|
|
34
|
+
options: ['subtle', 'emphasis'],
|
|
35
|
+
description: 'Background emphasis style',
|
|
36
|
+
},
|
|
37
|
+
color: {
|
|
38
|
+
control: 'select',
|
|
39
|
+
options: ['pig', 'energy', 'broadband', 'mobile', 'insurance', 'cashback', 'highlight'],
|
|
40
|
+
description: 'Semantic color surface family',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
icon: Icons[Object.keys(Icons)[0] as IconKey],
|
|
45
|
+
size: 'md',
|
|
46
|
+
radiusNone: false,
|
|
47
|
+
variant: 'subtle',
|
|
48
|
+
color: 'pig',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default meta;
|
|
53
|
+
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
export const Playground: Story = { render: args => <IconContainer {...args} /> };
|
|
57
|
+
|
|
58
|
+
export const Subtle: Story = {
|
|
59
|
+
parameters: {
|
|
60
|
+
controls: { exclude: ['variant'] },
|
|
61
|
+
},
|
|
62
|
+
args: {
|
|
63
|
+
variant: 'subtle',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Emphasis: Story = {
|
|
68
|
+
parameters: {
|
|
69
|
+
controls: { exclude: ['variant'] },
|
|
70
|
+
},
|
|
71
|
+
args: {
|
|
72
|
+
variant: 'emphasis',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const RadiusNone: Story = {
|
|
77
|
+
parameters: {
|
|
78
|
+
controls: { exclude: ['radiusNone'] },
|
|
79
|
+
},
|
|
80
|
+
args: {
|
|
81
|
+
radiusNone: true,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const KitchenSink: Story = {
|
|
86
|
+
parameters: {
|
|
87
|
+
controls: { exclude: ['radiusNone', 'variant', 'color', 'size'] },
|
|
88
|
+
},
|
|
89
|
+
render: ({ icon }) => {
|
|
90
|
+
const sizes: Array<'sm' | 'md' | 'lg'> = ['sm', 'md', 'lg'];
|
|
91
|
+
const colors: Array<
|
|
92
|
+
'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight'
|
|
93
|
+
> = ['pig', 'energy', 'broadband', 'mobile', 'insurance', 'cashback', 'highlight'];
|
|
94
|
+
return (
|
|
95
|
+
<Flex direction="column" space="lg">
|
|
96
|
+
{sizes.map(size => (
|
|
97
|
+
<Box key={size} gap="300">
|
|
98
|
+
<VariantTitle title={`Size: ${size.toUpperCase()} / Subtle`}> </VariantTitle>
|
|
99
|
+
<Flex direction="row" wrap="wrap" space="md">
|
|
100
|
+
{colors.map(color => (
|
|
101
|
+
<IconContainer
|
|
102
|
+
key={`${size}-subtle-${color}`}
|
|
103
|
+
icon={icon}
|
|
104
|
+
size={size}
|
|
105
|
+
variant="subtle"
|
|
106
|
+
color={color}
|
|
107
|
+
/>
|
|
108
|
+
))}
|
|
109
|
+
</Flex>
|
|
110
|
+
<VariantTitle title={`Size: ${size.toUpperCase()} / Emphasis`}> </VariantTitle>
|
|
111
|
+
<Flex direction="row" wrap="wrap" space="md">
|
|
112
|
+
{colors.map(
|
|
113
|
+
color =>
|
|
114
|
+
color !== 'highlight' && (
|
|
115
|
+
<IconContainer
|
|
116
|
+
key={`${size}-emphasis-${color}`}
|
|
117
|
+
icon={icon}
|
|
118
|
+
size={size}
|
|
119
|
+
variant="emphasis"
|
|
120
|
+
color={color}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
123
|
+
)}
|
|
124
|
+
</Flex>
|
|
125
|
+
</Box>
|
|
126
|
+
))}
|
|
127
|
+
</Flex>
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { StyleSheet, withUnistyles } from 'react-native-unistyles';
|
|
3
|
+
import { Icon } from '../Icon';
|
|
4
|
+
import type IconContainerProps from './IconContainer.props';
|
|
5
|
+
|
|
6
|
+
const IconContainer = withUnistyles(
|
|
7
|
+
({
|
|
8
|
+
icon: IconComp,
|
|
9
|
+
size = 'md',
|
|
10
|
+
radiusNone = false,
|
|
11
|
+
variant = 'subtle',
|
|
12
|
+
color = 'pig',
|
|
13
|
+
style,
|
|
14
|
+
...props
|
|
15
|
+
}: IconContainerProps) => {
|
|
16
|
+
styles.useVariants({ size, radiusNone, variant, color });
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View style={[styles.container, style]} {...props}>
|
|
20
|
+
{IconComp ? <Icon as={IconComp} style={styles.icon} /> : null}
|
|
21
|
+
</View>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
IconContainer.displayName = 'IconContainer';
|
|
27
|
+
|
|
28
|
+
const styles = StyleSheet.create(theme => ({
|
|
29
|
+
container: {
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
overflow: 'hidden',
|
|
33
|
+
variants: {
|
|
34
|
+
size: {
|
|
35
|
+
sm: {
|
|
36
|
+
width: theme.components.iconContainer.sm.width,
|
|
37
|
+
height: theme.components.iconContainer.sm.height,
|
|
38
|
+
padding: theme.components.iconContainer.sm.padding,
|
|
39
|
+
borderRadius: theme.components.iconContainer.sm.borderRadiusRounded,
|
|
40
|
+
},
|
|
41
|
+
md: {
|
|
42
|
+
width: theme.components.iconContainer.md.width,
|
|
43
|
+
height: theme.components.iconContainer.md.height,
|
|
44
|
+
padding: theme.components.iconContainer.md.padding,
|
|
45
|
+
borderRadius: theme.components.iconContainer.md.borderRadiusRounded,
|
|
46
|
+
},
|
|
47
|
+
lg: {
|
|
48
|
+
width: theme.components.iconContainer.lg.width,
|
|
49
|
+
height: theme.components.iconContainer.lg.height,
|
|
50
|
+
padding: theme.components.iconContainer.lg.padding,
|
|
51
|
+
borderRadius: theme.components.iconContainer.lg.borderRadiusRounded,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
radiusNone: {
|
|
55
|
+
true: {
|
|
56
|
+
borderRadius: 0,
|
|
57
|
+
},
|
|
58
|
+
false: {},
|
|
59
|
+
},
|
|
60
|
+
variant: {
|
|
61
|
+
subtle: {},
|
|
62
|
+
emphasis: {},
|
|
63
|
+
},
|
|
64
|
+
color: {
|
|
65
|
+
pig: {},
|
|
66
|
+
energy: {},
|
|
67
|
+
broadband: {},
|
|
68
|
+
mobile: {},
|
|
69
|
+
insurance: {},
|
|
70
|
+
cashback: {},
|
|
71
|
+
highlight: {},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
compoundVariants: [
|
|
75
|
+
{
|
|
76
|
+
variant: 'emphasis',
|
|
77
|
+
color: 'pig',
|
|
78
|
+
styles: {
|
|
79
|
+
backgroundColor: theme.color.surface.pig.default,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
variant: 'subtle',
|
|
84
|
+
color: 'pig',
|
|
85
|
+
styles: {
|
|
86
|
+
backgroundColor: theme.color.surface.pig.subtle,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
variant: 'emphasis',
|
|
91
|
+
color: 'energy',
|
|
92
|
+
styles: {
|
|
93
|
+
backgroundColor: theme.color.surface.energy.default,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
variant: 'subtle',
|
|
98
|
+
color: 'energy',
|
|
99
|
+
styles: {
|
|
100
|
+
backgroundColor: theme.color.surface.energy.subtle,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
variant: 'emphasis',
|
|
105
|
+
color: 'broadband',
|
|
106
|
+
styles: {
|
|
107
|
+
backgroundColor: theme.color.surface.broadband.default,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
variant: 'subtle',
|
|
112
|
+
color: 'broadband',
|
|
113
|
+
styles: {
|
|
114
|
+
backgroundColor: theme.color.surface.broadband.subtle,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
variant: 'emphasis',
|
|
119
|
+
color: 'mobile',
|
|
120
|
+
styles: {
|
|
121
|
+
backgroundColor: theme.color.surface.mobile.default,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
variant: 'subtle',
|
|
126
|
+
color: 'mobile',
|
|
127
|
+
styles: {
|
|
128
|
+
backgroundColor: theme.color.surface.mobile.subtle,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
variant: 'emphasis',
|
|
133
|
+
color: 'insurance',
|
|
134
|
+
styles: {
|
|
135
|
+
backgroundColor: theme.color.surface.insurance.default,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
variant: 'subtle',
|
|
140
|
+
color: 'insurance',
|
|
141
|
+
styles: {
|
|
142
|
+
backgroundColor: theme.color.surface.insurance.subtle,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
variant: 'emphasis',
|
|
147
|
+
color: 'cashback',
|
|
148
|
+
styles: {
|
|
149
|
+
backgroundColor: theme.color.surface.cashback.default,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
variant: 'subtle',
|
|
154
|
+
color: 'cashback',
|
|
155
|
+
styles: {
|
|
156
|
+
backgroundColor: theme.color.surface.cashback.subtle,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
variant: 'emphasis',
|
|
161
|
+
color: 'highlight',
|
|
162
|
+
styles: {
|
|
163
|
+
backgroundColor: theme.color.surface.highlight.default,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
variant: 'subtle',
|
|
168
|
+
color: 'highlight',
|
|
169
|
+
styles: {
|
|
170
|
+
backgroundColor: theme.color.surface.highlight.subtle,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
icon: {
|
|
176
|
+
color: theme.color.icon.primary,
|
|
177
|
+
},
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
export default IconContainer;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { createIcon } from '@gluestack-ui/icon';
|
|
2
|
-
import {
|
|
2
|
+
import { Path, Svg } from 'react-native-svg';
|
|
3
3
|
|
|
4
4
|
const CircleIcon = createIcon({
|
|
5
5
|
Root: Svg,
|
|
6
6
|
viewBox: '0 0 24 24',
|
|
7
7
|
path: (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/>
|
|
17
|
-
</>
|
|
8
|
+
<Path
|
|
9
|
+
d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"
|
|
10
|
+
fill="currentColor"
|
|
11
|
+
stroke="currentColor"
|
|
12
|
+
strokeWidth="2"
|
|
13
|
+
strokeLinecap="round"
|
|
14
|
+
strokeLinejoin="round"
|
|
15
|
+
/>
|
|
18
16
|
),
|
|
19
17
|
});
|
|
20
18
|
|
|
@@ -57,12 +57,12 @@ import { EmailMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
|
57
57
|
|
|
58
58
|
const MyComponent = () => {
|
|
59
59
|
const [value, setValue] = useState('');
|
|
60
|
-
const handleChange =
|
|
61
|
-
setValue(
|
|
60
|
+
const handleChange = val => {
|
|
61
|
+
setValue(val);
|
|
62
62
|
};
|
|
63
63
|
return (
|
|
64
64
|
<Input
|
|
65
|
-
|
|
65
|
+
onChangeText={handleChange}
|
|
66
66
|
value={value}
|
|
67
67
|
placeholder="Placeholder"
|
|
68
68
|
leadingIcon={EmailMediumIcon}
|
|
@@ -70,24 +70,6 @@ interface PasswordInputSpecificProps extends InputWithoutChildrenBaseProps {
|
|
|
70
70
|
onClear?: never;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
interface DateInputSpecificProps extends InputWithoutChildrenBaseProps {
|
|
74
|
-
type: 'date';
|
|
75
|
-
format?: string;
|
|
76
|
-
showPasswordToggle?: never;
|
|
77
|
-
loading?: never;
|
|
78
|
-
clearable?: never;
|
|
79
|
-
onClear?: never;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
interface CurrencyInputSpecificProps extends InputWithoutChildrenBaseProps {
|
|
83
|
-
type: 'currency';
|
|
84
|
-
format?: string;
|
|
85
|
-
showPasswordToggle?: never;
|
|
86
|
-
loading?: never;
|
|
87
|
-
clearable?: never;
|
|
88
|
-
onClear?: never;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
73
|
interface SearchInputSpecificProps extends InputWithoutChildrenBaseProps {
|
|
92
74
|
type: 'search';
|
|
93
75
|
loading?: boolean;
|
|
@@ -101,8 +83,6 @@ interface SearchInputSpecificProps extends InputWithoutChildrenBaseProps {
|
|
|
101
83
|
export type InputWithoutChildrenProps =
|
|
102
84
|
| TextInputSpecificProps
|
|
103
85
|
| PasswordInputSpecificProps
|
|
104
|
-
| DateInputSpecificProps
|
|
105
|
-
| CurrencyInputSpecificProps
|
|
106
86
|
| SearchInputSpecificProps;
|
|
107
87
|
|
|
108
88
|
/**
|
|
@@ -130,12 +130,6 @@ export const Variants: Story = {
|
|
|
130
130
|
<VariantTitle title="Type search - loading">
|
|
131
131
|
<Input placeholder="Input placeholder" type="search" loading />
|
|
132
132
|
</VariantTitle>
|
|
133
|
-
<VariantTitle title="Type currency">
|
|
134
|
-
<Input type="currency" />
|
|
135
|
-
</VariantTitle>
|
|
136
|
-
<VariantTitle title="Type date">
|
|
137
|
-
<Input type="date" />
|
|
138
|
-
</VariantTitle>
|
|
139
133
|
<VariantTitle title="Valid">
|
|
140
134
|
<Input validationStatus="valid" placeholder="Input placeholder" />
|
|
141
135
|
</VariantTitle>
|
|
@@ -3,15 +3,12 @@ import { ComponentType, useState } from 'react';
|
|
|
3
3
|
import type InputProps from './Input.props';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
CalendarMediumIcon,
|
|
7
6
|
CloseSmallIcon,
|
|
8
7
|
EyeOffSmallIcon,
|
|
9
8
|
EyeSmallIcon,
|
|
10
9
|
SearchMediumIcon,
|
|
11
10
|
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
12
|
-
import { Platform } from 'react-native';
|
|
13
11
|
import { useTheme } from '../../hooks';
|
|
14
|
-
import { DetailText } from '../DetailText';
|
|
15
12
|
import { useFormFieldContext } from '../FormField';
|
|
16
13
|
import { Spinner } from '../Spinner';
|
|
17
14
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
@@ -59,26 +56,6 @@ const Input = ({
|
|
|
59
56
|
);
|
|
60
57
|
const { color } = useTheme();
|
|
61
58
|
|
|
62
|
-
const defaultFornat = (() => {
|
|
63
|
-
if (type === 'currency') {
|
|
64
|
-
return '0.00';
|
|
65
|
-
}
|
|
66
|
-
if (type === 'date') {
|
|
67
|
-
return 'DD/MM/YYYY';
|
|
68
|
-
}
|
|
69
|
-
return;
|
|
70
|
-
})();
|
|
71
|
-
|
|
72
|
-
const getPlaceholder = (() => {
|
|
73
|
-
if (type === 'currency') {
|
|
74
|
-
return props.placeholder ?? format ?? defaultFornat;
|
|
75
|
-
}
|
|
76
|
-
if (type === 'date') {
|
|
77
|
-
return props.placeholder ?? format ?? defaultFornat;
|
|
78
|
-
}
|
|
79
|
-
return props.placeholder;
|
|
80
|
-
})();
|
|
81
|
-
|
|
82
59
|
const shouldShowPasswordToggle = type === 'password' && showPasswordToggle;
|
|
83
60
|
const shouldShowClear = clearable && !!(props as InputWithoutChildrenProps)?.value;
|
|
84
61
|
|
|
@@ -93,17 +70,7 @@ const Input = ({
|
|
|
93
70
|
return leadingIcon;
|
|
94
71
|
})();
|
|
95
72
|
|
|
96
|
-
const trailingIconComponent = ((): ComponentType | undefined => {
|
|
97
|
-
if (type === 'date') {
|
|
98
|
-
return CalendarMediumIcon;
|
|
99
|
-
}
|
|
100
|
-
return trailingIcon;
|
|
101
|
-
})();
|
|
102
|
-
|
|
103
73
|
const getInputMode = (() => {
|
|
104
|
-
if (type === 'currency') {
|
|
105
|
-
return 'decimal';
|
|
106
|
-
}
|
|
107
74
|
if (type === 'search') {
|
|
108
75
|
return 'search';
|
|
109
76
|
}
|
|
@@ -130,25 +97,11 @@ const Input = ({
|
|
|
130
97
|
<InputIcon as={leadingIconComponent} />
|
|
131
98
|
</InputSlot>
|
|
132
99
|
)}
|
|
133
|
-
{type === 'currency' && (
|
|
134
|
-
<InputSlot>
|
|
135
|
-
<DetailText
|
|
136
|
-
size="4xl"
|
|
137
|
-
style={{
|
|
138
|
-
// todo: fix this
|
|
139
|
-
...(Platform.OS === 'ios' && { lineHeight: 46 }),
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
£
|
|
143
|
-
</DetailText>
|
|
144
|
-
</InputSlot>
|
|
145
|
-
)}
|
|
146
100
|
<InputField
|
|
147
101
|
type={fieldType}
|
|
148
102
|
inputMode={getInputMode}
|
|
149
103
|
inBottomSheet={inBottomSheet}
|
|
150
104
|
{...props}
|
|
151
|
-
placeholder={getPlaceholder}
|
|
152
105
|
/>
|
|
153
106
|
{shouldShowClear && (
|
|
154
107
|
<InputSlot>
|
|
@@ -168,9 +121,9 @@ const Input = ({
|
|
|
168
121
|
/>
|
|
169
122
|
</InputSlot>
|
|
170
123
|
)}
|
|
171
|
-
{!!
|
|
124
|
+
{!!trailingIcon && (
|
|
172
125
|
<InputSlot>
|
|
173
|
-
<InputIcon as={
|
|
126
|
+
<InputIcon as={trailingIcon} />
|
|
174
127
|
</InputSlot>
|
|
175
128
|
)}
|
|
176
129
|
</>
|
|
@@ -64,13 +64,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
64
64
|
text: {},
|
|
65
65
|
password: {},
|
|
66
66
|
search: {},
|
|
67
|
-
currency: {
|
|
68
|
-
fontSize: theme.typography.mobile.detailText['4xl'].fontSize,
|
|
69
|
-
fontFamily: theme.typography.mobile.detailText.fontFamily,
|
|
70
|
-
fontWeight: theme.typography.mobile.detailText.fontWeight,
|
|
71
|
-
paddingTop: 0,
|
|
72
|
-
paddingBottom: 0,
|
|
73
|
-
},
|
|
74
67
|
date: {},
|
|
75
68
|
},
|
|
76
69
|
},
|
|
@@ -154,6 +154,8 @@ const Modal = ({
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
+
styles.useVariants({ loading });
|
|
158
|
+
|
|
157
159
|
const content = (
|
|
158
160
|
<>
|
|
159
161
|
{loading ? (
|
|
@@ -261,6 +263,7 @@ const Modal = ({
|
|
|
261
263
|
{...props}
|
|
262
264
|
onChange={handleChange}
|
|
263
265
|
>
|
|
266
|
+
{loading ? <View style={styles.loadingTop} /> : null}
|
|
264
267
|
<BottomSheetScrollView contentContainerStyle={styles.container} ref={scrollViewRef}>
|
|
265
268
|
{content}
|
|
266
269
|
</BottomSheetScrollView>
|
|
@@ -272,6 +275,13 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
272
275
|
container: {
|
|
273
276
|
flex: 1,
|
|
274
277
|
gap: theme.components.dialog.gap,
|
|
278
|
+
variants: {
|
|
279
|
+
loading: {
|
|
280
|
+
true: {
|
|
281
|
+
paddingTop: 0,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
275
285
|
},
|
|
276
286
|
header: {
|
|
277
287
|
flexDirection: 'row',
|
|
@@ -293,7 +303,15 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
293
303
|
textContent: {
|
|
294
304
|
gap: theme.components.dialog.content.gap,
|
|
295
305
|
},
|
|
306
|
+
loadingTop: {
|
|
307
|
+
borderTopLeftRadius: theme.components.dialog.borderRadius,
|
|
308
|
+
borderTopRightRadius: theme.components.dialog.borderRadius,
|
|
309
|
+
height: 16,
|
|
310
|
+
backgroundColor: theme.color.surface.neutral.strong,
|
|
311
|
+
},
|
|
296
312
|
loadingContainer: {
|
|
313
|
+
borderTopLeftRadius: theme.components.dialog.borderRadius,
|
|
314
|
+
borderTopRightRadius: theme.components.dialog.borderRadius,
|
|
297
315
|
flex: 1,
|
|
298
316
|
alignItems: 'center',
|
|
299
317
|
justifyContent: 'center',
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface TabProps extends PressableProps {
|
|
5
|
+
/** Unique value for the tab */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Tab label */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Optional leading icon */
|
|
10
|
+
icon?: ComponentType<any>;
|
|
11
|
+
/** Whether the tab is disabled */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
style?: ViewProps['style'];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default TabProps;
|