@utilitywarehouse/hearth-react-native 0.2.0 → 0.3.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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +3 -1
- package/CHANGELOG.md +34 -0
- package/build/components/Alert/AlertCloseButton.js +25 -3
- package/build/components/Alert/AlertIcon.js +17 -1
- package/build/components/Alert/AlertIconButton.js +27 -1
- package/build/components/Alert/AlertLink.js +47 -1
- package/build/components/Alert/AlertText.d.ts +1 -1
- package/build/components/Alert/AlertText.js +26 -2
- package/build/components/Alert/AlertTitle.d.ts +1 -1
- package/build/components/Alert/AlertTitle.js +26 -2
- package/build/components/Badge/Badge.js +101 -14
- package/build/components/Badge/Badge.props.d.ts +2 -2
- package/build/components/Badge/BadgeIcon.js +27 -29
- package/build/components/Badge/BadgeText.js +29 -31
- 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/Button/ButtonRoot.js +1 -0
- package/build/components/Card/Card.props.d.ts +2 -2
- package/build/components/Checkbox/Checkbox.d.ts +2 -2
- package/build/components/Checkbox/Checkbox.js +11 -10
- package/build/components/Checkbox/Checkbox.props.d.ts +3 -1
- package/build/components/Checkbox/CheckboxIcon.js +1 -1
- package/build/components/Checkbox/CheckboxImage.d.ts +6 -0
- package/build/components/Checkbox/CheckboxImage.js +5 -0
- package/build/components/Checkbox/CheckboxTileRoot.js +1 -1
- package/build/components/Checkbox/index.d.ts +3 -2
- package/build/components/Checkbox/index.js +2 -1
- 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/Link/Link.d.ts +1 -1
- package/build/components/Link/Link.js +4 -4
- package/build/components/Link/Link.props.d.ts +3 -0
- package/build/components/Modal/Modal.js +17 -1
- package/build/components/Radio/Radio.d.ts +2 -2
- package/build/components/Radio/Radio.js +9 -8
- package/build/components/Radio/Radio.props.d.ts +3 -1
- package/build/components/Radio/RadioImage.d.ts +6 -0
- package/build/components/Radio/RadioImage.js +5 -0
- package/build/components/Radio/RadioTileRoot.js +1 -1
- package/build/components/Radio/index.d.ts +3 -2
- package/build/components/Radio/index.js +2 -1
- package/build/components/SectionHeader/SectionHeader.js +1 -0
- package/build/components/Select/SelectOption.js +1 -7
- 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/UnstyledIconButton/UnstyledIconButton.d.ts +1 -1
- package/build/components/UnstyledIconButton/UnstyledIconButton.js +4 -4
- package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +2 -1
- package/build/components/index.d.ts +4 -0
- package/build/components/index.js +4 -0
- package/build/core/themes.d.ts +428 -160
- package/build/core/themes.js +57 -1
- package/build/tokens/color.d.ts +88 -80
- package/build/tokens/color.js +44 -40
- package/build/tokens/components/dark/alert.d.ts +13 -0
- package/build/tokens/components/dark/alert.js +13 -0
- 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 +4 -1
- package/build/tokens/components/dark/checkbox.js +4 -1
- package/build/tokens/components/dark/icon-button.d.ts +10 -3
- package/build/tokens/components/dark/icon-button.js +10 -3
- package/build/tokens/components/dark/index.d.ts +1 -0
- package/build/tokens/components/dark/index.js +1 -0
- package/build/tokens/components/dark/link.d.ts +5 -0
- package/build/tokens/components/dark/link.js +5 -0
- package/build/tokens/components/dark/progress-bar.d.ts +41 -0
- package/build/tokens/components/dark/progress-bar.js +40 -0
- 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/alert.d.ts +13 -0
- package/build/tokens/components/light/alert.js +13 -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 +6 -3
- package/build/tokens/components/light/checkbox.js +6 -3
- package/build/tokens/components/light/icon-button.d.ts +8 -1
- package/build/tokens/components/light/icon-button.js +8 -1
- package/build/tokens/components/light/index.d.ts +1 -0
- package/build/tokens/components/light/index.js +1 -0
- package/build/tokens/components/light/link.d.ts +5 -0
- package/build/tokens/components/light/link.js +5 -0
- package/build/tokens/components/light/progress-bar.d.ts +41 -0
- package/build/tokens/components/light/progress-bar.js +40 -0
- 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/index.d.ts +1 -0
- package/build/tokens/index.js +1 -0
- package/build/tokens/layout.d.ts +48 -30
- package/build/tokens/layout.js +24 -15
- package/build/tokens/motion.d.ts +23 -0
- package/build/tokens/motion.js +22 -0
- package/build/tokens/primitive.d.ts +19 -0
- package/build/tokens/primitive.js +19 -0
- package/build/tokens/semantic-dark.d.ts +26 -24
- package/build/tokens/semantic-dark.js +26 -24
- package/build/tokens/semantic-light.d.ts +18 -16
- package/build/tokens/semantic-light.js +18 -16
- 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/assets/bank-logo.png +0 -0
- package/docs/assets/bank-logo1.png +0 -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/components/index.ts +6 -7
- package/docs/heplers/addReactNativePrefix.ts +8 -0
- package/docs/heplers/index.ts +1 -0
- package/docs/introduction.mdx +3 -3
- package/docs/theme-tokens.mdx +42 -0
- package/package.json +13 -13
- package/src/components/Alert/AlertCloseButton.tsx +33 -5
- package/src/components/Alert/AlertIcon.tsx +17 -1
- package/src/components/Alert/AlertIconButton.tsx +37 -4
- package/src/components/Alert/AlertLink.tsx +52 -1
- package/src/components/Alert/AlertText.tsx +28 -3
- package/src/components/Alert/AlertTitle.tsx +28 -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 +27 -29
- package/src/components/Badge/BadgeText.tsx +29 -31
- package/src/components/Button/ButtonGroupRoot.tsx +12 -2
- package/src/components/Button/ButtonRoot.tsx +1 -0
- package/src/components/Card/Card.docs.mdx +1 -1
- package/src/components/Card/Card.props.ts +2 -2
- package/src/components/Checkbox/Checkbox.docs.mdx +45 -7
- package/src/components/Checkbox/Checkbox.props.ts +3 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +37 -1
- package/src/components/Checkbox/Checkbox.tsx +12 -9
- package/src/components/Checkbox/CheckboxIcon.tsx +1 -1
- package/src/components/Checkbox/CheckboxImage.tsx +9 -0
- package/src/components/Checkbox/CheckboxTileRoot.tsx +1 -1
- package/src/components/Checkbox/index.ts +3 -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/Link/Link.props.ts +3 -0
- package/src/components/Link/Link.tsx +12 -6
- package/src/components/List/List.docs.mdx +24 -23
- package/src/components/Modal/Modal.tsx +18 -0
- package/src/components/Radio/Radio.docs.mdx +96 -124
- package/src/components/Radio/Radio.props.ts +3 -1
- package/src/components/Radio/Radio.stories.tsx +47 -0
- package/src/components/Radio/Radio.tsx +10 -7
- package/src/components/Radio/RadioImage.tsx +9 -0
- package/src/components/Radio/RadioTileRoot.tsx +1 -1
- package/src/components/Radio/index.ts +3 -2
- package/src/components/SectionHeader/SectionHeader.tsx +1 -0
- package/src/components/Select/Select.docs.mdx +6 -6
- package/src/components/Select/Select.stories.tsx +7 -7
- package/src/components/Select/SelectOption.tsx +4 -10
- 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/UnstyledIconButton/UnstyledIconButton.props.ts +2 -1
- package/src/components/UnstyledIconButton/UnstyledIconButton.tsx +9 -3
- package/src/components/index.ts +4 -0
- package/src/core/themes.ts +57 -1
- package/src/tokens/color.ts +44 -40
- package/src/tokens/components/dark/alert.ts +13 -0
- package/src/tokens/components/dark/button.ts +1 -0
- package/src/tokens/components/dark/checkbox.ts +4 -1
- package/src/tokens/components/dark/icon-button.ts +10 -3
- package/src/tokens/components/dark/index.ts +1 -0
- package/src/tokens/components/dark/link.ts +5 -0
- package/src/tokens/components/dark/progress-bar.ts +41 -0
- package/src/tokens/components/dark/radio.ts +1 -1
- package/src/tokens/components/dark/tabs.ts +2 -0
- package/src/tokens/components/light/alert.ts +13 -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 +6 -3
- package/src/tokens/components/light/icon-button.ts +8 -1
- package/src/tokens/components/light/index.ts +1 -0
- package/src/tokens/components/light/link.ts +5 -0
- package/src/tokens/components/light/progress-bar.ts +41 -0
- package/src/tokens/components/light/radio.ts +3 -3
- package/src/tokens/components/light/tabs.ts +2 -0
- package/src/tokens/index.ts +1 -0
- package/src/tokens/layout.ts +24 -15
- package/src/tokens/motion.ts +23 -0
- package/src/tokens/primitive.ts +19 -0
- package/src/tokens/semantic-dark.ts +26 -24
- package/src/tokens/semantic-light.ts +18 -16
- package/src/types/values.ts +3 -1
- package/src/utils/formatThousands.ts +14 -0
- package/src/utils/index.ts +1 -0
- package/docs/assets/react-native-pig.png +0 -0
- package/docs/components/AdvancedRadioExample.tsx +0 -126
|
@@ -3,9 +3,9 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
3
3
|
import { BodyText } from '../BodyText';
|
|
4
4
|
import { useBadgeContext } from './Badge.context';
|
|
5
5
|
const BadgeText = ({ children, style, ...props }) => {
|
|
6
|
-
const { variant, colorScheme } = useBadgeContext();
|
|
6
|
+
const { variant, colorScheme, size } = useBadgeContext();
|
|
7
7
|
styles.useVariants({ variant, colorScheme });
|
|
8
|
-
return (_jsx(BodyText, { ...props, size:
|
|
8
|
+
return (_jsx(BodyText, { ...props, size: size, weight: "semibold", style: [styles.text, style], children: children }));
|
|
9
9
|
};
|
|
10
10
|
BadgeText.displayName = 'BadgeText';
|
|
11
11
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -23,91 +23,89 @@ const styles = StyleSheet.create(theme => ({
|
|
|
23
23
|
insurance: {},
|
|
24
24
|
cashback: {},
|
|
25
25
|
pig: {},
|
|
26
|
+
highlight: {},
|
|
26
27
|
},
|
|
27
28
|
variant: {
|
|
28
|
-
|
|
29
|
+
emphasis: {
|
|
30
|
+
color: theme.color.text.primary,
|
|
31
|
+
},
|
|
32
|
+
subtle: {
|
|
29
33
|
color: theme.color.text.primary,
|
|
30
34
|
},
|
|
31
35
|
outline: {},
|
|
32
36
|
},
|
|
33
37
|
},
|
|
34
38
|
compoundVariants: [
|
|
35
|
-
//
|
|
39
|
+
// Emphasis
|
|
36
40
|
{
|
|
37
41
|
colorScheme: 'info',
|
|
38
|
-
variant: '
|
|
42
|
+
variant: 'emphasis',
|
|
39
43
|
styles: {
|
|
40
44
|
color: theme.color.feedback.info.foreground.default,
|
|
41
45
|
},
|
|
42
46
|
},
|
|
43
47
|
{
|
|
44
48
|
colorScheme: 'danger',
|
|
45
|
-
variant: '
|
|
49
|
+
variant: 'emphasis',
|
|
46
50
|
styles: {
|
|
47
51
|
color: theme.color.feedback.danger.foreground.default,
|
|
48
52
|
},
|
|
49
53
|
},
|
|
50
54
|
{
|
|
51
55
|
colorScheme: 'positive',
|
|
52
|
-
variant: '
|
|
56
|
+
variant: 'emphasis',
|
|
53
57
|
styles: {
|
|
54
58
|
color: theme.color.feedback.positive.foreground.default,
|
|
55
59
|
},
|
|
56
60
|
},
|
|
57
61
|
{
|
|
58
62
|
colorScheme: 'warning',
|
|
59
|
-
variant: '
|
|
63
|
+
variant: 'emphasis',
|
|
60
64
|
styles: {
|
|
61
65
|
color: theme.color.feedback.warning.foreground.default,
|
|
62
66
|
},
|
|
63
67
|
},
|
|
64
68
|
{
|
|
65
69
|
colorScheme: 'functional',
|
|
66
|
-
variant: '
|
|
70
|
+
variant: 'emphasis',
|
|
67
71
|
styles: {
|
|
68
72
|
color: theme.color.feedback.functional.foreground.default,
|
|
69
73
|
},
|
|
70
74
|
},
|
|
75
|
+
// Subtle
|
|
71
76
|
{
|
|
72
|
-
colorScheme: '
|
|
73
|
-
variant: '
|
|
74
|
-
styles: {
|
|
75
|
-
color: theme.color.text.primary,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
colorScheme: 'broadband',
|
|
80
|
-
variant: 'solid',
|
|
77
|
+
colorScheme: 'info',
|
|
78
|
+
variant: 'subtle',
|
|
81
79
|
styles: {
|
|
82
|
-
color: theme.color.
|
|
80
|
+
color: theme.color.feedback.info.foreground.default,
|
|
83
81
|
},
|
|
84
82
|
},
|
|
85
83
|
{
|
|
86
|
-
colorScheme: '
|
|
87
|
-
variant: '
|
|
84
|
+
colorScheme: 'danger',
|
|
85
|
+
variant: 'subtle',
|
|
88
86
|
styles: {
|
|
89
|
-
color: theme.color.
|
|
87
|
+
color: theme.color.feedback.danger.foreground.default,
|
|
90
88
|
},
|
|
91
89
|
},
|
|
92
90
|
{
|
|
93
|
-
colorScheme: '
|
|
94
|
-
variant: '
|
|
91
|
+
colorScheme: 'positive',
|
|
92
|
+
variant: 'subtle',
|
|
95
93
|
styles: {
|
|
96
|
-
color: theme.color.
|
|
94
|
+
color: theme.color.feedback.positive.foreground.default,
|
|
97
95
|
},
|
|
98
96
|
},
|
|
99
97
|
{
|
|
100
|
-
colorScheme: '
|
|
101
|
-
variant: '
|
|
98
|
+
colorScheme: 'warning',
|
|
99
|
+
variant: 'subtle',
|
|
102
100
|
styles: {
|
|
103
|
-
color: theme.color.
|
|
101
|
+
color: theme.color.feedback.warning.foreground.default,
|
|
104
102
|
},
|
|
105
103
|
},
|
|
106
104
|
{
|
|
107
|
-
colorScheme: '
|
|
108
|
-
variant: '
|
|
105
|
+
colorScheme: 'functional',
|
|
106
|
+
variant: 'subtle',
|
|
109
107
|
styles: {
|
|
110
|
-
color: theme.color.
|
|
108
|
+
color: theme.color.feedback.functional.foreground.default,
|
|
111
109
|
},
|
|
112
110
|
},
|
|
113
111
|
// Outline
|
|
@@ -6,12 +6,12 @@ export declare const ButtonGroupComponent: import("react").ForwardRefExoticCompo
|
|
|
6
6
|
flexDirection?: import("react-native").ViewStyle["flexDirection"];
|
|
7
7
|
reversed?: boolean;
|
|
8
8
|
attached?: boolean;
|
|
9
|
-
space?: "
|
|
9
|
+
space?: import("../../types").SpacingValues;
|
|
10
10
|
}> & import("react-native").ViewProps & {
|
|
11
11
|
flexDirection?: import("react-native").ViewStyle["flexDirection"];
|
|
12
12
|
reversed?: boolean;
|
|
13
13
|
attached?: boolean;
|
|
14
|
-
space?: "
|
|
14
|
+
space?: import("../../types").SpacingValues;
|
|
15
15
|
} & import("@gluestack-ui/button/lib/typescript/types").IButtonGroupProps>;
|
|
16
16
|
declare const Button: {
|
|
17
17
|
({ children, disabled, pressed, text, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ViewProps, type ViewStyle } from 'react-native';
|
|
2
|
+
import { SpacingValues } from '../../types';
|
|
2
3
|
declare const ButtonGroupRoot: {
|
|
3
4
|
({ children, attached, flexDirection, reversed, space, ...props }: ViewProps & {
|
|
4
5
|
flexDirection?: ViewStyle["flexDirection"];
|
|
5
6
|
reversed?: boolean;
|
|
6
7
|
attached?: boolean;
|
|
7
|
-
space?:
|
|
8
|
+
space?: SpacingValues;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
@@ -24,6 +24,12 @@ const styles = StyleSheet.create(theme => ({
|
|
|
24
24
|
text: {
|
|
25
25
|
variants: {
|
|
26
26
|
space: {
|
|
27
|
+
none: {
|
|
28
|
+
gap: theme.layout.mobile.spacing.none,
|
|
29
|
+
},
|
|
30
|
+
'2xs': {
|
|
31
|
+
gap: theme.layout.mobile.spacing['2xs'],
|
|
32
|
+
},
|
|
27
33
|
xs: {
|
|
28
34
|
gap: theme.layout.mobile.spacing.xs,
|
|
29
35
|
},
|
|
@@ -39,6 +45,9 @@ const styles = StyleSheet.create(theme => ({
|
|
|
39
45
|
xl: {
|
|
40
46
|
gap: theme.layout.mobile.spacing.xl,
|
|
41
47
|
},
|
|
48
|
+
'2xl': {
|
|
49
|
+
gap: theme.layout.mobile.spacing['2xl'],
|
|
50
|
+
},
|
|
42
51
|
},
|
|
43
52
|
attached: {
|
|
44
53
|
true: {
|
|
@@ -177,6 +177,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
177
177
|
colorScheme: 'affirmative',
|
|
178
178
|
styles: {
|
|
179
179
|
backgroundColor: theme.color.interactive.affirmative.surface.strong.default,
|
|
180
|
+
borderColor: theme.color.interactive.affirmative.border.strong,
|
|
180
181
|
_web: {
|
|
181
182
|
_hover: {
|
|
182
183
|
backgroundColor: theme.color.interactive.affirmative.surface.strong.hover,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PressableProps, ViewStyle } from 'react-native';
|
|
2
|
-
import { SpaceValue } from '../../types';
|
|
2
|
+
import { SpaceValue, SpacingValues } from '../../types';
|
|
3
3
|
interface CardProps extends PressableProps {
|
|
4
4
|
variant?: 'emphasis' | 'subtle';
|
|
5
5
|
colorScheme?: 'neutralStrong' | 'neutralSubtle' | 'brand' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'pig';
|
|
6
6
|
noPadding?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
space?:
|
|
8
|
+
space?: SpacingValues;
|
|
9
9
|
alignItems?: ViewStyle['alignItems'];
|
|
10
10
|
justifyContent?: ViewStyle['justifyContent'];
|
|
11
11
|
flexDirection?: ViewStyle['flexDirection'];
|
|
@@ -10,12 +10,12 @@ declare const CheckboxIcon: import("react").ForwardRefExoticComponent<import("re
|
|
|
10
10
|
}>;
|
|
11
11
|
declare const CheckboxLabel: import("react").ForwardRefExoticComponent<import("react").RefAttributes<import("../Label/Label.props").default> & Omit<import("../Label/Label.props").default, "ref">>;
|
|
12
12
|
declare const Checkbox: {
|
|
13
|
-
({ children, label, disabled, checked, helperIcon, helperText, invalidText, validText, validationStatus: validation, showValidationIcon, type, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
({ children, label, disabled, checked, helperIcon, helperText, invalidText, validText, validationStatus: validation, showValidationIcon, type, image, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
displayName: string;
|
|
15
15
|
};
|
|
16
16
|
declare const CheckboxTile: {
|
|
17
17
|
({ type, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
displayName: string;
|
|
19
19
|
};
|
|
20
|
-
export { Checkbox, CheckboxGroup,
|
|
20
|
+
export { Checkbox, CheckboxGroup, CheckboxIcon, CheckboxIndicator, CheckboxLabel, CheckboxTile };
|
|
21
21
|
export default Checkbox;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { createCheckbox } from '@gluestack-ui/checkbox';
|
|
3
|
-
import
|
|
4
|
-
import StyledCheckboxIndicator from './CheckboxIndicator';
|
|
5
|
-
import StyledCheckboxIcon from './CheckboxIcon';
|
|
6
|
-
import StyledCheckboxLabel from './CheckboxLabel';
|
|
7
|
-
import StyledCheckboxGroup from './CheckboxGroupRoot';
|
|
3
|
+
import { useFormFieldContext } from '../FormField';
|
|
8
4
|
import { Helper } from '../Helper';
|
|
9
5
|
import { useCheckboxGroupContext } from './CheckboxGroup.context';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
6
|
+
import StyledCheckboxGroup from './CheckboxGroupRoot';
|
|
7
|
+
import StyledCheckboxIcon from './CheckboxIcon';
|
|
8
|
+
import CheckboxImage from './CheckboxImage';
|
|
9
|
+
import StyledCheckboxIndicator from './CheckboxIndicator';
|
|
10
|
+
import StyledCheckboxLabel from './CheckboxLabel';
|
|
11
|
+
import StyledCheckbox from './CheckboxRoot';
|
|
12
12
|
import CheckboxTextContent from './CheckboxTextContent';
|
|
13
|
+
import CheckboxTileRoot from './CheckboxTileRoot';
|
|
13
14
|
const CheckboxComponent = createCheckbox({
|
|
14
15
|
Root: StyledCheckbox,
|
|
15
16
|
Group: StyledCheckboxGroup,
|
|
@@ -25,12 +26,12 @@ CheckboxGroup.displayName = 'CheckboxGroup';
|
|
|
25
26
|
CheckboxIndicator.displayName = 'CheckboxIndicator';
|
|
26
27
|
CheckboxIcon.displayName = 'CheckboxIcon';
|
|
27
28
|
CheckboxLabel.displayName = 'CheckboxLabel';
|
|
28
|
-
const Checkbox = ({ children, label, disabled, checked, helperIcon, helperText, invalidText, validText, validationStatus: validation, showValidationIcon, type = 'default', ...props }) => {
|
|
29
|
+
const Checkbox = ({ children, label, disabled, checked, helperIcon, helperText, invalidText, validText, validationStatus: validation, showValidationIcon, type = 'default', image, ...props }) => {
|
|
29
30
|
const { validationStatus: fieldValidationStatus } = useFormFieldContext();
|
|
30
31
|
const { validationStatus: groupValidationStatus, type: groupType } = useCheckboxGroupContext();
|
|
31
32
|
const validationStatus = fieldValidationStatus ?? groupValidationStatus ?? validation ?? 'initial';
|
|
32
33
|
const checkboxType = groupType ?? type;
|
|
33
|
-
const checkboxChildren = children ? (children) : (_jsxs(_Fragment, { children: [_jsx(CheckboxIndicator, { children: _jsx(CheckboxIcon, {}) }), _jsxs(CheckboxTextContent, { children: [!!label && _jsx(CheckboxLabel, { children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })] }));
|
|
34
|
+
const checkboxChildren = children ? (children) : (_jsxs(_Fragment, { children: [_jsx(CheckboxIndicator, { children: _jsx(CheckboxIcon, {}) }), image ? _jsx(CheckboxImage, { ...image }) : null, _jsxs(CheckboxTextContent, { children: [!!label && _jsx(CheckboxLabel, { children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })] }));
|
|
34
35
|
return (
|
|
35
36
|
// @ts-expect-error - type
|
|
36
37
|
_jsx(CheckboxComponent, { ...props, isDisabled: disabled, isChecked: checked, children: checkboxType === 'tile' ? (_jsx(CheckboxTileRoot, { children: checkboxChildren })) : (checkboxChildren) }));
|
|
@@ -40,5 +41,5 @@ const CheckboxTile = ({ type = 'tile', ...props }) => {
|
|
|
40
41
|
};
|
|
41
42
|
CheckboxTile.displayName = 'CheckboxTile';
|
|
42
43
|
Checkbox.displayName = 'Checkbox';
|
|
43
|
-
export { Checkbox, CheckboxGroup,
|
|
44
|
+
export { Checkbox, CheckboxGroup, CheckboxIcon, CheckboxIndicator, CheckboxLabel, CheckboxTile };
|
|
44
45
|
export default Checkbox;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type { PressableProps, ViewProps } from 'react-native';
|
|
2
|
+
import type { ImageProps, PressableProps, ViewProps } from 'react-native';
|
|
3
3
|
type CheckboxBaseProps = {
|
|
4
4
|
onChange?: (isSelected: boolean) => void;
|
|
5
5
|
disabled?: boolean;
|
|
@@ -20,6 +20,7 @@ type CheckboxWithChildrenProps = {
|
|
|
20
20
|
invalidText?: never;
|
|
21
21
|
validText?: never;
|
|
22
22
|
showValidationIcon?: never;
|
|
23
|
+
image?: never;
|
|
23
24
|
} & CheckboxBaseProps;
|
|
24
25
|
type CheckboxWithoutChildrenProps = {
|
|
25
26
|
children?: never;
|
|
@@ -29,6 +30,7 @@ type CheckboxWithoutChildrenProps = {
|
|
|
29
30
|
invalidText?: string;
|
|
30
31
|
validText?: string;
|
|
31
32
|
showValidationIcon?: boolean;
|
|
33
|
+
image?: ImageProps;
|
|
32
34
|
} & CheckboxBaseProps;
|
|
33
35
|
type CheckboxProps = CheckboxWithChildrenProps | CheckboxWithoutChildrenProps;
|
|
34
36
|
export default CheckboxProps;
|
|
@@ -10,7 +10,7 @@ const CheckboxIcon = ({ style, ...props }) => {
|
|
|
10
10
|
};
|
|
11
11
|
const styles = StyleSheet.create(theme => ({
|
|
12
12
|
icon: {
|
|
13
|
-
color: theme.
|
|
13
|
+
color: theme.components.checkbox.checked.icon.color,
|
|
14
14
|
},
|
|
15
15
|
}));
|
|
16
16
|
CheckboxIcon.displayName = 'CheckboxIcon';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Image } from 'react-native';
|
|
3
|
+
const CheckboxImage = ({ source, style, ...props }) => (_jsx(Image, { source: source, style: style, ...props }));
|
|
4
|
+
CheckboxImage.displayName = 'CheckboxImage';
|
|
5
|
+
export default CheckboxImage;
|
|
@@ -18,7 +18,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
18
18
|
gap: theme.components.checkbox.gap,
|
|
19
19
|
padding: theme.components.checkbox.tile.padding,
|
|
20
20
|
borderWidth: theme.components.checkbox.tile.borderWidth,
|
|
21
|
-
borderColor: theme.color.border.
|
|
21
|
+
borderColor: theme.color.border.strong,
|
|
22
22
|
borderRadius: theme.components.checkbox.tile.borderRadius,
|
|
23
23
|
backgroundColor: theme.color.surface.neutral.strong,
|
|
24
24
|
variants: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { default as Checkbox, CheckboxIndicator, CheckboxLabel,
|
|
1
|
+
export { default as Checkbox, CheckboxIcon, CheckboxIndicator, CheckboxLabel, CheckboxTile, } from './Checkbox';
|
|
2
|
+
export type { default as CheckboxProps } from './Checkbox.props';
|
|
2
3
|
export { default as CheckboxGroup } from './CheckboxGroup';
|
|
3
4
|
export { default as CheckboxGroupTextContent } from './CheckboxGroupTextContent';
|
|
5
|
+
export { default as CheckboxImage } from './CheckboxImage';
|
|
4
6
|
export { default as CheckboxTextContent } from './CheckboxTextContent';
|
|
5
|
-
export type { default as CheckboxProps } from './Checkbox.props';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default as Checkbox, CheckboxIndicator, CheckboxLabel,
|
|
1
|
+
export { default as Checkbox, CheckboxIcon, CheckboxIndicator, CheckboxLabel, CheckboxTile, } from './Checkbox';
|
|
2
2
|
export { default as CheckboxGroup } from './CheckboxGroup';
|
|
3
3
|
export { default as CheckboxGroupTextContent } from './CheckboxGroupTextContent';
|
|
4
|
+
export { default as CheckboxImage } from './CheckboxImage';
|
|
4
5
|
export { default as CheckboxTextContent } from './CheckboxTextContent';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type CurrencyInputProps from './CurrencyInput.props';
|
|
2
|
+
declare const CurrencyInput: {
|
|
3
|
+
({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, required, autoFormatThousands, value, onChangeText, ...rest }: CurrencyInputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default CurrencyInput;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import { formatThousands } from '../../utils';
|
|
5
|
+
import { DetailText } from '../DetailText';
|
|
6
|
+
import { useFormFieldContext } from '../FormField';
|
|
7
|
+
import { Input, InputField, InputSlot } from '../Input';
|
|
8
|
+
const CurrencyInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, required, autoFormatThousands = false, value, onChangeText, ...rest }) => {
|
|
9
|
+
const formFieldContext = useFormFieldContext();
|
|
10
|
+
const { disabled: formFieldDisabled } = formFieldContext;
|
|
11
|
+
const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
|
|
12
|
+
const defaultFormat = '0.00';
|
|
13
|
+
const getPlaceholder = placeholder ?? defaultFormat;
|
|
14
|
+
const handleChangeText = (text) => {
|
|
15
|
+
if (autoFormatThousands) {
|
|
16
|
+
const formatted = formatThousands(text);
|
|
17
|
+
onChangeText?.(formatted);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
onChangeText?.(text);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const displayValue = autoFormatThousands && typeof value === 'string' ? formatThousands(value) : value;
|
|
24
|
+
return (_jsxs(Input, { validationStatus: validationStatusFromContext, disabled: formFieldDisabled ?? disabled, readonly: readonly, focused: focused, style: styles.wrap, children: [_jsx(InputSlot, { children: _jsx(DetailText, { size: "4xl", style: styles.text, children: "\u00A3" }) }), _jsx(InputField, { inputMode: "decimal", inBottomSheet: inBottomSheet, ...rest, placeholder: getPlaceholder, keyboardType: "decimal-pad", style: styles.input, value: displayValue, onChangeText: handleChangeText })] }));
|
|
25
|
+
};
|
|
26
|
+
CurrencyInput.displayName = 'CurrencyInput';
|
|
27
|
+
const styles = StyleSheet.create(theme => ({
|
|
28
|
+
wrap: {
|
|
29
|
+
height: theme.components.input.currency.height,
|
|
30
|
+
gap: theme.components.input.currency.gap,
|
|
31
|
+
},
|
|
32
|
+
text: {
|
|
33
|
+
...(Platform.OS === 'ios' && { lineHeight: 46 }),
|
|
34
|
+
_web: {
|
|
35
|
+
marginTop: 1,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
input: {
|
|
39
|
+
fontSize: theme.typography.mobile.detailText['4xl'].fontSize,
|
|
40
|
+
fontFamily: theme.typography.mobile.detailText.fontFamily,
|
|
41
|
+
fontWeight: theme.typography.mobile.detailText.fontWeight,
|
|
42
|
+
paddingTop: 0,
|
|
43
|
+
paddingBottom: 0,
|
|
44
|
+
paddingLeft: 0,
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
export default CurrencyInput;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TextInputProps, ViewProps } from 'react-native';
|
|
2
|
+
export interface CurrencyInputBaseProps {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
validationStatus?: 'initial' | 'valid' | 'invalid';
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
focused?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
inBottomSheet?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** When true, automatically formats the numeric value with thousand separators (e.g. 1234 -> 1,234). */
|
|
11
|
+
autoFormatThousands?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type CurrencyInputProps = CurrencyInputBaseProps & Omit<TextInputProps, 'children'> & ViewProps;
|
|
14
|
+
export default CurrencyInputProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CurrencyInput } from './CurrencyInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CurrencyInput } from './CurrencyInput';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface DescriptionListContextValue {
|
|
2
|
+
direction: 'row' | 'column';
|
|
3
|
+
itemHeadingWidth?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const DescriptionListContext: import("react").Context<DescriptionListContextValue | undefined>;
|
|
6
|
+
export declare const useDescriptionListContext: () => DescriptionListContextValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const DescriptionListContext = createContext(undefined);
|
|
3
|
+
export const useDescriptionListContext = () => {
|
|
4
|
+
const ctx = useContext(DescriptionListContext);
|
|
5
|
+
if (!ctx) {
|
|
6
|
+
throw new Error('DescriptionListItem must be used within a DescriptionList');
|
|
7
|
+
}
|
|
8
|
+
return ctx;
|
|
9
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type DescriptionListProps from './DescriptionList.props';
|
|
2
|
+
declare const DescriptionList: {
|
|
3
|
+
({ direction, itemHeadingWidth, heading, helperText, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, children, style, ...props }: DescriptionListProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default DescriptionList;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
+
import { SectionHeader } from '../SectionHeader';
|
|
6
|
+
import { DescriptionListContext } from './DescriptionList.context';
|
|
7
|
+
const DescriptionList = ({ direction = 'column', itemHeadingWidth, heading, helperText, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, children, style, ...props }) => {
|
|
8
|
+
styles.useVariants({ direction });
|
|
9
|
+
const value = useMemo(() => ({ direction, itemHeadingWidth }), [direction, itemHeadingWidth]);
|
|
10
|
+
return (_jsx(DescriptionListContext.Provider, { value: value, children: _jsxs(View, { accessibilityRole: "list", ...props, style: [styles.container, style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, linkText: linkText, linkHref: linkHref, linkIcon: linkIcon, linkIconPosition: linkIconPosition, linkOnPress: linkOnPress, linkTarget: linkTarget, linkShowIcon: linkShowIcon })) : null, children] }) }));
|
|
11
|
+
};
|
|
12
|
+
DescriptionList.displayName = 'DescriptionList';
|
|
13
|
+
const styles = StyleSheet.create(theme => ({
|
|
14
|
+
container: {
|
|
15
|
+
width: theme.space.full,
|
|
16
|
+
gap: theme.components.descriptionList.gap,
|
|
17
|
+
variants: {
|
|
18
|
+
direction: {
|
|
19
|
+
row: {},
|
|
20
|
+
column: {},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
export default DescriptionList;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
export interface DescriptionListProps extends ViewProps {
|
|
4
|
+
/** Direction orientation for items */
|
|
5
|
+
direction?: 'row' | 'column';
|
|
6
|
+
/** Override heading/term column width when layout is row (defaults to token) */
|
|
7
|
+
itemHeadingWidth?: number;
|
|
8
|
+
heading?: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
linkText?: string;
|
|
11
|
+
linkHref?: string;
|
|
12
|
+
linkIcon?: ComponentType;
|
|
13
|
+
linkIconPosition?: 'left' | 'right';
|
|
14
|
+
linkOnPress?: () => void;
|
|
15
|
+
linkTarget?: '_blank' | '_self' | '_parent' | '_top';
|
|
16
|
+
linkShowIcon?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export default DescriptionListProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type DescriptionListItemProps from './DescriptionListItem.props';
|
|
2
|
+
declare const DescriptionListItem: {
|
|
3
|
+
({ heading, description, headingWidth, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, style, ...props }: DescriptionListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default DescriptionListItem;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import { useTheme } from '../../hooks';
|
|
5
|
+
import { BodyText } from '../BodyText';
|
|
6
|
+
import { Link } from '../Link';
|
|
7
|
+
import { useDescriptionListContext } from './DescriptionList.context';
|
|
8
|
+
const DescriptionListItem = ({ heading, description, headingWidth, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, style, ...props }) => {
|
|
9
|
+
const { components } = useTheme();
|
|
10
|
+
const { direction, itemHeadingWidth = components.descriptionList.item.row.headingWidth } = useDescriptionListContext();
|
|
11
|
+
styles.useVariants({ direction });
|
|
12
|
+
const headingIsText = typeof heading === 'string' || typeof heading === 'number';
|
|
13
|
+
const descIsText = typeof description === 'string' || typeof description === 'number';
|
|
14
|
+
const combinedLabel = headingIsText && descIsText ? `${heading}: ${description}` : undefined;
|
|
15
|
+
const hideDescendants = !!combinedLabel;
|
|
16
|
+
return (_jsxs(View, { accessibilityRole: "text", accessible: !!combinedLabel, accessibilityLabel: combinedLabel, ...props, style: [styles.item, style], children: [_jsxs(View, { style: styles.textWrap, importantForAccessibility: hideDescendants ? 'no-hide-descendants' : undefined, accessibilityElementsHidden: hideDescendants || undefined, children: [_jsx(View, { style: [direction === 'row' && { width: headingWidth || itemHeadingWidth }], children: headingIsText ? _jsx(BodyText, { style: styles.headingText, children: heading }) : heading }), _jsx(View, { style: styles.descriptionWrapper, children: descIsText ? _jsx(BodyText, { children: description }) : description })] }), linkText ? (_jsx(Link, { href: linkHref, onPress: linkOnPress, target: linkTarget, showIcon: linkShowIcon, icon: linkIcon, iconPosition: linkIconPosition, accessibilityRole: "link", children: linkText })) : null] }));
|
|
17
|
+
};
|
|
18
|
+
DescriptionListItem.displayName = 'DescriptionListItem';
|
|
19
|
+
const styles = StyleSheet.create(theme => ({
|
|
20
|
+
item: {
|
|
21
|
+
width: theme.space.full,
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
alignItems: 'flex-start',
|
|
24
|
+
gap: theme.components.descriptionList.item.gap,
|
|
25
|
+
},
|
|
26
|
+
textWrap: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
variants: {
|
|
29
|
+
direction: {
|
|
30
|
+
row: {
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
alignItems: 'flex-start',
|
|
33
|
+
gap: theme.components.descriptionList.item.row.gap,
|
|
34
|
+
},
|
|
35
|
+
column: {
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
gap: theme.components.descriptionList.item.column.gap,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
headingText: {
|
|
43
|
+
color: theme.color.text.secondary,
|
|
44
|
+
},
|
|
45
|
+
descriptionWrapper: {
|
|
46
|
+
flex: 1,
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
export default DescriptionListItem;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
export interface DescriptionListItemProps extends ViewProps {
|
|
4
|
+
/** Heading / label part */
|
|
5
|
+
heading: ReactNode;
|
|
6
|
+
/** Description / value part */
|
|
7
|
+
description: ReactNode;
|
|
8
|
+
headingWidth?: number;
|
|
9
|
+
linkText?: string;
|
|
10
|
+
linkHref?: string;
|
|
11
|
+
linkIcon?: ComponentType;
|
|
12
|
+
linkIconPosition?: 'left' | 'right';
|
|
13
|
+
linkOnPress?: () => void;
|
|
14
|
+
linkTarget?: '_blank' | '_self' | '_parent' | '_top';
|
|
15
|
+
linkShowIcon?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export default DescriptionListItemProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as DescriptionList } from './DescriptionList';
|
|
2
|
+
export type { default as DescriptionListProps } from './DescriptionList.props';
|
|
3
|
+
export { default as DescriptionListItem } from './DescriptionListItem';
|
|
4
|
+
export type { default as DescriptionListItemProps } from './DescriptionListItem.props';
|