@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.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +22 -0
- package/build/components/Accordion/AccordionTrigger.js +1 -1
- package/build/components/BodyText/index.d.ts +1 -0
- package/build/components/Checkbox/CheckboxGroup.context.d.ts +2 -0
- package/build/components/Checkbox/CheckboxGroup.js +5 -5
- package/build/components/Checkbox/CheckboxIndicator.js +3 -3
- package/build/components/Checkbox/CheckboxTextContent.js +0 -1
- package/build/components/Checkbox/CheckboxTileRoot.js +9 -1
- package/build/components/DatePicker/DatePickerDay.js +3 -3
- package/build/components/FormField/FormField.d.ts +5 -5
- package/build/components/List/List.context.d.ts +2 -0
- package/build/components/List/List.context.js +2 -0
- package/build/components/List/List.js +19 -15
- package/build/components/List/ListAction/ListAction.js +3 -2
- package/build/components/List/ListAction/ListAction.props.d.ts +0 -1
- package/build/components/List/ListItem/ListItem.props.d.ts +4 -1
- package/build/components/List/ListItem/ListItemHeading.d.ts +13 -0
- package/build/components/List/ListItem/ListItemHeading.js +12 -0
- package/build/components/List/ListItem/ListItemHelperText.d.ts +2 -2
- package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
- package/build/components/List/ListItem/ListItemRoot.js +7 -6
- package/build/components/List/ListItem/index.d.ts +1 -1
- package/build/components/List/ListItem/index.js +1 -1
- package/build/components/PillGroup/Pill.js +2 -2
- package/build/components/Radio/RadioGroup.context.d.ts +2 -0
- package/build/components/Radio/RadioGroup.js +1 -1
- package/build/components/Radio/RadioIndicator.js +3 -3
- package/build/components/Radio/RadioTextContent.js +0 -1
- package/build/components/Radio/RadioTileRoot.js +9 -1
- package/build/components/RadioCard/RadioCardIndicator.js +3 -3
- package/build/components/RadioCard/RadioCardRoot.js +3 -3
- package/build/components/Tabs/Tab.js +5 -5
- package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
- package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
- package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
- package/build/components/VerificationInput/VerificationInput.d.ts +6 -0
- package/build/components/VerificationInput/VerificationInput.js +35 -0
- package/build/components/VerificationInput/VerificationInput.props.d.ts +49 -0
- package/build/components/VerificationInput/VerificationInput.props.js +1 -0
- package/build/components/VerificationInput/VerificationInputSlot.d.ts +9 -0
- package/build/components/VerificationInput/VerificationInputSlot.js +72 -0
- package/build/components/VerificationInput/index.d.ts +4 -0
- package/build/components/VerificationInput/index.js +3 -0
- package/build/components/VerificationInput/useVerificationInput.d.ts +14 -0
- package/build/components/VerificationInput/useVerificationInput.js +58 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/docs/components/AllComponents.web.tsx +9 -0
- package/package.json +10 -11
- package/src/components/Accordion/Accordion.figma.tsx +23 -0
- package/src/components/Accordion/AccordionItemRoot.figma.tsx +47 -0
- package/src/components/Accordion/AccordionTrigger.tsx +1 -1
- package/src/components/Alert/Alert.figma.tsx +47 -0
- package/src/components/Avatar/Avatar.figma.tsx +33 -0
- package/src/components/Badge/Badge.figma.tsx +48 -24
- package/src/components/Banner/Banner.figma.tsx +15 -0
- package/src/components/Banner/BannerIllustration.figma.tsx +30 -0
- package/src/components/BodyText/index.ts +1 -0
- package/src/components/BottomSheet/BottomSheetModal.figma.tsx +20 -0
- package/src/components/Button/Button.figma.tsx +60 -229
- package/src/components/Card/Card.figma.tsx +43 -71
- package/src/components/Card/CardAction/CardAction.figma.tsx +44 -0
- package/src/components/Card/CardAction/CardAction.stories.tsx +1 -1
- package/src/components/Carousel/Carousel.figma.tsx +19 -0
- package/src/components/Checkbox/Checkbox.figma.tsx +26 -41
- package/src/components/Checkbox/CheckboxGroup.context.ts +1 -0
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +20 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +7 -8
- package/src/components/Checkbox/CheckboxImage.figma.tsx +27 -0
- package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
- package/src/components/Checkbox/CheckboxTextContent.tsx +0 -1
- package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +32 -0
- package/src/components/Checkbox/CheckboxTileRoot.tsx +9 -1
- package/src/components/CurrencyInput/CurrencyInput.figma.tsx +56 -0
- package/src/components/DateInput/DateInput.figma.tsx +75 -0
- package/src/components/DatePicker/DatePickerCalendar.figma.tsx +34 -0
- package/src/components/DatePicker/DatePickerDay.tsx +3 -3
- package/src/components/DatePickerInput/DatePickerInput.figma.tsx +62 -0
- package/src/components/DescriptionList/DescriptionList.figma.tsx +23 -0
- package/src/components/Divider/Divider.figma.tsx +23 -18
- package/src/components/ExpandableCard/ExpandableCard.figma.tsx +54 -0
- package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +23 -0
- package/src/components/FormField/FormField.figma.tsx +23 -0
- package/src/components/Helper/HelperText.figma.tsx +23 -0
- package/src/components/IconButton/IconButton.figma.tsx +55 -161
- package/src/components/IconContainer/IconContainer.figma.tsx +50 -0
- package/src/components/InlineLink/InlineLink.figma.tsx +33 -0
- package/src/components/Input/Input.figma.tsx +52 -110
- package/src/components/Label/Label.figma.tsx +24 -0
- package/src/components/Link/Link.figma.tsx +42 -0
- package/src/components/List/List.context.ts +4 -0
- package/src/components/List/List.docs.mdx +30 -24
- package/src/components/List/List.figma.tsx +29 -108
- package/src/components/List/List.stories.tsx +26 -1
- package/src/components/List/List.tsx +26 -19
- package/src/components/List/ListAction/ListAction.figma.tsx +29 -0
- package/src/components/List/ListAction/ListAction.props.ts +0 -1
- package/src/components/List/ListAction/ListAction.tsx +3 -2
- package/src/components/List/ListItem/ListItem.figma.tsx +40 -220
- package/src/components/List/ListItem/ListItem.props.ts +4 -1
- package/src/components/List/ListItem/ListItemHeading.tsx +20 -0
- package/src/components/List/ListItem/ListItemHelperText.tsx +2 -3
- package/src/components/List/ListItem/ListItemLeadingContent.figma.tsx +29 -0
- package/src/components/List/ListItem/ListItemRoot.tsx +11 -6
- package/src/components/List/ListItem/ListItemTrailingContent.figma.tsx +27 -0
- package/src/components/List/ListItem/index.ts +1 -1
- package/src/components/Menu/Menu.figma.tsx +30 -0
- package/src/components/Menu/MenuItem.figma.tsx +31 -0
- package/src/components/Modal/Modal.docs.mdx +23 -20
- package/src/components/Modal/Modal.figma.tsx +56 -0
- package/src/components/PillGroup/Pill.figma.tsx +25 -0
- package/src/components/PillGroup/Pill.tsx +3 -3
- package/src/components/PillGroup/PillGroup.figma.tsx +21 -0
- package/src/components/ProgressStepper/ProgressStep.figma.tsx +30 -0
- package/src/components/ProgressStepper/ProgressStepper.figma.tsx +20 -0
- package/src/components/Radio/Radio.figma.tsx +22 -42
- package/src/components/Radio/Radio.stories.tsx +24 -0
- package/src/components/Radio/RadioGroup.context.ts +1 -0
- package/src/components/Radio/RadioGroup.figma.tsx +54 -0
- package/src/components/Radio/RadioGroup.tsx +2 -2
- package/src/components/Radio/RadioImage.figma.tsx +27 -0
- package/src/components/Radio/RadioIndicator.tsx +3 -3
- package/src/components/Radio/RadioTextContent.tsx +0 -1
- package/src/components/Radio/RadioTileRoot.figma.tsx +31 -0
- package/src/components/Radio/RadioTileRoot.tsx +9 -1
- package/src/components/RadioCard/RadioCardIndicator.tsx +3 -3
- package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
- package/src/components/SectionHeader/SectionHeader.figma.tsx +30 -16
- package/src/components/Select/Select.figma.tsx +55 -0
- package/src/components/Select/SelectOption.figma.tsx +36 -0
- package/src/components/Spinner/Spinner.figma.tsx +20 -12
- package/src/components/Switch/Switch.figma.tsx +31 -23
- package/src/components/Tabs/Tab.tsx +5 -5
- package/src/components/Tabs/Tabs.figma.tsx +29 -0
- package/src/components/ThemedImage/ThemedImage.stories.tsx +1 -1
- package/src/components/Toast/ToastItem.figma.tsx +22 -0
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
- package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
- package/src/components/UnstyledIconButton/UnstyledIconButton.figma.tsx +49 -0
- package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +1 -1
- package/src/components/VerificationInput/VerificationInput.docs.mdx +68 -0
- package/src/components/VerificationInput/VerificationInput.props.ts +52 -0
- package/src/components/VerificationInput/VerificationInput.stories.tsx +140 -0
- package/src/components/VerificationInput/VerificationInput.tsx +89 -0
- package/src/components/VerificationInput/VerificationInputSlot.tsx +94 -0
- package/src/components/VerificationInput/index.ts +5 -0
- package/src/components/VerificationInput/useVerificationInput.ts +72 -0
- package/src/components/index.ts +1 -0
- package/build/components/List/ListItem/ListItemText.d.ts +0 -6
- package/build/components/List/ListItem/ListItemText.js +0 -7
- package/src/components/Checkbox/CheckboxIndicator.figma.tsx +0 -19
- package/src/components/List/ListItem/ListItemText.tsx +0 -14
- package/src/components/Radio/RadioIndicator.figma.tsx +0 -21
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import VerificationInputProps from './VerificationInput.props';
|
|
2
|
+
declare const VerificationInput: {
|
|
3
|
+
({ value, onChangeText, label, helperText, helperIcon, validationStatus, validText, invalidText, disabled, readonly, secureTextEntry, style, ...props }: VerificationInputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default VerificationInput;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import { FormField } from '../FormField';
|
|
5
|
+
import { useVerificationInput } from './useVerificationInput';
|
|
6
|
+
import { VerificationInputSlot } from './VerificationInputSlot';
|
|
7
|
+
const VerificationInput = ({ value = '', onChangeText, label, helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled = false, readonly = false, secureTextEntry = false, style, ...props }) => {
|
|
8
|
+
const length = 6;
|
|
9
|
+
const { inputRefs, focusedIndex, handleFocus, handleBlur, handleChangeText, handleKeyPress } = useVerificationInput({
|
|
10
|
+
value,
|
|
11
|
+
onChangeText,
|
|
12
|
+
});
|
|
13
|
+
const slots = Array.from({ length }, (_, index) => index);
|
|
14
|
+
return (_jsx(FormField, { label: label, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatus, validText: validText, invalidText: invalidText, disabled: disabled, readonly: readonly, style: [styles.root, style], ...props, children: _jsx(View, { style: styles.slotsContainer, children: slots.map(index => {
|
|
15
|
+
const char = value[index] || '';
|
|
16
|
+
const isActive = focusedIndex === index;
|
|
17
|
+
return (_jsx(VerificationInputSlot, { ref: ref => {
|
|
18
|
+
inputRefs.current[index] = ref;
|
|
19
|
+
}, value: char, isActive: isActive, validationStatus: validationStatus, disabled: disabled, readonly: readonly, secureTextEntry: secureTextEntry, onChangeText: text => handleChangeText(text, index), onKeyPress: e => handleKeyPress(e, index), onFocus: () => handleFocus(index), onBlur: handleBlur }, index));
|
|
20
|
+
}) }) }));
|
|
21
|
+
};
|
|
22
|
+
const styles = StyleSheet.create(theme => ({
|
|
23
|
+
root: {
|
|
24
|
+
gap: theme.components.input.verification.gap,
|
|
25
|
+
width: '100%',
|
|
26
|
+
maxWidth: theme.components.input.maxWidth,
|
|
27
|
+
},
|
|
28
|
+
slotsContainer: {
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
gap: theme.components.input.verification.gap,
|
|
31
|
+
width: '100%',
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
VerificationInput.displayName = 'VerificationInput';
|
|
35
|
+
export default VerificationInput;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
export interface VerificationInputProps extends ViewProps {
|
|
4
|
+
/**
|
|
5
|
+
* The value of the input.
|
|
6
|
+
*/
|
|
7
|
+
value?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when the value changes.
|
|
10
|
+
*/
|
|
11
|
+
onChangeText?: (text: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* The label for the input.
|
|
14
|
+
*/
|
|
15
|
+
label?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Helper text to display below the input.
|
|
18
|
+
*/
|
|
19
|
+
helperText?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Icon to display alongside the helper text.
|
|
22
|
+
*/
|
|
23
|
+
helperIcon?: ComponentType;
|
|
24
|
+
/**
|
|
25
|
+
* The validation status of the input.
|
|
26
|
+
*/
|
|
27
|
+
validationStatus?: 'initial' | 'valid' | 'invalid';
|
|
28
|
+
/**
|
|
29
|
+
* Text to display when validation status is 'valid'.
|
|
30
|
+
*/
|
|
31
|
+
validText?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Text to display when validation status is 'invalid'.
|
|
34
|
+
*/
|
|
35
|
+
invalidText?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the input is disabled.
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the input is read-only.
|
|
42
|
+
*/
|
|
43
|
+
readonly?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to obscure the text entry (e.g. for passwords/OTPs).
|
|
46
|
+
*/
|
|
47
|
+
secureTextEntry?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export default VerificationInputProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TextInput, TextInputProps } from 'react-native';
|
|
2
|
+
interface VerificationInputSlotProps extends TextInputProps {
|
|
3
|
+
isActive: boolean;
|
|
4
|
+
validationStatus: 'initial' | 'valid' | 'invalid';
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const VerificationInputSlot: import("react").ForwardRefExoticComponent<VerificationInputSlotProps & import("react").RefAttributes<TextInput>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import InputField from '../Input/InputField';
|
|
5
|
+
export const VerificationInputSlot = forwardRef(({ isActive, validationStatus, disabled, readonly, style, ...props }, ref) => {
|
|
6
|
+
styles.useVariants({
|
|
7
|
+
disabled,
|
|
8
|
+
readonly,
|
|
9
|
+
validationStatus,
|
|
10
|
+
active: isActive,
|
|
11
|
+
});
|
|
12
|
+
return (_jsx(InputField, { ref: ref, ...props, editable: !disabled && !readonly, selectTextOnFocus: true, keyboardType: "number-pad", style: [styles.slot, style] }));
|
|
13
|
+
});
|
|
14
|
+
VerificationInputSlot.displayName = 'VerificationInputSlot';
|
|
15
|
+
const styles = StyleSheet.create(theme => ({
|
|
16
|
+
slot: {
|
|
17
|
+
flex: 0,
|
|
18
|
+
width: theme.components.input.height,
|
|
19
|
+
height: theme.components.input.height,
|
|
20
|
+
borderWidth: theme.components.input.borderWidth,
|
|
21
|
+
borderColor: theme.color.border.strong,
|
|
22
|
+
borderRadius: theme.components.input.borderRadius,
|
|
23
|
+
backgroundColor: theme.color.surface.neutral.strong,
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
padding: 0,
|
|
26
|
+
variants: {
|
|
27
|
+
disabled: {
|
|
28
|
+
true: {
|
|
29
|
+
opacity: theme.opacity.disabled,
|
|
30
|
+
color: theme.color.text.secondary,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
readonly: {
|
|
34
|
+
true: {
|
|
35
|
+
borderColor: theme.color.border.subtle,
|
|
36
|
+
backgroundColor: theme.color.surface.neutral.subtle,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
validationStatus: {
|
|
40
|
+
initial: {},
|
|
41
|
+
valid: {
|
|
42
|
+
borderColor: theme.color.feedback.positive.border,
|
|
43
|
+
},
|
|
44
|
+
invalid: {
|
|
45
|
+
borderColor: theme.color.feedback.danger.border,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
active: {
|
|
49
|
+
true: {
|
|
50
|
+
borderColor: theme.color.border.strong,
|
|
51
|
+
borderWidth: theme.components.input.borderWidthFocused,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
compoundVariants: [
|
|
56
|
+
{
|
|
57
|
+
validationStatus: 'invalid',
|
|
58
|
+
active: true,
|
|
59
|
+
styles: {
|
|
60
|
+
borderColor: theme.color.feedback.danger.border,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
validationStatus: 'valid',
|
|
65
|
+
active: true,
|
|
66
|
+
styles: {
|
|
67
|
+
borderColor: theme.color.border.strong,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
@@ -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';
|
|
@@ -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.
|
|
3
|
+
"version": "0.14.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.
|
|
28
|
-
"@figma/code-connect": "^1.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.
|
|
31
|
-
"@storybook/addon-docs": "^10.
|
|
32
|
-
"@storybook/addon-vitest": "^10.
|
|
33
|
-
"@storybook/react": "^10.
|
|
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.
|
|
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,7 +50,7 @@
|
|
|
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.
|
|
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",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
"@utilitywarehouse/hearth-react-icons": "^0.7.4",
|
|
61
60
|
"@utilitywarehouse/hearth-react-native-icons": "^0.7.4",
|
|
62
61
|
"@utilitywarehouse/hearth-svg-assets": "^0.2.0",
|
|
63
|
-
"@utilitywarehouse/hearth-tokens": "^0.2.
|
|
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
|
|
2
|
-
import
|
|
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
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
size: figma.enum("Size", {
|
|
38
|
+
"SM-24": "sm",
|
|
39
|
+
"MD-28": "md",
|
|
26
40
|
}),
|
|
27
|
-
flatBase: figma.boolean(
|
|
28
|
-
|
|
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: (
|
|
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,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
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import BannerIllustration from "./BannerIllustration"
|
|
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
|
+
BannerIllustration,
|
|
15
|
+
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=10145%3A4877",
|
|
16
|
+
{
|
|
17
|
+
props: {
|
|
18
|
+
// No matching props could be found for these Figma properties:
|
|
19
|
+
// "illustration": figma.instance('Illustration'),
|
|
20
|
+
// "size": figma.enum('Size', {
|
|
21
|
+
// "XL-120": "xl-120",
|
|
22
|
+
// "LG-100": "lg-100",
|
|
23
|
+
// "MD-80": "md-80",
|
|
24
|
+
// "SM-60": "sm-60",
|
|
25
|
+
// "XS-40": "xs-40"
|
|
26
|
+
// })
|
|
27
|
+
},
|
|
28
|
+
example: (props) => <BannerIllustration />,
|
|
29
|
+
},
|
|
30
|
+
)
|