@utilitywarehouse/hearth-react-native 0.15.2 → 0.16.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 -3
- package/CHANGELOG.md +75 -6
- package/build/components/BottomSheet/BottomSheetScrollView.js +2 -0
- package/build/components/Checkbox/CheckboxGroup.d.ts +1 -1
- package/build/components/Checkbox/CheckboxGroup.js +2 -2
- package/build/components/Checkbox/CheckboxGroup.props.d.ts +2 -1
- package/build/components/Checkbox/CheckboxTileRoot.js +3 -0
- package/build/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/build/components/CurrencyInput/CurrencyInput.js +2 -6
- package/build/components/CurrencyInput/CurrencyInput.props.d.ts +6 -0
- package/build/components/DateInput/DateInputSegment.js +0 -1
- package/build/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/build/components/DatePickerInput/DatePickerInput.js +2 -2
- package/build/components/DatePickerInput/DatePickerInput.props.d.ts +6 -0
- package/build/components/FormField/FormField.context.d.ts +8 -2
- package/build/components/FormField/FormField.d.ts +1 -1
- package/build/components/FormField/FormField.js +24 -4
- package/build/components/FormField/FormField.props.d.ts +2 -0
- package/build/components/FormField/FormFieldLabel.d.ts +1 -1
- package/build/components/FormField/FormFieldLabel.js +3 -3
- package/build/components/FormField/FormFieldValid.js +2 -2
- package/build/components/Input/Input.js +48 -10
- package/build/components/Input/Input.props.d.ts +7 -1
- package/build/components/Label/Label.d.ts +1 -1
- package/build/components/Label/Label.js +5 -1
- package/build/components/Label/Label.props.d.ts +3 -2
- package/build/components/Modal/Modal.js +9 -0
- package/build/components/Radio/RadioGroup.d.ts +1 -1
- package/build/components/Radio/RadioGroup.js +2 -2
- package/build/components/Radio/RadioGroup.props.d.ts +1 -0
- package/build/components/RadioCard/RadioCard.d.ts +1 -1
- package/build/components/RadioCard/RadioCard.js +2 -2
- package/build/components/RadioCard/RadioCard.props.d.ts +1 -0
- package/build/components/Select/Select.d.ts +1 -1
- package/build/components/Select/Select.js +2 -2
- package/build/components/Select/Select.props.d.ts +10 -0
- package/build/components/Textarea/Textarea.d.ts +1 -1
- package/build/components/Textarea/Textarea.js +43 -6
- package/build/components/Textarea/Textarea.props.d.ts +8 -0
- package/build/components/VerificationInput/VerificationInput.d.ts +1 -1
- package/build/components/VerificationInput/VerificationInput.js +2 -2
- package/build/components/VerificationInput/VerificationInput.props.d.ts +4 -0
- package/docs/components/AllComponents.web.tsx +8 -5
- package/docs/theme-tokens.mdx +390 -2
- package/package.json +2 -2
- package/src/components/BottomSheet/BottomSheetScrollView.tsx +2 -0
- package/src/components/Checkbox/Checkbox.docs.mdx +32 -31
- package/src/components/Checkbox/CheckboxGroup.props.ts +2 -1
- package/src/components/Checkbox/CheckboxGroup.tsx +6 -1
- package/src/components/Checkbox/CheckboxTileRoot.tsx +3 -0
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +52 -9
- package/src/components/CurrencyInput/CurrencyInput.props.ts +6 -0
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +30 -1
- package/src/components/CurrencyInput/CurrencyInput.tsx +16 -8
- package/src/components/DateInput/DateInputSegment.tsx +0 -1
- package/src/components/DatePickerInput/DatePickerInput.docs.mdx +22 -0
- package/src/components/DatePickerInput/DatePickerInput.props.ts +6 -0
- package/src/components/DatePickerInput/DatePickerInput.tsx +17 -3
- package/src/components/FormField/FormField.context.ts +6 -1
- package/src/components/FormField/FormField.docs.mdx +30 -30
- package/src/components/FormField/FormField.props.ts +2 -0
- package/src/components/FormField/FormField.stories.tsx +8 -2
- package/src/components/FormField/FormField.tsx +38 -4
- package/src/components/FormField/FormFieldLabel.tsx +7 -3
- package/src/components/FormField/FormFieldValid.tsx +2 -2
- package/src/components/Input/Input.docs.mdx +67 -22
- package/src/components/Input/Input.props.ts +7 -1
- package/src/components/Input/Input.stories.tsx +9 -1
- package/src/components/Input/Input.tsx +124 -59
- package/src/components/Label/Label.props.ts +3 -2
- package/src/components/Label/Label.tsx +11 -1
- package/src/components/Modal/Modal.tsx +9 -0
- package/src/components/Radio/Radio.docs.mdx +31 -30
- package/src/components/Radio/RadioGroup.props.ts +1 -0
- package/src/components/Radio/RadioGroup.stories.tsx +6 -0
- package/src/components/Radio/RadioGroup.tsx +6 -1
- package/src/components/RadioCard/RadioCard.docs.mdx +31 -30
- package/src/components/RadioCard/RadioCard.props.ts +1 -0
- package/src/components/RadioCard/RadioCard.tsx +8 -2
- package/src/components/Select/Select.props.ts +10 -0
- package/src/components/Select/Select.tsx +3 -2
- package/src/components/Textarea/Textarea.docs.mdx +65 -17
- package/src/components/Textarea/Textarea.props.ts +8 -0
- package/src/components/Textarea/Textarea.stories.tsx +23 -2
- package/src/components/Textarea/Textarea.tsx +84 -19
- package/src/components/VerificationInput/VerificationInput.docs.mdx +1 -0
- package/src/components/VerificationInput/VerificationInput.props.ts +4 -1
- package/src/components/VerificationInput/VerificationInput.tsx +2 -0
|
@@ -7,7 +7,7 @@ import { Label } from '../Label';
|
|
|
7
7
|
import { RadioGroup as RadioGroupComponent } from './Radio';
|
|
8
8
|
import { RadioGroupContext } from './RadioGroup.context';
|
|
9
9
|
import RadioGroupTextContent from './RadioGroupTextContent';
|
|
10
|
-
const RadioGroup = ({ children, disabled, readonly, validationStatus, label, helperText, invalidText, validText, showValidationIcon = true, helperIcon, type, direction = 'column', gap, ...props }) => {
|
|
10
|
+
const RadioGroup = ({ children, disabled, readonly, validationStatus, label, labelVariant = 'body', helperText, invalidText, validText, showValidationIcon = true, helperIcon, type, direction = 'column', gap, ...props }) => {
|
|
11
11
|
const value = useMemo(() => ({ disabled, validationStatus, type, direction }), [disabled, validationStatus, type, direction]);
|
|
12
12
|
const showHeader = !!label || !!helperText || !!invalidText || !!validText;
|
|
13
13
|
const childrenArray = React.Children.toArray(children);
|
|
@@ -16,7 +16,7 @@ const RadioGroup = ({ children, disabled, readonly, validationStatus, label, hel
|
|
|
16
16
|
// @ts-expect-error - child.type is not typed
|
|
17
17
|
(child.props.type === 'tile' || child.type.displayName === 'RadioTile'));
|
|
18
18
|
styles.useVariants({ type: childIsCard ? 'tile' : 'radio', direction });
|
|
19
|
-
return (_jsx(RadioGroupContext.Provider, { value: value, children: _jsxs(RadioGroupComponent, { ...props, isDisabled: disabled, isReadOnly: readonly, isCard: childIsCard, children: [showHeader && (_jsxs(RadioGroupTextContent, { children: [!!label && _jsx(Label, { disabled: disabled, children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })), _jsx(View, { style: [styles.container, styles.containerGap(gap)], children: children })] }) }));
|
|
19
|
+
return (_jsx(RadioGroupContext.Provider, { value: value, children: _jsxs(RadioGroupComponent, { ...props, isDisabled: disabled, isReadOnly: readonly, isCard: childIsCard, children: [showHeader && (_jsxs(RadioGroupTextContent, { children: [!!label && (_jsx(Label, { disabled: disabled, variant: labelVariant, children: label })), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })), _jsx(View, { style: [styles.container, styles.containerGap(gap)], children: children })] }) }));
|
|
20
20
|
};
|
|
21
21
|
const styles = StyleSheet.create(theme => ({
|
|
22
22
|
container: {
|
|
@@ -29,7 +29,7 @@ declare const RadioCardIcon: import("react").ForwardRefExoticComponent<import("r
|
|
|
29
29
|
}>;
|
|
30
30
|
declare const RadioCardLabel: import("react").ForwardRefExoticComponent<import("react").RefAttributes<import("../Label/Label.props").default> & Omit<import("../Label/Label.props").default, "ref">>;
|
|
31
31
|
declare const RadioCard: {
|
|
32
|
-
({ children, label, contentStyle, ...props }: RadioCardProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
({ children, label, labelVariant, contentStyle, ...props }: RadioCardProps): import("react/jsx-runtime").JSX.Element;
|
|
33
33
|
displayName: string;
|
|
34
34
|
};
|
|
35
35
|
export { RadioCard, RadioCardGroup, RadioCardIcon, RadioCardIndicator, RadioCardLabel };
|
|
@@ -23,9 +23,9 @@ RadioCardGroup.displayName = 'RadioCardGroup';
|
|
|
23
23
|
RadioCardIndicator.displayName = 'RadioCardIndicator';
|
|
24
24
|
RadioCardIcon.displayName = 'RadioCardIcon';
|
|
25
25
|
RadioCardLabel.displayName = 'RadioCardLabel';
|
|
26
|
-
const RadioCard = ({ children, label, contentStyle, ...props }) => {
|
|
26
|
+
const RadioCard = ({ children, label, labelVariant = 'body', contentStyle, ...props }) => {
|
|
27
27
|
const { computedStyles } = useStyleProps(props);
|
|
28
|
-
return (_jsxs(RadioCardComponent, { ...props, children: [_jsxs(View, { style: styles.radioContainer, children: [_jsx(RadioCardIndicator, { children: _jsx(RadioCardIcon, {}) }), !!label && _jsx(RadioCardLabel, { children: label })] }), !!children && _jsx(View, { style: [computedStyles, contentStyle], children: children })] }));
|
|
28
|
+
return (_jsxs(RadioCardComponent, { ...props, children: [_jsxs(View, { style: styles.radioContainer, children: [_jsx(RadioCardIndicator, { children: _jsx(RadioCardIcon, {}) }), !!label && _jsx(RadioCardLabel, { variant: labelVariant, children: label })] }), !!children && _jsx(View, { style: [computedStyles, contentStyle], children: children })] }));
|
|
29
29
|
};
|
|
30
30
|
const styles = StyleSheet.create(theme => ({
|
|
31
31
|
radioContainer: {
|
|
@@ -6,6 +6,7 @@ interface RadioCardProps extends Omit<PressableProps, 'children'> {
|
|
|
6
6
|
onChange?: (isSelected: boolean) => void;
|
|
7
7
|
children?: ViewProps['children'];
|
|
8
8
|
label?: string;
|
|
9
|
+
labelVariant?: 'heading' | 'body';
|
|
9
10
|
flexDirection?: ViewStyle['flexDirection'];
|
|
10
11
|
flexWrap?: ViewStyle['flexWrap'];
|
|
11
12
|
alignItems?: ViewStyle['alignItems'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SelectProps from './Select.props';
|
|
2
2
|
declare const Select: {
|
|
3
|
-
({ options, value, onValueChange, label, placeholder, disabled, leadingIcon: LeadingIcon, validationStatus, required, children, bottomSheetProps, menuHeading, readonly, emptyText, listProps, searchable, searchPlaceholder, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ options, value, onValueChange, label, labelVariant, placeholder, disabled, leadingIcon: LeadingIcon, validationStatus, required, children, bottomSheetProps, menuHeading, readonly, emptyText, listProps, searchable, searchPlaceholder, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Select;
|
|
@@ -12,7 +12,7 @@ import { Input } from '../Input';
|
|
|
12
12
|
import { Label } from '../Label';
|
|
13
13
|
import { SelectContext } from './Select.context';
|
|
14
14
|
import SelectOption from './SelectOption';
|
|
15
|
-
const Select = ({ options = [], value, onValueChange, label, placeholder = 'Select an option', disabled = false, leadingIcon: LeadingIcon, validationStatus = 'initial', required = true, children, bottomSheetProps, menuHeading, readonly = false, emptyText = 'No options available', listProps, searchable = false, searchPlaceholder = 'Search', ...rest }) => {
|
|
15
|
+
const Select = ({ options = [], value, onValueChange, label, labelVariant = 'body', placeholder = 'Select an option', disabled = false, leadingIcon: LeadingIcon, validationStatus = 'initial', required = true, children, bottomSheetProps, menuHeading, readonly = false, emptyText = 'No options available', listProps, searchable = false, searchPlaceholder = 'Search', ...rest }) => {
|
|
16
16
|
const formFieldContext = useFormFieldContext();
|
|
17
17
|
const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
|
|
18
18
|
const isRequired = formFieldContext?.required ?? required;
|
|
@@ -67,7 +67,7 @@ const Select = ({ options = [], value, onValueChange, label, placeholder = 'Sele
|
|
|
67
67
|
}, []);
|
|
68
68
|
const renderSelectOption = useCallback(({ item }) => (_jsx(SelectOption, { label: item.label, value: item.value, disabled: item.disabled, leadingIcon: item.leadingIcon, trailingIcon: item.trailingIcon })), []);
|
|
69
69
|
const renderEmptyComponent = useCallback(() => (_jsx(BottomSheetView, { style: styles.emptyContainer, children: _jsx(DetailText, { children: emptyText }) })), [emptyText]);
|
|
70
|
-
return (_jsxs(View, { ...rest, style: [styles.container, rest.style], children: [!!label && (_jsx(View, { children: _jsxs(Label, { children: [label, !isRequired && _jsx(Label, { children: " (Optional)" })] }) })), _jsxs(Pressable, { onPress: openBottomSheet, disabled: isDisabled || isReadonly, style: ({ pressed }) => [
|
|
70
|
+
return (_jsxs(View, { ...rest, style: [styles.container, rest.style], children: [!!label && (_jsx(View, { children: _jsxs(Label, { variant: labelVariant, children: [label, !isRequired && _jsx(Label, { variant: labelVariant, children: " (Optional)" })] }) })), _jsxs(Pressable, { onPress: openBottomSheet, disabled: isDisabled || isReadonly, style: ({ pressed }) => [
|
|
71
71
|
styles.selectContainer,
|
|
72
72
|
styles.pressedContainer(pressed || isOpen),
|
|
73
73
|
], children: [!!LeadingIcon && (_jsx(View, { children: (() => {
|
|
@@ -40,6 +40,16 @@ interface SelectProps extends ViewProps {
|
|
|
40
40
|
* Label for the select
|
|
41
41
|
*/
|
|
42
42
|
label?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The variant of the label text.
|
|
45
|
+
*
|
|
46
|
+
* Supported values are:
|
|
47
|
+
* - `'heading'` – use heading text styling for the label.
|
|
48
|
+
* - `'body'` – use body text styling for the label.
|
|
49
|
+
*
|
|
50
|
+
* @default 'body'.
|
|
51
|
+
*/
|
|
52
|
+
labelVariant?: 'heading' | 'body';
|
|
43
53
|
/**
|
|
44
54
|
* Placeholder text to show when no value is selected
|
|
45
55
|
*/
|
|
@@ -7,5 +7,5 @@ export declare const TextareaComponent: import("@gluestack-ui/textarea/lib/types
|
|
|
7
7
|
};
|
|
8
8
|
}, import("react-native").TextInputProps>;
|
|
9
9
|
export declare const TextareaField: import("react").ForwardRefExoticComponent<import("react-native").TextInputProps & import("react").RefAttributes<import("react-native").TextInputProps> & import("@gluestack-ui/textarea/lib/typescript/types").IInputProps>;
|
|
10
|
-
declare const Textarea: ({ validationStatus, children, disabled, focused, readonly, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const Textarea: ({ validationStatus, children, disabled, focused, readonly, label, labelVariant, helperText, validText, invalidText, required, helperIcon, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default Textarea;
|
|
@@ -1,17 +1,54 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createTextarea } from '@gluestack-ui/textarea';
|
|
3
|
-
import
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { FormField, useFormFieldContext } from '../FormField';
|
|
4
5
|
import TextareaFieldComponent from './TextareaField';
|
|
5
|
-
import
|
|
6
|
+
import TextareaRoot from './TextareaRoot';
|
|
6
7
|
export const TextareaComponent = createTextarea({
|
|
7
8
|
Root: TextareaRoot,
|
|
8
9
|
Input: TextareaFieldComponent,
|
|
9
10
|
});
|
|
10
11
|
export const TextareaField = TextareaComponent.Input;
|
|
11
|
-
const Textarea = ({ validationStatus = 'initial', children, disabled, focused, readonly, ...props }) => {
|
|
12
|
+
const Textarea = ({ validationStatus = 'initial', children, disabled, focused, readonly, label, labelVariant, helperText, validText, invalidText, required, helperIcon, ...props }) => {
|
|
12
13
|
const formFieldContext = useFormFieldContext();
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const textareaLabel = label ?? formFieldContext?.label;
|
|
15
|
+
const textareaHelperText = helperText ?? formFieldContext?.helperText;
|
|
16
|
+
const textareaValidText = validText ?? formFieldContext?.validText;
|
|
17
|
+
const textareaInvalidText = invalidText ?? formFieldContext?.invalidText;
|
|
18
|
+
const textareaRequired = required ?? formFieldContext?.required;
|
|
19
|
+
const textareaDisabled = disabled ?? formFieldContext?.disabled;
|
|
20
|
+
const textareaReadonly = readonly ?? formFieldContext?.readonly;
|
|
21
|
+
const textareaValidationStatus = formFieldContext?.validationStatus ?? validationStatus;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (formFieldContext?.setShouldHandleAccessibility) {
|
|
24
|
+
formFieldContext.setShouldHandleAccessibility(true);
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
const getAccessibilityLabel = () => {
|
|
28
|
+
let accessibilityLabel = '';
|
|
29
|
+
if (textareaLabel) {
|
|
30
|
+
accessibilityLabel = accessibilityLabel + textareaLabel;
|
|
31
|
+
}
|
|
32
|
+
if (textareaRequired) {
|
|
33
|
+
accessibilityLabel = accessibilityLabel + ', required';
|
|
34
|
+
}
|
|
35
|
+
return accessibilityLabel || props.accessibilityLabel;
|
|
36
|
+
};
|
|
37
|
+
const getAccessibilityHint = () => {
|
|
38
|
+
let accessibilityHint = '';
|
|
39
|
+
if (textareaValidationStatus !== 'initial') {
|
|
40
|
+
if (accessibilityHint.length > 0) {
|
|
41
|
+
accessibilityHint = accessibilityHint + ', ';
|
|
42
|
+
}
|
|
43
|
+
if (textareaValidationStatus === 'invalid' && textareaInvalidText) {
|
|
44
|
+
accessibilityHint = accessibilityHint + textareaInvalidText;
|
|
45
|
+
}
|
|
46
|
+
if (textareaValidationStatus === 'valid' && textareaValidText) {
|
|
47
|
+
accessibilityHint = accessibilityHint + textareaValidText;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return accessibilityHint || props.accessibilityHint;
|
|
51
|
+
};
|
|
52
|
+
return (_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validText: validText, invalidText: invalidText, required: required, validationStatus: validationStatus, disabled: disabled, readonly: readonly, accessibilityHandledByChildren: true, children: _jsx(TextareaComponent, { ...(children ? props : {}), validationStatus: textareaValidationStatus, isInvalid: textareaValidationStatus === 'invalid', isReadOnly: textareaReadonly, isDisabled: textareaDisabled, isFocused: focused, required: textareaRequired, "aria-label": getAccessibilityLabel(), accessibilityHint: getAccessibilityHint(), children: children ? (_jsx(_Fragment, { children: children })) : (_jsx(_Fragment, { children: _jsx(TextareaField, { ...props }) })) }) }));
|
|
16
53
|
};
|
|
17
54
|
export default Textarea;
|
|
@@ -23,6 +23,14 @@ export interface TextareaBaseProps {
|
|
|
23
23
|
readonly?: boolean;
|
|
24
24
|
focused?: boolean;
|
|
25
25
|
placeholder?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
labelVariant?: 'heading' | 'body';
|
|
28
|
+
helperText?: string;
|
|
29
|
+
helperIcon?: React.ComponentType;
|
|
30
|
+
validText?: string;
|
|
31
|
+
invalidText?: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
isInBottomSheet?: boolean;
|
|
26
34
|
}
|
|
27
35
|
export interface TextareaWithChildrenProps extends TextareaBaseProps, ViewProps {
|
|
28
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import VerificationInputProps from './VerificationInput.props';
|
|
2
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;
|
|
3
|
+
({ value, onChangeText, label, labelVariant, helperText, helperIcon, validationStatus, validText, invalidText, disabled, readonly, secureTextEntry, style, ...props }: VerificationInputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default VerificationInput;
|
|
@@ -4,14 +4,14 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { FormField } from '../FormField';
|
|
5
5
|
import { useVerificationInput } from './useVerificationInput';
|
|
6
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 }) => {
|
|
7
|
+
const VerificationInput = ({ value = '', onChangeText, label, labelVariant = 'body', helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled = false, readonly = false, secureTextEntry = false, style, ...props }) => {
|
|
8
8
|
const length = 6;
|
|
9
9
|
const { inputRefs, focusedIndex, handleFocus, handleBlur, handleChangeText, handleKeyPress } = useVerificationInput({
|
|
10
10
|
value,
|
|
11
11
|
onChangeText,
|
|
12
12
|
});
|
|
13
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 => {
|
|
14
|
+
return (_jsx(FormField, { label: label, labelVariant: labelVariant, 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
15
|
const char = value[index] || '';
|
|
16
16
|
const isActive = focusedIndex === index;
|
|
17
17
|
return (_jsx(VerificationInputSlot, { ref: ref => {
|
|
@@ -13,6 +13,10 @@ export interface VerificationInputProps extends ViewProps {
|
|
|
13
13
|
* The label for the input.
|
|
14
14
|
*/
|
|
15
15
|
label?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The label variant for the input.
|
|
18
|
+
*/
|
|
19
|
+
labelVariant?: 'heading' | 'body';
|
|
16
20
|
/**
|
|
17
21
|
* Helper text to display below the input.
|
|
18
22
|
*/
|
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
Grid,
|
|
56
56
|
Heading,
|
|
57
57
|
HighlightBanner,
|
|
58
|
+
HighlightBannerImage,
|
|
58
59
|
Icon,
|
|
59
60
|
IconButton,
|
|
60
61
|
IconContainer,
|
|
@@ -488,11 +489,13 @@ const AllComponents: React.FC = () => {
|
|
|
488
489
|
heading="Featured Content"
|
|
489
490
|
headingColor="energy"
|
|
490
491
|
imageContainerHeight={40}
|
|
491
|
-
image={
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
492
|
+
image={
|
|
493
|
+
<HighlightBannerImage
|
|
494
|
+
source={{
|
|
495
|
+
uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=800&q=80',
|
|
496
|
+
}}
|
|
497
|
+
/>
|
|
498
|
+
}
|
|
496
499
|
description="Banner description goes here."
|
|
497
500
|
/>
|
|
498
501
|
</Center>
|