@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.
- package/.storybook/preview.tsx +1 -0
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +24 -21
- package/CHANGELOG.md +128 -0
- package/build/components/Banner/Banner.d.ts +1 -1
- package/build/components/Banner/Banner.js +24 -4
- package/build/components/Banner/Banner.props.d.ts +1 -6
- package/build/components/Box/Box.props.d.ts +5 -2
- package/build/components/Button/Button.d.ts +2 -0
- package/build/components/Button/ButtonGroupRoot.d.ts +5 -1
- package/build/components/Button/ButtonGroupRoot.js +3 -3
- package/build/components/Card/Card.context.d.ts +1 -1
- package/build/components/Card/Card.props.d.ts +2 -0
- package/build/components/Card/CardContent.js +3 -3
- package/build/components/Card/CardRoot.d.ts +1 -1
- package/build/components/Card/CardRoot.js +14 -4
- package/build/components/Checkbox/CheckboxGroupTextContent.js +1 -1
- package/build/components/Checkbox/CheckboxTextContent.js +1 -1
- package/build/components/Container/Container.d.ts +1 -1
- package/build/components/Container/Container.js +3 -3
- package/build/components/Container/Container.props.d.ts +5 -0
- package/build/components/Divider/Divider.d.ts +1 -1
- package/build/components/Divider/Divider.js +19 -19
- package/build/components/Divider/Divider.props.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardExpandedContent.js +1 -1
- package/build/components/Flex/Flex.d.ts +1 -1
- package/build/components/Flex/Flex.js +3 -3
- package/build/components/Flex/Flex.props.d.ts +5 -0
- package/build/components/Grid/Grid.d.ts +1 -1
- package/build/components/Grid/Grid.js +4 -4
- package/build/components/Grid/Grid.props.d.ts +5 -0
- package/build/components/Menu/Menu.d.ts +1 -1
- package/build/components/Menu/Menu.js +2 -2
- package/build/components/Menu/Menu.props.d.ts +2 -6
- package/build/components/Modal/Modal.d.ts +1 -1
- package/build/components/Modal/Modal.js +16 -6
- package/build/components/Modal/Modal.props.d.ts +1 -0
- package/build/components/Modal/Modal.web.d.ts +1 -1
- package/build/components/Modal/Modal.web.js +2 -2
- package/build/components/Radio/RadioGroupTextContent.js +1 -1
- package/build/components/Radio/RadioTextContent.js +1 -1
- package/build/components/Toast/Toast.context.d.ts +2 -4
- package/build/components/Toast/Toast.context.js +14 -2
- package/build/components/Toast/Toast.props.d.ts +4 -0
- package/build/components/Toast/ToastItem.js +5 -2
- package/build/components/VerificationInput/VerificationInput.d.ts +2 -5
- package/build/components/VerificationInput/VerificationInput.js +20 -7
- package/build/components/VerificationInput/VerificationInput.props.d.ts +10 -0
- package/build/components/VerificationInput/index.d.ts +1 -1
- package/build/components/VerificationInput/useVerificationInput.d.ts +1 -0
- package/build/components/VerificationInput/useVerificationInput.js +24 -9
- package/build/core/themes.d.ts +4 -4
- package/build/core/themes.js +1 -1
- package/build/types/values.d.ts +1 -1
- package/docs/changelog.mdx +687 -0
- package/docs/components/AllComponents.web.tsx +9 -9
- package/docs/layout-components.docs.mdx +3 -3
- package/package.json +7 -7
- package/scripts/copyChangelog.js +50 -0
- package/src/components/Alert/Alert.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +4 -5
- package/src/components/Badge/Badge.stories.tsx +3 -3
- package/src/components/Banner/Banner.docs.mdx +1 -1
- package/src/components/Banner/Banner.props.ts +13 -20
- package/src/components/Banner/Banner.stories.tsx +83 -15
- package/src/components/Banner/Banner.tsx +27 -3
- package/src/components/Box/Box.props.ts +11 -4
- package/src/components/Button/Button.docs.mdx +2 -2
- package/src/components/Button/Button.stories.tsx +4 -4
- package/src/components/Button/ButtonGroupRoot.tsx +8 -3
- package/src/components/Card/Card.context.ts +1 -1
- package/src/components/Card/Card.docs.mdx +1 -1
- package/src/components/Card/Card.props.ts +2 -0
- package/src/components/Card/Card.stories.tsx +9 -9
- package/src/components/Card/CardAction/CardAction.stories.tsx +2 -2
- package/src/components/Card/CardContent.tsx +3 -3
- package/src/components/Card/CardRoot.tsx +15 -5
- package/src/components/Checkbox/CheckboxGroupTextContent.tsx +2 -2
- package/src/components/Checkbox/CheckboxTextContent.tsx +1 -1
- package/src/components/Container/Container.docs.mdx +2 -2
- package/src/components/Container/Container.props.ts +5 -0
- package/src/components/Container/Container.stories.tsx +2 -2
- package/src/components/Container/Container.tsx +3 -3
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +1 -1
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +2 -2
- package/src/components/DateInput/DateInput.stories.tsx +3 -3
- package/src/components/DatePickerInput/DatePickerInput.stories.tsx +1 -1
- package/src/components/DescriptionList/DescriptionList.stories.tsx +1 -1
- package/src/components/Divider/Divider.docs.mdx +6 -6
- package/src/components/Divider/Divider.props.ts +6 -0
- package/src/components/Divider/Divider.tsx +19 -18
- package/src/components/ExpandableCard/ExpandableCardExpandedContent.tsx +1 -1
- package/src/components/Flex/Flex.docs.mdx +3 -3
- package/src/components/Flex/Flex.props.ts +5 -0
- package/src/components/Flex/Flex.stories.tsx +2 -2
- package/src/components/Flex/Flex.tsx +4 -3
- package/src/components/FormField/FormField.docs.mdx +1 -1
- package/src/components/FormField/FormField.stories.tsx +1 -1
- package/src/components/Grid/Grid.docs.mdx +5 -5
- package/src/components/Grid/Grid.props.ts +6 -0
- package/src/components/Grid/Grid.stories.tsx +8 -8
- package/src/components/Grid/Grid.tsx +4 -3
- package/src/components/HighlightBanner/HighlightBanner.docs.mdx +1 -1
- package/src/components/HighlightBanner/HighlightBanner.stories.tsx +2 -2
- package/src/components/Icon/Icon.docs.mdx +3 -3
- package/src/components/IconButton/IconButton.stories.tsx +5 -5
- package/src/components/IconContainer/IconContainer.docs.mdx +1 -1
- package/src/components/IconContainer/IconContainer.stories.tsx +3 -3
- package/src/components/IndicatorIconButton/IndicatorIconButton.stories.tsx +17 -9
- package/src/components/InlineLink/InlineLink.stories.tsx +2 -2
- package/src/components/Input/Input.stories.tsx +4 -4
- package/src/components/List/List.stories.tsx +1 -1
- package/src/components/Menu/Menu.docs.mdx +8 -5
- package/src/components/Menu/Menu.figma.tsx +27 -27
- package/src/components/Menu/Menu.props.ts +2 -6
- package/src/components/Menu/Menu.tsx +3 -6
- package/src/components/Menu/MenuItem.figma.tsx +26 -18
- package/src/components/Modal/Modal.docs.mdx +22 -21
- package/src/components/Modal/Modal.figma.tsx +58 -47
- package/src/components/Modal/Modal.props.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +4 -0
- package/src/components/Modal/Modal.tsx +20 -5
- package/src/components/Modal/Modal.web.tsx +2 -1
- package/src/components/PillGroup/PillGroup.stories.tsx +7 -7
- package/src/components/ProgressStepper/ProgressStepper.stories.tsx +7 -8
- package/src/components/Radio/Radio.stories.tsx +1 -1
- package/src/components/Radio/RadioGroup.stories.tsx +1 -1
- package/src/components/Radio/RadioGroupTextContent.tsx +2 -2
- package/src/components/Radio/RadioTextContent.tsx +1 -1
- package/src/components/SectionHeader/SectionHeader.stories.tsx +1 -1
- package/src/components/Switch/Switch.docs.mdx +8 -8
- package/src/components/Switch/Switch.stories.tsx +2 -2
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.docs.mdx +3 -3
- package/src/components/Toast/Toast.context.tsx +24 -3
- package/src/components/Toast/Toast.props.ts +5 -0
- package/src/components/Toast/Toast.stories.tsx +29 -0
- package/src/components/Toast/ToastItem.tsx +7 -2
- package/src/components/UnstyledIconButton/UnstyledIconButton.stories.tsx +5 -5
- package/src/components/VerificationInput/VerificationInput.docs.mdx +31 -8
- package/src/components/VerificationInput/VerificationInput.props.ts +11 -0
- package/src/components/VerificationInput/VerificationInput.stories.tsx +79 -3
- package/src/components/VerificationInput/VerificationInput.tsx +94 -62
- package/src/components/VerificationInput/index.ts +4 -2
- package/src/components/VerificationInput/useVerificationInput.ts +26 -10
- package/src/core/themes.ts +1 -1
- 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
|
-
|
|
26
|
+
const currentValue = latestValueRef.current;
|
|
14
27
|
const chars = Array(length).fill('');
|
|
15
|
-
for (let i = 0; i <
|
|
16
|
-
chars[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
|
-
|
|
47
|
+
updateValue(chars.join(''));
|
|
35
48
|
};
|
|
36
49
|
const handleKeyPress = (e, index) => {
|
|
37
50
|
if (e.nativeEvent.key === 'Backspace') {
|
|
38
|
-
|
|
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 <
|
|
43
|
-
chars[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
|
-
|
|
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,
|
package/build/core/themes.d.ts
CHANGED
|
@@ -718,7 +718,7 @@ export declare const lightTheme: {
|
|
|
718
718
|
};
|
|
719
719
|
};
|
|
720
720
|
};
|
|
721
|
-
readonly
|
|
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
|
|
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
|
|
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
|
|
4813
|
+
readonly spacing: {
|
|
4814
4814
|
readonly none: {
|
|
4815
4815
|
readonly gap: {
|
|
4816
4816
|
readonly base: 0;
|
package/build/core/themes.js
CHANGED
package/build/types/values.d.ts
CHANGED
|
@@ -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']['
|
|
29
|
+
export type SpacingValues = keyof (typeof themes)['light']['globalStyle']['variants']['spacing'];
|
|
30
30
|
export {};
|