@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.
Files changed (160) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +67 -6
  3. package/CHANGELOG.md +73 -6
  4. package/build/components/Avatar/Avatar.js +0 -2
  5. package/build/components/Banner/Banner.d.ts +1 -1
  6. package/build/components/Banner/Banner.js +3 -1
  7. package/build/components/Carousel/Carousel.js +1 -1
  8. package/build/components/Checkbox/CheckboxGroup.d.ts +1 -1
  9. package/build/components/Checkbox/CheckboxGroup.js +2 -2
  10. package/build/components/Checkbox/CheckboxGroup.props.d.ts +2 -1
  11. package/build/components/CurrencyInput/CurrencyInput.d.ts +1 -1
  12. package/build/components/CurrencyInput/CurrencyInput.js +2 -6
  13. package/build/components/CurrencyInput/CurrencyInput.props.d.ts +6 -0
  14. package/build/components/DateInput/DateInput.js +1 -0
  15. package/build/components/DateInput/DateInputSegment.js +2 -3
  16. package/build/components/DatePicker/DatePicker.js +8 -4
  17. package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.d.ts +0 -1
  18. package/build/components/DatePicker/DatePickerHeader/index.js +1 -1
  19. package/build/components/DatePicker/index.d.ts +1 -0
  20. package/build/components/DatePicker/polyfill.js +3 -3
  21. package/build/components/DatePicker/time-picker/wheel-web.js +1 -3
  22. package/build/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  23. package/build/components/DatePickerInput/DatePickerInput.js +3 -4
  24. package/build/components/DatePickerInput/DatePickerInput.props.d.ts +6 -0
  25. package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
  26. package/build/components/DescriptionList/DescriptionList.js +2 -2
  27. package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -0
  28. package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
  29. package/build/components/DescriptionList/DescriptionListItem.js +3 -2
  30. package/build/components/DescriptionList/DescriptionListItem.props.d.ts +1 -0
  31. package/build/components/FormField/FormField.context.d.ts +8 -2
  32. package/build/components/FormField/FormField.d.ts +1 -1
  33. package/build/components/FormField/FormField.js +24 -4
  34. package/build/components/FormField/FormField.props.d.ts +2 -0
  35. package/build/components/FormField/FormFieldLabel.d.ts +1 -1
  36. package/build/components/FormField/FormFieldLabel.js +3 -3
  37. package/build/components/FormField/FormFieldValid.js +2 -2
  38. package/build/components/Input/Input.js +48 -10
  39. package/build/components/Input/Input.props.d.ts +7 -1
  40. package/build/components/Label/Label.d.ts +1 -1
  41. package/build/components/Label/Label.js +5 -1
  42. package/build/components/Label/Label.props.d.ts +3 -2
  43. package/build/components/Radio/RadioGroup.d.ts +1 -1
  44. package/build/components/Radio/RadioGroup.js +2 -2
  45. package/build/components/Radio/RadioGroup.props.d.ts +1 -0
  46. package/build/components/RadioCard/RadioCard.d.ts +1 -1
  47. package/build/components/RadioCard/RadioCard.js +2 -2
  48. package/build/components/RadioCard/RadioCard.props.d.ts +1 -0
  49. package/build/components/Select/Select.d.ts +1 -1
  50. package/build/components/Select/Select.js +2 -2
  51. package/build/components/Select/Select.props.d.ts +10 -0
  52. package/build/components/Switch/Switch.js +1 -1
  53. package/build/components/Tabs/Tabs.d.ts +1 -1
  54. package/build/components/Tabs/Tabs.js +1 -1
  55. package/build/components/Textarea/Textarea.d.ts +1 -1
  56. package/build/components/Textarea/Textarea.js +46 -6
  57. package/build/components/Textarea/Textarea.props.d.ts +8 -0
  58. package/build/components/Toast/ToastItem.js +1 -1
  59. package/build/components/ToggleButton/ToggleButtonIcon.js +1 -1
  60. package/build/components/ToggleButton/ToggleButtonRoot.js +0 -2
  61. package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +1 -1
  62. package/build/components/VerificationInput/VerificationInput.d.ts +1 -1
  63. package/build/components/VerificationInput/VerificationInput.js +2 -2
  64. package/build/components/VerificationInput/VerificationInput.props.d.ts +4 -0
  65. package/build/utils/coloursAsArray.js +1 -1
  66. package/docs/components/AllComponents.web.tsx +19 -20
  67. package/docs/components/UsageWrap.tsx +17 -20
  68. package/docs/theme-tokens.mdx +390 -2
  69. package/eslint.config.js +5 -1
  70. package/package.json +12 -12
  71. package/src/components/Accordion/Accordion.figma.tsx +15 -17
  72. package/src/components/Accordion/AccordionItem.figma.tsx +27 -0
  73. package/src/components/Avatar/Avatar.figma.tsx +11 -21
  74. package/src/components/Avatar/Avatar.tsx +0 -2
  75. package/src/components/Badge/Badge.figma.tsx +45 -54
  76. package/src/components/Banner/Banner.figma.tsx +21 -13
  77. package/src/components/Banner/Banner.stories.tsx +4 -4
  78. package/src/components/Banner/Banner.tsx +2 -1
  79. package/src/components/Button/Button.figma.tsx +118 -46
  80. package/src/components/Card/Card.figma.tsx +27 -43
  81. package/src/components/Card/Card.stories.tsx +1 -1
  82. package/src/components/Carousel/Carousel.figma.tsx +20 -17
  83. package/src/components/Carousel/Carousel.tsx +1 -1
  84. package/src/components/Checkbox/Checkbox.docs.mdx +32 -31
  85. package/src/components/Checkbox/Checkbox.figma.tsx +15 -18
  86. package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
  87. package/src/components/Checkbox/CheckboxGroup.figma.tsx +48 -15
  88. package/src/components/Checkbox/CheckboxGroup.props.ts +2 -1
  89. package/src/components/Checkbox/CheckboxGroup.tsx +6 -1
  90. package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +24 -27
  91. package/src/components/CurrencyInput/CurrencyInput.docs.mdx +52 -9
  92. package/src/components/CurrencyInput/CurrencyInput.figma.tsx +65 -49
  93. package/src/components/CurrencyInput/CurrencyInput.props.ts +6 -0
  94. package/src/components/CurrencyInput/CurrencyInput.stories.tsx +30 -1
  95. package/src/components/CurrencyInput/CurrencyInput.tsx +16 -8
  96. package/src/components/DateInput/DateInput.figma.tsx +58 -45
  97. package/src/components/DateInput/DateInput.tsx +1 -0
  98. package/src/components/DateInput/DateInputSegment.tsx +2 -3
  99. package/src/components/DatePicker/DatePicker.figma.tsx +47 -0
  100. package/src/components/DatePicker/DatePicker.tsx +8 -4
  101. package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.props.ts +0 -2
  102. package/src/components/DatePicker/DatePickerHeader/index.tsx +2 -2
  103. package/src/components/DatePicker/index.ts +2 -0
  104. package/src/components/DatePicker/polyfill.ts +3 -3
  105. package/src/components/DatePicker/time-picker/wheel-web.tsx +0 -1
  106. package/src/components/DatePickerInput/DatePickerInput.docs.mdx +22 -0
  107. package/src/components/DatePickerInput/DatePickerInput.figma.tsx +18 -46
  108. package/src/components/DatePickerInput/DatePickerInput.props.ts +6 -0
  109. package/src/components/DatePickerInput/DatePickerInput.tsx +17 -5
  110. package/src/components/DescriptionList/DescriptionList.docs.mdx +16 -14
  111. package/src/components/DescriptionList/DescriptionList.figma.tsx +41 -17
  112. package/src/components/DescriptionList/DescriptionList.props.ts +1 -0
  113. package/src/components/DescriptionList/DescriptionList.stories.tsx +24 -0
  114. package/src/components/DescriptionList/DescriptionList.tsx +2 -0
  115. package/src/components/DescriptionList/DescriptionListItem.figma.tsx +42 -0
  116. package/src/components/DescriptionList/DescriptionListItem.props.ts +1 -0
  117. package/src/components/DescriptionList/DescriptionListItem.tsx +7 -0
  118. package/src/components/Divider/Divider.figma.tsx +10 -23
  119. package/src/components/FormField/FormField.context.ts +6 -1
  120. package/src/components/FormField/FormField.docs.mdx +30 -30
  121. package/src/components/FormField/FormField.props.ts +2 -0
  122. package/src/components/FormField/FormField.stories.tsx +8 -2
  123. package/src/components/FormField/FormField.tsx +38 -4
  124. package/src/components/FormField/FormFieldLabel.tsx +7 -3
  125. package/src/components/FormField/FormFieldValid.tsx +2 -2
  126. package/src/components/Input/Input.docs.mdx +67 -22
  127. package/src/components/Input/Input.props.ts +7 -1
  128. package/src/components/Input/Input.stories.tsx +9 -1
  129. package/src/components/Input/Input.tsx +124 -60
  130. package/src/components/Label/Label.props.ts +3 -2
  131. package/src/components/Label/Label.tsx +11 -1
  132. package/src/components/List/List.stories.tsx +1 -4
  133. package/src/components/Radio/Radio.docs.mdx +31 -30
  134. package/src/components/Radio/Radio.stories.tsx +1 -1
  135. package/src/components/Radio/RadioGroup.props.ts +1 -0
  136. package/src/components/Radio/RadioGroup.stories.tsx +6 -0
  137. package/src/components/Radio/RadioGroup.tsx +6 -1
  138. package/src/components/RadioCard/RadioCard.docs.mdx +31 -30
  139. package/src/components/RadioCard/RadioCard.props.ts +1 -0
  140. package/src/components/RadioCard/RadioCard.tsx +8 -2
  141. package/src/components/Select/Select.props.ts +10 -0
  142. package/src/components/Select/Select.tsx +3 -2
  143. package/src/components/Switch/Switch.tsx +1 -1
  144. package/src/components/Tabs/Tabs.tsx +0 -1
  145. package/src/components/Textarea/Textarea.docs.mdx +65 -17
  146. package/src/components/Textarea/Textarea.props.ts +8 -0
  147. package/src/components/Textarea/Textarea.stories.tsx +23 -2
  148. package/src/components/Textarea/Textarea.tsx +87 -19
  149. package/src/components/ThemedImage/ThemedImage.stories.tsx +14 -14
  150. package/src/components/Toast/ToastItem.tsx +1 -1
  151. package/src/components/ToggleButton/ToggleButtonIcon.tsx +1 -1
  152. package/src/components/ToggleButton/ToggleButtonRoot.tsx +0 -2
  153. package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +1 -1
  154. package/src/components/VerificationInput/VerificationInput.docs.mdx +1 -0
  155. package/src/components/VerificationInput/VerificationInput.props.ts +4 -1
  156. package/src/components/VerificationInput/VerificationInput.tsx +2 -0
  157. package/src/utils/coloursAsArray.ts +1 -1
  158. package/tsconfig.eslint.json +13 -0
  159. package/src/components/Accordion/AccordionItemRoot.figma.tsx +0 -47
  160. package/src/components/DatePicker/DatePickerCalendar.figma.tsx +0 -34
@@ -1,8 +1,8 @@
1
- import { Meta, Controls, Story, Canvas } from '@storybook/addon-docs/blocks';
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 { ViewFigmaButton, BackToTopButton, UsageWrap } from '../../../docs/components';
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 | `false` | Disables the input. |
65
- | readonly | boolean | `false` | Makes the input read-only. |
66
- | focused | boolean | `false` | Sets focus on the input. |
67
- | value | string | `-` | The value of the input. **(Only to be used if the input has no children)** |
68
- | 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)** |
69
- | onBlur | function | `-` | Callback function that is triggered when the input loses focus. **(Only to be used if the input has no children)** |
70
- | onFocus | function | `-` | Callback function that is triggered when the input gains focus. **(Only to be used if the input has no children)** |
71
- | placeholder | string | `-` | The placeholder text for the input. **(Only to be used if the input has no children)** |
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 | `-` | The value of the input. |
83
- | onChange | function | `-` | Callback function that is triggered when the input value changes. |
84
- | onBlur | function | `-` | Callback function that is triggered when the input loses focus. |
85
- | onFocus | function | `-` | Callback function that is triggered when the input gains focus. |
86
- | placeholder | string | `-` | The placeholder text for the input. |
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 TextareaRoot from './TextareaRoot';
4
+ import { useEffect } from 'react';
5
+ import { FormField, useFormFieldContext } from '../FormField';
5
6
  import TextareaFieldComponent from './TextareaField';
6
- import { useFormFieldContext } from '../FormField';
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 { disabled: formFieldDisabled } = formFieldContext;
25
- const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
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
- <TextareaComponent
29
- {...(children ? props : {})}
30
- validationStatus={validationStatusFromContext}
31
- isInvalid={validationStatusFromContext === 'invalid'}
32
- isReadOnly={readonly}
33
- isDisabled={formFieldDisabled ?? disabled}
34
- isFocused={focused}
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
- {children ? (
37
- <>{children}</>
38
- ) : (
39
- <>
40
- <TextareaField {...props} />
41
- </>
42
- )}
43
- </TextareaComponent>
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-ignore
36
+ // @ts-expect-error - This is a playground
37
37
  light={<SpotBillingLight width={200} height={200} />}
38
- // @ts-ignore
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-ignore
52
+ // @ts-expect-error - Ignore TS2322 for Storybook stories
53
53
  light={<SpotBillingLight width={120} height={120} />}
54
- // @ts-ignore
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-ignore
84
+ // @ts-expect-error - Ignore TS2322 for Storybook stories
85
85
  light={<SceneBroadbandLight width={300} height={200} />}
86
- // @ts-ignore
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-ignore
132
+ // @ts-expect-error - Ignore TS2322 for Storybook stories
133
133
  light={<SpotBillingLight width={80} height={80} />}
134
- // @ts-ignore
134
+ // @ts-expect-error - Ignore TS2322 for Storybook stories
135
135
  dark={<SpotBillingDark width={80} height={80} />}
136
136
  />
137
137
  <ThemedImage
138
- // @ts-ignore
138
+ // @ts-expect-error - Ignore TS2322 for Storybook stories
139
139
  light={<SpotBillingLight width={120} height={120} />}
140
- // @ts-ignore
140
+ // @ts-expect-error - Ignore TS2322 for Storybook stories
141
141
  dark={<SpotBillingDark width={120} height={120} />}
142
142
  />
143
143
  <ThemedImage
144
- // @ts-ignore
144
+ // @ts-expect-error - Ignore TS2322 for Storybook stories
145
145
  light={<SpotBillingLight width={160} height={160} />}
146
- // @ts-ignore
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-ignore
166
+ // @ts-expect-error - This is a playground
167
167
  light={<MascotEnergyLight width={150} height={150} />}
168
- // @ts-ignore
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-ignore
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-ignore
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,6 +1,6 @@
1
1
  import { color } from '../tokens';
2
2
 
3
- const { light, dark, ...restOfColors } = color;
3
+ const { light, ...restOfColors } = color;
4
4
 
5
5
  /**
6
6
  * Recursively flatten nested color objects into camelCase keys
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": [
4
+ "./src",
5
+ "./src/**/*.stories.tsx",
6
+ "./src/**/*.figma.tsx",
7
+ "./.storybook/**/*",
8
+ "./docs/**/*"
9
+ ],
10
+ "exclude": [
11
+ "node_modules"
12
+ ]
13
+ }
@@ -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
- )