@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,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as Stories from './Textarea.stories';
|
|
3
|
-
import { Textarea, TextareaField, Center, Pressable } from '../..';
|
|
1
|
+
import { Canvas, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
|
|
4
2
|
import { EmailMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
5
|
-
import {
|
|
3
|
+
import { Center, Pressable, Textarea, TextareaField } from '../..';
|
|
4
|
+
import { BackToTopButton, UsageWrap, ViewFigmaButton } from '../../../docs/components';
|
|
5
|
+
import * as Stories from './Textarea.stories';
|
|
6
6
|
|
|
7
7
|
<Meta title="Forms / Textarea" />
|
|
8
8
|
|
|
@@ -19,6 +19,7 @@ The input component is a text field that allows users to enter text, numbers, or
|
|
|
19
19
|
- [Props](#props)
|
|
20
20
|
- [`Textarea`](#input)
|
|
21
21
|
- [`TextareaField`](#inputfield)
|
|
22
|
+
- [Examples](#examples)
|
|
22
23
|
- [Accessibility](#accessibility)
|
|
23
24
|
|
|
24
25
|
## Playground
|
|
@@ -61,14 +62,21 @@ all of the React Native [`View` props](https://reactnative.dev/docs/view).
|
|
|
61
62
|
| ---------------- | ---------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
63
|
| type | `'text' \| 'password'` | `'text'` | The type of the input. |
|
|
63
64
|
| validationStatus | `'initial' \| 'valid' \| 'invalid` | `'initial'` | The validation status of the input. |
|
|
64
|
-
| disabled | boolean
|
|
65
|
-
| readonly | boolean
|
|
66
|
-
| focused | boolean
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
65
|
+
| disabled | `boolean` | `false` | Disables the input. |
|
|
66
|
+
| readonly | `boolean` | `false` | Makes the input read-only. |
|
|
67
|
+
| focused | `boolean` | `false` | Sets focus on the input. |
|
|
68
|
+
| label | `string` | `-` | The label for the input. **(Only to be used if the input has no children)** |
|
|
69
|
+
| labelVariant | `'heading' \| 'body'` | `'body'` | The variant of the label text. **(Only to be used if the input has no children)** |
|
|
70
|
+
| helperText | `string` | `-` | Helper text to display below the input. **(Only to be used if the input has no children)** |
|
|
71
|
+
| helperIcon | `ComponentType` | `-` | Icon to display alongside the helper text. **(Only to be used if the input has no children)** |
|
|
72
|
+
| validText | `string` | `-` | Text to display when validation status is 'valid'. **(Only to be used if the input has no children)** |
|
|
73
|
+
| invalidText | `string` | `-` | Text to display when validation status is 'invalid'. |
|
|
74
|
+
| required | `boolean` | `false` | Whether the input is required. **(Only to be used if the input has no children)** |
|
|
75
|
+
| value | `string` | `-` | The value of the input. **(Only to be used if the input has no children)** |
|
|
76
|
+
| onChange | `function` | `-` | Callback function that is triggered when the input value changes. **(Only to be used if the input has no children)** **(Only to be used if the input has no children)** |
|
|
77
|
+
| onBlur | `function` | `-` | Callback function that is triggered when the input loses focus. **(Only to be used if the input has no children)** |
|
|
78
|
+
| onFocus | `function` | `-` | Callback function that is triggered when the input gains focus. **(Only to be used if the input has no children)** |
|
|
79
|
+
| placeholder | `string` | `-` | The placeholder text for the input. **(Only to be used if the input has no children)** |
|
|
72
80
|
|
|
73
81
|
If the `leadingIcon` or `trailingIcon` props are used, the `Textarea` component should not have any children.
|
|
74
82
|
|
|
@@ -79,11 +87,48 @@ The `TextareaField` inherits all of the React Native [`TextTextarea` props](http
|
|
|
79
87
|
| Prop | Type | Default | Description |
|
|
80
88
|
| ----------- | ---------------------- | -------- | ----------------------------------------------------------------- |
|
|
81
89
|
| type | `'text' \| 'password'` | `'text'` | The type of the input. |
|
|
82
|
-
| value | string
|
|
83
|
-
| onChange | function
|
|
84
|
-
| onBlur | function
|
|
85
|
-
| onFocus | function
|
|
86
|
-
| placeholder | string
|
|
90
|
+
| value | `string` | `-` | The value of the input. |
|
|
91
|
+
| onChange | `function` | `-` | Callback function that is triggered when the input value changes. |
|
|
92
|
+
| onBlur | `function` | `-` | Callback function that is triggered when the input loses focus. |
|
|
93
|
+
| onFocus | `function` | `-` | Callback function that is triggered when the input gains focus. |
|
|
94
|
+
| placeholder | `string` | `-` | The placeholder text for the input. |
|
|
95
|
+
|
|
96
|
+
## Examples
|
|
97
|
+
|
|
98
|
+
### With Label and Helper Text
|
|
99
|
+
|
|
100
|
+
The `Textarea` component can display a label and helper text by passing the appropriate props.
|
|
101
|
+
|
|
102
|
+
<UsageWrap>
|
|
103
|
+
<Center>
|
|
104
|
+
<Textarea
|
|
105
|
+
label="Description"
|
|
106
|
+
helperText="Provide a detailed description"
|
|
107
|
+
placeholder="Enter your text here..."
|
|
108
|
+
onChange={() => console.log('###')}
|
|
109
|
+
/>
|
|
110
|
+
</Center>
|
|
111
|
+
</UsageWrap>
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { Textarea } from '@utilitywarehouse/hearth-react-native';
|
|
115
|
+
|
|
116
|
+
const MyComponent = () => {
|
|
117
|
+
const [value, setValue] = useState('');
|
|
118
|
+
const handleChange = e => {
|
|
119
|
+
setValue(e.target.value);
|
|
120
|
+
};
|
|
121
|
+
return (
|
|
122
|
+
<Textarea
|
|
123
|
+
label="Description"
|
|
124
|
+
helperText="Provide a detailed description"
|
|
125
|
+
placeholder="Enter your text here..."
|
|
126
|
+
value={value}
|
|
127
|
+
onTextChange={handleChange}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
```
|
|
87
132
|
|
|
88
133
|
## Accessibility
|
|
89
134
|
|
|
@@ -95,6 +140,9 @@ We have outlined the various features that ensure the Textarea component is acce
|
|
|
95
140
|
|
|
96
141
|
### Screen Reader
|
|
97
142
|
|
|
143
|
+
- When setting the label prop, it is associated with the Textarea using aria-label.
|
|
144
|
+
- When setting the helperText prop, it is associated with the Textarea using aria-describedby.
|
|
145
|
+
- The required prop to indicate if the Textarea is required or optional and is read out by screen readers.
|
|
98
146
|
- Compatible with screen readers such as VoiceOver and Talk-back.
|
|
99
147
|
- The accessible and aria-label props to provide descriptive information about the Textarea
|
|
100
148
|
- Setting aria-traits and aria-hint to provide contextual information about the various states of the Textarea, such as "double tap to edit".
|
|
@@ -24,6 +24,14 @@ export interface TextareaBaseProps {
|
|
|
24
24
|
readonly?: boolean;
|
|
25
25
|
focused?: boolean;
|
|
26
26
|
placeholder?: string;
|
|
27
|
+
label?: string;
|
|
28
|
+
labelVariant?: 'heading' | 'body';
|
|
29
|
+
helperText?: string;
|
|
30
|
+
helperIcon?: React.ComponentType;
|
|
31
|
+
validText?: string;
|
|
32
|
+
invalidText?: string;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
isInBottomSheet?: boolean;
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
export interface TextareaWithChildrenProps extends TextareaBaseProps, ViewProps {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Textarea } from '.';
|
|
2
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Textarea } from '.';
|
|
3
3
|
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'Stories / Textarea',
|
|
@@ -13,13 +13,34 @@ const meta = {
|
|
|
13
13
|
description: 'The Textarea field placeholder',
|
|
14
14
|
defaultValue: '',
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
label: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'The label for the Textarea component',
|
|
19
|
+
defaultValue: 'Textarea label',
|
|
20
|
+
},
|
|
21
|
+
labelVariant: {
|
|
22
|
+
control: 'radio',
|
|
23
|
+
options: ['heading', 'body'],
|
|
24
|
+
description: 'The label variant for the Textarea component',
|
|
25
|
+
},
|
|
26
|
+
helperText: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'The helper text for the Textarea component',
|
|
29
|
+
},
|
|
17
30
|
validationStatus: {
|
|
18
31
|
control: 'select',
|
|
19
32
|
options: ['initial', 'valid', 'invalid'],
|
|
20
33
|
description: 'The validation status of the Textarea component',
|
|
21
34
|
defaultValue: 'initial',
|
|
22
35
|
},
|
|
36
|
+
invalidText: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'The invalid text for the Textarea component',
|
|
39
|
+
},
|
|
40
|
+
validText: {
|
|
41
|
+
control: 'text',
|
|
42
|
+
description: 'The valid text for the Textarea component',
|
|
43
|
+
},
|
|
23
44
|
disabled: {
|
|
24
45
|
control: 'boolean',
|
|
25
46
|
description: 'Disable the Textarea component',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createTextarea } from '@gluestack-ui/textarea';
|
|
2
2
|
import type TextareaProps from './Textarea.props';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
import { FormField, useFormFieldContext } from '../FormField';
|
|
5
6
|
import TextareaFieldComponent from './TextareaField';
|
|
6
|
-
import
|
|
7
|
+
import TextareaRoot from './TextareaRoot';
|
|
7
8
|
|
|
8
9
|
export const TextareaComponent = createTextarea({
|
|
9
10
|
Root: TextareaRoot,
|
|
@@ -18,29 +19,96 @@ const Textarea = ({
|
|
|
18
19
|
disabled,
|
|
19
20
|
focused,
|
|
20
21
|
readonly,
|
|
22
|
+
label,
|
|
23
|
+
labelVariant,
|
|
24
|
+
helperText,
|
|
25
|
+
validText,
|
|
26
|
+
invalidText,
|
|
27
|
+
required,
|
|
28
|
+
helperIcon,
|
|
21
29
|
...props
|
|
22
30
|
}: TextareaProps) => {
|
|
23
31
|
const formFieldContext = useFormFieldContext();
|
|
24
|
-
const
|
|
25
|
-
const
|
|
32
|
+
const textareaLabel = label ?? formFieldContext?.label;
|
|
33
|
+
const textareaHelperText = helperText ?? formFieldContext?.helperText;
|
|
34
|
+
const textareaValidText = validText ?? formFieldContext?.validText;
|
|
35
|
+
const textareaInvalidText = invalidText ?? formFieldContext?.invalidText;
|
|
36
|
+
const textareaRequired = required ?? formFieldContext?.required;
|
|
37
|
+
const textareaDisabled = disabled ?? formFieldContext?.disabled;
|
|
38
|
+
const textareaReadonly = readonly ?? formFieldContext?.readonly;
|
|
39
|
+
const textareaValidationStatus = formFieldContext?.validationStatus ?? validationStatus;
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (formFieldContext?.setShouldHandleAccessibility) {
|
|
43
|
+
formFieldContext.setShouldHandleAccessibility(true);
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
const getAccessibilityLabel = () => {
|
|
48
|
+
let accessibilityLabel = '';
|
|
49
|
+
if (textareaLabel) {
|
|
50
|
+
accessibilityLabel = accessibilityLabel + textareaLabel;
|
|
51
|
+
}
|
|
52
|
+
if (textareaRequired) {
|
|
53
|
+
accessibilityLabel = accessibilityLabel + ', required';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return accessibilityLabel || props.accessibilityLabel;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const getAccessibilityHint = () => {
|
|
60
|
+
let accessibilityHint = '';
|
|
61
|
+
if (textareaHelperText) {
|
|
62
|
+
accessibilityHint = accessibilityHint + textareaHelperText;
|
|
63
|
+
}
|
|
64
|
+
if (textareaValidationStatus !== 'initial') {
|
|
65
|
+
if (accessibilityHint.length > 0) {
|
|
66
|
+
accessibilityHint = accessibilityHint + ', ';
|
|
67
|
+
}
|
|
68
|
+
if (textareaValidationStatus === 'invalid' && textareaInvalidText) {
|
|
69
|
+
accessibilityHint = accessibilityHint + textareaInvalidText;
|
|
70
|
+
}
|
|
71
|
+
if (textareaValidationStatus === 'valid' && textareaValidText) {
|
|
72
|
+
accessibilityHint = accessibilityHint + textareaValidText;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return accessibilityHint || props.accessibilityHint;
|
|
76
|
+
};
|
|
26
77
|
|
|
27
78
|
return (
|
|
28
|
-
<
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
79
|
+
<FormField
|
|
80
|
+
label={label}
|
|
81
|
+
labelVariant={labelVariant}
|
|
82
|
+
helperText={helperText}
|
|
83
|
+
helperIcon={helperIcon}
|
|
84
|
+
validText={validText}
|
|
85
|
+
invalidText={invalidText}
|
|
86
|
+
required={required}
|
|
87
|
+
validationStatus={validationStatus}
|
|
88
|
+
disabled={disabled}
|
|
89
|
+
readonly={readonly}
|
|
90
|
+
accessibilityHandledByChildren
|
|
35
91
|
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
92
|
+
<TextareaComponent
|
|
93
|
+
{...(children ? props : {})}
|
|
94
|
+
validationStatus={textareaValidationStatus}
|
|
95
|
+
isInvalid={textareaValidationStatus === 'invalid'}
|
|
96
|
+
isReadOnly={textareaReadonly}
|
|
97
|
+
isDisabled={textareaDisabled}
|
|
98
|
+
isFocused={focused}
|
|
99
|
+
required={textareaRequired}
|
|
100
|
+
aria-label={getAccessibilityLabel()}
|
|
101
|
+
accessibilityHint={getAccessibilityHint()}
|
|
102
|
+
>
|
|
103
|
+
{children ? (
|
|
104
|
+
<>{children}</>
|
|
105
|
+
) : (
|
|
106
|
+
<>
|
|
107
|
+
<TextareaField {...props} />
|
|
108
|
+
</>
|
|
109
|
+
)}
|
|
110
|
+
</TextareaComponent>
|
|
111
|
+
</FormField>
|
|
44
112
|
);
|
|
45
113
|
};
|
|
46
114
|
|
|
@@ -33,9 +33,9 @@ export const Playground: Story = {
|
|
|
33
33
|
render: () => (
|
|
34
34
|
<Box gap="200">
|
|
35
35
|
<ThemedImage
|
|
36
|
-
// @ts-
|
|
36
|
+
// @ts-expect-error - This is a playground
|
|
37
37
|
light={<SpotBillingLight width={200} height={200} />}
|
|
38
|
-
// @ts-
|
|
38
|
+
// @ts-expect-error - This is a playground
|
|
39
39
|
dark={<SpotBillingDark width={200} height={200} />}
|
|
40
40
|
/>
|
|
41
41
|
</Box>
|
|
@@ -49,9 +49,9 @@ export const WithSpotIllustrations: Story = {
|
|
|
49
49
|
render: () => (
|
|
50
50
|
<Box flexDirection="row" flexWrap="wrap" gap="200">
|
|
51
51
|
<ThemedImage
|
|
52
|
-
// @ts-
|
|
52
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
53
53
|
light={<SpotBillingLight width={120} height={120} />}
|
|
54
|
-
// @ts-
|
|
54
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
55
55
|
dark={<SpotBillingDark width={120} height={120} />}
|
|
56
56
|
/>
|
|
57
57
|
</Box>
|
|
@@ -81,9 +81,9 @@ export const WithSceneIllustrations: Story = {
|
|
|
81
81
|
render: () => (
|
|
82
82
|
<Box gap="200">
|
|
83
83
|
<ThemedImage
|
|
84
|
-
// @ts-
|
|
84
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
85
85
|
light={<SceneBroadbandLight width={300} height={200} />}
|
|
86
|
-
// @ts-
|
|
86
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
87
87
|
dark={<SceneBroadbandDark width={300} height={200} />}
|
|
88
88
|
/>
|
|
89
89
|
</Box>
|
|
@@ -129,21 +129,21 @@ export const WithCustomSize: Story = {
|
|
|
129
129
|
render: () => (
|
|
130
130
|
<Box flexDirection="row" flexWrap="wrap" gap="200" alignItems="center">
|
|
131
131
|
<ThemedImage
|
|
132
|
-
// @ts-
|
|
132
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
133
133
|
light={<SpotBillingLight width={80} height={80} />}
|
|
134
|
-
// @ts-
|
|
134
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
135
135
|
dark={<SpotBillingDark width={80} height={80} />}
|
|
136
136
|
/>
|
|
137
137
|
<ThemedImage
|
|
138
|
-
// @ts-
|
|
138
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
139
139
|
light={<SpotBillingLight width={120} height={120} />}
|
|
140
|
-
// @ts-
|
|
140
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
141
141
|
dark={<SpotBillingDark width={120} height={120} />}
|
|
142
142
|
/>
|
|
143
143
|
<ThemedImage
|
|
144
|
-
// @ts-
|
|
144
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
145
145
|
light={<SpotBillingLight width={160} height={160} />}
|
|
146
|
-
// @ts-
|
|
146
|
+
// @ts-expect-error - Ignore TS2322 for Storybook stories
|
|
147
147
|
dark={<SpotBillingDark width={160} height={160} />}
|
|
148
148
|
/>
|
|
149
149
|
</Box>
|
|
@@ -163,9 +163,9 @@ export const WithAccessibility: Story = {
|
|
|
163
163
|
render: () => (
|
|
164
164
|
<Box gap="200">
|
|
165
165
|
<ThemedImage
|
|
166
|
-
// @ts-
|
|
166
|
+
// @ts-expect-error - This is a playground
|
|
167
167
|
light={<MascotEnergyLight width={150} height={150} />}
|
|
168
|
-
// @ts-
|
|
168
|
+
// @ts-expect-error - This is a playground
|
|
169
169
|
dark={<MascotEnergyDark width={150} height={150} />}
|
|
170
170
|
accessible={true}
|
|
171
171
|
accessibilityLabel="Energy service mascot illustration"
|
|
@@ -45,7 +45,7 @@ const ToastItem = forwardRef<ToastItemHandle, Props>(({ toast, onClose }, ref) =
|
|
|
45
45
|
}, 100);
|
|
46
46
|
|
|
47
47
|
return () => clearTimeout(timer);
|
|
48
|
-
}, [toast.text, toast.actionText]);
|
|
48
|
+
}, [toast.text, toast.actionText, translateY, opacity]);
|
|
49
49
|
|
|
50
50
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
51
51
|
transform: [{ translateY: translateY.value + gestureTranslateY.value }],
|
|
@@ -19,7 +19,7 @@ const ButtonIcon = ({
|
|
|
19
19
|
{...props}
|
|
20
20
|
style={
|
|
21
21
|
Platform.OS === 'web'
|
|
22
|
-
? // @ts-
|
|
22
|
+
? // @ts-expect-error - Spread types may only be created from object types.
|
|
23
23
|
{ ...(styles.icon as StyleProp<ViewStyle>), ...props.style }
|
|
24
24
|
: [styles.icon as StyleProp<ViewStyle>, props.style]
|
|
25
25
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GestureResponderEvent, Pressable, ViewStyle } from 'react-native';
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
|
-
import { useCardPressHandlerContext } from '../Card';
|
|
4
3
|
import type { ToggleButtonProps } from './ToggleButton.props';
|
|
5
4
|
|
|
6
5
|
const ButtonRoot = ({
|
|
@@ -12,7 +11,6 @@ const ButtonRoot = ({
|
|
|
12
11
|
...props
|
|
13
12
|
}: ToggleButtonProps & { states?: { active?: boolean; disabled?: boolean } }) => {
|
|
14
13
|
const { active } = states || {};
|
|
15
|
-
const { pressed } = useCardPressHandlerContext();
|
|
16
14
|
|
|
17
15
|
styles.useVariants({
|
|
18
16
|
toggled,
|
|
@@ -12,7 +12,7 @@ const UnstyledIconButtonIcon = ({ children, ...props }: IconProps) => {
|
|
|
12
12
|
{...props}
|
|
13
13
|
style={
|
|
14
14
|
Platform.OS === 'web'
|
|
15
|
-
? // @ts-
|
|
15
|
+
? // @ts-expect-error - Spread types may only be created from object types.
|
|
16
16
|
{ ...(styles.icon as StyleProp<ViewStyle>), ...props.style }
|
|
17
17
|
: [styles.icon as ViewStyle, props.style]
|
|
18
18
|
}
|
|
@@ -54,6 +54,7 @@ The component accepts the following props:
|
|
|
54
54
|
| `value` | `string` | - | The value of the input. |
|
|
55
55
|
| `onChangeText` | `(text: string) => void` | - | Callback when the value changes. |
|
|
56
56
|
| `label` | `string` | - | The label for the input. |
|
|
57
|
+
| `labelVariant` | `'heading' \| 'body'` | `'body'` | The variant of the label text. |
|
|
57
58
|
| `helperText` | `string` | - | Helper text to display below the input. |
|
|
58
59
|
| `helperIcon` | `ComponentType` | - | Icon to display alongside the helper text. |
|
|
59
60
|
| `validationStatus` | `'initial' \| 'valid' \| 'invalid'` | `'initial'` | The validation status of the input. |
|
|
@@ -14,6 +14,10 @@ export interface VerificationInputProps extends ViewProps {
|
|
|
14
14
|
* The label for the input.
|
|
15
15
|
*/
|
|
16
16
|
label?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The label variant for the input.
|
|
19
|
+
*/
|
|
20
|
+
labelVariant?: 'heading' | 'body';
|
|
17
21
|
/**
|
|
18
22
|
* Helper text to display below the input.
|
|
19
23
|
*/
|
|
@@ -49,4 +53,3 @@ export interface VerificationInputProps extends ViewProps {
|
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
export default VerificationInputProps;
|
|
52
|
-
|
|
@@ -9,6 +9,7 @@ const VerificationInput = ({
|
|
|
9
9
|
value = '',
|
|
10
10
|
onChangeText,
|
|
11
11
|
label,
|
|
12
|
+
labelVariant = 'body',
|
|
12
13
|
helperText,
|
|
13
14
|
helperIcon,
|
|
14
15
|
validationStatus = 'initial',
|
|
@@ -32,6 +33,7 @@ const VerificationInput = ({
|
|
|
32
33
|
return (
|
|
33
34
|
<FormField
|
|
34
35
|
label={label}
|
|
36
|
+
labelVariant={labelVariant}
|
|
35
37
|
helperText={helperText}
|
|
36
38
|
helperIcon={helperIcon}
|
|
37
39
|
validationStatus={validationStatus}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import DatePickerCalendar from "./DatePickerCalendar"
|
|
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
|
-
DatePickerCalendar,
|
|
15
|
-
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3797%3A6383",
|
|
16
|
-
{
|
|
17
|
-
props: {
|
|
18
|
-
// No matching props could be found for these Figma properties:
|
|
19
|
-
// "grabber": figma.boolean('Grabber?'),
|
|
20
|
-
// "header": figma.boolean('Header?'),
|
|
21
|
-
// "footer": figma.boolean('Footer?'),
|
|
22
|
-
// "deviceType": figma.enum('Device type', {
|
|
23
|
-
// "Desktop": "desktop",
|
|
24
|
-
// "Mobile": "mobile"
|
|
25
|
-
// }),
|
|
26
|
-
// "type": figma.enum('Type', {
|
|
27
|
-
// "Day": "day",
|
|
28
|
-
// "Month": "month",
|
|
29
|
-
// "Year": "year"
|
|
30
|
-
// })
|
|
31
|
-
},
|
|
32
|
-
example: (props) => <DatePickerCalendar />,
|
|
33
|
-
},
|
|
34
|
-
)
|