@utilitywarehouse/hearth-react-native 0.4.2 → 0.6.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.
Files changed (207) hide show
  1. package/.storybook/main.ts +21 -1
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.turbo/turbo-lint.log +1 -1
  4. package/CHANGELOG.md +52 -0
  5. package/build/components/Alert/AlertTitle.js +6 -6
  6. package/build/components/Badge/Badge.js +3 -3
  7. package/build/components/Badge/Badge.props.d.ts +1 -0
  8. package/build/components/Button/ButtonRoot.js +4 -0
  9. package/build/components/Button/ButtonText.js +2 -2
  10. package/build/components/Card/CardRoot.js +1 -1
  11. package/build/components/Carousel/Carousel.context.d.ts +4 -0
  12. package/build/components/Carousel/Carousel.context.js +4 -0
  13. package/build/components/Carousel/Carousel.d.ts +6 -0
  14. package/build/components/Carousel/Carousel.js +278 -0
  15. package/build/components/Carousel/Carousel.props.d.ts +65 -0
  16. package/build/components/Carousel/Carousel.props.js +1 -0
  17. package/build/components/Carousel/CarouselControlItem.d.ts +24 -0
  18. package/build/components/Carousel/CarouselControlItem.js +64 -0
  19. package/build/components/Carousel/CarouselControls.d.ts +4 -0
  20. package/build/components/Carousel/CarouselControls.js +74 -0
  21. package/build/components/Carousel/CarouselItem.d.ts +6 -0
  22. package/build/components/Carousel/CarouselItem.js +38 -0
  23. package/build/components/Carousel/index.d.ts +5 -0
  24. package/build/components/Carousel/index.js +5 -0
  25. package/build/components/Container/Container.d.ts +6 -0
  26. package/build/components/Container/Container.js +40 -0
  27. package/build/components/Container/Container.props.d.ts +85 -0
  28. package/build/components/Container/Container.props.js +1 -0
  29. package/build/components/Container/index.d.ts +2 -0
  30. package/build/components/Container/index.js +1 -0
  31. package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
  32. package/build/components/DescriptionList/DescriptionList.js +2 -2
  33. package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -8
  34. package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
  35. package/build/components/DescriptionList/DescriptionListItem.js +4 -3
  36. package/build/components/DescriptionList/DescriptionListItem.props.d.ts +3 -8
  37. package/build/components/IndicatorIconButton/IndicatorIconButton.d.ts +6 -0
  38. package/build/components/IndicatorIconButton/IndicatorIconButton.js +26 -0
  39. package/build/components/IndicatorIconButton/IndicatorIconButton.props.d.ts +8 -0
  40. package/build/components/IndicatorIconButton/IndicatorIconButton.props.js +1 -0
  41. package/build/components/IndicatorIconButton/index.d.ts +2 -0
  42. package/build/components/IndicatorIconButton/index.js +1 -0
  43. package/build/components/Link/LinkText.js +3 -3
  44. package/build/components/List/List.context.d.ts +0 -2
  45. package/build/components/List/List.d.ts +1 -1
  46. package/build/components/List/List.js +5 -5
  47. package/build/components/List/List.props.d.ts +1 -9
  48. package/build/components/List/ListAction/ListAction.d.ts +18 -0
  49. package/build/components/List/ListAction/ListAction.js +103 -0
  50. package/build/components/List/ListAction/ListAction.props.d.ts +8 -0
  51. package/build/components/List/ListAction/ListAction.props.js +1 -0
  52. package/build/components/List/ListAction/ListActionContent.d.ts +6 -0
  53. package/build/components/List/ListAction/ListActionContent.js +14 -0
  54. package/build/components/List/ListAction/ListActionText.d.ts +6 -0
  55. package/build/components/List/ListAction/ListActionText.js +7 -0
  56. package/build/components/List/ListAction/ListActionTrailingContent.d.ts +6 -0
  57. package/build/components/List/ListAction/ListActionTrailingContent.js +5 -0
  58. package/build/components/List/ListAction/ListActionTrailingIcon.d.ts +9 -0
  59. package/build/components/List/ListAction/ListActionTrailingIcon.js +18 -0
  60. package/build/components/List/ListAction/index.d.ts +6 -0
  61. package/build/components/List/ListAction/index.js +5 -0
  62. package/build/components/List/ListItem/ListItem.context.d.ts +1 -1
  63. package/build/components/List/ListItem/ListItem.props.d.ts +9 -5
  64. package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
  65. package/build/components/List/ListItem/ListItemRoot.js +10 -12
  66. package/build/components/List/ListItem/index.d.ts +4 -4
  67. package/build/components/List/ListItem/index.js +3 -3
  68. package/build/components/List/index.d.ts +1 -0
  69. package/build/components/List/index.js +1 -0
  70. package/build/components/ProgressStepper/ProgressStep.d.ts +10 -0
  71. package/build/components/ProgressStepper/ProgressStep.js +100 -0
  72. package/build/components/ProgressStepper/ProgressStepper.d.ts +6 -0
  73. package/build/components/ProgressStepper/ProgressStepper.js +22 -0
  74. package/build/components/ProgressStepper/ProgressStepper.props.d.ts +22 -0
  75. package/build/components/ProgressStepper/ProgressStepper.props.js +1 -0
  76. package/build/components/ProgressStepper/ProgressStepperRoot.d.ts +6 -0
  77. package/build/components/ProgressStepper/ProgressStepperRoot.js +16 -0
  78. package/build/components/ProgressStepper/index.d.ts +3 -0
  79. package/build/components/ProgressStepper/index.js +2 -0
  80. package/build/components/SectionHeader/SectionHeader.d.ts +1 -1
  81. package/build/components/SectionHeader/SectionHeader.js +6 -3
  82. package/build/components/SectionHeader/SectionHeader.props.d.ts +9 -16
  83. package/build/components/SectionHeader/SectionHeaderTrailingContent.d.ts +6 -0
  84. package/build/components/SectionHeader/SectionHeaderTrailingContent.js +13 -0
  85. package/build/components/SectionHeader/index.d.ts +1 -0
  86. package/build/components/SectionHeader/index.js +1 -0
  87. package/build/components/Tabs/Tab.js +2 -2
  88. package/build/components/ThemedImage/ThemedImage.d.ts +12 -0
  89. package/build/components/ThemedImage/ThemedImage.js +27 -0
  90. package/build/components/ThemedImage/ThemedImage.props.d.ts +13 -0
  91. package/build/components/ThemedImage/ThemedImage.props.js +1 -0
  92. package/build/components/ThemedImage/index.d.ts +2 -0
  93. package/build/components/ThemedImage/index.js +1 -0
  94. package/build/components/ToggleButton/ToggleButtonText.js +2 -2
  95. package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +4 -1
  96. package/build/components/index.d.ts +5 -0
  97. package/build/components/index.js +5 -0
  98. package/build/core/themes.d.ts +12 -24
  99. package/build/hooks/useStyleProps.js +1 -1
  100. package/build/tokens/components/dark/button.d.ts +1 -1
  101. package/build/tokens/components/dark/button.js +1 -1
  102. package/build/tokens/components/dark/dialog.d.ts +1 -0
  103. package/build/tokens/components/dark/dialog.js +1 -0
  104. package/build/tokens/components/dark/illustrations.d.ts +1 -0
  105. package/build/tokens/components/dark/illustrations.js +1 -0
  106. package/build/tokens/components/dark/toast.d.ts +4 -1
  107. package/build/tokens/components/dark/toast.js +4 -1
  108. package/build/tokens/components/light/button.d.ts +1 -1
  109. package/build/tokens/components/light/button.js +1 -1
  110. package/build/tokens/components/light/dialog.d.ts +1 -0
  111. package/build/tokens/components/light/dialog.js +1 -0
  112. package/build/tokens/components/light/illustrations.d.ts +1 -0
  113. package/build/tokens/components/light/illustrations.js +1 -0
  114. package/build/tokens/components/light/toast.d.ts +4 -1
  115. package/build/tokens/components/light/toast.js +4 -1
  116. package/build/tokens/layout.d.ts +6 -12
  117. package/build/tokens/layout.js +3 -6
  118. package/docs/components/AllComponents.web.tsx +122 -5
  119. package/docs/components/BadgeList.tsx +20 -56
  120. package/docs/components/SwitchList.tsx +4 -8
  121. package/docs/getting-started.mdx +30 -14
  122. package/docs/introduction.mdx +1 -1
  123. package/docs/layout-components.docs.mdx +30 -0
  124. package/package.json +6 -4
  125. package/src/components/Alert/AlertTitle.tsx +7 -7
  126. package/src/components/Badge/Badge.props.ts +1 -0
  127. package/src/components/Badge/Badge.tsx +3 -2
  128. package/src/components/Button/ButtonRoot.tsx +4 -0
  129. package/src/components/Button/ButtonText.tsx +3 -3
  130. package/src/components/Card/CardRoot.tsx +2 -0
  131. package/src/components/Carousel/Carousel.context.tsx +8 -0
  132. package/src/components/Carousel/Carousel.docs.mdx +389 -0
  133. package/src/components/Carousel/Carousel.props.ts +89 -0
  134. package/src/components/Carousel/Carousel.stories.tsx +317 -0
  135. package/src/components/Carousel/Carousel.tsx +444 -0
  136. package/src/components/Carousel/CarouselControlItem.tsx +87 -0
  137. package/src/components/Carousel/CarouselControls.tsx +150 -0
  138. package/src/components/Carousel/CarouselItem.tsx +68 -0
  139. package/src/components/Carousel/index.ts +6 -0
  140. package/src/components/Container/Container.docs.mdx +168 -0
  141. package/src/components/Container/Container.props.ts +89 -0
  142. package/src/components/Container/Container.stories.tsx +274 -0
  143. package/src/components/Container/Container.tsx +52 -0
  144. package/src/components/Container/index.tsx +2 -0
  145. package/src/components/DescriptionList/DescriptionList.docs.mdx +24 -27
  146. package/src/components/DescriptionList/DescriptionList.props.ts +1 -8
  147. package/src/components/DescriptionList/DescriptionList.stories.tsx +13 -19
  148. package/src/components/DescriptionList/DescriptionList.tsx +2 -14
  149. package/src/components/DescriptionList/DescriptionListItem.props.ts +3 -8
  150. package/src/components/DescriptionList/DescriptionListItem.tsx +13 -21
  151. package/src/components/IndicatorIconButton/IndicatorIconButton.docs.mdx +85 -0
  152. package/src/components/IndicatorIconButton/IndicatorIconButton.props.ts +12 -0
  153. package/src/components/IndicatorIconButton/IndicatorIconButton.stories.tsx +142 -0
  154. package/src/components/IndicatorIconButton/IndicatorIconButton.tsx +36 -0
  155. package/src/components/IndicatorIconButton/index.tsx +2 -0
  156. package/src/components/Link/LinkText.tsx +4 -4
  157. package/src/components/List/List.context.ts +0 -1
  158. package/src/components/List/List.docs.mdx +376 -179
  159. package/src/components/List/List.props.ts +1 -9
  160. package/src/components/List/List.stories.tsx +289 -38
  161. package/src/components/List/List.tsx +5 -26
  162. package/src/components/List/ListAction/ListAction.props.ts +10 -0
  163. package/src/components/List/ListAction/ListAction.tsx +133 -0
  164. package/src/components/List/ListAction/ListActionContent.tsx +21 -0
  165. package/src/components/List/ListAction/ListActionText.tsx +14 -0
  166. package/src/components/List/ListAction/ListActionTrailingContent.tsx +9 -0
  167. package/src/components/List/ListAction/ListActionTrailingIcon.tsx +32 -0
  168. package/src/components/List/ListAction/index.ts +6 -0
  169. package/src/components/List/ListItem/ListItem.context.ts +1 -1
  170. package/src/components/List/ListItem/ListItem.props.ts +9 -5
  171. package/src/components/List/ListItem/ListItemRoot.tsx +18 -14
  172. package/src/components/List/ListItem/index.ts +4 -4
  173. package/src/components/List/index.ts +1 -0
  174. package/src/components/ProgressStepper/ProgressStep.tsx +134 -0
  175. package/src/components/ProgressStepper/ProgressStepper.docs.mdx +87 -0
  176. package/src/components/ProgressStepper/ProgressStepper.props.ts +27 -0
  177. package/src/components/ProgressStepper/ProgressStepper.stories.tsx +108 -0
  178. package/src/components/ProgressStepper/ProgressStepper.tsx +26 -0
  179. package/src/components/ProgressStepper/ProgressStepperRoot.tsx +32 -0
  180. package/src/components/ProgressStepper/index.ts +3 -0
  181. package/src/components/SectionHeader/SectionHeader.props.ts +9 -16
  182. package/src/components/SectionHeader/SectionHeader.stories.tsx +28 -18
  183. package/src/components/SectionHeader/SectionHeader.tsx +18 -19
  184. package/src/components/SectionHeader/SectionHeaderTrailingContent.tsx +20 -0
  185. package/src/components/SectionHeader/Sectionheader.docs.mdx +9 -24
  186. package/src/components/SectionHeader/index.ts +1 -0
  187. package/src/components/Switch/Switch.docs.mdx +0 -4
  188. package/src/components/Tabs/Tab.tsx +4 -2
  189. package/src/components/ThemedImage/ThemedImage.docs.mdx +208 -0
  190. package/src/components/ThemedImage/ThemedImage.props.ts +15 -0
  191. package/src/components/ThemedImage/ThemedImage.stories.tsx +175 -0
  192. package/src/components/ThemedImage/ThemedImage.tsx +34 -0
  193. package/src/components/ThemedImage/index.tsx +2 -0
  194. package/src/components/ToggleButton/ToggleButtonText.tsx +3 -3
  195. package/src/components/UnstyledIconButton/UnstyledIconButton.props.ts +2 -1
  196. package/src/components/index.ts +5 -0
  197. package/src/hooks/useStyleProps.ts +1 -1
  198. package/src/tokens/components/dark/button.ts +1 -1
  199. package/src/tokens/components/dark/dialog.ts +1 -0
  200. package/src/tokens/components/dark/illustrations.ts +1 -0
  201. package/src/tokens/components/dark/toast.ts +4 -1
  202. package/src/tokens/components/light/button.ts +1 -1
  203. package/src/tokens/components/light/dialog.ts +1 -0
  204. package/src/tokens/components/light/illustrations.ts +1 -0
  205. package/src/tokens/components/light/toast.ts +4 -1
  206. package/src/tokens/layout.ts +3 -6
  207. package/src/vite-env.d.ts +6 -0
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { SettingsMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
3
3
  import { VariantTitle } from '../../../docs/components';
4
4
  import { Flex } from '../Flex';
5
+ import { Link } from '../Link';
5
6
  import SectionHeader from './SectionHeader';
6
7
 
7
8
  const meta = {
@@ -16,15 +17,10 @@ const meta = {
16
17
  control: 'text',
17
18
  description: 'The heading supporting text to be displayed.',
18
19
  },
19
- linkText: {
20
- control: 'text',
21
- description: 'Link text to display',
22
- },
23
20
  },
24
21
  args: {
25
22
  heading: 'This is the section heading',
26
23
  helperText: 'Helper text',
27
- linkText: 'See more',
28
24
  },
29
25
  } satisfies Meta<typeof SectionHeader>;
30
26
 
@@ -33,13 +29,7 @@ type Story = StoryObj<typeof meta>;
33
29
 
34
30
  export const Playground: Story = {
35
31
  render: () => {
36
- return (
37
- <SectionHeader
38
- heading="This is the section heading"
39
- helperText="Helper text"
40
- linkText="See more"
41
- />
42
- );
32
+ return <SectionHeader heading="This is the section heading" helperText="Helper text" />;
43
33
  },
44
34
  };
45
35
 
@@ -51,23 +41,43 @@ export const KitchenSink: Story = {
51
41
  return (
52
42
  <Flex space="xl" direction="column" style={{ width: '100%' }}>
53
43
  <VariantTitle title="Default SectionHeader with helper text and link">
54
- <SectionHeader heading="Heading" helperText="Helper text" linkText="See more" />
44
+ <SectionHeader
45
+ heading="Heading"
46
+ helperText="Helper text"
47
+ trailingContent={<Link>See more</Link>}
48
+ />
55
49
  </VariantTitle>
56
50
  <VariantTitle title="SectionHeader with icon on the left of the link ">
57
51
  <SectionHeader
58
52
  heading="Heading"
59
53
  helperText="Helper text"
60
- linkText="Settings"
61
- linkIcon={SettingsMediumIcon}
62
- linkIconPosition="left"
54
+ trailingContent={
55
+ <Link icon={SettingsMediumIcon} iconPosition="left">
56
+ Settings
57
+ </Link>
58
+ }
63
59
  />
64
60
  </VariantTitle>
65
61
  <VariantTitle title="SectionHeader with no icon">
66
62
  <SectionHeader
67
63
  heading="Heading"
68
64
  helperText="Helper text"
69
- linkText="Call to action"
70
- linkShowIcon={false}
65
+ trailingContent={<Link showIcon={false}>Call to action</Link>}
66
+ />
67
+ </VariantTitle>
68
+ <VariantTitle title="SectionHeader with badge">
69
+ <SectionHeader
70
+ heading="Heading"
71
+ helperText="Helper text"
72
+ badge={{ text: "I'm a badge" }}
73
+ />
74
+ </VariantTitle>
75
+ <VariantTitle title="SectionHeader with badge and link">
76
+ <SectionHeader
77
+ heading="Heading"
78
+ helperText="Helper text"
79
+ trailingContent={<Link>Show more</Link>}
80
+ badge={{ text: 'New' }}
71
81
  />
72
82
  </VariantTitle>
73
83
  </Flex>
@@ -1,23 +1,22 @@
1
+ import { ErrorCircleSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
1
2
  import { View } from 'react-native';
2
3
  import { StyleSheet } from 'react-native-unistyles';
3
- import { Link } from '../Link';
4
+ import { Badge } from '../Badge';
5
+ import { Helper } from '../Helper';
4
6
  import SectionHeaderProps from './SectionHeader.props';
5
7
  import SectionHeaderTitle from './SectionHeaderHeading';
6
8
  import SectionHeaderHelperText from './SectionHeaderHelperText';
7
9
  import SectionHeaderTextContent from './SectionHeaderTextContent';
10
+ import SectionHeaderTrailingContent from './SectionHeaderTrailingContent';
8
11
 
9
12
  const SectionHeader = ({
10
13
  heading,
11
14
  helperText,
12
15
  children,
13
16
  style,
14
- linkHref,
15
- linkIcon,
16
- linkIconPosition,
17
- linkOnPress,
18
- linkShowIcon,
19
- linkTarget,
20
- linkText,
17
+ trailingContent,
18
+ badge,
19
+ invalidText,
21
20
  ...props
22
21
  }: SectionHeaderProps) => {
23
22
  return (
@@ -29,18 +28,18 @@ const SectionHeader = ({
29
28
  <SectionHeaderTextContent>
30
29
  <SectionHeaderTitle>{heading}</SectionHeaderTitle>
31
30
  {!!helperText && <SectionHeaderHelperText>{helperText}</SectionHeaderHelperText>}
31
+ {!!invalidText && (
32
+ <Helper
33
+ validationStatus="invalid"
34
+ showIcon
35
+ icon={ErrorCircleSmallIcon}
36
+ text={invalidText || ''}
37
+ />
38
+ )}
32
39
  </SectionHeaderTextContent>
33
- {!!linkText && (
34
- <Link
35
- href={linkHref}
36
- onPress={linkOnPress}
37
- icon={linkIcon}
38
- showIcon={linkShowIcon}
39
- iconPosition={linkIconPosition}
40
- target={linkTarget}
41
- >
42
- {linkText}
43
- </Link>
40
+ {!!badge && <Badge {...badge} />}
41
+ {!!trailingContent && (
42
+ <SectionHeaderTrailingContent>{trailingContent}</SectionHeaderTrailingContent>
44
43
  )}
45
44
  </>
46
45
  )}
@@ -0,0 +1,20 @@
1
+ import { View, type ViewProps } from 'react-native';
2
+ import { StyleSheet } from 'react-native-unistyles';
3
+
4
+ const SectionHeaderTrailingContent = ({ children, ...props }: ViewProps) => {
5
+ return (
6
+ <View {...props} style={[styles.container, props.style]}>
7
+ {children}
8
+ </View>
9
+ );
10
+ };
11
+
12
+ SectionHeaderTrailingContent.displayName = 'SectionHeaderTrailingContent';
13
+
14
+ const styles = StyleSheet.create({
15
+ container: {
16
+ alignSelf: 'flex-start',
17
+ },
18
+ });
19
+
20
+ export default SectionHeaderTrailingContent;
@@ -26,7 +26,7 @@ Use the `Section Header` component to help define and separate content within a
26
26
 
27
27
  ## Anatomy
28
28
 
29
- Section Header consists of: Heading, Helper Text and Link
29
+ Section Header consists of: Heading, Helper Text, a Badge (optional) and a trailing content (optional, usually a Link or Button).
30
30
 
31
31
  ### Heading
32
32
 
@@ -42,41 +42,26 @@ A helper text property is included in the component to be able to add helper tex
42
42
 
43
43
  Use helper text when users need extra clarity or explanation before engaging with the section.
44
44
 
45
- ### Link
46
-
47
- The Section Header component includes an optional Link that provides users with a related navigation option.
48
-
49
- Use the Link to provide a shortcut to additional details or a more comprehensive view.
50
-
51
- Use when users may need to navigate away or view extended content (e.g. view all)
52
-
53
45
  ## Usage
54
46
 
55
47
  <UsageWrap>
56
- <SectionHeader heading="Heading" helperText="Helper text" linkText="See more" />
48
+ <SectionHeader heading="Heading" helperText="Helper text" />
57
49
  </UsageWrap>
58
50
 
59
51
  ```tsx
60
52
  import { SectionHeader } from '@utilitywarehouse/hearth-react-native';
61
53
 
62
- const MyComponent = () => (
63
- <SectionHeader heading="Heading" helperText="Helper text" linkText="See more" />
64
- );
54
+ const MyComponent = () => <SectionHeader heading="Heading" helperText="Helper text" />;
65
55
  ```
66
56
 
67
57
  ## Props
68
58
 
69
- | Name | Type | Default | Description |
70
- | ---------------- | -------------------------------------------- | ---------- | ------------------------------------------------------ |
71
- | heading | `string` | | The text to display in the heading of the list. |
72
- | helperText | `string` | | The helper text to display in the heading of the list. |
73
- | linkText | `string` | | The text for the link in the heading. |
74
- | linkHref | `string` | | The href for the link in the heading. |
75
- | linkOnPress | `() => void` | | Callback function when the link is pressed. |
76
- | linkTarget | `'_blank' \| '_self' \| '_parent' \| '_top'` | `'_blank'` | Target for the link in the heading. |
77
- | linkIcon | `ComponentType` | | Icon for the link. |
78
- | linkIconPosition | `'left' \| 'right'` | `'right'` | Position of the icon in the link. |
79
- | linkShowIcon | `boolean` | `true` | Whether to show the icon in the link. |
59
+ | Name | Type | Default | Description |
60
+ | --------------- | ----------------- | ------- | ------------------------------------------------------ |
61
+ | heading | `string` | | The text to display in the heading of the list. |
62
+ | helperText | `string` | | The helper text to display in the heading of the list. |
63
+ | trailingContent | `React.ReactNode` | | Optional content to display on the right side. |
64
+ | badge | `BadgeProps` | | Optional badge to display next to the heading. |
80
65
 
81
66
  ## Variants
82
67
 
@@ -2,3 +2,4 @@ export { default as SectionHeader } from './SectionHeader';
2
2
  export { default as SectionHeaderHeading } from './SectionHeaderHeading';
3
3
  export { default as SectionHeaderHelperText } from './SectionHeaderHelperText';
4
4
  export { default as SectionHeaderTextContent } from './SectionHeaderTextContent';
5
+ export { default as SectionHeaderTrailingContent } from './SectionHeaderTrailingContent';
@@ -137,7 +137,6 @@ const SwitchList = () => {
137
137
  <ListItem
138
138
  text="Notifications"
139
139
  helperText="Allow notifications"
140
- divider
141
140
  leadingContent={<ListItemIcon as={BellMediumIcon} />}
142
141
  trailingContent={
143
142
  <Switch value={notifications} onValueChange={setNotifications} size="small" />
@@ -147,7 +146,6 @@ const SwitchList = () => {
147
146
  <ListItem
148
147
  text="Secure ID"
149
148
  helperText="Use secure ID"
150
- divider
151
149
  leadingContent={<ListItemIcon as={LockMediumIcon} />}
152
150
  trailingContent={<Switch value={secureId} onValueChange={setSecureId} size="small" />}
153
151
  onPress={() => setSecureId(!secureId)}
@@ -155,7 +153,6 @@ const SwitchList = () => {
155
153
  <ListItem
156
154
  text="Location"
157
155
  helperText="Allow location"
158
- divider
159
156
  leadingContent={<ListItemIcon as={LocationMediumIcon} />}
160
157
  trailingContent={<Switch value={location} onValueChange={setLocation} size="small" />}
161
158
  onPress={() => setLocation(!location)}
@@ -163,7 +160,6 @@ const SwitchList = () => {
163
160
  <ListItem
164
161
  text="Dark mode"
165
162
  helperText="Enable dark mode"
166
- divider
167
163
  leadingContent={<ListItemIcon as={EyeMediumIcon} />}
168
164
  trailingContent={<Switch value={darkMode} onValueChange={setDarkMode} size="small" />}
169
165
  onPress={() => setDarkMode(!darkMode)}
@@ -1,12 +1,12 @@
1
1
  import { useCallback, useRef } from 'react';
2
2
  import { Platform, Pressable, View } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
- import { DetailText } from '../DetailText';
5
4
  import { Icon } from '../Icon';
6
5
  import type TabProps from './Tab.props';
7
6
  import { useTabsContext } from './Tabs.context';
8
7
 
9
8
  import { createPressable } from '@gluestack-ui/pressable';
9
+ import { BodyText } from '../BodyText';
10
10
 
11
11
  const Tab = ({
12
12
  value,
@@ -54,7 +54,9 @@ const Tab = ({
54
54
  >
55
55
  <View style={styles.content}>
56
56
  {icon ? <Icon as={icon} /> : null}
57
- <DetailText size={size}>{children}</DetailText>
57
+ <BodyText size={size} weight="semibold">
58
+ {children}
59
+ </BodyText>
58
60
  </View>
59
61
  </Pressable>
60
62
  );
@@ -0,0 +1,208 @@
1
+ import { Canvas, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
2
+ import * as ThemedImageStories from './ThemedImage.stories';
3
+
4
+ <Meta title="Utility Components / Themed Image" />
5
+
6
+ # Themed Image
7
+
8
+ The `ThemedImage` component automatically switches between light and dark mode images or SVG components based on the current theme. It's perfect for illustrations, logos, or any visual assets that need different appearances for light and dark modes.
9
+
10
+ - [Features](#features)
11
+ - [Basic Usage](#basic-usage)
12
+ - [Props](#props)
13
+ - [Examples](#examples)
14
+
15
+ ## Features
16
+
17
+ - **Automatic theme switching** - Responds to color mode changes
18
+ - **Flexible sources** - Accepts both regular image sources and React components (like SVGs)
19
+ - **Accessible** - Supports all standard Image accessibility props
20
+ - **Works with svg-assets** - Seamlessly integrates with the `@utilitywarehouse/hearth-svg-assets` package
21
+
22
+ ## Basic Usage
23
+
24
+ <Canvas of={ThemedImageStories.Playground} />
25
+
26
+ ## Props
27
+
28
+ | Prop | Type | Required | Description |
29
+ | ------- | ------------------------------------- | -------- | -------------------------------------------------- |
30
+ | `light` | `ImageSourcePropType \| ReactElement` | Yes | Image source or component to display in light mode |
31
+ | `dark` | `ImageSourcePropType \| ReactElement` | Yes | Image source or component to display in dark mode |
32
+ | ...rest | `ImageProps` | No | All other standard React Native Image props |
33
+
34
+ ### Additional Props
35
+
36
+ `ThemedImage` extends React Native's `Image` component, so it accepts all standard `ImageProps` including:
37
+
38
+ - `style` - Custom styling for the image container
39
+ - `resizeMode` - How to resize the image when the frame doesn't match the raw image dimensions
40
+ - `accessible` - Whether the element is an accessibility element
41
+ - `accessibilityLabel` - Text to be announced by screen readers
42
+ - `testID` - Used to locate this view in end-to-end tests
43
+
44
+ ## Examples
45
+
46
+ ### With SVG Assets
47
+
48
+ The most common use case is with SVG components from the `@utilitywarehouse/hearth-svg-assets` package:
49
+
50
+ ```tsx
51
+ import { View } from 'react-native';
52
+ import { ThemedImage } from '@utilitywarehouse/hearth-react-native';
53
+ import SpotBillingDark from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-dark.svg';
54
+ import SpotBillingLight from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-light.svg';
55
+
56
+ function MyComponent() {
57
+ return <ThemedImage light={SpotBillingLight} dark={SpotBillingDark} width={200} height={200} />;
58
+ }
59
+ ```
60
+
61
+ <Canvas of={ThemedImageStories.WithSpotIllustrations} />
62
+
63
+ ### With Regular Images
64
+
65
+ You can also use regular image sources (not just SVG components):
66
+
67
+ ```tsx
68
+ import { ThemedImage } from '@utilitywarehouse/hearth-react-native';
69
+ import logoLight from './assets/logo-light.png';
70
+ import logoDark from './assets/logo-dark.png';
71
+
72
+ function MyComponent() {
73
+ return <ThemedImage light={logoLight} dark={logoDark} />;
74
+ }
75
+ ```
76
+
77
+ <Canvas of={ThemedImageStories.WithRegularImages} />
78
+
79
+ ### With Custom Sizes
80
+
81
+ When using SVG components, control the size by passing a `style` prop with `width` and `height` to the component:
82
+
83
+ <Canvas of={ThemedImageStories.WithCustomSize} />
84
+
85
+ ### With Accessibility
86
+
87
+ Support screen readers and assistive technologies:
88
+
89
+ ```tsx
90
+ import { View } from 'react-native';
91
+ import { ThemedImage } from '@utilitywarehouse/hearth-react-native';
92
+ import MascotEnergyDark from '@utilitywarehouse/hearth-svg-assets/lib/mascot-energy-dark.svg';
93
+ import MascotEnergyLight from '@utilitywarehouse/hearth-svg-assets/lib/mascot-energy-light.svg';
94
+
95
+ function MyComponent() {
96
+ return (
97
+ <ThemedImage
98
+ light={MascotEnergyLight}
99
+ dark={MascotEnergyDark}
100
+ width={150}
101
+ height={150}
102
+ accessible={true}
103
+ accessibilityLabel="Energy service mascot illustration"
104
+ />
105
+ );
106
+ }
107
+ ```
108
+
109
+ <Canvas of={ThemedImageStories.WithAccessibility} />
110
+
111
+ ## Usage with svg-assets Package
112
+
113
+ The `@utilitywarehouse/hearth-svg-assets` package provides themed illustrations in three categories:
114
+
115
+ ### Spot Illustrations
116
+
117
+ Small, focused illustrations for specific concepts:
118
+
119
+ - `spot-billing` - Billing and payments
120
+ - `spot-celebratory` - Success and celebration
121
+ - `spot-error` - Error states
122
+ - `spot-help` - Help and support
123
+ - `spot-innovation` - New features
124
+ - `spot-savings` - Cost savings
125
+ - And more...
126
+
127
+ ### Mascots
128
+
129
+ Service-specific character illustrations:
130
+
131
+ - `mascot-energy` - Energy service
132
+ - `mascot-broadband` - Broadband service
133
+ - `mascot-mobile` - Mobile service
134
+ - `mascot-insurance` - Insurance service
135
+ - `mascot-cashback` - Cashback rewards
136
+
137
+ ### Scene Illustrations
138
+
139
+ Large, detailed illustrations for landing pages:
140
+
141
+ - `scene-energy` - Energy service scenes
142
+ - `scene-broadband` - Broadband service scenes
143
+ - `scene-mobile` - Mobile service scenes
144
+ - `scene-insurance` - Insurance service scenes
145
+ - `scene-bundle` - Service bundle scenes
146
+
147
+ All assets come in both `-light.svg` and `-dark.svg` variants.
148
+
149
+ ## Integration with react-native-svg-transformer
150
+
151
+ To use SVG files as React components in React Native, you'll need `react-native-svg-transformer`:
152
+
153
+ ```bash
154
+ # Install dependencies
155
+ npm install react-native-svg react-native-svg-transformer --save-dev
156
+ ```
157
+
158
+ Configure your `metro.config.js`:
159
+
160
+ ```js
161
+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
162
+
163
+ const config = {
164
+ transformer: {
165
+ babelTransformerPath: require.resolve('react-native-svg-transformer'),
166
+ },
167
+ resolver: {
168
+ assetExts: getDefaultConfig(__dirname).resolver.assetExts.filter(ext => ext !== 'svg'),
169
+ sourceExts: [...getDefaultConfig(__dirname).resolver.sourceExts, 'svg'],
170
+ },
171
+ };
172
+
173
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
174
+ ```
175
+
176
+ Add TypeScript declarations (optional):
177
+
178
+ ```typescript
179
+ // svg.d.ts
180
+ declare module '*.svg' {
181
+ import React from 'react';
182
+ import { SvgProps } from 'react-native-svg';
183
+ const content: React.FC<SvgProps>;
184
+ export default content;
185
+ }
186
+ ```
187
+
188
+ ## Best Practices
189
+
190
+ 1. **Always provide both variants** - Ensure you have both light and dark versions of your assets
191
+ 2. **Use appropriate sizes** - Match illustration sizes to your design specifications
192
+ 3. **Add accessibility labels** - Make your images accessible to screen readers
193
+ 4. **Consider performance** - Large SVG files may impact performance on older devices
194
+ 5. **Test in both modes** - Always test your themed images in both light and dark modes
195
+
196
+ ## Troubleshooting
197
+
198
+ ### SVG not displaying
199
+
200
+ Make sure you have configured `react-native-svg-transformer` correctly and that your SVG files are valid.
201
+
202
+ ### Theme not switching
203
+
204
+ The component uses `useColorMode` hook which relies on the Unistyles theme system. Ensure your app is properly configured with Unistyles.
205
+
206
+ ### TypeScript errors with SVG imports
207
+
208
+ Add the TypeScript declaration file for `.svg` modules as shown in the integration section above.
@@ -0,0 +1,15 @@
1
+ import type { ComponentType, ReactElement } from 'react';
2
+ import type { ImageProps, ImageSourcePropType } from 'react-native';
3
+
4
+ interface ThemedImageProps extends Omit<ImageProps, 'source'> {
5
+ /**
6
+ * Image source or component to display in light mode
7
+ */
8
+ light: ImageSourcePropType | ReactElement | ComponentType<any>;
9
+ /**
10
+ * Image source or component to display in dark mode
11
+ */
12
+ dark: ImageSourcePropType | ReactElement | ComponentType<any>;
13
+ }
14
+
15
+ export default ThemedImageProps;