@utilitywarehouse/hearth-react-native 0.11.0 → 0.13.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 (202) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +16 -0
  4. package/build/components/Accordion/AccordionTrigger.js +1 -1
  5. package/build/components/Banner/Banner.context.d.ts +7 -0
  6. package/build/components/Banner/Banner.context.js +8 -0
  7. package/build/components/Banner/Banner.js +10 -40
  8. package/build/components/Banner/Banner.props.d.ts +3 -5
  9. package/build/components/Banner/BannerIllustration.d.ts +4 -0
  10. package/build/components/Banner/BannerIllustration.js +53 -0
  11. package/build/components/Banner/BannerImage.d.ts +4 -0
  12. package/build/components/Banner/BannerImage.js +53 -0
  13. package/build/components/Banner/index.d.ts +2 -0
  14. package/build/components/Banner/index.js +2 -0
  15. package/build/components/Card/CardAction/CardAction.props.d.ts +2 -3
  16. package/build/components/Card/CardAction/CardActionRoot.js +1 -2
  17. package/build/components/Checkbox/Checkbox.js +1 -2
  18. package/build/components/Checkbox/Checkbox.props.d.ts +3 -3
  19. package/build/components/Checkbox/CheckboxImage.d.ts +2 -1
  20. package/build/components/Checkbox/CheckboxImage.js +8 -1
  21. package/build/components/Checkbox/CheckboxIndicator.js +3 -3
  22. package/build/components/DatePicker/DatePickerDay.js +3 -3
  23. package/build/components/ExpandableCard/ExpandableCard.props.d.ts +1 -2
  24. package/build/components/ExpandableCard/ExpandableCardTrigger.props.d.ts +4 -5
  25. package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +1 -14
  26. package/build/components/HighlightBanner/HighlightBanner.js +2 -6
  27. package/build/components/HighlightBanner/HighlightBanner.props.d.ts +2 -3
  28. package/build/components/HighlightBanner/HighlightBannerImage.d.ts +4 -0
  29. package/build/components/HighlightBanner/HighlightBannerImage.js +18 -0
  30. package/build/components/HighlightBanner/index.d.ts +1 -0
  31. package/build/components/HighlightBanner/index.js +1 -0
  32. package/build/components/Input/Input.d.ts +5 -7
  33. package/build/components/Input/Input.js +11 -4
  34. package/build/components/Input/InputField.d.ts +4 -7
  35. package/build/components/Input/InputField.js +6 -5
  36. package/build/components/List/ListItem/ListItem.props.d.ts +2 -2
  37. package/build/components/List/ListItem/ListItemRoot.js +1 -2
  38. package/build/components/Modal/Modal.js +2 -6
  39. package/build/components/Modal/Modal.props.d.ts +3 -2
  40. package/build/components/Modal/Modal.web.js +2 -6
  41. package/build/components/Modal/ModalImage.d.ts +4 -0
  42. package/build/components/Modal/ModalImage.js +18 -0
  43. package/build/components/Modal/index.d.ts +1 -0
  44. package/build/components/Modal/index.js +1 -0
  45. package/build/components/PillGroup/Pill.js +2 -2
  46. package/build/components/Radio/Radio.js +1 -2
  47. package/build/components/Radio/Radio.props.d.ts +3 -3
  48. package/build/components/Radio/RadioImage.d.ts +2 -1
  49. package/build/components/Radio/RadioImage.js +8 -1
  50. package/build/components/Radio/RadioIndicator.js +3 -3
  51. package/build/components/RadioCard/RadioCardIndicator.js +3 -3
  52. package/build/components/RadioCard/RadioCardRoot.js +3 -3
  53. package/build/components/Tabs/Tab.js +5 -5
  54. package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
  55. package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
  56. package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
  57. package/build/components/VerificationInput/VerificationInput.d.ts +6 -0
  58. package/build/components/VerificationInput/VerificationInput.js +35 -0
  59. package/build/components/VerificationInput/VerificationInput.props.d.ts +49 -0
  60. package/build/components/VerificationInput/VerificationInput.props.js +1 -0
  61. package/build/components/VerificationInput/VerificationInputSlot.d.ts +9 -0
  62. package/build/components/VerificationInput/VerificationInputSlot.js +72 -0
  63. package/build/components/VerificationInput/index.d.ts +4 -0
  64. package/build/components/VerificationInput/index.js +3 -0
  65. package/build/components/VerificationInput/useVerificationInput.d.ts +14 -0
  66. package/build/components/VerificationInput/useVerificationInput.js +58 -0
  67. package/build/components/index.d.ts +1 -0
  68. package/build/components/index.js +1 -0
  69. package/build/utils/index.d.ts +2 -1
  70. package/build/utils/index.js +2 -1
  71. package/build/utils/isThemedImageProps.d.ts +4 -0
  72. package/build/utils/isThemedImageProps.js +4 -0
  73. package/docs/components/AllComponents.web.tsx +9 -0
  74. package/package.json +11 -12
  75. package/src/components/Accordion/Accordion.figma.tsx +23 -0
  76. package/src/components/Accordion/AccordionItemRoot.figma.tsx +47 -0
  77. package/src/components/Accordion/AccordionTrigger.tsx +1 -1
  78. package/src/components/Alert/Alert.figma.tsx +47 -0
  79. package/src/components/Avatar/Avatar.figma.tsx +33 -0
  80. package/src/components/Badge/Badge.figma.tsx +48 -24
  81. package/src/components/Banner/Banner.context.ts +11 -0
  82. package/src/components/Banner/Banner.docs.mdx +55 -37
  83. package/src/components/Banner/Banner.figma.tsx +15 -0
  84. package/src/components/Banner/Banner.props.ts +3 -5
  85. package/src/components/Banner/Banner.stories.tsx +86 -57
  86. package/src/components/Banner/Banner.tsx +24 -67
  87. package/src/components/Banner/BannerIllustration.figma.tsx +30 -0
  88. package/src/components/Banner/BannerIllustration.tsx +63 -0
  89. package/src/components/Banner/BannerImage.tsx +63 -0
  90. package/src/components/Banner/index.ts +2 -0
  91. package/src/components/BottomSheet/BottomSheetModal.figma.tsx +20 -0
  92. package/src/components/Button/Button.figma.tsx +60 -229
  93. package/src/components/Card/Card.docs.mdx +4 -4
  94. package/src/components/Card/Card.figma.tsx +43 -71
  95. package/src/components/Card/CardAction/CardAction.figma.tsx +44 -0
  96. package/src/components/Card/CardAction/CardAction.props.ts +2 -3
  97. package/src/components/Card/CardAction/CardAction.stories.tsx +5 -4
  98. package/src/components/Card/CardAction/CardActionRoot.tsx +4 -5
  99. package/src/components/Carousel/Carousel.figma.tsx +19 -0
  100. package/src/components/Checkbox/Checkbox.docs.mdx +23 -4
  101. package/src/components/Checkbox/Checkbox.figma.tsx +26 -41
  102. package/src/components/Checkbox/Checkbox.props.ts +3 -3
  103. package/src/components/Checkbox/Checkbox.stories.tsx +14 -8
  104. package/src/components/Checkbox/Checkbox.tsx +1 -2
  105. package/src/components/Checkbox/CheckboxGroup.figma.tsx +20 -0
  106. package/src/components/Checkbox/CheckboxImage.figma.tsx +27 -0
  107. package/src/components/Checkbox/CheckboxImage.tsx +8 -3
  108. package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
  109. package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +32 -0
  110. package/src/components/CurrencyInput/CurrencyInput.figma.tsx +56 -0
  111. package/src/components/DateInput/DateInput.figma.tsx +75 -0
  112. package/src/components/DatePicker/DatePickerCalendar.figma.tsx +34 -0
  113. package/src/components/DatePicker/DatePickerDay.tsx +3 -3
  114. package/src/components/DatePickerInput/DatePickerInput.figma.tsx +62 -0
  115. package/src/components/DescriptionList/DescriptionList.figma.tsx +23 -0
  116. package/src/components/Divider/Divider.figma.tsx +23 -18
  117. package/src/components/ExpandableCard/ExpandableCard.docs.mdx +2 -2
  118. package/src/components/ExpandableCard/ExpandableCard.figma.tsx +54 -0
  119. package/src/components/ExpandableCard/ExpandableCard.props.ts +1 -2
  120. package/src/components/ExpandableCard/ExpandableCard.stories.tsx +3 -3
  121. package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +23 -0
  122. package/src/components/ExpandableCard/ExpandableCardTrigger.props.ts +4 -5
  123. package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +2 -17
  124. package/src/components/FormField/FormField.figma.tsx +23 -0
  125. package/src/components/Helper/HelperText.figma.tsx +23 -0
  126. package/src/components/HighlightBanner/HighlightBanner.docs.mdx +73 -42
  127. package/src/components/HighlightBanner/HighlightBanner.props.ts +2 -3
  128. package/src/components/HighlightBanner/HighlightBanner.stories.tsx +85 -60
  129. package/src/components/HighlightBanner/HighlightBanner.tsx +3 -10
  130. package/src/components/HighlightBanner/HighlightBannerImage.tsx +20 -0
  131. package/src/components/HighlightBanner/index.ts +1 -0
  132. package/src/components/IconButton/IconButton.figma.tsx +55 -161
  133. package/src/components/IconContainer/IconContainer.figma.tsx +50 -0
  134. package/src/components/InlineLink/InlineLink.figma.tsx +33 -0
  135. package/src/components/Input/Input.figma.tsx +52 -110
  136. package/src/components/Input/Input.stories.tsx +76 -3
  137. package/src/components/Input/Input.tsx +110 -98
  138. package/src/components/Input/InputField.tsx +27 -26
  139. package/src/components/Label/Label.figma.tsx +24 -0
  140. package/src/components/Link/Link.figma.tsx +42 -0
  141. package/src/components/List/List.docs.mdx +15 -9
  142. package/src/components/List/List.figma.tsx +29 -108
  143. package/src/components/List/List.stories.tsx +2 -2
  144. package/src/components/List/ListAction/ListAction.figma.tsx +29 -0
  145. package/src/components/List/ListItem/ListItem.figma.tsx +40 -220
  146. package/src/components/List/ListItem/ListItem.props.ts +2 -2
  147. package/src/components/List/ListItem/ListItemLeadingContent.figma.tsx +29 -0
  148. package/src/components/List/ListItem/ListItemRoot.tsx +2 -3
  149. package/src/components/List/ListItem/ListItemTrailingContent.figma.tsx +27 -0
  150. package/src/components/Menu/Menu.figma.tsx +30 -0
  151. package/src/components/Menu/MenuItem.figma.tsx +31 -0
  152. package/src/components/Modal/Modal.docs.mdx +16 -4
  153. package/src/components/Modal/Modal.figma.tsx +56 -0
  154. package/src/components/Modal/Modal.props.ts +3 -2
  155. package/src/components/Modal/Modal.stories.tsx +2 -5
  156. package/src/components/Modal/Modal.tsx +2 -6
  157. package/src/components/Modal/Modal.web.tsx +2 -6
  158. package/src/components/Modal/ModalImage.tsx +20 -0
  159. package/src/components/Modal/index.ts +1 -0
  160. package/src/components/PillGroup/Pill.figma.tsx +25 -0
  161. package/src/components/PillGroup/Pill.tsx +3 -3
  162. package/src/components/PillGroup/PillGroup.figma.tsx +21 -0
  163. package/src/components/PillGroup/PillGroup.stories.tsx +1 -1
  164. package/src/components/ProgressStepper/ProgressStep.figma.tsx +30 -0
  165. package/src/components/ProgressStepper/ProgressStepper.figma.tsx +20 -0
  166. package/src/components/Radio/Radio.docs.mdx +21 -8
  167. package/src/components/Radio/Radio.figma.tsx +22 -42
  168. package/src/components/Radio/Radio.props.ts +3 -3
  169. package/src/components/Radio/Radio.stories.tsx +15 -11
  170. package/src/components/Radio/Radio.tsx +1 -2
  171. package/src/components/Radio/RadioGroup.figma.tsx +54 -0
  172. package/src/components/Radio/RadioImage.figma.tsx +27 -0
  173. package/src/components/Radio/RadioImage.tsx +8 -3
  174. package/src/components/Radio/RadioIndicator.tsx +3 -3
  175. package/src/components/Radio/RadioTileRoot.figma.tsx +31 -0
  176. package/src/components/RadioCard/RadioCardIndicator.tsx +3 -3
  177. package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
  178. package/src/components/SectionHeader/SectionHeader.figma.tsx +30 -16
  179. package/src/components/Select/Select.figma.tsx +55 -0
  180. package/src/components/Select/SelectOption.figma.tsx +36 -0
  181. package/src/components/Spinner/Spinner.figma.tsx +20 -12
  182. package/src/components/Switch/Switch.figma.tsx +31 -23
  183. package/src/components/Tabs/Tab.tsx +5 -5
  184. package/src/components/Tabs/Tabs.figma.tsx +29 -0
  185. package/src/components/ThemedImage/ThemedImage.stories.tsx +1 -1
  186. package/src/components/Toast/ToastItem.figma.tsx +22 -0
  187. package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
  188. package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
  189. package/src/components/UnstyledIconButton/UnstyledIconButton.figma.tsx +49 -0
  190. package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +1 -1
  191. package/src/components/VerificationInput/VerificationInput.docs.mdx +68 -0
  192. package/src/components/VerificationInput/VerificationInput.props.ts +52 -0
  193. package/src/components/VerificationInput/VerificationInput.stories.tsx +140 -0
  194. package/src/components/VerificationInput/VerificationInput.tsx +89 -0
  195. package/src/components/VerificationInput/VerificationInputSlot.tsx +94 -0
  196. package/src/components/VerificationInput/index.ts +5 -0
  197. package/src/components/VerificationInput/useVerificationInput.ts +72 -0
  198. package/src/components/index.ts +1 -0
  199. package/src/utils/index.ts +2 -1
  200. package/src/utils/isThemedImageProps.ts +8 -0
  201. package/src/components/Checkbox/CheckboxIndicator.figma.tsx +0 -19
  202. package/src/components/Radio/RadioIndicator.figma.tsx +0 -21
@@ -0,0 +1,14 @@
1
+ import { NativeSyntheticEvent, TextInput, TextInputKeyPressEventData } from 'react-native';
2
+ interface UseVerificationInputProps {
3
+ value: string;
4
+ onChangeText?: (text: string) => void;
5
+ }
6
+ export declare const useVerificationInput: ({ value, onChangeText }: UseVerificationInputProps) => {
7
+ inputRefs: import("react").RefObject<(TextInput | null)[]>;
8
+ focusedIndex: number | null;
9
+ handleFocus: (index: number) => void;
10
+ handleBlur: () => void;
11
+ handleChangeText: (text: string, index: number) => void;
12
+ handleKeyPress: (e: NativeSyntheticEvent<TextInputKeyPressEventData>, index: number) => void;
13
+ };
14
+ export {};
@@ -0,0 +1,58 @@
1
+ import { useRef, useState } from 'react';
2
+ export const useVerificationInput = ({ value, onChangeText }) => {
3
+ const length = 6;
4
+ const inputRefs = useRef([]);
5
+ const [focusedIndex, setFocusedIndex] = useState(null);
6
+ const handleFocus = (index) => {
7
+ setFocusedIndex(index);
8
+ };
9
+ const handleBlur = () => {
10
+ setFocusedIndex(null);
11
+ };
12
+ const handleChangeText = (text, index) => {
13
+ // Break down the text into an array of characters
14
+ const chars = Array(length).fill('');
15
+ for (let i = 0; i < value.length && i < length; i++) {
16
+ chars[i] = value[i];
17
+ }
18
+ if (text.length > 1) {
19
+ // Handle paste
20
+ const pastedChars = text.slice(0, length - index).split('');
21
+ for (let i = 0; i < pastedChars.length; i++) {
22
+ chars[index + i] = pastedChars[i];
23
+ }
24
+ const nextIndex = Math.min(index + pastedChars.length, length - 1);
25
+ inputRefs.current[nextIndex]?.focus();
26
+ }
27
+ else {
28
+ // Handle single char input
29
+ chars[index] = text;
30
+ if (text.length === 1 && index < length - 1) {
31
+ inputRefs.current[index + 1]?.focus();
32
+ }
33
+ }
34
+ onChangeText?.(chars.join(''));
35
+ };
36
+ const handleKeyPress = (e, index) => {
37
+ if (e.nativeEvent.key === 'Backspace') {
38
+ if (!value[index] && index > 0) {
39
+ e.preventDefault();
40
+ inputRefs.current[index - 1]?.focus();
41
+ const chars = Array(length).fill('');
42
+ for (let i = 0; i < value.length && i < length; i++) {
43
+ chars[i] = value[i];
44
+ }
45
+ chars[index - 1] = '';
46
+ onChangeText?.(chars.join(''));
47
+ }
48
+ }
49
+ };
50
+ return {
51
+ inputRefs,
52
+ focusedIndex,
53
+ handleFocus,
54
+ handleBlur,
55
+ handleChangeText,
56
+ handleKeyPress,
57
+ };
58
+ };
@@ -53,6 +53,7 @@ export * from './Textarea';
53
53
  export * from './ThemedImage';
54
54
  export * from './Toast';
55
55
  export * from './ToggleButtonCard';
56
+ export * from './VerificationInput';
56
57
  export { FlatList, Image, KeyboardAvoidingView, ScrollView, SectionList, View } from 'react-native';
57
58
  export { Pressable } from 'react-native';
58
59
  export { createIcon } from '@gluestack-ui/icon';
@@ -54,6 +54,7 @@ export * from './Textarea';
54
54
  export * from './ThemedImage';
55
55
  export * from './Toast';
56
56
  export * from './ToggleButtonCard';
57
+ export * from './VerificationInput';
57
58
  export { FlatList, Image, KeyboardAvoidingView, ScrollView, SectionList, View } from 'react-native';
58
59
  export { Pressable } from 'react-native';
59
60
  export { createIcon } from '@gluestack-ui/icon';
@@ -1,9 +1,10 @@
1
1
  export { default as coloursAsArray, extractLightColorValues } from './coloursAsArray';
2
2
  export { default as formatThousands } from './formatThousands';
3
3
  export { default as getFlattenedColorValue } from './getFlattenedColorValue';
4
+ export { getInitials } from './getInitials';
4
5
  export { default as getStyleValue } from './getStyleValue';
5
6
  export { default as hexWithOpacity } from './hexWithOpacity';
6
- export { getInitials } from './getInitials';
7
7
  export { default as isEqual } from './isEqual';
8
+ export { default as isThemedImageProps } from './isThemedImageProps';
8
9
  export * from './styleUtils';
9
10
  export * from './themeValueHelpers';
@@ -1,9 +1,10 @@
1
1
  export { default as coloursAsArray, extractLightColorValues } from './coloursAsArray';
2
2
  export { default as formatThousands } from './formatThousands';
3
3
  export { default as getFlattenedColorValue } from './getFlattenedColorValue';
4
+ export { getInitials } from './getInitials';
4
5
  export { default as getStyleValue } from './getStyleValue';
5
6
  export { default as hexWithOpacity } from './hexWithOpacity';
6
- export { getInitials } from './getInitials';
7
7
  export { default as isEqual } from './isEqual';
8
+ export { default as isThemedImageProps } from './isThemedImageProps';
8
9
  export * from './styleUtils';
9
10
  export * from './themeValueHelpers';
@@ -0,0 +1,4 @@
1
+ import { ImageProps } from 'react-native';
2
+ import { ThemedImageProps } from 'src/components';
3
+ declare const isThemedImageProps: (props: ThemedImageProps | ImageProps) => props is ThemedImageProps;
4
+ export default isThemedImageProps;
@@ -0,0 +1,4 @@
1
+ const isThemedImageProps = (props) => {
2
+ return 'light' in props && 'dark' in props;
3
+ };
4
+ export default isThemedImageProps;
@@ -94,6 +94,7 @@ import {
94
94
  ToggleButtonCardGroup,
95
95
  UL,
96
96
  useColorMode,
97
+ VerificationInput,
97
98
  } from '../../src';
98
99
  import { addReactNativePrefix } from '../heplers';
99
100
 
@@ -821,6 +822,14 @@ const AllComponents: React.FC = () => {
821
822
  </UL>
822
823
  </Center>
823
824
  </ComponentWrapper>
825
+ <ComponentWrapper
826
+ name="Verification Input"
827
+ link="/?path=/docs/forms-verificationinput--docs"
828
+ >
829
+ <Center flex={1} padding="200">
830
+ <VerificationInput onChangeText={() => {}} />
831
+ </Center>
832
+ </ComponentWrapper>
824
833
  </Flex>
825
834
  </ScrollView>
826
835
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilitywarehouse/hearth-react-native",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Utility Warehouse React Native UI library",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -24,20 +24,19 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
27
- "@chromatic-com/storybook": "^4.1.2",
28
- "@figma/code-connect": "^1.3.3",
27
+ "@chromatic-com/storybook": "^4.1.3",
28
+ "@figma/code-connect": "^1.3.11",
29
29
  "@gorhom/bottom-sheet": "5.2.6",
30
- "@storybook/addon-a11y": "^10.0.5",
31
- "@storybook/addon-docs": "^10.0.5",
32
- "@storybook/addon-vitest": "^10.0.5",
33
- "@storybook/react": "^10.0.5",
34
- "@storybook/react-native-web-vite": "^10.0.5",
30
+ "@storybook/addon-a11y": "^10.1.4",
31
+ "@storybook/addon-docs": "^10.1.4",
32
+ "@storybook/addon-vitest": "^10.1.4",
33
+ "@storybook/react-native-web-vite": "^10.1.4",
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
38
  "chromatic": "^13.3.0",
40
- "eslint-plugin-storybook": "10.0.5",
39
+ "eslint-plugin-storybook": "10.1.4",
41
40
  "playwright": "^1.55.1",
42
41
  "prismjs": "^1.30.0",
43
42
  "react": "^19.1.0",
@@ -51,16 +50,16 @@
51
50
  "react-native-web": "^0.20.0",
52
51
  "react-native-worklets": "^0.6.1",
53
52
  "remark-gfm": "^4.0.1",
54
- "storybook": "^10.0.5",
53
+ "storybook": "^10.1.4",
55
54
  "typescript": "^5.7.3",
56
55
  "vite": "^7.1.3",
57
56
  "vite-plugin-svgr": "^4.5.0",
58
57
  "vitest": "^3.2.4",
59
58
  "@utilitywarehouse/hearth-fonts": "^0.0.4",
60
- "@utilitywarehouse/hearth-react-icons": "^0.7.4",
61
59
  "@utilitywarehouse/hearth-react-native-icons": "^0.7.4",
60
+ "@utilitywarehouse/hearth-react-icons": "^0.7.4",
62
61
  "@utilitywarehouse/hearth-svg-assets": "^0.2.0",
63
- "@utilitywarehouse/hearth-tokens": "^0.2.0"
62
+ "@utilitywarehouse/hearth-tokens": "^0.2.2"
64
63
  },
65
64
  "peerDependencies": {
66
65
  "@gorhom/bottom-sheet": "^5.0.0",
@@ -0,0 +1,23 @@
1
+ import React from "react"
2
+ import Accordion from "./Accordion"
3
+ import figma from "@figma/code-connect"
4
+
5
+ /**
6
+ * -- This file was auto-generated by Code Connect --
7
+ * None of your props could be automatically mapped to Figma properties.
8
+ * You should update the `props` object to include a mapping from your
9
+ * code props to Figma properties, and update the `example` function to
10
+ * return the code example you'd like to see in Figma
11
+ */
12
+
13
+ figma.connect(
14
+ Accordion,
15
+ "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3385%3A7751",
16
+ {
17
+ props: {
18
+ // No matching props could be found for these Figma properties:
19
+ // "sectionHeader": figma.boolean('Section header?')
20
+ },
21
+ example: (props) => <Accordion />,
22
+ },
23
+ )
@@ -0,0 +1,47 @@
1
+ import React from "react"
2
+ import AccordionItemRoot from "./AccordionItemRoot"
3
+ import figma from "@figma/code-connect"
4
+
5
+ /**
6
+ * -- This file was auto-generated by Code Connect --
7
+ * `props` includes a mapping from your code props to Figma properties.
8
+ * You should check this is correct, and update the `example` function
9
+ * to return the code example you'd like to see in Figma
10
+ */
11
+
12
+ figma.connect(
13
+ AccordionItemRoot,
14
+ "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3390%3A6160",
15
+ {
16
+ props: {
17
+ // These props were automatically mapped based on your linked code:
18
+ disabled: figma.enum("State", {
19
+ Active: true,
20
+ }),
21
+ title: figma.string("Title"),
22
+ expanded: figma.boolean("Expand?"),
23
+ triggerContent: figma.instance("Trigger custom content"),
24
+ collapsable: figma.boolean("Expand?"),
25
+ focusable: figma.enum("State", {
26
+ Focus: true,
27
+ }),
28
+ // No matching props could be found for these Figma properties:
29
+ // "customContent": figma.boolean('Custom content?'),
30
+ // "title": figma.string('Title'),
31
+ // "description": figma.string('Description'),
32
+ // "customContent": figma.instance('Custom content'),
33
+ // "triggerCustomContent": figma.instance('Trigger custom content'),
34
+ // "triggerCustomContent": figma.boolean('Trigger custom content?')
35
+ },
36
+ example: (props) => (
37
+ <AccordionItemRoot
38
+ disabled={props.disabled}
39
+ title={props.title}
40
+ expanded={props.expanded}
41
+ triggerContent={props.triggerContent}
42
+ collapsable={props.collapsable}
43
+ focusable={props.focusable}
44
+ />
45
+ ),
46
+ },
47
+ )
@@ -31,7 +31,7 @@ const styles = StyleSheet.create(theme => ({
31
31
  _hover: {
32
32
  backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
33
33
  },
34
- '_focus-visible': theme.helpers.focusVisible,
34
+ // '_focus-visible': theme.helpers.focusVisible,
35
35
  _active: {
36
36
  backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
37
37
  },
@@ -0,0 +1,47 @@
1
+ import figma from '@figma/code-connect';
2
+ import { Alert } from './';
3
+
4
+ figma.connect(Alert, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3288%3A4656', {
5
+ links: [
6
+ {
7
+ name: 'Engineering Docs',
8
+ url: 'https://hearth.prod.uw.systems/react-native/?path=/docs/components-alert--docs',
9
+ },
10
+ ],
11
+ props: {
12
+ colorScheme: figma.enum('Color Scheme', {
13
+ Info: 'info',
14
+ Positive: 'positive',
15
+ Warning: 'warning',
16
+ Danger: 'danger',
17
+ }),
18
+ iconButton: figma.boolean('Icon button?', {
19
+ true: () => console.log('icon button pressed'),
20
+ false: undefined,
21
+ }),
22
+ text: figma.string('Text'),
23
+ close: figma.boolean('Close?', {
24
+ true: () => console.log('close'),
25
+ false: undefined,
26
+ }),
27
+ title: figma.string('Title'),
28
+ showLink: figma.boolean('Link?', {
29
+ true: () => console.log('link pressed'),
30
+ false: undefined,
31
+ }),
32
+ link: figma.nestedProps('Link', {
33
+ text: figma.string('Text'),
34
+ }),
35
+ },
36
+ example: props => (
37
+ <Alert
38
+ colorScheme={props.colorScheme}
39
+ title={props.title}
40
+ text={props.text}
41
+ onClose={props.close}
42
+ onPressIconButton={props.iconButton}
43
+ link={props.link.text}
44
+ onPressLink={props.showLink}
45
+ />
46
+ ),
47
+ });
@@ -0,0 +1,33 @@
1
+ import React from "react"
2
+ import Avatar from "./Avatar"
3
+ import figma from "@figma/code-connect"
4
+
5
+ /**
6
+ * -- This file was auto-generated by Code Connect --
7
+ * `props` includes a mapping from your code props to Figma properties.
8
+ * You should check this is correct, and update the `example` function
9
+ * to return the code example you'd like to see in Figma
10
+ */
11
+
12
+ figma.connect(
13
+ Avatar,
14
+ "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6790%3A14313",
15
+ {
16
+ props: {
17
+ // These props were automatically mapped based on your linked code:
18
+ size: figma.enum("Size", {
19
+ "SM-32": "sm",
20
+ "MD-48": "md",
21
+ }),
22
+ // No matching props could be found for these Figma properties:
23
+ // "initials": figma.string('Initials'),
24
+ // "image": figma.instance('Image'),
25
+ // "variant": figma.enum('Variant', {
26
+ // "Image": "image",
27
+ // "Initials": "initials",
28
+ // "Icon": "icon"
29
+ // })
30
+ },
31
+ example: (props) => <Avatar size={props.size} />,
32
+ },
33
+ )
@@ -1,32 +1,56 @@
1
- import { Badge } from './';
2
- import figma from '@figma/code-connect';
1
+ import React from "react"
2
+ import Badge from "./Badge"
3
+ import figma from "@figma/code-connect"
4
+
5
+ /**
6
+ * -- This file was auto-generated by Code Connect --
7
+ * `props` includes a mapping from your code props to Figma properties.
8
+ * You should check this is correct, and update the `example` function
9
+ * to return the code example you'd like to see in Figma
10
+ */
3
11
 
4
12
  figma.connect(
5
13
  Badge,
6
- 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components-%26-Tokens?node-id=61-652&t=8rlYQ45xy8j75vwM-4',
14
+ "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=61%3A652",
7
15
  {
8
- links: [
9
- {
10
- name: 'Storybook - Docs',
11
- url: 'https://uw-hearth-react-native.vercel.app/?path=/docs/components-badge--docs',
12
- },
13
- ],
14
16
  props: {
15
- text: figma.string('Text'),
16
- colorScheme: figma.enum('Color Scheme', {
17
- Blue: 'blue',
18
- Orange: 'orange',
19
- Green: 'green',
20
- Grey: 'grey',
21
- Red: 'red',
17
+ // These props were automatically mapped based on your linked code:
18
+ variant: figma.enum("Variant", {
19
+ "Subtle - Default": "subtle",
20
+ Emphasis: "emphasis",
21
+ Outline: "outline",
22
+ }),
23
+ colorScheme: figma.enum("Color Scheme", {
24
+ Info: "info",
25
+ Positive: "positive",
26
+ Danger: "danger",
27
+ Warning: "warning",
28
+ Functional: "functional",
29
+ Energy: "energy",
30
+ Broadband: "broadband",
31
+ Mobile: "mobile",
32
+ Insurance: "insurance",
33
+ Cashback: "cashback",
34
+ Pig: "pig",
35
+ Highlight: "highlight",
22
36
  }),
23
- variant: figma.enum('Variant', {
24
- Solid: 'solid',
25
- Outline: 'outline',
37
+ size: figma.enum("Size", {
38
+ "SM-24": "sm",
39
+ "MD-28": "md",
26
40
  }),
27
- flatBase: figma.boolean('Flat Base?'),
28
- icon: figma.instance('Icon'),
41
+ flatBase: figma.boolean("Flat Base?"),
42
+ // No matching props could be found for these Figma properties:
43
+ // "icon": figma.boolean('Icon?'),
44
+ // "icon20": figma.instance('Icon-20'),
45
+ // "text": figma.string('Text')
29
46
  },
30
- example: ({ text, ...props }) => <Badge {...props}>{text}</Badge>,
31
- }
32
- );
47
+ example: (props) => (
48
+ <Badge
49
+ variant={props.variant}
50
+ colorScheme={props.colorScheme}
51
+ size={props.size}
52
+ flatBase={props.flatBase}
53
+ />
54
+ ),
55
+ },
56
+ )
@@ -0,0 +1,11 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ const BannerContext = createContext<{ direction: 'horizontal' | 'vertical' }>({
4
+ direction: 'horizontal',
5
+ });
6
+
7
+ export const useBannerContext = () => {
8
+ return useContext(BannerContext);
9
+ };
10
+
11
+ export default BannerContext;
@@ -63,26 +63,39 @@ const MyComponent = () => (
63
63
 
64
64
  ## Props
65
65
 
66
- | Property | Type | Description | Default |
67
- | -------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------------- |
68
- | icon | `ComponentType` | Icon component to display (mutually exclusive with image/illustration) | `-` |
69
- | iconContainerVariant | `'subtle' \| 'emphasis'` | Icon container visual style | `'subtle'` |
70
- | iconContainerSize | `'sm' \| 'md' \| 'lg'` | Icon container size | `'md'` |
71
- | iconContainerColor | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | Icon container color scheme | `'pig'` |
72
- | illustration | `ThemedImageProps \| ImageProps` | Themed illustration object (mutually exclusive with icon/image) | `-` |
73
- | image | `ThemedImageProps \| ImageProps` | Themed image object (mutually exclusive with icon/illustration) | `-` |
74
- | heading | `string` | Heading text | `-` (required) |
75
- | description | `string` | Description text | `-` (required) |
76
- | direction | `'horizontal' \| 'vertical'` | Layout direction for icon/image and content | `'horizontal'` |
77
- | link | `ReactNode` | Link element to display | `-` |
78
- | button | `ReactNode` | Button element to display | `-` |
79
- | onPress | `() => void` | Makes the entire banner pressable (shows chevron) | `-` |
80
- | onClose | `() => void` | Shows close button with handler | `-` |
81
- | variant | `'subtle' \| 'emphasis'` | Card visual style variant | `'subtle'` |
82
- | colorScheme | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | Color scheme for buttons | `'pig'` |
66
+ | Property | Type | Description | Default |
67
+ | -------------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -------------- |
68
+ | icon | `ComponentType` | Icon component to display (mutually exclusive with image/illustration) | `-` |
69
+ | iconContainerVariant | `'subtle' \| 'emphasis'` | Icon container visual style | `'subtle'` |
70
+ | iconContainerSize | `'sm' \| 'md' \| 'lg'` | Icon container size | `'md'` |
71
+ | iconContainerColor | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | Icon container color scheme | `'pig'` |
72
+ | illustration | `ReactNode` | The illustration element to render (mutually exclusive with icon/image) | `-` |
73
+ | image | `ReactNode` | The image element to render (mutually exclusive with icon/illustration) | `-` |
74
+ | heading | `string` | Heading text | `-` (required) |
75
+ | description | `string` | Description text | `-` (required) |
76
+ | direction | `'horizontal' \| 'vertical'` | Layout direction for icon/image and content | `'horizontal'` |
77
+ | link | `ReactNode` | Link element to display | `-` |
78
+ | button | `ReactNode` | Button element to display | `-` |
79
+ | onPress | `() => void` | Makes the entire banner pressable (shows chevron) | `-` |
80
+ | onClose | `() => void` | Shows close button with handler | `-` |
81
+ | variant | `'subtle' \| 'emphasis'` | Card visual style variant | `'subtle'` |
82
+ | colorScheme | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | Color scheme for buttons | `'pig'` |
83
83
 
84
84
  The component also accepts all standard Card props except `noPadding`, `space`, `gap`, `rowGap`, `columnGap`, `flexDirection`, `flexWrap`, `alignItems`, and `justifyContent`.
85
85
 
86
+ ### `BannerImage` & `BannerIllustration` Props
87
+
88
+ The `BannerImage` & `BannerIllustration` component can be used to display an image within the Banner. It accepts the following props:
89
+
90
+ | Property | Type | Description |
91
+ | --------- | --------------------- | ------------------------------------------------------------------------ |
92
+ | `source` | `ImageSourcePropType` | The source of the image to display |
93
+ | `light` | `ImageSourcePropType` | The source of the image to display in light mode (use instead of source) |
94
+ | `dark` | `ImageSourcePropType` | The source of the image to display in dark mode (use instead of source) |
95
+ | `...rest` | `ImageProps` | Additional props to pass to the underlying Image component |
96
+
97
+ For more details about the ThemedImage component used internally, refer to the [`ThemedImage` documentation](/docs/utility-components-themed-image--docs).
98
+
86
99
  ## Layout Options
87
100
 
88
101
  ### Horizontal Layout (Default)
@@ -153,22 +166,28 @@ Display a themed image that automatically switches between light and dark modes:
153
166
  <Canvas of={Stories.WithImage} />
154
167
 
155
168
  ```jsx
156
- import { Banner } from '@utilitywarehouse/hearth-react-native';
169
+ import { Banner, BannerImage } from '@utilitywarehouse/hearth-react-native';
157
170
 
158
171
  const MyComponent = () => (
159
172
  <>
160
173
  <Banner
161
- image={{
162
- source: { uri: 'https://example.com/image.jpg' },
163
- }}
174
+ image={
175
+ <BannerImage
176
+ source={{
177
+ uri: 'https://example.com/image.jpg',
178
+ }}
179
+ />
180
+ }
164
181
  heading="Featured Content"
165
182
  description="Discover amazing content curated just for you."
166
183
  />
167
184
  <Banner
168
- image={{
169
- light: { uri: 'https://example.com/light-image.jpg' },
170
- dark: { uri: 'https://example.com/dark-image.jpg' },
171
- }}
185
+ image={
186
+ <BannerImage
187
+ light={{ uri: 'https://example.com/light-image.jpg' }}
188
+ dark={{ uri: 'https://example.com/dark-image.jpg' }}
189
+ />
190
+ }
172
191
  heading="Featured Content"
173
192
  description="Discover amazing content curated just for you."
174
193
  />
@@ -183,18 +202,15 @@ Display a themed illustration that adapts to layout changes:
183
202
  <Canvas of={Stories.WithIllustration} />
184
203
 
185
204
  ```jsx
186
- import { Banner } from '@utilitywarehouse/hearth-react-native';
205
+ import { Banner, BannerIllustration } from '@utilitywarehouse/hearth-react-native';
187
206
  import SpotBillingDark from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-dark.svg';
188
207
  import SpotBillingLight from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-light.svg';
189
208
 
190
209
  const MyComponent = () => (
191
210
  <Banner
192
- illustration={{
193
- light: SpotBillingLight,
194
- dark: SpotBillingDark,
195
- width: 80,
196
- height: 80,
197
- }}
211
+ illustration={
212
+ <BannerIllustration light={SpotBillingLight} dark={SpotBillingDark} width={80} height={80} />
213
+ }
198
214
  heading="Featured Content"
199
215
  description="Discover amazing content curated just for you."
200
216
  />
@@ -358,7 +374,7 @@ Combine multiple features for rich interactive banners:
358
374
  <Canvas of={Stories.ComplexExample} />
359
375
 
360
376
  ```jsx
361
- import { Banner } from '@utilitywarehouse/hearth-react-native';
377
+ import { Banner, BannerImage } from '@utilitywarehouse/hearth-react-native';
362
378
  import { InsuranceMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
363
379
 
364
380
  const MyComponent = () => (
@@ -381,10 +397,12 @@ const MyComponent = () => (
381
397
 
382
398
  {/* Dismissible banner with link */}
383
399
  <Banner
384
- image={{
385
- light: { uri: 'https://example.com/light.jpg' },
386
- dark: { uri: 'https://example.com/dark.jpg' },
387
- }}
400
+ image={
401
+ <BannerImage
402
+ light={{ uri: 'https://example.com/light.jpg' }}
403
+ dark={{ uri: 'https://example.com/dark.jpg' }}
404
+ />
405
+ }
388
406
  heading="Exclusive Member Benefit"
389
407
  description="As a valued member, you now have access to premium features at no extra cost."
390
408
  variant="emphasis"
@@ -0,0 +1,15 @@
1
+ import figma from '@figma/code-connect';
2
+ import Banner from './Banner';
3
+
4
+ /**
5
+ * -- This file was auto-generated by Code Connect --
6
+ * None of your props could be automatically mapped to Figma properties.
7
+ * You should update the `props` object to include a mapping from your
8
+ * code props to Figma properties, and update the `example` function to
9
+ * return the code example you'd like to see in Figma
10
+ */
11
+
12
+ figma.connect(Banner, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=8294%3A3905', {
13
+ props: {},
14
+ example: props => <Banner heading={null} description={null} />,
15
+ });