@utilitywarehouse/hearth-react-native 0.15.3 → 0.16.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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +67 -6
- package/CHANGELOG.md +73 -6
- package/build/components/Avatar/Avatar.js +0 -2
- package/build/components/Banner/Banner.d.ts +1 -1
- package/build/components/Banner/Banner.js +3 -1
- package/build/components/Carousel/Carousel.js +1 -1
- 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/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/DateInput.js +1 -0
- package/build/components/DateInput/DateInputSegment.js +2 -3
- package/build/components/DatePicker/DatePicker.js +8 -4
- package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.d.ts +0 -1
- package/build/components/DatePicker/DatePickerHeader/index.js +1 -1
- package/build/components/DatePicker/index.d.ts +1 -0
- package/build/components/DatePicker/polyfill.js +3 -3
- package/build/components/DatePicker/time-picker/wheel-web.js +1 -3
- package/build/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/build/components/DatePickerInput/DatePickerInput.js +3 -4
- package/build/components/DatePickerInput/DatePickerInput.props.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
- package/build/components/DescriptionList/DescriptionList.js +2 -2
- package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -0
- package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
- package/build/components/DescriptionList/DescriptionListItem.js +3 -2
- package/build/components/DescriptionList/DescriptionListItem.props.d.ts +1 -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/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/Switch/Switch.js +1 -1
- package/build/components/Tabs/Tabs.d.ts +1 -1
- package/build/components/Tabs/Tabs.js +1 -1
- package/build/components/Textarea/Textarea.d.ts +1 -1
- package/build/components/Textarea/Textarea.js +46 -6
- package/build/components/Textarea/Textarea.props.d.ts +8 -0
- package/build/components/Toast/ToastItem.js +1 -1
- package/build/components/ToggleButton/ToggleButtonIcon.js +1 -1
- package/build/components/ToggleButton/ToggleButtonRoot.js +0 -2
- package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +1 -1
- 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/build/utils/coloursAsArray.js +1 -1
- package/docs/components/AllComponents.web.tsx +19 -20
- package/docs/components/UsageWrap.tsx +17 -20
- package/docs/theme-tokens.mdx +390 -2
- package/eslint.config.js +5 -1
- package/package.json +12 -12
- package/src/components/Accordion/Accordion.figma.tsx +15 -17
- package/src/components/Accordion/AccordionItem.figma.tsx +27 -0
- package/src/components/Avatar/Avatar.figma.tsx +11 -21
- package/src/components/Avatar/Avatar.tsx +0 -2
- package/src/components/Badge/Badge.figma.tsx +45 -54
- package/src/components/Banner/Banner.figma.tsx +21 -13
- package/src/components/Banner/Banner.stories.tsx +4 -4
- package/src/components/Banner/Banner.tsx +2 -1
- package/src/components/Button/Button.figma.tsx +118 -46
- package/src/components/Card/Card.figma.tsx +27 -43
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Carousel/Carousel.figma.tsx +20 -17
- package/src/components/Carousel/Carousel.tsx +1 -1
- package/src/components/Checkbox/Checkbox.docs.mdx +32 -31
- package/src/components/Checkbox/Checkbox.figma.tsx +15 -18
- package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +48 -15
- package/src/components/Checkbox/CheckboxGroup.props.ts +2 -1
- package/src/components/Checkbox/CheckboxGroup.tsx +6 -1
- package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +24 -27
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +52 -9
- package/src/components/CurrencyInput/CurrencyInput.figma.tsx +65 -49
- 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/DateInput.figma.tsx +58 -45
- package/src/components/DateInput/DateInput.tsx +1 -0
- package/src/components/DateInput/DateInputSegment.tsx +2 -3
- package/src/components/DatePicker/DatePicker.figma.tsx +47 -0
- package/src/components/DatePicker/DatePicker.tsx +8 -4
- package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.props.ts +0 -2
- package/src/components/DatePicker/DatePickerHeader/index.tsx +2 -2
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/DatePicker/polyfill.ts +3 -3
- package/src/components/DatePicker/time-picker/wheel-web.tsx +0 -1
- package/src/components/DatePickerInput/DatePickerInput.docs.mdx +22 -0
- package/src/components/DatePickerInput/DatePickerInput.figma.tsx +18 -46
- package/src/components/DatePickerInput/DatePickerInput.props.ts +6 -0
- package/src/components/DatePickerInput/DatePickerInput.tsx +17 -5
- package/src/components/DescriptionList/DescriptionList.docs.mdx +16 -14
- package/src/components/DescriptionList/DescriptionList.figma.tsx +41 -17
- package/src/components/DescriptionList/DescriptionList.props.ts +1 -0
- package/src/components/DescriptionList/DescriptionList.stories.tsx +24 -0
- package/src/components/DescriptionList/DescriptionList.tsx +2 -0
- package/src/components/DescriptionList/DescriptionListItem.figma.tsx +42 -0
- package/src/components/DescriptionList/DescriptionListItem.props.ts +1 -0
- package/src/components/DescriptionList/DescriptionListItem.tsx +7 -0
- package/src/components/Divider/Divider.figma.tsx +10 -23
- 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 -60
- package/src/components/Label/Label.props.ts +3 -2
- package/src/components/Label/Label.tsx +11 -1
- package/src/components/List/List.stories.tsx +1 -4
- package/src/components/Radio/Radio.docs.mdx +31 -30
- package/src/components/Radio/Radio.stories.tsx +1 -1
- 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/Switch/Switch.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +0 -1
- 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 +87 -19
- package/src/components/ThemedImage/ThemedImage.stories.tsx +14 -14
- package/src/components/Toast/ToastItem.tsx +1 -1
- package/src/components/ToggleButton/ToggleButtonIcon.tsx +1 -1
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +0 -2
- package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +1 -1
- 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
- package/src/utils/coloursAsArray.ts +1 -1
- package/tsconfig.eslint.json +13 -0
- package/src/components/Accordion/AccordionItemRoot.figma.tsx +0 -47
- package/src/components/DatePicker/DatePickerCalendar.figma.tsx +0 -34
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { FormFieldBaseProps } from './FormField.props';
|
|
2
|
-
export declare const FormFieldContext: import("react").Context<FormFieldBaseProps
|
|
3
|
-
|
|
2
|
+
export declare const FormFieldContext: import("react").Context<FormFieldBaseProps & {
|
|
3
|
+
setShouldHandleAccessibility?: (value: boolean) => void;
|
|
4
|
+
shouldHandleAccessibility?: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useFormFieldContext: () => FormFieldBaseProps & {
|
|
7
|
+
setShouldHandleAccessibility?: (value: boolean) => void;
|
|
8
|
+
shouldHandleAccessibility?: boolean;
|
|
9
|
+
};
|
|
@@ -23,7 +23,7 @@ export declare const FormFieldInvalidText: {
|
|
|
23
23
|
};
|
|
24
24
|
export declare const FormFieldTextContent: typeof View;
|
|
25
25
|
declare const FormField: {
|
|
26
|
-
({ children, disabled, validationStatus, readonly, label, helperText, helperIcon, validText, invalidText, required, ...props }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
({ children, disabled, validationStatus, readonly, label, helperText, helperIcon, validText, invalidText, required, labelVariant, accessibilityHandledByChildren, ...props }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
displayName: string;
|
|
28
28
|
};
|
|
29
29
|
export default FormField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createFormControl } from '@gluestack-ui/form-control';
|
|
3
|
-
import { useMemo } from 'react';
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
4
|
import { View } from 'react-native';
|
|
5
5
|
import { HelperIcon, HelperText } from '../Helper';
|
|
6
6
|
import { FormFieldContext } from './FormField.context';
|
|
@@ -29,14 +29,34 @@ export const FormFieldHelperIcon = HelperIcon;
|
|
|
29
29
|
export const FormFieldValidText = HelperText;
|
|
30
30
|
export const FormFieldInvalidText = HelperText;
|
|
31
31
|
export const FormFieldTextContent = View;
|
|
32
|
-
const FormField = ({ children, disabled, validationStatus = 'initial', readonly, label, helperText, helperIcon, validText, invalidText, required = true, ...props }) => {
|
|
32
|
+
const FormField = ({ children, disabled, validationStatus = 'initial', readonly, label, helperText, helperIcon, validText, invalidText, required = true, labelVariant = 'body', accessibilityHandledByChildren = false, ...props }) => {
|
|
33
|
+
const [shouldHandleAccessibility, setShouldHandleAccessibility] = useState(accessibilityHandledByChildren);
|
|
33
34
|
const value = useMemo(() => ({
|
|
34
35
|
validationStatus,
|
|
35
36
|
disabled,
|
|
36
37
|
readonly,
|
|
37
38
|
required,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
label,
|
|
40
|
+
helperText,
|
|
41
|
+
helperIcon,
|
|
42
|
+
validText,
|
|
43
|
+
invalidText,
|
|
44
|
+
setShouldHandleAccessibility,
|
|
45
|
+
shouldHandleAccessibility,
|
|
46
|
+
}), [
|
|
47
|
+
validationStatus,
|
|
48
|
+
disabled,
|
|
49
|
+
readonly,
|
|
50
|
+
required,
|
|
51
|
+
label,
|
|
52
|
+
helperText,
|
|
53
|
+
helperIcon,
|
|
54
|
+
validText,
|
|
55
|
+
invalidText,
|
|
56
|
+
setShouldHandleAccessibility,
|
|
57
|
+
shouldHandleAccessibility,
|
|
58
|
+
]);
|
|
59
|
+
return (_jsx(FormFieldContext.Provider, { value: value, children: _jsxs(FormFieldComponent, { ...props, isDisabled: disabled, isReadOnly: readonly, children: [(!!label || !!helperText) && (_jsxs(FormFieldTextContent, { children: [!!label && (_jsxs(FormFieldLabelText, { variant: labelVariant, importantForAccessibility: shouldHandleAccessibility ? 'no' : undefined, accessibilityElementsHidden: shouldHandleAccessibility, children: [label, !required ? ` (Optional)` : ''] })), !!helperText && (_jsx(FormFieldHelper, { text: helperText, icon: helperIcon, showIcon: !!helperIcon, importantForAccessibility: shouldHandleAccessibility ? 'no' : undefined, accessibilityElementsHidden: shouldHandleAccessibility }))] })), children, !!validText && _jsx(FormFieldValid, { text: validText }), !!invalidText && _jsx(FormFieldInvalidComponent, { text: invalidText })] }) }));
|
|
40
60
|
};
|
|
41
61
|
FormField.displayName = 'FormField';
|
|
42
62
|
export default FormField;
|
|
@@ -5,11 +5,13 @@ export interface FormFieldBaseProps {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
readonly?: boolean;
|
|
7
7
|
label?: string;
|
|
8
|
+
labelVariant?: 'heading' | 'body';
|
|
8
9
|
helperText?: string;
|
|
9
10
|
helperIcon?: ComponentType;
|
|
10
11
|
validText?: string;
|
|
11
12
|
invalidText?: string;
|
|
12
13
|
required?: boolean;
|
|
14
|
+
accessibilityHandledByChildren?: boolean;
|
|
13
15
|
}
|
|
14
16
|
interface FormFieldProps extends FormFieldBaseProps, ViewProps {
|
|
15
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import LabelProps from '../Label/Label.props';
|
|
2
2
|
declare const FormFieldLabel: {
|
|
3
|
-
({ children }: Omit<LabelProps, "disabled">): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, ...props }: Omit<LabelProps, "disabled">): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default FormFieldLabel;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFormFieldContext } from './FormField.context';
|
|
3
2
|
import { Label } from '../Label';
|
|
4
|
-
|
|
3
|
+
import { useFormFieldContext } from './FormField.context';
|
|
4
|
+
const FormFieldLabel = ({ children, ...props }) => {
|
|
5
5
|
const { disabled } = useFormFieldContext();
|
|
6
|
-
return _jsx(Label, { disabled: disabled, children: children });
|
|
6
|
+
return (_jsx(Label, { disabled: disabled, ...props, children: children }));
|
|
7
7
|
};
|
|
8
8
|
FormFieldLabel.displayName = 'FormFieldLabel';
|
|
9
9
|
export default FormFieldLabel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFormFieldContext } from './FormField.context';
|
|
3
|
-
import { Helper } from '../Helper';
|
|
4
2
|
import { TickCircleSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import { Helper } from '../Helper';
|
|
4
|
+
import { useFormFieldContext } from './FormField.context';
|
|
5
5
|
const FormFieldValid = ({ children, icon = TickCircleSmallIcon, text, ...props }) => {
|
|
6
6
|
const { validationStatus, disabled } = useFormFieldContext();
|
|
7
7
|
return validationStatus === 'valid' ? (children ? (_jsx(Helper, { validationStatus: "valid", showIcon: true, disabled: disabled, ...props, children: children })) : (_jsx(Helper, { validationStatus: "valid", disabled: disabled, showIcon: true, icon: icon, text: text, ...props }))) : null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createInput } from '@gluestack-ui/input';
|
|
3
|
-
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
3
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
4
|
import { CloseSmallIcon, EyeOffSmallIcon, EyeSmallIcon, SearchMediumIcon, } from '@utilitywarehouse/hearth-react-native-icons';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
|
-
import { useFormFieldContext } from '../FormField';
|
|
6
|
+
import { FormField, useFormFieldContext } from '../FormField';
|
|
7
7
|
import { Spinner } from '../Spinner';
|
|
8
8
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
9
9
|
import InputFieldComponent from './InputField';
|
|
@@ -19,11 +19,21 @@ export const InputComponent = createInput({
|
|
|
19
19
|
export const InputSlot = InputComponent.Slot;
|
|
20
20
|
export const InputField = InputComponent.Input;
|
|
21
21
|
export const InputIcon = InputComponent.Icon;
|
|
22
|
-
const Input = forwardRef(({ validationStatus = 'initial', children, disabled, focused, readonly, leadingIcon, trailingIcon, type, showPasswordToggle = true, onClear,
|
|
22
|
+
const Input = forwardRef(({ validationStatus = 'initial', children, disabled, focused, readonly, leadingIcon, trailingIcon, type, showPasswordToggle = true, onClear, loading, clearable = false, required = true, inBottomSheet = false, style, label, labelVariant, helperText, helperIcon, validText, invalidText, ...props }, ref) => {
|
|
23
23
|
const formFieldContext = useFormFieldContext();
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
24
|
+
const inputLabel = label ?? formFieldContext?.label;
|
|
25
|
+
const inputHelperText = helperText ?? formFieldContext?.helperText;
|
|
26
|
+
const inputValidText = validText ?? formFieldContext?.validText;
|
|
27
|
+
const inputInvalidText = invalidText ?? formFieldContext?.invalidText;
|
|
28
|
+
const inputRequired = required ?? formFieldContext?.required;
|
|
29
|
+
const inputDisabled = disabled ?? formFieldContext?.disabled;
|
|
30
|
+
const inputReadonly = readonly ?? formFieldContext?.readonly;
|
|
31
|
+
const inputValidationStatus = formFieldContext?.validationStatus ?? validationStatus;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (formFieldContext?.setShouldHandleAccessibility) {
|
|
34
|
+
formFieldContext.setShouldHandleAccessibility(true);
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
27
37
|
const [fieldType, setFieldType] = useState(type === 'password' ? 'password' : 'text');
|
|
28
38
|
const { color } = useTheme();
|
|
29
39
|
const inputRef = useRef(null);
|
|
@@ -46,11 +56,39 @@ const Input = forwardRef(({ validationStatus = 'initial', children, disabled, fo
|
|
|
46
56
|
}
|
|
47
57
|
return undefined;
|
|
48
58
|
})();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
const getAccessibilityLabel = () => {
|
|
60
|
+
let accessibilityLabel = '';
|
|
61
|
+
if (inputLabel) {
|
|
62
|
+
accessibilityLabel = accessibilityLabel + inputLabel;
|
|
63
|
+
}
|
|
64
|
+
if (inputRequired) {
|
|
65
|
+
accessibilityLabel = accessibilityLabel + ', required';
|
|
66
|
+
}
|
|
67
|
+
return accessibilityLabel || props.accessibilityLabel;
|
|
68
|
+
};
|
|
69
|
+
const getAccessibilityHint = () => {
|
|
70
|
+
let accessibilityHint = '';
|
|
71
|
+
if (inputHelperText) {
|
|
72
|
+
accessibilityHint = accessibilityHint + inputHelperText;
|
|
73
|
+
}
|
|
74
|
+
if (inputValidationStatus !== 'initial') {
|
|
75
|
+
if (accessibilityHint.length > 0) {
|
|
76
|
+
accessibilityHint = accessibilityHint + ', ';
|
|
77
|
+
}
|
|
78
|
+
if (inputValidationStatus === 'invalid' && inputInvalidText) {
|
|
79
|
+
accessibilityHint = accessibilityHint + inputInvalidText;
|
|
80
|
+
}
|
|
81
|
+
if (inputValidationStatus === 'valid' && inputValidText) {
|
|
82
|
+
accessibilityHint = accessibilityHint + inputValidText;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return accessibilityHint || props.accessibilityHint;
|
|
86
|
+
};
|
|
87
|
+
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(InputComponent, { ...(children ? props : {}), validationStatus: inputValidationStatus, isInvalid: inputValidationStatus === 'invalid', isReadOnly: inputReadonly, isDisabled: inputDisabled, isFocused: focused, type: type, isRequired: inputRequired, style: style, children: children ? (_jsx(_Fragment, { children: children })) : (_jsxs(_Fragment, { children: [!!leadingIconComponent && (_jsx(InputSlot, { children: _jsx(InputIcon, { as: leadingIconComponent }) })), _jsx(InputField
|
|
52
88
|
// @ts-expect-error - ref forwarding issue
|
|
53
|
-
|
|
89
|
+
, {
|
|
90
|
+
// @ts-expect-error - ref forwarding issue
|
|
91
|
+
ref: inputRef, type: fieldType, inputMode: getInputMode, inBottomSheet: inBottomSheet, ...props, "aria-label": getAccessibilityLabel(), accessibilityHint: getAccessibilityHint() }), shouldShowClear && (_jsx(InputSlot, { children: _jsx(UnstyledIconButton, { onPress: onClear, icon: CloseSmallIcon }) })), loading && (_jsx(InputSlot, { children: _jsx(Spinner, { size: "xs", color: color.icon.primary }) })), shouldShowPasswordToggle && (_jsx(InputSlot, { children: _jsx(UnstyledIconButton, { onPress: toggleFieldType, icon: fieldType === 'password' ? EyeSmallIcon : EyeOffSmallIcon }) })), !!trailingIcon && (_jsx(InputSlot, { children: _jsx(InputIcon, { as: trailingIcon }) }))] })) }) }));
|
|
54
92
|
});
|
|
55
93
|
Input.displayName = 'Input';
|
|
56
94
|
export default Input;
|
|
@@ -25,6 +25,13 @@ export interface InputBaseProps {
|
|
|
25
25
|
focused?: boolean;
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
inBottomSheet?: boolean;
|
|
28
|
+
label?: string;
|
|
29
|
+
labelVariant?: 'heading' | 'body';
|
|
30
|
+
helperText?: string;
|
|
31
|
+
helperIcon?: ComponentType;
|
|
32
|
+
validText?: string;
|
|
33
|
+
invalidText?: string;
|
|
34
|
+
required?: boolean;
|
|
28
35
|
}
|
|
29
36
|
export interface InputWithChildrenProps extends InputBaseProps, ViewProps {
|
|
30
37
|
children: ViewProps['children'];
|
|
@@ -36,7 +43,6 @@ export interface InputWithChildrenProps extends InputBaseProps, ViewProps {
|
|
|
36
43
|
onClear?: never;
|
|
37
44
|
leadingIcon?: never;
|
|
38
45
|
trailingIcon?: never;
|
|
39
|
-
required?: never;
|
|
40
46
|
}
|
|
41
47
|
interface InputWithoutChildrenBaseProps extends InputBaseProps, Omit<TextInputProps, 'children'> {
|
|
42
48
|
children?: never;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import LabelProps from './Label.props';
|
|
2
2
|
declare const Label: {
|
|
3
|
-
({ children, nested, disabled, style, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, nested, disabled, style, variant, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Label;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
import { BodyText } from '../BodyText';
|
|
4
|
-
|
|
4
|
+
import { Heading } from '../Heading';
|
|
5
|
+
const Label = ({ children, nested, disabled, style, variant = 'body', ...props }) => {
|
|
5
6
|
styles.useVariants({ disabled });
|
|
7
|
+
if (variant === 'heading') {
|
|
8
|
+
return (_jsx(Heading, { size: "md", style: [styles.text, style], ...props, children: children }));
|
|
9
|
+
}
|
|
6
10
|
return (_jsx(BodyText, { size: "md", weight: nested ? 'regular' : 'semibold', style: [styles.text, style], ...props, children: children }));
|
|
7
11
|
};
|
|
8
12
|
Label.displayName = 'Label';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
interface LabelProps extends
|
|
1
|
+
import { BodyTextProps } from '../BodyText';
|
|
2
|
+
interface LabelProps extends Omit<BodyTextProps, 'size' | 'weight'> {
|
|
3
3
|
nested?: boolean;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
variant?: 'heading' | 'body';
|
|
5
6
|
}
|
|
6
7
|
export default LabelProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import RadioGroupProps from './RadioGroup.props';
|
|
2
2
|
declare const RadioGroup: {
|
|
3
|
-
({ children, disabled, readonly, validationStatus, label, helperText, invalidText, validText, showValidationIcon, helperIcon, type, direction, gap, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, disabled, readonly, validationStatus, label, labelVariant, helperText, invalidText, validText, showValidationIcon, helperIcon, type, direction, gap, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default RadioGroup;
|
|
@@ -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
|
*/
|
|
@@ -8,7 +8,7 @@ import { useAnimatedTheme } from 'react-native-unistyles/reanimated';
|
|
|
8
8
|
import { useTheme } from '../../hooks';
|
|
9
9
|
import { Icon } from '../Icon';
|
|
10
10
|
const CustomSwitch = ({ value = false, onValueChange, disabled = false, size = 'medium', ...accessibilityProps }) => {
|
|
11
|
-
const { components
|
|
11
|
+
const { components } = useTheme();
|
|
12
12
|
const theme = useAnimatedTheme();
|
|
13
13
|
const SWITCH_WIDTH = size === 'medium' ? components.switch.md.width : components.switch.sm.width;
|
|
14
14
|
const THUMB_SIZE = size === 'medium' ? components.switch.md.circle.size : components.switch.sm.circle.size;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type TabsProps from './Tabs.props';
|
|
2
2
|
declare const Tabs: {
|
|
3
|
-
({ value: controlledValue, defaultValue, onValueChange, size, disabled, children,
|
|
3
|
+
({ value: controlledValue, defaultValue, onValueChange, size, disabled, children, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Tabs;
|
|
@@ -3,7 +3,7 @@ import { Children, isValidElement, useCallback, useEffect, useMemo, useRef, useS
|
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { Easing, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
5
5
|
import { TabsContext } from './Tabs.context';
|
|
6
|
-
const Tabs = ({ value: controlledValue, defaultValue, onValueChange, size = 'md', disabled, children,
|
|
6
|
+
const Tabs = ({ value: controlledValue, defaultValue, onValueChange, size = 'md', disabled, children, ...props }) => {
|
|
7
7
|
// Collect child tab values
|
|
8
8
|
const tabValues = useMemo(() => {
|
|
9
9
|
const vals = [];
|
|
@@ -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,57 @@
|
|
|
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 (textareaHelperText) {
|
|
40
|
+
accessibilityHint = accessibilityHint + textareaHelperText;
|
|
41
|
+
}
|
|
42
|
+
if (textareaValidationStatus !== 'initial') {
|
|
43
|
+
if (accessibilityHint.length > 0) {
|
|
44
|
+
accessibilityHint = accessibilityHint + ', ';
|
|
45
|
+
}
|
|
46
|
+
if (textareaValidationStatus === 'invalid' && textareaInvalidText) {
|
|
47
|
+
accessibilityHint = accessibilityHint + textareaInvalidText;
|
|
48
|
+
}
|
|
49
|
+
if (textareaValidationStatus === 'valid' && textareaValidText) {
|
|
50
|
+
accessibilityHint = accessibilityHint + textareaValidText;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return accessibilityHint || props.accessibilityHint;
|
|
54
|
+
};
|
|
55
|
+
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
56
|
};
|
|
17
57
|
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
|
}
|
|
@@ -26,7 +26,7 @@ const ToastItem = forwardRef(({ toast, onClose }, ref) => {
|
|
|
26
26
|
AccessibilityInfo.announceForAccessibility(announcement);
|
|
27
27
|
}, 100);
|
|
28
28
|
return () => clearTimeout(timer);
|
|
29
|
-
}, [toast.text, toast.actionText]);
|
|
29
|
+
}, [toast.text, toast.actionText, translateY, opacity]);
|
|
30
30
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
31
31
|
transform: [{ translateY: translateY.value + gestureTranslateY.value }],
|
|
32
32
|
opacity: opacity.value,
|
|
@@ -7,7 +7,7 @@ const ButtonIcon = ({ children, toggled, as = TickSmallIcon, ...props }) => {
|
|
|
7
7
|
styles.useVariants({ toggled });
|
|
8
8
|
const IconAny = Icon;
|
|
9
9
|
return (_jsx(IconAny, { as: as, ...props, style: Platform.OS === 'web'
|
|
10
|
-
? // @ts-
|
|
10
|
+
? // @ts-expect-error - Spread types may only be created from object types.
|
|
11
11
|
{ ...styles.icon, ...props.style }
|
|
12
12
|
: [styles.icon, props.style], children: children }));
|
|
13
13
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
-
import { useCardPressHandlerContext } from '../Card';
|
|
5
4
|
const ButtonRoot = ({ children, onToggle, toggled, states, onPress, ...props }) => {
|
|
6
5
|
const { active } = states || {};
|
|
7
|
-
const { pressed } = useCardPressHandlerContext();
|
|
8
6
|
styles.useVariants({
|
|
9
7
|
toggled,
|
|
10
8
|
active,
|
|
@@ -7,7 +7,7 @@ const UnstyledIconButtonIcon = ({ children, ...props }) => {
|
|
|
7
7
|
const { active, inverted, size } = useUnstyledIconButtonContext();
|
|
8
8
|
styles.useVariants({ active, inverted, size });
|
|
9
9
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
10
|
-
? // @ts-
|
|
10
|
+
? // @ts-expect-error - Spread types may only be created from object types.
|
|
11
11
|
{ ...styles.icon, ...props.style }
|
|
12
12
|
: [styles.icon, props.style], children: children }));
|
|
13
13
|
};
|
|
@@ -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
|
*/
|