@utilitywarehouse/hearth-react-native 0.12.0 → 0.14.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 (155) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +22 -0
  4. package/build/components/Accordion/AccordionTrigger.js +1 -1
  5. package/build/components/BodyText/index.d.ts +1 -0
  6. package/build/components/Checkbox/CheckboxGroup.context.d.ts +2 -0
  7. package/build/components/Checkbox/CheckboxGroup.js +5 -5
  8. package/build/components/Checkbox/CheckboxIndicator.js +3 -3
  9. package/build/components/Checkbox/CheckboxTextContent.js +0 -1
  10. package/build/components/Checkbox/CheckboxTileRoot.js +9 -1
  11. package/build/components/DatePicker/DatePickerDay.js +3 -3
  12. package/build/components/FormField/FormField.d.ts +5 -5
  13. package/build/components/List/List.context.d.ts +2 -0
  14. package/build/components/List/List.context.js +2 -0
  15. package/build/components/List/List.js +19 -15
  16. package/build/components/List/ListAction/ListAction.js +3 -2
  17. package/build/components/List/ListAction/ListAction.props.d.ts +0 -1
  18. package/build/components/List/ListItem/ListItem.props.d.ts +4 -1
  19. package/build/components/List/ListItem/ListItemHeading.d.ts +13 -0
  20. package/build/components/List/ListItem/ListItemHeading.js +12 -0
  21. package/build/components/List/ListItem/ListItemHelperText.d.ts +2 -2
  22. package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
  23. package/build/components/List/ListItem/ListItemRoot.js +7 -6
  24. package/build/components/List/ListItem/index.d.ts +1 -1
  25. package/build/components/List/ListItem/index.js +1 -1
  26. package/build/components/PillGroup/Pill.js +2 -2
  27. package/build/components/Radio/RadioGroup.context.d.ts +2 -0
  28. package/build/components/Radio/RadioGroup.js +1 -1
  29. package/build/components/Radio/RadioIndicator.js +3 -3
  30. package/build/components/Radio/RadioTextContent.js +0 -1
  31. package/build/components/Radio/RadioTileRoot.js +9 -1
  32. package/build/components/RadioCard/RadioCardIndicator.js +3 -3
  33. package/build/components/RadioCard/RadioCardRoot.js +3 -3
  34. package/build/components/Tabs/Tab.js +5 -5
  35. package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
  36. package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
  37. package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
  38. package/build/components/VerificationInput/VerificationInput.d.ts +6 -0
  39. package/build/components/VerificationInput/VerificationInput.js +35 -0
  40. package/build/components/VerificationInput/VerificationInput.props.d.ts +49 -0
  41. package/build/components/VerificationInput/VerificationInput.props.js +1 -0
  42. package/build/components/VerificationInput/VerificationInputSlot.d.ts +9 -0
  43. package/build/components/VerificationInput/VerificationInputSlot.js +72 -0
  44. package/build/components/VerificationInput/index.d.ts +4 -0
  45. package/build/components/VerificationInput/index.js +3 -0
  46. package/build/components/VerificationInput/useVerificationInput.d.ts +14 -0
  47. package/build/components/VerificationInput/useVerificationInput.js +58 -0
  48. package/build/components/index.d.ts +1 -0
  49. package/build/components/index.js +1 -0
  50. package/docs/components/AllComponents.web.tsx +9 -0
  51. package/package.json +10 -11
  52. package/src/components/Accordion/Accordion.figma.tsx +23 -0
  53. package/src/components/Accordion/AccordionItemRoot.figma.tsx +47 -0
  54. package/src/components/Accordion/AccordionTrigger.tsx +1 -1
  55. package/src/components/Alert/Alert.figma.tsx +47 -0
  56. package/src/components/Avatar/Avatar.figma.tsx +33 -0
  57. package/src/components/Badge/Badge.figma.tsx +48 -24
  58. package/src/components/Banner/Banner.figma.tsx +15 -0
  59. package/src/components/Banner/BannerIllustration.figma.tsx +30 -0
  60. package/src/components/BodyText/index.ts +1 -0
  61. package/src/components/BottomSheet/BottomSheetModal.figma.tsx +20 -0
  62. package/src/components/Button/Button.figma.tsx +60 -229
  63. package/src/components/Card/Card.figma.tsx +43 -71
  64. package/src/components/Card/CardAction/CardAction.figma.tsx +44 -0
  65. package/src/components/Card/CardAction/CardAction.stories.tsx +1 -1
  66. package/src/components/Carousel/Carousel.figma.tsx +19 -0
  67. package/src/components/Checkbox/Checkbox.figma.tsx +26 -41
  68. package/src/components/Checkbox/CheckboxGroup.context.ts +1 -0
  69. package/src/components/Checkbox/CheckboxGroup.figma.tsx +20 -0
  70. package/src/components/Checkbox/CheckboxGroup.tsx +7 -8
  71. package/src/components/Checkbox/CheckboxImage.figma.tsx +27 -0
  72. package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
  73. package/src/components/Checkbox/CheckboxTextContent.tsx +0 -1
  74. package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +32 -0
  75. package/src/components/Checkbox/CheckboxTileRoot.tsx +9 -1
  76. package/src/components/CurrencyInput/CurrencyInput.figma.tsx +56 -0
  77. package/src/components/DateInput/DateInput.figma.tsx +75 -0
  78. package/src/components/DatePicker/DatePickerCalendar.figma.tsx +34 -0
  79. package/src/components/DatePicker/DatePickerDay.tsx +3 -3
  80. package/src/components/DatePickerInput/DatePickerInput.figma.tsx +62 -0
  81. package/src/components/DescriptionList/DescriptionList.figma.tsx +23 -0
  82. package/src/components/Divider/Divider.figma.tsx +23 -18
  83. package/src/components/ExpandableCard/ExpandableCard.figma.tsx +54 -0
  84. package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +23 -0
  85. package/src/components/FormField/FormField.figma.tsx +23 -0
  86. package/src/components/Helper/HelperText.figma.tsx +23 -0
  87. package/src/components/IconButton/IconButton.figma.tsx +55 -161
  88. package/src/components/IconContainer/IconContainer.figma.tsx +50 -0
  89. package/src/components/InlineLink/InlineLink.figma.tsx +33 -0
  90. package/src/components/Input/Input.figma.tsx +52 -110
  91. package/src/components/Label/Label.figma.tsx +24 -0
  92. package/src/components/Link/Link.figma.tsx +42 -0
  93. package/src/components/List/List.context.ts +4 -0
  94. package/src/components/List/List.docs.mdx +30 -24
  95. package/src/components/List/List.figma.tsx +29 -108
  96. package/src/components/List/List.stories.tsx +26 -1
  97. package/src/components/List/List.tsx +26 -19
  98. package/src/components/List/ListAction/ListAction.figma.tsx +29 -0
  99. package/src/components/List/ListAction/ListAction.props.ts +0 -1
  100. package/src/components/List/ListAction/ListAction.tsx +3 -2
  101. package/src/components/List/ListItem/ListItem.figma.tsx +40 -220
  102. package/src/components/List/ListItem/ListItem.props.ts +4 -1
  103. package/src/components/List/ListItem/ListItemHeading.tsx +20 -0
  104. package/src/components/List/ListItem/ListItemHelperText.tsx +2 -3
  105. package/src/components/List/ListItem/ListItemLeadingContent.figma.tsx +29 -0
  106. package/src/components/List/ListItem/ListItemRoot.tsx +11 -6
  107. package/src/components/List/ListItem/ListItemTrailingContent.figma.tsx +27 -0
  108. package/src/components/List/ListItem/index.ts +1 -1
  109. package/src/components/Menu/Menu.figma.tsx +30 -0
  110. package/src/components/Menu/MenuItem.figma.tsx +31 -0
  111. package/src/components/Modal/Modal.docs.mdx +23 -20
  112. package/src/components/Modal/Modal.figma.tsx +56 -0
  113. package/src/components/PillGroup/Pill.figma.tsx +25 -0
  114. package/src/components/PillGroup/Pill.tsx +3 -3
  115. package/src/components/PillGroup/PillGroup.figma.tsx +21 -0
  116. package/src/components/ProgressStepper/ProgressStep.figma.tsx +30 -0
  117. package/src/components/ProgressStepper/ProgressStepper.figma.tsx +20 -0
  118. package/src/components/Radio/Radio.figma.tsx +22 -42
  119. package/src/components/Radio/Radio.stories.tsx +24 -0
  120. package/src/components/Radio/RadioGroup.context.ts +1 -0
  121. package/src/components/Radio/RadioGroup.figma.tsx +54 -0
  122. package/src/components/Radio/RadioGroup.tsx +2 -2
  123. package/src/components/Radio/RadioImage.figma.tsx +27 -0
  124. package/src/components/Radio/RadioIndicator.tsx +3 -3
  125. package/src/components/Radio/RadioTextContent.tsx +0 -1
  126. package/src/components/Radio/RadioTileRoot.figma.tsx +31 -0
  127. package/src/components/Radio/RadioTileRoot.tsx +9 -1
  128. package/src/components/RadioCard/RadioCardIndicator.tsx +3 -3
  129. package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
  130. package/src/components/SectionHeader/SectionHeader.figma.tsx +30 -16
  131. package/src/components/Select/Select.figma.tsx +55 -0
  132. package/src/components/Select/SelectOption.figma.tsx +36 -0
  133. package/src/components/Spinner/Spinner.figma.tsx +20 -12
  134. package/src/components/Switch/Switch.figma.tsx +31 -23
  135. package/src/components/Tabs/Tab.tsx +5 -5
  136. package/src/components/Tabs/Tabs.figma.tsx +29 -0
  137. package/src/components/ThemedImage/ThemedImage.stories.tsx +1 -1
  138. package/src/components/Toast/ToastItem.figma.tsx +22 -0
  139. package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
  140. package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
  141. package/src/components/UnstyledIconButton/UnstyledIconButton.figma.tsx +49 -0
  142. package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +1 -1
  143. package/src/components/VerificationInput/VerificationInput.docs.mdx +68 -0
  144. package/src/components/VerificationInput/VerificationInput.props.ts +52 -0
  145. package/src/components/VerificationInput/VerificationInput.stories.tsx +140 -0
  146. package/src/components/VerificationInput/VerificationInput.tsx +89 -0
  147. package/src/components/VerificationInput/VerificationInputSlot.tsx +94 -0
  148. package/src/components/VerificationInput/index.ts +5 -0
  149. package/src/components/VerificationInput/useVerificationInput.ts +72 -0
  150. package/src/components/index.ts +1 -0
  151. package/build/components/List/ListItem/ListItemText.d.ts +0 -6
  152. package/build/components/List/ListItem/ListItemText.js +0 -7
  153. package/src/components/Checkbox/CheckboxIndicator.figma.tsx +0 -19
  154. package/src/components/List/ListItem/ListItemText.tsx +0 -14
  155. package/src/components/Radio/RadioIndicator.figma.tsx +0 -21
@@ -0,0 +1,72 @@
1
+ import { useRef, useState } from 'react';
2
+ import { NativeSyntheticEvent, TextInput, TextInputKeyPressEventData } from 'react-native';
3
+
4
+ interface UseVerificationInputProps {
5
+ value: string;
6
+ onChangeText?: (text: string) => void;
7
+ }
8
+
9
+ export const useVerificationInput = ({ value, onChangeText }: UseVerificationInputProps) => {
10
+ const length = 6;
11
+ const inputRefs = useRef<(TextInput | null)[]>([]);
12
+ const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
13
+
14
+ const handleFocus = (index: number) => {
15
+ setFocusedIndex(index);
16
+ };
17
+
18
+ const handleBlur = () => {
19
+ setFocusedIndex(null);
20
+ };
21
+
22
+ const handleChangeText = (text: string, index: number) => {
23
+ // Break down the text into an array of characters
24
+ const chars = Array(length).fill('');
25
+ for (let i = 0; i < value.length && i < length; i++) {
26
+ chars[i] = value[i];
27
+ }
28
+
29
+ if (text.length > 1) {
30
+ // Handle paste
31
+ const pastedChars = text.slice(0, length - index).split('');
32
+ for (let i = 0; i < pastedChars.length; i++) {
33
+ chars[index + i] = pastedChars[i];
34
+ }
35
+ const nextIndex = Math.min(index + pastedChars.length, length - 1);
36
+ inputRefs.current[nextIndex]?.focus();
37
+ } else {
38
+ // Handle single char input
39
+ chars[index] = text;
40
+ if (text.length === 1 && index < length - 1) {
41
+ inputRefs.current[index + 1]?.focus();
42
+ }
43
+ }
44
+
45
+ onChangeText?.(chars.join(''));
46
+ };
47
+
48
+ const handleKeyPress = (e: NativeSyntheticEvent<TextInputKeyPressEventData>, index: number) => {
49
+ if (e.nativeEvent.key === 'Backspace') {
50
+ if (!value[index] && index > 0) {
51
+ e.preventDefault();
52
+ inputRefs.current[index - 1]?.focus();
53
+
54
+ const chars = Array(length).fill('');
55
+ for (let i = 0; i < value.length && i < length; i++) {
56
+ chars[i] = value[i];
57
+ }
58
+ chars[index - 1] = '';
59
+ onChangeText?.(chars.join(''));
60
+ }
61
+ }
62
+ };
63
+
64
+ return {
65
+ inputRefs,
66
+ focusedIndex,
67
+ handleFocus,
68
+ handleBlur,
69
+ handleChangeText,
70
+ handleKeyPress,
71
+ };
72
+ };
@@ -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
 
58
59
  export { FlatList, Image, KeyboardAvoidingView, ScrollView, SectionList, View } from 'react-native';
59
60
 
@@ -1,6 +0,0 @@
1
- import { TextProps } from 'react-native';
2
- declare const ListItemText: {
3
- ({ children, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
4
- displayName: string;
5
- };
6
- export default ListItemText;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { BodyText } from '../../BodyText';
3
- const ListItemText = ({ children, ...props }) => {
4
- return (_jsx(BodyText, { size: "lg", ...props, children: children }));
5
- };
6
- ListItemText.displayName = 'ListItemText';
7
- export default ListItemText;
@@ -1,19 +0,0 @@
1
- import { Checkbox } from './';
2
- import figma from '@figma/code-connect';
3
-
4
- const value = 'some-value';
5
- const setValue = (isChecked: boolean) => console.log(isChecked);
6
-
7
- figma.connect(
8
- Checkbox,
9
- 'https://www.figma.com/design/3RY3OvLA88yZksRjOfjQJm/UW-App-UI?node-id=4454-3759&m=dev',
10
- {
11
- props: {
12
- checked: figma.boolean('checked'),
13
- disabled: figma.boolean('disabled'),
14
- },
15
- example: ({ disabled, checked }) => (
16
- <Checkbox value={value} onChange={setValue} disabled={disabled} checked={checked} />
17
- ),
18
- }
19
- );
@@ -1,14 +0,0 @@
1
- import { TextProps } from 'react-native';
2
- import { BodyText } from '../../BodyText';
3
-
4
- const ListItemText = ({ children, ...props }: TextProps) => {
5
- return (
6
- <BodyText size="lg" {...props}>
7
- {children}
8
- </BodyText>
9
- );
10
- };
11
-
12
- ListItemText.displayName = 'ListItemText';
13
-
14
- export default ListItemText;
@@ -1,21 +0,0 @@
1
- import { Radio, RadioGroup } from './';
2
- import figma from '@figma/code-connect';
3
-
4
- const value = 'some-value';
5
- const setValue = (value: string) => console.log(value);
6
-
7
- figma.connect(
8
- Radio,
9
- 'https://www.figma.com/design/3RY3OvLA88yZksRjOfjQJm/UW-App-UI?node-id=4461-7535&m=dev',
10
- {
11
- props: {
12
- checked: figma.boolean('checked', { true: 'some-value', false: undefined }),
13
- disabled: figma.boolean('disabled'),
14
- },
15
- example: ({ disabled, checked }) => (
16
- <RadioGroup value={checked} onChange={setValue}>
17
- <Radio value={value} disabled={disabled} />
18
- </RadioGroup>
19
- ),
20
- }
21
- );