@utilitywarehouse/hearth-react-native 0.18.0 → 0.19.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.
Files changed (147) hide show
  1. package/.storybook/preview.tsx +1 -0
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.turbo/turbo-lint.log +24 -21
  4. package/CHANGELOG.md +128 -0
  5. package/build/components/Banner/Banner.d.ts +1 -1
  6. package/build/components/Banner/Banner.js +24 -4
  7. package/build/components/Banner/Banner.props.d.ts +1 -6
  8. package/build/components/Box/Box.props.d.ts +5 -2
  9. package/build/components/Button/Button.d.ts +2 -0
  10. package/build/components/Button/ButtonGroupRoot.d.ts +5 -1
  11. package/build/components/Button/ButtonGroupRoot.js +3 -3
  12. package/build/components/Card/Card.context.d.ts +1 -1
  13. package/build/components/Card/Card.props.d.ts +2 -0
  14. package/build/components/Card/CardContent.js +3 -3
  15. package/build/components/Card/CardRoot.d.ts +1 -1
  16. package/build/components/Card/CardRoot.js +14 -4
  17. package/build/components/Checkbox/CheckboxGroupTextContent.js +1 -1
  18. package/build/components/Checkbox/CheckboxTextContent.js +1 -1
  19. package/build/components/Container/Container.d.ts +1 -1
  20. package/build/components/Container/Container.js +3 -3
  21. package/build/components/Container/Container.props.d.ts +5 -0
  22. package/build/components/Divider/Divider.d.ts +1 -1
  23. package/build/components/Divider/Divider.js +19 -19
  24. package/build/components/Divider/Divider.props.d.ts +6 -0
  25. package/build/components/ExpandableCard/ExpandableCardExpandedContent.js +1 -1
  26. package/build/components/Flex/Flex.d.ts +1 -1
  27. package/build/components/Flex/Flex.js +3 -3
  28. package/build/components/Flex/Flex.props.d.ts +5 -0
  29. package/build/components/Grid/Grid.d.ts +1 -1
  30. package/build/components/Grid/Grid.js +4 -4
  31. package/build/components/Grid/Grid.props.d.ts +5 -0
  32. package/build/components/Menu/Menu.d.ts +1 -1
  33. package/build/components/Menu/Menu.js +2 -2
  34. package/build/components/Menu/Menu.props.d.ts +2 -6
  35. package/build/components/Modal/Modal.d.ts +1 -1
  36. package/build/components/Modal/Modal.js +16 -6
  37. package/build/components/Modal/Modal.props.d.ts +1 -0
  38. package/build/components/Modal/Modal.web.d.ts +1 -1
  39. package/build/components/Modal/Modal.web.js +2 -2
  40. package/build/components/Radio/RadioGroupTextContent.js +1 -1
  41. package/build/components/Radio/RadioTextContent.js +1 -1
  42. package/build/components/Toast/Toast.context.d.ts +2 -4
  43. package/build/components/Toast/Toast.context.js +14 -2
  44. package/build/components/Toast/Toast.props.d.ts +4 -0
  45. package/build/components/Toast/ToastItem.js +5 -2
  46. package/build/components/VerificationInput/VerificationInput.d.ts +2 -5
  47. package/build/components/VerificationInput/VerificationInput.js +20 -7
  48. package/build/components/VerificationInput/VerificationInput.props.d.ts +10 -0
  49. package/build/components/VerificationInput/index.d.ts +1 -1
  50. package/build/components/VerificationInput/useVerificationInput.d.ts +1 -0
  51. package/build/components/VerificationInput/useVerificationInput.js +24 -9
  52. package/build/core/themes.d.ts +4 -4
  53. package/build/core/themes.js +1 -1
  54. package/build/types/values.d.ts +1 -1
  55. package/docs/changelog.mdx +687 -0
  56. package/docs/components/AllComponents.web.tsx +9 -9
  57. package/docs/layout-components.docs.mdx +3 -3
  58. package/package.json +7 -7
  59. package/scripts/copyChangelog.js +50 -0
  60. package/src/components/Alert/Alert.stories.tsx +1 -1
  61. package/src/components/Avatar/Avatar.stories.tsx +4 -5
  62. package/src/components/Badge/Badge.stories.tsx +3 -3
  63. package/src/components/Banner/Banner.docs.mdx +1 -1
  64. package/src/components/Banner/Banner.props.ts +13 -20
  65. package/src/components/Banner/Banner.stories.tsx +83 -15
  66. package/src/components/Banner/Banner.tsx +27 -3
  67. package/src/components/Box/Box.props.ts +11 -4
  68. package/src/components/Button/Button.docs.mdx +2 -2
  69. package/src/components/Button/Button.stories.tsx +4 -4
  70. package/src/components/Button/ButtonGroupRoot.tsx +8 -3
  71. package/src/components/Card/Card.context.ts +1 -1
  72. package/src/components/Card/Card.docs.mdx +1 -1
  73. package/src/components/Card/Card.props.ts +2 -0
  74. package/src/components/Card/Card.stories.tsx +9 -9
  75. package/src/components/Card/CardAction/CardAction.stories.tsx +2 -2
  76. package/src/components/Card/CardContent.tsx +3 -3
  77. package/src/components/Card/CardRoot.tsx +15 -5
  78. package/src/components/Checkbox/CheckboxGroupTextContent.tsx +2 -2
  79. package/src/components/Checkbox/CheckboxTextContent.tsx +1 -1
  80. package/src/components/Container/Container.docs.mdx +2 -2
  81. package/src/components/Container/Container.props.ts +5 -0
  82. package/src/components/Container/Container.stories.tsx +2 -2
  83. package/src/components/Container/Container.tsx +3 -3
  84. package/src/components/CurrencyInput/CurrencyInput.docs.mdx +1 -1
  85. package/src/components/CurrencyInput/CurrencyInput.stories.tsx +2 -2
  86. package/src/components/DateInput/DateInput.stories.tsx +3 -3
  87. package/src/components/DatePickerInput/DatePickerInput.stories.tsx +1 -1
  88. package/src/components/DescriptionList/DescriptionList.stories.tsx +1 -1
  89. package/src/components/Divider/Divider.docs.mdx +6 -6
  90. package/src/components/Divider/Divider.props.ts +6 -0
  91. package/src/components/Divider/Divider.tsx +19 -18
  92. package/src/components/ExpandableCard/ExpandableCardExpandedContent.tsx +1 -1
  93. package/src/components/Flex/Flex.docs.mdx +3 -3
  94. package/src/components/Flex/Flex.props.ts +5 -0
  95. package/src/components/Flex/Flex.stories.tsx +2 -2
  96. package/src/components/Flex/Flex.tsx +4 -3
  97. package/src/components/FormField/FormField.docs.mdx +1 -1
  98. package/src/components/FormField/FormField.stories.tsx +1 -1
  99. package/src/components/Grid/Grid.docs.mdx +5 -5
  100. package/src/components/Grid/Grid.props.ts +6 -0
  101. package/src/components/Grid/Grid.stories.tsx +8 -8
  102. package/src/components/Grid/Grid.tsx +4 -3
  103. package/src/components/HighlightBanner/HighlightBanner.docs.mdx +1 -1
  104. package/src/components/HighlightBanner/HighlightBanner.stories.tsx +2 -2
  105. package/src/components/Icon/Icon.docs.mdx +3 -3
  106. package/src/components/IconButton/IconButton.stories.tsx +5 -5
  107. package/src/components/IconContainer/IconContainer.docs.mdx +1 -1
  108. package/src/components/IconContainer/IconContainer.stories.tsx +3 -3
  109. package/src/components/IndicatorIconButton/IndicatorIconButton.stories.tsx +17 -9
  110. package/src/components/InlineLink/InlineLink.stories.tsx +2 -2
  111. package/src/components/Input/Input.stories.tsx +4 -4
  112. package/src/components/List/List.stories.tsx +1 -1
  113. package/src/components/Menu/Menu.docs.mdx +8 -5
  114. package/src/components/Menu/Menu.figma.tsx +27 -27
  115. package/src/components/Menu/Menu.props.ts +2 -6
  116. package/src/components/Menu/Menu.tsx +3 -6
  117. package/src/components/Menu/MenuItem.figma.tsx +26 -18
  118. package/src/components/Modal/Modal.docs.mdx +22 -21
  119. package/src/components/Modal/Modal.figma.tsx +58 -47
  120. package/src/components/Modal/Modal.props.ts +1 -0
  121. package/src/components/Modal/Modal.stories.tsx +4 -0
  122. package/src/components/Modal/Modal.tsx +20 -5
  123. package/src/components/Modal/Modal.web.tsx +2 -1
  124. package/src/components/PillGroup/PillGroup.stories.tsx +7 -7
  125. package/src/components/ProgressStepper/ProgressStepper.stories.tsx +7 -8
  126. package/src/components/Radio/Radio.stories.tsx +1 -1
  127. package/src/components/Radio/RadioGroup.stories.tsx +1 -1
  128. package/src/components/Radio/RadioGroupTextContent.tsx +2 -2
  129. package/src/components/Radio/RadioTextContent.tsx +1 -1
  130. package/src/components/SectionHeader/SectionHeader.stories.tsx +1 -1
  131. package/src/components/Switch/Switch.docs.mdx +8 -8
  132. package/src/components/Switch/Switch.stories.tsx +2 -2
  133. package/src/components/Tabs/Tabs.stories.tsx +1 -1
  134. package/src/components/Textarea/Textarea.docs.mdx +3 -3
  135. package/src/components/Toast/Toast.context.tsx +24 -3
  136. package/src/components/Toast/Toast.props.ts +5 -0
  137. package/src/components/Toast/Toast.stories.tsx +29 -0
  138. package/src/components/Toast/ToastItem.tsx +7 -2
  139. package/src/components/UnstyledIconButton/UnstyledIconButton.stories.tsx +5 -5
  140. package/src/components/VerificationInput/VerificationInput.docs.mdx +31 -8
  141. package/src/components/VerificationInput/VerificationInput.props.ts +11 -0
  142. package/src/components/VerificationInput/VerificationInput.stories.tsx +79 -3
  143. package/src/components/VerificationInput/VerificationInput.tsx +94 -62
  144. package/src/components/VerificationInput/index.ts +4 -2
  145. package/src/components/VerificationInput/useVerificationInput.ts +26 -10
  146. package/src/core/themes.ts +1 -1
  147. package/src/types/values.ts +1 -1
@@ -1,5 +1,11 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import { ViewProps } from 'react-native';
3
+ export interface VerificationInputHandle {
4
+ focus: () => void;
5
+ blur: () => void;
6
+ clear: () => void;
7
+ focusIndex: (index: number) => void;
8
+ }
3
9
  export interface VerificationInputProps extends ViewProps {
4
10
  /**
5
11
  * The value of the input.
@@ -49,5 +55,9 @@ export interface VerificationInputProps extends ViewProps {
49
55
  * Whether to obscure the text entry (e.g. for passwords/OTPs).
50
56
  */
51
57
  secureTextEntry?: boolean;
58
+ /**
59
+ * Whether the input should auto-focus when mounted.
60
+ */
61
+ autoFocus?: boolean;
52
62
  }
53
63
  export default VerificationInputProps;
@@ -1,4 +1,4 @@
1
1
  import VerificationInput from './VerificationInput';
2
2
  export { default as VerificationInput } from './VerificationInput';
3
- export type { default as VerificationInputProps } from './VerificationInput.props';
3
+ export type { VerificationInputHandle, default as VerificationInputProps, } from './VerificationInput.props';
4
4
  export default VerificationInput;
@@ -5,6 +5,7 @@ interface UseVerificationInputProps {
5
5
  }
6
6
  export declare const useVerificationInput: ({ value, onChangeText }: UseVerificationInputProps) => {
7
7
  inputRefs: import("react").RefObject<(TextInput | null)[]>;
8
+ displayValue: string;
8
9
  focusedIndex: number | null;
9
10
  handleFocus: (index: number) => void;
10
11
  handleBlur: () => void;
@@ -1,19 +1,32 @@
1
- import { useRef, useState } from 'react';
1
+ import { useEffect, useRef, useState } from 'react';
2
2
  export const useVerificationInput = ({ value, onChangeText }) => {
3
3
  const length = 6;
4
4
  const inputRefs = useRef([]);
5
+ const latestValueRef = useRef(value);
6
+ const [displayValue, setDisplayValue] = useState(value);
5
7
  const [focusedIndex, setFocusedIndex] = useState(null);
8
+ useEffect(() => {
9
+ if (value !== latestValueRef.current) {
10
+ latestValueRef.current = value;
11
+ setDisplayValue(value);
12
+ }
13
+ }, [value]);
6
14
  const handleFocus = (index) => {
7
15
  setFocusedIndex(index);
8
16
  };
9
17
  const handleBlur = () => {
10
18
  setFocusedIndex(null);
11
19
  };
20
+ const updateValue = (nextValue) => {
21
+ latestValueRef.current = nextValue;
22
+ setDisplayValue(nextValue);
23
+ onChangeText?.(nextValue);
24
+ };
12
25
  const handleChangeText = (text, index) => {
13
- // Break down the text into an array of characters
26
+ const currentValue = latestValueRef.current;
14
27
  const chars = Array(length).fill('');
15
- for (let i = 0; i < value.length && i < length; i++) {
16
- chars[i] = value[i];
28
+ for (let i = 0; i < currentValue.length && i < length; i++) {
29
+ chars[i] = currentValue[i];
17
30
  }
18
31
  if (text.length > 1) {
19
32
  // Handle paste
@@ -31,24 +44,26 @@ export const useVerificationInput = ({ value, onChangeText }) => {
31
44
  inputRefs.current[index + 1]?.focus();
32
45
  }
33
46
  }
34
- onChangeText?.(chars.join(''));
47
+ updateValue(chars.join(''));
35
48
  };
36
49
  const handleKeyPress = (e, index) => {
37
50
  if (e.nativeEvent.key === 'Backspace') {
38
- if (!value[index] && index > 0) {
51
+ const currentValue = latestValueRef.current;
52
+ if (!currentValue[index] && index > 0) {
39
53
  e.preventDefault();
40
54
  inputRefs.current[index - 1]?.focus();
41
55
  const chars = Array(length).fill('');
42
- for (let i = 0; i < value.length && i < length; i++) {
43
- chars[i] = value[i];
56
+ for (let i = 0; i < currentValue.length && i < length; i++) {
57
+ chars[i] = currentValue[i];
44
58
  }
45
59
  chars[index - 1] = '';
46
- onChangeText?.(chars.join(''));
60
+ updateValue(chars.join(''));
47
61
  }
48
62
  }
49
63
  };
50
64
  return {
51
65
  inputRefs,
66
+ displayValue,
52
67
  focusedIndex,
53
68
  handleFocus,
54
69
  handleBlur,
@@ -718,7 +718,7 @@ export declare const lightTheme: {
718
718
  };
719
719
  };
720
720
  };
721
- readonly space: {
721
+ readonly spacing: {
722
722
  readonly none: {
723
723
  readonly gap: {
724
724
  readonly base: 0;
@@ -2078,7 +2078,7 @@ export declare const darkTheme: {
2078
2078
  };
2079
2079
  };
2080
2080
  };
2081
- readonly space: {
2081
+ readonly spacing: {
2082
2082
  readonly none: {
2083
2083
  readonly gap: {
2084
2084
  readonly base: 0;
@@ -3450,7 +3450,7 @@ export declare const themes: {
3450
3450
  };
3451
3451
  };
3452
3452
  };
3453
- readonly space: {
3453
+ readonly spacing: {
3454
3454
  readonly none: {
3455
3455
  readonly gap: {
3456
3456
  readonly base: 0;
@@ -4810,7 +4810,7 @@ export declare const themes: {
4810
4810
  };
4811
4811
  };
4812
4812
  };
4813
- readonly space: {
4813
+ readonly spacing: {
4814
4814
  readonly none: {
4815
4815
  readonly gap: {
4816
4816
  readonly base: 0;
@@ -191,7 +191,7 @@ const shared = {
191
191
  },
192
192
  },
193
193
  },
194
- space: {
194
+ spacing: {
195
195
  none: {
196
196
  gap: {
197
197
  base: layout.mobile.spacing.none,
@@ -26,5 +26,5 @@ export type ColorValue = 'currentColor' | 'transparent' | FlattenColorKeys<Omit<
26
26
  export type BorderRadiusValue = `${keyof (typeof lightTheme)['borderRadius'] & (string | number)}` | AnimatableNumericValue | undefined;
27
27
  export type BordeWidthValue = `${keyof (typeof lightTheme)['borderWidth'] & (string | number)}` | number | undefined;
28
28
  export type OpacityValue = AnimatableNumericValue | undefined;
29
- export type SpacingValues = keyof (typeof themes)['light']['globalStyle']['variants']['space'];
29
+ export type SpacingValues = keyof (typeof themes)['light']['globalStyle']['variants']['spacing'];
30
30
  export {};