@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,6 +3,7 @@ import React, { useCallback, useEffect, useRef } from 'react';
|
|
|
3
3
|
import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
4
4
|
import {
|
|
5
5
|
BroadbandMediumIcon,
|
|
6
|
+
CashbackCardMediumIcon,
|
|
6
7
|
ChevronRightMediumIcon,
|
|
7
8
|
ElectricityMediumIcon,
|
|
8
9
|
InsuranceMediumIcon,
|
|
@@ -24,6 +25,9 @@ import {
|
|
|
24
25
|
Card,
|
|
25
26
|
Center,
|
|
26
27
|
Checkbox,
|
|
28
|
+
CurrencyInput,
|
|
29
|
+
DescriptionList,
|
|
30
|
+
DescriptionListItem,
|
|
27
31
|
DetailText,
|
|
28
32
|
Divider,
|
|
29
33
|
Flex,
|
|
@@ -32,6 +36,7 @@ import {
|
|
|
32
36
|
Heading,
|
|
33
37
|
Icon,
|
|
34
38
|
IconButton,
|
|
39
|
+
IconContainer,
|
|
35
40
|
InlineLink,
|
|
36
41
|
Input,
|
|
37
42
|
LI,
|
|
@@ -49,12 +54,17 @@ import {
|
|
|
49
54
|
Skeleton,
|
|
50
55
|
Spinner,
|
|
51
56
|
Switch,
|
|
57
|
+
Tab,
|
|
58
|
+
TabPanel,
|
|
59
|
+
Tabs,
|
|
60
|
+
TabsList,
|
|
52
61
|
Textarea,
|
|
53
62
|
ToggleButtonCard,
|
|
54
63
|
ToggleButtonCardGroup,
|
|
55
64
|
UL,
|
|
56
65
|
useColorMode,
|
|
57
66
|
} from '../../src';
|
|
67
|
+
import { addReactNativePrefix } from '../heplers';
|
|
58
68
|
|
|
59
69
|
const ComponentWrapper = ({
|
|
60
70
|
name,
|
|
@@ -66,8 +76,15 @@ const ComponentWrapper = ({
|
|
|
66
76
|
children?: ViewProps['children'];
|
|
67
77
|
}) => {
|
|
68
78
|
const navigate = () => {
|
|
79
|
+
let target = link;
|
|
80
|
+
if (
|
|
81
|
+
typeof window !== 'undefined' &&
|
|
82
|
+
window.top?.location.href.includes('hearth.prod.uw.systems/?path=')
|
|
83
|
+
) {
|
|
84
|
+
target = addReactNativePrefix(link);
|
|
85
|
+
}
|
|
69
86
|
if (window.top) {
|
|
70
|
-
window.top.location.href =
|
|
87
|
+
window.top.location.href = target;
|
|
71
88
|
}
|
|
72
89
|
};
|
|
73
90
|
return (
|
|
@@ -203,6 +220,22 @@ const AllComponents: React.FC = () => {
|
|
|
203
220
|
</View>
|
|
204
221
|
</Center>
|
|
205
222
|
</ComponentWrapper>
|
|
223
|
+
<ComponentWrapper name="Currency Input" link="/?path=/docs/forms-currency-input--docs">
|
|
224
|
+
<Center flex={1} padding="200">
|
|
225
|
+
<CurrencyInput />
|
|
226
|
+
</Center>
|
|
227
|
+
</ComponentWrapper>
|
|
228
|
+
<ComponentWrapper
|
|
229
|
+
name="Description List"
|
|
230
|
+
link="/?path=/docs/components-description-list--docs"
|
|
231
|
+
>
|
|
232
|
+
<Center flex={1} padding="200">
|
|
233
|
+
<DescriptionList>
|
|
234
|
+
<DescriptionListItem heading="This is a" description="Description list" />
|
|
235
|
+
<DescriptionListItem heading="So is this" description="12-34-56" />
|
|
236
|
+
</DescriptionList>
|
|
237
|
+
</Center>
|
|
238
|
+
</ComponentWrapper>
|
|
206
239
|
<ComponentWrapper name="Detail Text" link="/?path=/docs/typography-detail-text--docs">
|
|
207
240
|
<Center flex={1}>
|
|
208
241
|
<DetailText>This is some Detail Text</DetailText>
|
|
@@ -255,11 +288,51 @@ const AllComponents: React.FC = () => {
|
|
|
255
288
|
<Heading>This is a Heading</Heading>
|
|
256
289
|
</Center>
|
|
257
290
|
</ComponentWrapper>
|
|
258
|
-
<ComponentWrapper name="Icon Button" link="/?path=/docs/components-
|
|
291
|
+
<ComponentWrapper name="Icon Button" link="/?path=/docs/components-icon-button--docs">
|
|
259
292
|
<Center flex={1}>
|
|
260
293
|
<IconButton icon={ChevronRightMediumIcon} size="md" onPress={() => null} />
|
|
261
294
|
</Center>
|
|
262
295
|
</ComponentWrapper>
|
|
296
|
+
<ComponentWrapper
|
|
297
|
+
name="Icon Container"
|
|
298
|
+
link="/?path=/docs/components-icon-container--docs"
|
|
299
|
+
>
|
|
300
|
+
<Center flex={1}>
|
|
301
|
+
<Flex direction="row" space="sm">
|
|
302
|
+
<IconContainer
|
|
303
|
+
icon={ElectricityMediumIcon}
|
|
304
|
+
size="sm"
|
|
305
|
+
variant="emphasis"
|
|
306
|
+
color="energy"
|
|
307
|
+
/>
|
|
308
|
+
<IconContainer
|
|
309
|
+
icon={BroadbandMediumIcon}
|
|
310
|
+
size="sm"
|
|
311
|
+
variant="emphasis"
|
|
312
|
+
color="broadband"
|
|
313
|
+
/>
|
|
314
|
+
<IconContainer
|
|
315
|
+
icon={MobileMediumIcon}
|
|
316
|
+
size="sm"
|
|
317
|
+
variant="emphasis"
|
|
318
|
+
color="mobile"
|
|
319
|
+
/>
|
|
320
|
+
<IconContainer
|
|
321
|
+
icon={InsuranceMediumIcon}
|
|
322
|
+
size="sm"
|
|
323
|
+
variant="emphasis"
|
|
324
|
+
color="insurance"
|
|
325
|
+
/>
|
|
326
|
+
<IconContainer
|
|
327
|
+
icon={CashbackCardMediumIcon}
|
|
328
|
+
size="sm"
|
|
329
|
+
variant="emphasis"
|
|
330
|
+
color="cashback"
|
|
331
|
+
/>
|
|
332
|
+
</Flex>
|
|
333
|
+
</Center>
|
|
334
|
+
</ComponentWrapper>
|
|
335
|
+
|
|
263
336
|
<ComponentWrapper name="Icons" link="/?path=/docs/components-icons--docs">
|
|
264
337
|
<Center flex={1}>
|
|
265
338
|
<Flex direction="row" space="lg">
|
|
@@ -353,7 +426,7 @@ const AllComponents: React.FC = () => {
|
|
|
353
426
|
name="Section Header"
|
|
354
427
|
link="/?path=/docs/components-section-header--docs"
|
|
355
428
|
>
|
|
356
|
-
<Center flex={1}>
|
|
429
|
+
<Center flex={1} p="300">
|
|
357
430
|
<SectionHeader heading="Heading" helperText="Supporting text" linkText="More" />
|
|
358
431
|
</Center>
|
|
359
432
|
</ComponentWrapper>
|
|
@@ -395,7 +468,26 @@ const AllComponents: React.FC = () => {
|
|
|
395
468
|
<Switch value={switchEnabled} onValueChange={toggleSwitch} />
|
|
396
469
|
</Center>
|
|
397
470
|
</ComponentWrapper>
|
|
398
|
-
|
|
471
|
+
<ComponentWrapper name="Tabs" link="/?path=/docs/components-tabs--docs">
|
|
472
|
+
<Center flex={1}>
|
|
473
|
+
<Tabs defaultValue="tab-1">
|
|
474
|
+
<TabsList>
|
|
475
|
+
<Tab value="tab-1">Tab 1</Tab>
|
|
476
|
+
<Tab value="tab-2">Tab 2</Tab>
|
|
477
|
+
<Tab value="tab-3">Tab 3</Tab>
|
|
478
|
+
</TabsList>
|
|
479
|
+
<TabPanel value="tab-1">
|
|
480
|
+
<BodyText>I'm the first tab's content</BodyText>
|
|
481
|
+
</TabPanel>
|
|
482
|
+
<TabPanel value="tab-2">
|
|
483
|
+
<BodyText>I'm the second tab's content</BodyText>
|
|
484
|
+
</TabPanel>
|
|
485
|
+
<TabPanel value="tab-3">
|
|
486
|
+
<BodyText>I'm the third tab's content</BodyText>
|
|
487
|
+
</TabPanel>
|
|
488
|
+
</Tabs>
|
|
489
|
+
</Center>
|
|
490
|
+
</ComponentWrapper>
|
|
399
491
|
<ComponentWrapper name="Textarea" link="/?path=/docs/forms-textarea--docs">
|
|
400
492
|
<Center flex={1}>
|
|
401
493
|
<Textarea numberOfLines={3} placeholder="This is a textarea" />
|
|
@@ -441,9 +533,7 @@ const AllComponents: React.FC = () => {
|
|
|
441
533
|
};
|
|
442
534
|
|
|
443
535
|
const styles = StyleSheet.create(theme => ({
|
|
444
|
-
container: {
|
|
445
|
-
gap: theme.space['2'],
|
|
446
|
-
},
|
|
536
|
+
container: {},
|
|
447
537
|
component: {
|
|
448
538
|
borderColor: theme.color.warmWhite[300],
|
|
449
539
|
borderWidth: theme.borderWidth['1'],
|
|
@@ -457,7 +547,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
457
547
|
},
|
|
458
548
|
},
|
|
459
549
|
componentWrap: {
|
|
460
|
-
padding: theme.space['4'],
|
|
461
550
|
flexGrow: 1,
|
|
462
551
|
flex: 1,
|
|
463
552
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { View, StyleSheet } from 'react-native';
|
|
2
|
-
import { Card, CardAction, Heading, Link } from '../../src';
|
|
3
1
|
import { ChevronLeftSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Card, CardAction, Heading, Link } from '../../src';
|
|
4
|
+
import { addReactNativePrefix } from '../heplers';
|
|
4
5
|
|
|
5
6
|
type NextPrevPageProps = {
|
|
6
7
|
nextLink?: string;
|
|
@@ -16,8 +17,15 @@ const NextPrevPage: React.FC<NextPrevPageProps> = ({
|
|
|
16
17
|
prevTitle,
|
|
17
18
|
}) => {
|
|
18
19
|
const openLink = (link: string) => {
|
|
20
|
+
let target = link;
|
|
21
|
+
if (
|
|
22
|
+
typeof window !== 'undefined' &&
|
|
23
|
+
window.top?.location.href.includes('hearth.prod.uw.systems/?path=')
|
|
24
|
+
) {
|
|
25
|
+
target = addReactNativePrefix(link);
|
|
26
|
+
}
|
|
19
27
|
if (window.top) {
|
|
20
|
-
window.top.location.href =
|
|
28
|
+
window.top.location.href = target;
|
|
21
29
|
}
|
|
22
30
|
};
|
|
23
31
|
return (
|
|
@@ -8,10 +8,10 @@ const UsageWrap: FC<PropsWithChildren> = ({ children }) => {
|
|
|
8
8
|
<Box
|
|
9
9
|
mt="300"
|
|
10
10
|
p="200"
|
|
11
|
-
bg=
|
|
11
|
+
bg="backgroundPrimary"
|
|
12
12
|
borderRadius="md"
|
|
13
13
|
borderWidth="1"
|
|
14
|
-
borderColor="
|
|
14
|
+
borderColor="borderSubtle"
|
|
15
15
|
width="100%"
|
|
16
16
|
position="relative"
|
|
17
17
|
>
|
package/docs/components/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as UsageWrap } from './UsageWrap';
|
|
1
|
+
export { default as AdvancedInputExample } from './AdvancedInputExample';
|
|
3
2
|
export { default as BackToTopButton } from './BackToTopButton';
|
|
4
|
-
export { default as ViewFigmaButton } from './ViewFigmaButton';
|
|
5
|
-
export { default as DocComponentWrap } from './DocComponentWrap';
|
|
6
3
|
export { default as BadgeList } from './BadgeList';
|
|
7
|
-
export { default as
|
|
4
|
+
export { default as DocComponentWrap } from './DocComponentWrap';
|
|
5
|
+
export { default as NextPrevPage } from './NextPrevPage';
|
|
8
6
|
export { default as SwitchExample } from './SwitchExample';
|
|
9
7
|
export { default as SwitchList } from './SwitchList';
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
8
|
+
export { default as UsageWrap } from './UsageWrap';
|
|
9
|
+
export { default as VariantTitle } from './VariantTitle';
|
|
10
|
+
export { default as ViewFigmaButton } from './ViewFigmaButton';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const addReactNativePrefix = (url: string) => {
|
|
2
|
+
if (!url.startsWith('/?path=/docs/')) return url;
|
|
3
|
+
return url.replace(/(\/\?path=\/docs\/)([^/]+)/, (full, prefix, slug) => {
|
|
4
|
+
if (slug.startsWith('react-native_')) return full; // already prefixed
|
|
5
|
+
return `${prefix}react-native_${slug}`;
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
export default addReactNativePrefix;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as addReactNativePrefix } from './addReactNativePrefix';
|
package/docs/introduction.mdx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import pig from '../../../shared/storybook/assets/images/react-native-pig.png';
|
|
2
3
|
import { version } from '../package.json';
|
|
3
4
|
import { Box } from '../src';
|
|
4
|
-
import pig from './assets/react-native-pig.png';
|
|
5
5
|
import { BackToTopButton, NextPrevPage } from './components';
|
|
6
6
|
|
|
7
7
|
<Meta title="Introduction" />
|
|
@@ -39,7 +39,7 @@ npm install @utilitywarehouse/hearth-react-native
|
|
|
39
39
|
To install the peer dependencies, you can run the following command:
|
|
40
40
|
|
|
41
41
|
```console
|
|
42
|
-
npm install react-native-unistyles react-native-edge-to-edge react-native-nitro-modules@0.28.1 @gorhom/bottom-sheet react-native-svg react-native-reanimated react-native-worklets react-native-gesture-handler
|
|
42
|
+
npm install react-native-unistyles react-native-edge-to-edge react-native-nitro-modules@0.28.1 @gorhom/bottom-sheet react-native-svg react-native-reanimated react-native-worklets react-native-gesture-handler @utilitywarehouse/hearth-react-native-icons
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
For more information on how to install and configure `react-native-svg`, `react-native-gesture-handler` and `react-native-reanimated`,
|
|
@@ -63,7 +63,7 @@ The `@utilitywarehouse/hearth-react-native` library uses a few packages under th
|
|
|
63
63
|
as well as fonts and icons. Feel free to additionally install these packages if you need to use them in your project.
|
|
64
64
|
|
|
65
65
|
```console
|
|
66
|
-
npm install @utilitywarehouse/hearth-tokens
|
|
66
|
+
npm install @utilitywarehouse/hearth-tokens
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
You will need to include the **Comic Hams**, **DM Mono** and **DM Sans** fonts.
|
package/docs/theme-tokens.mdx
CHANGED
|
@@ -429,6 +429,48 @@ Available spacing values:
|
|
|
429
429
|
| `900` | 72px | Maximum spacing |
|
|
430
430
|
| `1000` | 80px | Hero spacing |
|
|
431
431
|
|
|
432
|
+
There is also responsive layout spacing for different screen sizes:
|
|
433
|
+
|
|
434
|
+
| Token | Mobile (base) | Tablet (md) | Desktop (lg) | Usage (guideline) |
|
|
435
|
+
| ------ | ------------- | ----------- | ------------ | ------------------------------------- |
|
|
436
|
+
| `none` | 0px | 0px | 0px | Reset / collapse spacing |
|
|
437
|
+
| `2xs` | 2px | 2px | 2px | Hairline gaps, separators |
|
|
438
|
+
| `xs` | 4px | 4px | 4px | Tight padding, icon nudge |
|
|
439
|
+
| `sm` | 8px | 8px | 8px | Compact component gap |
|
|
440
|
+
| `md` | 12px | 12px | 12px | Dense layouts, inline stacks |
|
|
441
|
+
| `lg` | 16px | 16px | 16px | Base section spacing |
|
|
442
|
+
| `xl` | 20px | 24px | 24px | Larger grouping / outer padding |
|
|
443
|
+
| `2xl` | 28px | 28px | 40px | Major vertical rhythm / page sections |
|
|
444
|
+
|
|
445
|
+
There are built in responsive layout spacings for mobile, tablet and desktop. They live under `theme.space.xs` etc,
|
|
446
|
+
which are responsive values that adapt based on screen size. For example, `theme.space.xl` is `20px` on mobile, and `24px` on tablet and desktop.
|
|
447
|
+
|
|
448
|
+
These responsive layout spacings live under `theme.layout.[mobile|tablet|desktop].spacing` and are intended for macro
|
|
449
|
+
layout structure (page/frame scaffolding) rather than component-level internal spacing (which should prefer the core `space` scale).
|
|
450
|
+
|
|
451
|
+
```tsx
|
|
452
|
+
const styles = StyleSheet.create(theme => ({
|
|
453
|
+
pageSection: {
|
|
454
|
+
padding: theme.space.xl, // 20px on mobile, 24px on tablet/desktop
|
|
455
|
+
},
|
|
456
|
+
}));
|
|
457
|
+
|
|
458
|
+
// or using the layout tokens directly:
|
|
459
|
+
const styles = StyleSheet.create(theme => ({
|
|
460
|
+
pageSection: {
|
|
461
|
+
// Example: use responsive spacing tokens
|
|
462
|
+
paddingHorizontal: theme.layout.mobile.spacing.lg,
|
|
463
|
+
paddingTop: theme.layout.mobile.spacing.xl,
|
|
464
|
+
// Or use responsive object syntax
|
|
465
|
+
gap: {
|
|
466
|
+
base: theme.layout.mobile.spacing.md,
|
|
467
|
+
md: theme.layout.tablet.spacing.lg,
|
|
468
|
+
lg: theme.layout.desktop.spacing.xl,
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
}));
|
|
472
|
+
```
|
|
473
|
+
|
|
432
474
|
Percentage-based spacing is also available:
|
|
433
475
|
|
|
434
476
|
- `1/2`, `1/3`, `2/3`, `1/4`, `3/4`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilitywarehouse/hearth-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Utility Warehouse React Native UI library",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -20,23 +20,22 @@
|
|
|
20
20
|
"@gluestack-ui/radio": "0.1.33",
|
|
21
21
|
"@gluestack-ui/spinner": "0.1.14",
|
|
22
22
|
"@gluestack-ui/switch": "0.1.22",
|
|
23
|
-
"@gluestack-ui/textarea": "0.1.23"
|
|
24
|
-
"@utilitywarehouse/hearth-react-native-icons": "^0.1.0"
|
|
23
|
+
"@gluestack-ui/textarea": "0.1.23"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
26
|
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
|
28
27
|
"@chromatic-com/storybook": "^4.1.1",
|
|
29
28
|
"@figma/code-connect": "^1.3.3",
|
|
30
29
|
"@gorhom/bottom-sheet": "5.1.6",
|
|
31
|
-
"@storybook/addon-a11y": "^9.1.
|
|
32
|
-
"@storybook/addon-docs": "^9.1.
|
|
33
|
-
"@storybook/addon-vitest": "^9.1.
|
|
34
|
-
"@storybook/react-native-web-vite": "^9.1.
|
|
30
|
+
"@storybook/addon-a11y": "^9.1.6",
|
|
31
|
+
"@storybook/addon-docs": "^9.1.6",
|
|
32
|
+
"@storybook/addon-vitest": "^9.1.6",
|
|
33
|
+
"@storybook/react-native-web-vite": "^9.1.6",
|
|
35
34
|
"@types/prismjs": "^1.26.5",
|
|
36
35
|
"@types/react": "^19.1.10",
|
|
37
36
|
"@vitest/browser": "^3.2.4",
|
|
38
37
|
"@vitest/coverage-v8": "^3.2.4",
|
|
39
|
-
"eslint-plugin-storybook": "9.1.
|
|
38
|
+
"eslint-plugin-storybook": "9.1.6",
|
|
40
39
|
"playwright": "^1.53.1",
|
|
41
40
|
"prismjs": "^1.30.0",
|
|
42
41
|
"react": "^19.1.0",
|
|
@@ -49,16 +48,18 @@
|
|
|
49
48
|
"react-native-unistyles": "3.0.10",
|
|
50
49
|
"react-native-web": "^0.20.0",
|
|
51
50
|
"remark-gfm": "^4.0.1",
|
|
52
|
-
"storybook": "^9.1.
|
|
51
|
+
"storybook": "^9.1.6",
|
|
53
52
|
"typescript": "^5.7.3",
|
|
54
53
|
"vite": "^7.1.3",
|
|
55
54
|
"vitest": "^3.2.4",
|
|
56
55
|
"@utilitywarehouse/hearth-fonts": "^0.0.3",
|
|
57
|
-
"@utilitywarehouse/hearth-react-icons": "^0.
|
|
58
|
-
"@utilitywarehouse/hearth-
|
|
56
|
+
"@utilitywarehouse/hearth-react-native-icons": "^0.4.0",
|
|
57
|
+
"@utilitywarehouse/hearth-react-icons": "^0.4.0",
|
|
58
|
+
"@utilitywarehouse/hearth-tokens": "^0.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
62
|
+
"@utilitywarehouse/hearth-react-native-icons": "~0.4.0",
|
|
62
63
|
"react": ">=17 || ^18.0.0 || ^19.0.0",
|
|
63
64
|
"react-native": ">=0.77",
|
|
64
65
|
"react-native-gesture-handler": "^2.22.0",
|
|
@@ -75,11 +76,10 @@
|
|
|
75
76
|
"lint": "TIMING=1 eslint --max-warnings 0",
|
|
76
77
|
"build": "tsc",
|
|
77
78
|
"watch": "tsc --watch",
|
|
78
|
-
"watch:lab": "tsc --p tsconfig.lab.json --watch",
|
|
79
79
|
"figma:create": "figma connect create",
|
|
80
80
|
"figma:publish": "figma connect publish",
|
|
81
81
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
82
|
-
"
|
|
82
|
+
"dev": "storybook dev -p 6006",
|
|
83
83
|
"build:storybook": "storybook build"
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -3,22 +3,50 @@ import { ComponentType } from 'react';
|
|
|
3
3
|
import { ViewStyle } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { UnstyledIconButton, UnstyledIconButtonProps } from '../UnstyledIconButton';
|
|
6
|
+
import { useAlertContext } from './Alert.context';
|
|
6
7
|
|
|
7
8
|
const AlertCloseButton = ({
|
|
8
9
|
style,
|
|
9
10
|
icon = CloseSmallIcon,
|
|
10
11
|
...props
|
|
11
|
-
}: Omit<UnstyledIconButtonProps, 'icon'> & { icon?: ComponentType }) =>
|
|
12
|
-
|
|
13
|
-
);
|
|
12
|
+
}: Omit<UnstyledIconButtonProps, 'icon'> & { icon?: ComponentType }) => {
|
|
13
|
+
const { colorScheme } = useAlertContext();
|
|
14
|
+
styles.useVariants({ colorScheme });
|
|
15
|
+
return (
|
|
16
|
+
<UnstyledIconButton
|
|
17
|
+
{...props}
|
|
18
|
+
size="sm"
|
|
19
|
+
style={[styles.button, style as ViewStyle]}
|
|
20
|
+
icon={icon}
|
|
21
|
+
iconStyle={styles.icon as ViewStyle}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
14
25
|
|
|
15
26
|
const styles = StyleSheet.create(theme => ({
|
|
16
|
-
|
|
27
|
+
button: {
|
|
17
28
|
alignSelf: 'flex-start',
|
|
18
|
-
color: theme.color.icon.primary,
|
|
19
29
|
minWidth: 20,
|
|
20
30
|
minHeight: 20,
|
|
21
31
|
},
|
|
32
|
+
icon: {
|
|
33
|
+
variants: {
|
|
34
|
+
colorScheme: {
|
|
35
|
+
info: {
|
|
36
|
+
color: theme.color.feedback.info.foreground.default,
|
|
37
|
+
},
|
|
38
|
+
positive: {
|
|
39
|
+
color: theme.color.feedback.positive.foreground.default,
|
|
40
|
+
},
|
|
41
|
+
danger: {
|
|
42
|
+
color: theme.color.feedback.danger.foreground.default,
|
|
43
|
+
},
|
|
44
|
+
warning: {
|
|
45
|
+
color: theme.color.feedback.warning.foreground.default,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
22
50
|
}));
|
|
23
51
|
|
|
24
52
|
AlertCloseButton.displayName = 'AlertCloseButton';
|
|
@@ -19,6 +19,7 @@ const AlertIcon = (props: IconProps) => {
|
|
|
19
19
|
}
|
|
20
20
|
return InfoMediumIcon;
|
|
21
21
|
})();
|
|
22
|
+
styles.useVariants({ colorScheme });
|
|
22
23
|
return <Icon {...props} as={props.as ?? asProp} style={styles.icon} />;
|
|
23
24
|
};
|
|
24
25
|
|
|
@@ -31,7 +32,22 @@ const styles = StyleSheet.create(theme => ({
|
|
|
31
32
|
minWidth: 24,
|
|
32
33
|
minHeight: 24,
|
|
33
34
|
alignSelf: 'flex-start',
|
|
34
|
-
|
|
35
|
+
variants: {
|
|
36
|
+
colorScheme: {
|
|
37
|
+
info: {
|
|
38
|
+
color: theme.color.feedback.info.foreground.default,
|
|
39
|
+
},
|
|
40
|
+
positive: {
|
|
41
|
+
color: theme.color.feedback.positive.foreground.default,
|
|
42
|
+
},
|
|
43
|
+
danger: {
|
|
44
|
+
color: theme.color.feedback.danger.foreground.default,
|
|
45
|
+
},
|
|
46
|
+
warning: {
|
|
47
|
+
color: theme.color.feedback.warning.foreground.default,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
35
51
|
},
|
|
36
52
|
}));
|
|
37
53
|
|
|
@@ -1,15 +1,48 @@
|
|
|
1
|
+
import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
1
2
|
import { ComponentType } from 'react';
|
|
2
3
|
import { ViewStyle } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
5
|
import { UnstyledIconButton, UnstyledIconButtonProps } from '../UnstyledIconButton';
|
|
6
|
+
import { useAlertContext } from './Alert.context';
|
|
5
7
|
|
|
6
8
|
const AlertIconButton = ({
|
|
7
9
|
style,
|
|
8
10
|
icon = ChevronRightSmallIcon,
|
|
9
11
|
...props
|
|
10
|
-
}: Omit<UnstyledIconButtonProps, 'icon'> & { icon?: ComponentType }) =>
|
|
11
|
-
|
|
12
|
-
);
|
|
12
|
+
}: Omit<UnstyledIconButtonProps, 'icon'> & { icon?: ComponentType }) => {
|
|
13
|
+
const { colorScheme } = useAlertContext();
|
|
14
|
+
styles.useVariants({ colorScheme });
|
|
15
|
+
return (
|
|
16
|
+
<UnstyledIconButton
|
|
17
|
+
{...props}
|
|
18
|
+
size="sm"
|
|
19
|
+
style={style as ViewStyle}
|
|
20
|
+
icon={icon}
|
|
21
|
+
iconStyle={styles.icon as ViewStyle}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const styles = StyleSheet.create(theme => ({
|
|
27
|
+
icon: {
|
|
28
|
+
variants: {
|
|
29
|
+
colorScheme: {
|
|
30
|
+
info: {
|
|
31
|
+
color: theme.color.feedback.info.foreground.default,
|
|
32
|
+
},
|
|
33
|
+
positive: {
|
|
34
|
+
color: theme.color.feedback.positive.foreground.default,
|
|
35
|
+
},
|
|
36
|
+
danger: {
|
|
37
|
+
color: theme.color.feedback.danger.foreground.default,
|
|
38
|
+
},
|
|
39
|
+
warning: {
|
|
40
|
+
color: theme.color.feedback.warning.foreground.default,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
13
46
|
|
|
14
47
|
AlertIconButton.displayName = 'AlertIconButton';
|
|
15
48
|
|
|
@@ -1,9 +1,60 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
1
2
|
import { Link, LinkProps } from '../Link';
|
|
3
|
+
import { useAlertContext } from './Alert.context';
|
|
2
4
|
|
|
3
5
|
const AlertLink = ({ children, ...props }: LinkProps) => {
|
|
4
|
-
|
|
6
|
+
const { colorScheme } = useAlertContext();
|
|
7
|
+
styles.useVariants({ colorScheme });
|
|
8
|
+
return (
|
|
9
|
+
<Link {...props} textStyle={styles.text} iconStyle={styles.icon}>
|
|
10
|
+
{children}
|
|
11
|
+
</Link>
|
|
12
|
+
);
|
|
5
13
|
};
|
|
6
14
|
|
|
15
|
+
const styles = StyleSheet.create(theme => ({
|
|
16
|
+
text: {
|
|
17
|
+
variants: {
|
|
18
|
+
colorScheme: {
|
|
19
|
+
info: {
|
|
20
|
+
color: theme.color.feedback.info.foreground.default,
|
|
21
|
+
textDecorationColor: theme.color.feedback.info.foreground.default,
|
|
22
|
+
},
|
|
23
|
+
positive: {
|
|
24
|
+
color: theme.color.feedback.positive.foreground.default,
|
|
25
|
+
textDecorationColor: theme.color.feedback.positive.foreground.default,
|
|
26
|
+
},
|
|
27
|
+
danger: {
|
|
28
|
+
color: theme.color.feedback.danger.foreground.default,
|
|
29
|
+
textDecorationColor: theme.color.feedback.danger.foreground.default,
|
|
30
|
+
},
|
|
31
|
+
warning: {
|
|
32
|
+
color: theme.color.feedback.warning.foreground.default,
|
|
33
|
+
textDecorationColor: theme.color.feedback.warning.foreground.default,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
icon: {
|
|
39
|
+
variants: {
|
|
40
|
+
colorScheme: {
|
|
41
|
+
info: {
|
|
42
|
+
color: theme.color.feedback.info.foreground.default,
|
|
43
|
+
},
|
|
44
|
+
positive: {
|
|
45
|
+
color: theme.color.feedback.positive.foreground.default,
|
|
46
|
+
},
|
|
47
|
+
danger: {
|
|
48
|
+
color: theme.color.feedback.danger.foreground.default,
|
|
49
|
+
},
|
|
50
|
+
warning: {
|
|
51
|
+
color: theme.color.feedback.warning.foreground.default,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}));
|
|
57
|
+
|
|
7
58
|
AlertLink.displayName = 'AlertLink';
|
|
8
59
|
|
|
9
60
|
export default AlertLink;
|
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
import { TextProps } from 'react-native';
|
|
1
|
+
import { TextProps, TextStyle } from 'react-native';
|
|
2
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
3
|
import { BodyText } from '../BodyText';
|
|
4
|
+
import { useAlertContext } from './Alert.context';
|
|
3
5
|
|
|
4
|
-
const AlertText = ({ children, ...props }: TextProps & { semibold?: boolean }) => {
|
|
6
|
+
const AlertText = ({ children, style, ...props }: TextProps & { semibold?: boolean }) => {
|
|
7
|
+
const { colorScheme } = useAlertContext();
|
|
8
|
+
styles.useVariants({ colorScheme });
|
|
5
9
|
return (
|
|
6
|
-
<BodyText size="md" {...props}>
|
|
10
|
+
<BodyText size="md" style={[styles.text as TextStyle, style]} {...props}>
|
|
7
11
|
{children}
|
|
8
12
|
</BodyText>
|
|
9
13
|
);
|
|
10
14
|
};
|
|
11
15
|
|
|
16
|
+
const styles = StyleSheet.create(theme => ({
|
|
17
|
+
text: {
|
|
18
|
+
variants: {
|
|
19
|
+
colorScheme: {
|
|
20
|
+
info: {
|
|
21
|
+
color: theme.color.feedback.info.foreground.default,
|
|
22
|
+
},
|
|
23
|
+
positive: {
|
|
24
|
+
color: theme.color.feedback.positive.foreground.default,
|
|
25
|
+
},
|
|
26
|
+
danger: {
|
|
27
|
+
color: theme.color.feedback.danger.foreground.default,
|
|
28
|
+
},
|
|
29
|
+
warning: {
|
|
30
|
+
color: theme.color.feedback.warning.foreground.default,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
36
|
+
|
|
12
37
|
AlertText.displayName = 'AlertText';
|
|
13
38
|
|
|
14
39
|
export default AlertText;
|