@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,5 +1,5 @@
1
1
  import { createInput } from '@gluestack-ui/input';
2
- import { ComponentType, forwardRef, useImperativeHandle, useRef, useState } from 'react';
2
+ import { ComponentType, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
3
  import { TextInput } from 'react-native';
4
4
  import type InputProps from './Input.props';
5
5
 
@@ -10,7 +10,7 @@ import {
10
10
  SearchMediumIcon,
11
11
  } from '@utilitywarehouse/hearth-react-native-icons';
12
12
  import { useTheme } from '../../hooks';
13
- import { useFormFieldContext } from '../FormField';
13
+ import { FormField, useFormFieldContext } from '../FormField';
14
14
  import { Spinner } from '../Spinner';
15
15
  import { UnstyledIconButton } from '../UnstyledIconButton';
16
16
  import { InputWithoutChildrenProps } from './Input.props';
@@ -43,20 +43,37 @@ const Input = forwardRef<TextInput, InputProps>(
43
43
  type,
44
44
  showPasswordToggle = true,
45
45
  onClear,
46
- format,
47
46
  loading,
48
47
  clearable = false,
49
- required,
48
+ required = true,
50
49
  inBottomSheet = false,
51
50
  style,
51
+ label,
52
+ labelVariant,
53
+ helperText,
54
+ helperIcon,
55
+ validText,
56
+ invalidText,
52
57
  ...props
53
58
  },
54
59
  ref
55
60
  ) => {
56
61
  const formFieldContext = useFormFieldContext();
57
- const { disabled: formFieldDisabled } = formFieldContext;
58
- const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
59
- const isRequired = formFieldContext?.required ?? required;
62
+ const inputLabel = label ?? formFieldContext?.label;
63
+ const inputHelperText = helperText ?? formFieldContext?.helperText;
64
+ const inputValidText = validText ?? formFieldContext?.validText;
65
+ const inputInvalidText = invalidText ?? formFieldContext?.invalidText;
66
+ const inputRequired = required ?? formFieldContext?.required;
67
+ const inputDisabled = disabled ?? formFieldContext?.disabled;
68
+ const inputReadonly = readonly ?? formFieldContext?.readonly;
69
+ const inputValidationStatus = formFieldContext?.validationStatus ?? validationStatus;
70
+
71
+ useEffect(() => {
72
+ if (formFieldContext?.setShouldHandleAccessibility) {
73
+ formFieldContext.setShouldHandleAccessibility(true);
74
+ }
75
+ }, []);
76
+
60
77
  const [fieldType, setFieldType] = useState<'password' | 'text'>(
61
78
  type === 'password' ? 'password' : 'text'
62
79
  );
@@ -87,61 +104,108 @@ const Input = forwardRef<TextInput, InputProps>(
87
104
  return undefined;
88
105
  })();
89
106
 
107
+ const getAccessibilityLabel = () => {
108
+ let accessibilityLabel = '';
109
+ if (inputLabel) {
110
+ accessibilityLabel = accessibilityLabel + inputLabel;
111
+ }
112
+ if (inputRequired) {
113
+ accessibilityLabel = accessibilityLabel + ', required';
114
+ }
115
+
116
+ return accessibilityLabel || props.accessibilityLabel;
117
+ };
118
+
119
+ const getAccessibilityHint = () => {
120
+ let accessibilityHint = '';
121
+ if (inputHelperText) {
122
+ accessibilityHint = accessibilityHint + inputHelperText;
123
+ }
124
+ if (inputValidationStatus !== 'initial') {
125
+ if (accessibilityHint.length > 0) {
126
+ accessibilityHint = accessibilityHint + ', ';
127
+ }
128
+ if (inputValidationStatus === 'invalid' && inputInvalidText) {
129
+ accessibilityHint = accessibilityHint + inputInvalidText;
130
+ }
131
+ if (inputValidationStatus === 'valid' && inputValidText) {
132
+ accessibilityHint = accessibilityHint + inputValidText;
133
+ }
134
+ }
135
+ return accessibilityHint || props.accessibilityHint;
136
+ };
137
+
90
138
  return (
91
- <InputComponent
92
- {...(children ? props : {})}
93
- validationStatus={validationStatusFromContext}
94
- isInvalid={validationStatusFromContext === 'invalid'}
95
- isReadOnly={readonly}
96
- isDisabled={formFieldDisabled ?? disabled}
97
- isFocused={focused}
98
- type={type as undefined}
99
- isRequired={isRequired}
100
- style={style}
139
+ <FormField
140
+ label={label}
141
+ labelVariant={labelVariant}
142
+ helperText={helperText}
143
+ helperIcon={helperIcon}
144
+ validText={validText}
145
+ invalidText={invalidText}
146
+ required={required}
147
+ validationStatus={validationStatus}
148
+ disabled={disabled}
149
+ readonly={readonly}
150
+ accessibilityHandledByChildren
101
151
  >
102
- {children ? (
103
- <>{children}</>
104
- ) : (
105
- <>
106
- {!!leadingIconComponent && (
107
- <InputSlot>
108
- <InputIcon as={leadingIconComponent} />
109
- </InputSlot>
110
- )}
111
- <InputField
112
- // @ts-expect-error - ref forwarding issue
113
- ref={inputRef}
114
- type={fieldType}
115
- inputMode={getInputMode}
116
- inBottomSheet={inBottomSheet}
117
- {...props}
118
- />
119
- {shouldShowClear && (
120
- <InputSlot>
121
- <UnstyledIconButton onPress={onClear} icon={CloseSmallIcon} />
122
- </InputSlot>
123
- )}
124
- {loading && (
125
- <InputSlot>
126
- <Spinner size="xs" color={color.icon.primary} />
127
- </InputSlot>
128
- )}
129
- {shouldShowPasswordToggle && (
130
- <InputSlot>
131
- <UnstyledIconButton
132
- onPress={toggleFieldType}
133
- icon={fieldType === 'password' ? EyeSmallIcon : EyeOffSmallIcon}
134
- />
135
- </InputSlot>
136
- )}
137
- {!!trailingIcon && (
138
- <InputSlot>
139
- <InputIcon as={trailingIcon} />
140
- </InputSlot>
141
- )}
142
- </>
143
- )}
144
- </InputComponent>
152
+ <InputComponent
153
+ {...(children ? props : {})}
154
+ validationStatus={inputValidationStatus}
155
+ isInvalid={inputValidationStatus === 'invalid'}
156
+ isReadOnly={inputReadonly}
157
+ isDisabled={inputDisabled}
158
+ isFocused={focused}
159
+ type={type as undefined}
160
+ isRequired={inputRequired}
161
+ style={style}
162
+ >
163
+ {children ? (
164
+ <>{children}</>
165
+ ) : (
166
+ <>
167
+ {!!leadingIconComponent && (
168
+ <InputSlot>
169
+ <InputIcon as={leadingIconComponent} />
170
+ </InputSlot>
171
+ )}
172
+ <InputField
173
+ // @ts-expect-error - ref forwarding issue
174
+ ref={inputRef}
175
+ type={fieldType}
176
+ inputMode={getInputMode}
177
+ inBottomSheet={inBottomSheet}
178
+ {...props}
179
+ aria-label={getAccessibilityLabel()}
180
+ accessibilityHint={getAccessibilityHint()}
181
+ />
182
+ {shouldShowClear && (
183
+ <InputSlot>
184
+ <UnstyledIconButton onPress={onClear} icon={CloseSmallIcon} />
185
+ </InputSlot>
186
+ )}
187
+ {loading && (
188
+ <InputSlot>
189
+ <Spinner size="xs" color={color.icon.primary} />
190
+ </InputSlot>
191
+ )}
192
+ {shouldShowPasswordToggle && (
193
+ <InputSlot>
194
+ <UnstyledIconButton
195
+ onPress={toggleFieldType}
196
+ icon={fieldType === 'password' ? EyeSmallIcon : EyeOffSmallIcon}
197
+ />
198
+ </InputSlot>
199
+ )}
200
+ {!!trailingIcon && (
201
+ <InputSlot>
202
+ <InputIcon as={trailingIcon} />
203
+ </InputSlot>
204
+ )}
205
+ </>
206
+ )}
207
+ </InputComponent>
208
+ </FormField>
145
209
  );
146
210
  }
147
211
  );
@@ -1,8 +1,9 @@
1
- import type TextProps from '../BodyText/BodyText.props';
1
+ import { BodyTextProps } from '../BodyText';
2
2
 
3
- interface LabelProps extends TextProps {
3
+ interface LabelProps extends Omit<BodyTextProps, 'size' | 'weight'> {
4
4
  nested?: boolean;
5
5
  disabled?: boolean;
6
+ variant?: 'heading' | 'body';
6
7
  }
7
8
 
8
9
  export default LabelProps;
@@ -1,9 +1,19 @@
1
1
  import { StyleSheet } from 'react-native-unistyles';
2
2
  import { BodyText } from '../BodyText';
3
+ import { Heading } from '../Heading';
3
4
  import LabelProps from './Label.props';
4
5
 
5
- const Label = ({ children, nested, disabled, style, ...props }: LabelProps) => {
6
+ const Label = ({ children, nested, disabled, style, variant = 'body', ...props }: LabelProps) => {
6
7
  styles.useVariants({ disabled });
8
+
9
+ if (variant === 'heading') {
10
+ return (
11
+ <Heading size="md" style={[styles.text, style]} {...props}>
12
+ {children}
13
+ </Heading>
14
+ );
15
+ }
16
+
7
17
  return (
8
18
  <BodyText
9
19
  size="md"
@@ -9,7 +9,7 @@ import {
9
9
  SettingsMediumIcon,
10
10
  UserMediumIcon,
11
11
  } from '@utilitywarehouse/hearth-react-native-icons';
12
- import { FC, PropsWithChildren, useState } from 'react';
12
+ import { useState } from 'react';
13
13
  import { List, ListAction, ListItem, ListItemIcon, ListItemTrailingIcon } from '.';
14
14
  import { VariantTitle } from '../../../docs/components';
15
15
  import { Badge } from '../Badge';
@@ -18,9 +18,6 @@ import { Flex } from '../Flex';
18
18
  import { IconContainer } from '../IconContainer';
19
19
  import { Link } from '../Link';
20
20
  import { Switch } from '../Switch';
21
- // import { Card } from '../Card';
22
-
23
- const Card: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
24
21
 
25
22
  const meta = {
26
23
  title: 'Stories / List',
@@ -90,21 +90,21 @@ const MyComponent = () => {
90
90
 
91
91
  ## Props
92
92
 
93
- | Property | Type | Default | Description |
94
- | -------------------- | ----------------------------------- | --------- | ---------------------------------------------------------------------------------------------------- |
95
- | `value` | string | - | The value to be used in the radio input. This is the value that will be returned on form submission. |
96
- | `onChange` | function | - | Function called when the state of the radio changes. |
97
- | `disabled` | bool | false | To manually set disable to the radio. |
98
- | `validationStatus` | `'valid' \| 'invalid' \| 'initial'` | - | The validation status of the radio. |
99
- | `disabled` | `bool` | `false` | To manually set disable to the radio. |
100
- | `label` | `string` | - | The label to be displayed next to the radio. |
101
- | `helperText` | `string` | - | The helper text to be displayed below the radio. |
102
- | `helperIcon` | `React.ComponentType` | - | The icon to be displayed next to the helper text. |
103
- | `invalidText` | `string` | - | The invalid text to be displayed below the radio. |
104
- | `validText` | `string` | - | The valid text to be displayed below the radio. |
105
- | `showValidationIcon` | `boolean` | `true` | Whether to show the validation icon. |
106
- | `type` | `'default' \| 'tile'` | `default` | The type of the radio. |
107
- | `image` | `ReactNode` | - | The image to be displayed next to the label. |
93
+ | Property | Type | Default | Description |
94
+ | -------------------- | ----------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------- |
95
+ | `value` | string | - | The value to be used in the radio input. This is the value that will be returned on form submission. |
96
+ | `onChange` | function | - | Function called when the state of the radio changes. |
97
+ | `disabled` | bool | false | To manually set disable to the radio. |
98
+ | `validationStatus` | `'valid' \| 'invalid' \| 'initial'` | - | The validation status of the radio. |
99
+ | `disabled` | `bool` | `false` | To manually set disable to the radio. |
100
+ | `label` | `string` | - | The label to be displayed next to the radio. |
101
+ | `helperText` | `string` | - | The helper text to be displayed below the radio. |
102
+ | `helperIcon` | `React.ComponentType` | - | The icon to be displayed next to the helper text. |
103
+ | `invalidText` | `string` | - | The invalid text to be displayed below the radio. |
104
+ | `validText` | `string` | - | The valid text to be displayed below the radio. |
105
+ | `showValidationIcon` | `boolean` | `true` | Whether to show the validation icon. |
106
+ | `type` | `'default' \| 'tile'` | `'default'` | The type of the radio. |
107
+ | `image` | `ReactNode` | - | The image to be displayed next to the label. |
108
108
 
109
109
  ## Components
110
110
 
@@ -132,21 +132,22 @@ Contains all Label related layout style props and actions. It inherits all the p
132
132
 
133
133
  Contains all Group related layout style props and actions. It inherits all the properties of React Native's [View component](https://reactnative.dev/docs/view).
134
134
 
135
- | Property | Type | Default | Description |
136
- | -------------------- | ----------------------------------- | --------- | ------------------------------------------------------------------- |
137
- | `value` | string | - | The value of the radio group. |
138
- | `onChange` | function | - | The callback fired when any children Radio is checked or unchecked. |
139
- | `disabled` | bool | - | To manually set disable to the radio group. |
140
- | `validationStatus` | `'valid' \| 'invalid' \| 'initial'` | - | The validation status of the radio group. |
141
- | `label` | `string` | - | The label to be displayed above the radio group. |
142
- | `helperText` | `string` | - | The helper text to be displayed below the radio group. |
143
- | `helperIcon` | `React.ComponentType` | - | The icon to be displayed next to the helper text. |
144
- | `invalidText` | `string` | - | The invalid text to be displayed below the radio group. |
145
- | `validText` | `string` | - | The valid text to be displayed below the radio group. |
146
- | `showValidationIcon` | `boolean` | `true` | Whether to show the validation icon. |
147
- | `type` | `'default' \| 'tile'` | `default` | The type of the radio group. |
148
- | `direction` | `'row' \| 'column'` | `column` | The direction of the radio group. |
149
- | `gap` | `string` | - | The gap between the radio group items. |
135
+ | Property | Type | Default | Description |
136
+ | -------------------- | ----------------------------------- | ----------- | ------------------------------------------------------------------- |
137
+ | `value` | string | - | The value of the radio group. |
138
+ | `onChange` | function | - | The callback fired when any children Radio is checked or unchecked. |
139
+ | `disabled` | bool | - | To manually set disable to the radio group. |
140
+ | `validationStatus` | `'valid' \| 'invalid' \| 'initial'` | - | The validation status of the radio group. |
141
+ | `label` | `string` | - | The label to be displayed above the radio group. |
142
+ | `labelVariant` | `'heading' \| 'body'` | `'body'` | The variant of the label text. |
143
+ | `helperText` | `string` | - | The helper text to be displayed below the radio group. |
144
+ | `helperIcon` | `React.ComponentType` | - | The icon to be displayed next to the helper text. |
145
+ | `invalidText` | `string` | - | The invalid text to be displayed below the radio group. |
146
+ | `validText` | `string` | - | The valid text to be displayed below the radio group. |
147
+ | `showValidationIcon` | `boolean` | `true` | Whether to show the validation icon. |
148
+ | `type` | `'default' \| 'tile'` | `'default'` | The type of the radio group. |
149
+ | `direction` | `'row' \| 'column'` | `'column'` | The direction of the radio group. |
150
+ | `gap` | `string` | - | The gap between the radio group items. |
150
151
 
151
152
  ### `RadioImage`
152
153
 
@@ -96,7 +96,7 @@ export const WithImage: Story = {
96
96
  value: 'Option 1',
97
97
  label: 'Label',
98
98
  },
99
- render: ({ children, ...args }) => (
99
+ render: ({ ...args }) => (
100
100
  <RadioGroup>
101
101
  <Radio
102
102
  aria-label="Label 1"
@@ -9,6 +9,7 @@ interface RadioGroupProps extends ViewProps {
9
9
  readonly?: boolean;
10
10
  validationStatus?: 'valid' | 'invalid' | 'initial';
11
11
  label?: string;
12
+ labelVariant?: 'heading' | 'body';
12
13
  helperText?: string;
13
14
  showValidationIcon?: boolean;
14
15
  invalidText?: string;
@@ -19,6 +19,11 @@ const meta = {
19
19
  control: 'text',
20
20
  description: 'The label component for the radio group.',
21
21
  },
22
+ labelVariant: {
23
+ control: 'radio',
24
+ options: ['heading', 'body'],
25
+ description: 'The variant of the label text.',
26
+ },
22
27
  helperText: {
23
28
  type: 'string',
24
29
  control: 'text',
@@ -51,6 +56,7 @@ const meta = {
51
56
  args: {
52
57
  disabled: false,
53
58
  label: 'Group label',
59
+ labelVariant: 'body',
54
60
  helperText: 'Supporting text',
55
61
  validationStatus: 'initial',
56
62
  showValidationIcon: true,
@@ -14,6 +14,7 @@ const RadioGroup = ({
14
14
  readonly,
15
15
  validationStatus,
16
16
  label,
17
+ labelVariant = 'body',
17
18
  helperText,
18
19
  invalidText,
19
20
  validText,
@@ -49,7 +50,11 @@ const RadioGroup = ({
49
50
  >
50
51
  {showHeader && (
51
52
  <RadioGroupTextContent>
52
- {!!label && <Label disabled={disabled}>{label}</Label>}
53
+ {!!label && (
54
+ <Label disabled={disabled} variant={labelVariant}>
55
+ {label}
56
+ </Label>
57
+ )}
53
58
  {!!helperText && <Helper disabled={disabled} icon={helperIcon} text={helperText} />}
54
59
  {validationStatus === 'invalid' && !!invalidText && (
55
60
  <Helper
@@ -1,18 +1,18 @@
1
- import { Meta, Canvas, Story, Controls } from '@storybook/addon-docs/blocks';
2
- import * as Stories from './RadioCardGroup.stories';
1
+ import { Canvas, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
2
+ import { TickSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
3
3
  import {
4
- RadioCard,
5
- RadioCardGroup,
6
- Center,
7
- Box,
8
- Heading,
9
4
  BodyText,
5
+ Box,
6
+ Center,
10
7
  DetailText,
11
- UL,
8
+ Heading,
12
9
  LI,
10
+ RadioCard,
11
+ RadioCardGroup,
12
+ UL,
13
13
  } from '../..';
14
- import { TickSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
15
- import { ViewFigmaButton, BackToTopButton, UsageWrap } from '../../../docs/components';
14
+ import { BackToTopButton, UsageWrap, ViewFigmaButton } from '../../../docs/components';
15
+ import * as Stories from './RadioCardGroup.stories';
16
16
 
17
17
  <Meta title="Components / Radio Card" />
18
18
 
@@ -92,16 +92,17 @@ const MyComponent = () => {
92
92
 
93
93
  The `RadioCard` component accepts the following props:
94
94
 
95
- | Property | Type | Default | Description |
96
- | ---------------- | ------------------------------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------- |
97
- | `value` | string | - | The value to be used in the radio card input. This is the value that will be returned on form submission. |
98
- | `onChange` | `(isSelected: boolean) => void` | - | Function called when the state of the radio card changes. |
99
- | `children` | `React.ReactNode` | - | The content to be displayed inside the radio card. |
100
- | `label` | `string` | - | The label to be displayed next to the radio card. |
101
- | `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | - | Sets the direction of the flex items. |
102
- | `flexWrap` | `'wrap' \| 'nowrap' \| 'wrap-reverse'` | - | Sets whether flex items are forced onto one line or can wrap. |
103
- | `alignItems` | `'flex-start' \| 'flex-end' \| 'center' \|`<br />` 'stretch' \| 'baseline'` | - | Sets the alignment of flex items on the cross axis. |
104
- | `justifyContent` | `'flex-start' \| 'flex-end' \| 'center' \|`<br />` 'space-between' \| 'space-around' \| 'space-evenly'` | - | Sets the alignment of flex items on the main axis. |
95
+ | Property | Type | Default | Description |
96
+ | ---------------- | ------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------- |
97
+ | `value` | string | - | The value to be used in the radio card input. This is the value that will be returned on form submission. |
98
+ | `onChange` | `(isSelected: boolean) => void` | - | Function called when the state of the radio card changes. |
99
+ | `children` | `React.ReactNode` | - | The content to be displayed inside the radio card. |
100
+ | `label` | `string` | - | The label to be displayed next to the radio card. |
101
+ | `labelVariant` | `'heading' \| 'body'` | `'body'` | The variant of the label text. |
102
+ | `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | - | Sets the direction of the flex items. |
103
+ | `flexWrap` | `'wrap' \| 'nowrap' \| 'wrap-reverse'` | - | Sets whether flex items are forced onto one line or can wrap. |
104
+ | `alignItems` | `'flex-start' \| 'flex-end' \| 'center' \|`<br />` 'stretch' \| 'baseline'` | - | Sets the alignment of flex items on the cross axis. |
105
+ | `justifyContent` | `'flex-start' \| 'flex-end' \| 'center' \|`<br />` 'space-between' \| 'space-around' \| 'space-evenly'` | - | Sets the alignment of flex items on the main axis. |
105
106
 
106
107
  ## Components
107
108
 
@@ -113,13 +114,13 @@ Contains all RadioCard related layout style props and actions. It inherits all t
113
114
 
114
115
  Contains all Group related layout style props and actions. It inherits all the properties of React Native's [View component](https://reactnative.dev/docs/view).
115
116
 
116
- | Property | Type | Default | Description |
117
- | ---------------- | -------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
118
- | `value` | `string` | - | The value of the currently selected `RadioCard`. |
119
- | `onChange` | `(value: string) => void` | - | Callback fired when the selected `RadioCard` changes. |
120
- | `gap` | `keyof typeof space` | - | The gap between the `RadioCard` items. |
121
- | `columns` | `GridProps['columns']` | - | If set, the group will use a grid layout with the specified number of columns. Otherwise, it uses flexbox. |
122
- | `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | `row` | (Flexbox only) Sets the direction of the flex items. |
123
- | `flexWrap` | `'wrap' \| 'nowrap' \| 'wrap-reverse'` | `wrap` | (Flexbox only) Sets whether flex items are forced onto one line or can wrap. |
124
- | `alignItems` | `'flex-start' \| 'flex-end' \| 'center' \| `<br />`'stretch' \| 'baseline'` | - | (Flexbox only) Sets the alignment of flex items on the cross axis. |
125
- | `justifyContent` | `'flex-start' \| 'flex-end' \| 'center' \| `<br /> `'space-between' \| 'space-around' \| 'space-evenly'` | - | (Flexbox only) Sets the alignment of flex items on the main axis. |
117
+ | Property | Type | Default | Description |
118
+ | ---------------- | -------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
119
+ | `value` | `string` | - | The value of the currently selected `RadioCard`. |
120
+ | `onChange` | `(value: string) => void` | - | Callback fired when the selected `RadioCard` changes. |
121
+ | `gap` | `keyof typeof space` | - | The gap between the `RadioCard` items. |
122
+ | `columns` | `GridProps['columns']` | - | If set, the group will use a grid layout with the specified number of columns. Otherwise, it uses flexbox. |
123
+ | `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | `'row'` | (Flexbox only) Sets the direction of the flex items. |
124
+ | `flexWrap` | `'wrap' \| 'nowrap' \| 'wrap-reverse'` | `'wrap'` | (Flexbox only) Sets whether flex items are forced onto one line or can wrap. |
125
+ | `alignItems` | `'flex-start' \| 'flex-end' \| 'center' \| `<br />`'stretch' \| 'baseline'` | - | (Flexbox only) Sets the alignment of flex items on the cross axis. |
126
+ | `justifyContent` | `'flex-start' \| 'flex-end' \| 'center' \| `<br /> `'space-between' \| 'space-around' \| 'space-evenly'` | - | (Flexbox only) Sets the alignment of flex items on the main axis. |
@@ -7,6 +7,7 @@ interface RadioCardProps extends Omit<PressableProps, 'children'> {
7
7
  onChange?: (isSelected: boolean) => void;
8
8
  children?: ViewProps['children'];
9
9
  label?: string;
10
+ labelVariant?: 'heading' | 'body';
10
11
  flexDirection?: ViewStyle['flexDirection'];
11
12
  flexWrap?: ViewStyle['flexWrap'];
12
13
  alignItems?: ViewStyle['alignItems'];
@@ -27,7 +27,13 @@ RadioCardIndicator.displayName = 'RadioCardIndicator';
27
27
  RadioCardIcon.displayName = 'RadioCardIcon';
28
28
  RadioCardLabel.displayName = 'RadioCardLabel';
29
29
 
30
- const RadioCard = ({ children, label, contentStyle, ...props }: RadioCardProps) => {
30
+ const RadioCard = ({
31
+ children,
32
+ label,
33
+ labelVariant = 'body',
34
+ contentStyle,
35
+ ...props
36
+ }: RadioCardProps) => {
31
37
  const { computedStyles } = useStyleProps(props);
32
38
  return (
33
39
  <RadioCardComponent {...props}>
@@ -35,7 +41,7 @@ const RadioCard = ({ children, label, contentStyle, ...props }: RadioCardProps)
35
41
  <RadioCardIndicator>
36
42
  <RadioCardIcon />
37
43
  </RadioCardIndicator>
38
- {!!label && <RadioCardLabel>{label}</RadioCardLabel>}
44
+ {!!label && <RadioCardLabel variant={labelVariant}>{label}</RadioCardLabel>}
39
45
  </View>
40
46
  {!!children && <View style={[computedStyles, contentStyle]}>{children}</View>}
41
47
  </RadioCardComponent>
@@ -43,6 +43,16 @@ interface SelectProps extends ViewProps {
43
43
  * Label for the select
44
44
  */
45
45
  label?: string;
46
+ /**
47
+ * The variant of the label text.
48
+ *
49
+ * Supported values are:
50
+ * - `'heading'` – use heading text styling for the label.
51
+ * - `'body'` – use body text styling for the label.
52
+ *
53
+ * @default 'body'.
54
+ */
55
+ labelVariant?: 'heading' | 'body';
46
56
  /**
47
57
  * Placeholder text to show when no value is selected
48
58
  */
@@ -23,6 +23,7 @@ const Select = ({
23
23
  value,
24
24
  onValueChange,
25
25
  label,
26
+ labelVariant = 'body',
26
27
  placeholder = 'Select an option',
27
28
  disabled = false,
28
29
  leadingIcon: LeadingIcon,
@@ -123,9 +124,9 @@ const Select = ({
123
124
  <View {...rest} style={[styles.container, rest.style]}>
124
125
  {!!label && (
125
126
  <View>
126
- <Label>
127
+ <Label variant={labelVariant}>
127
128
  {label}
128
- {!isRequired && <Label> (Optional)</Label>}
129
+ {!isRequired && <Label variant={labelVariant}> (Optional)</Label>}
129
130
  </Label>
130
131
  </View>
131
132
  )}
@@ -23,7 +23,7 @@ const CustomSwitch = ({
23
23
  size = 'medium',
24
24
  ...accessibilityProps
25
25
  }: SwitchProps) => {
26
- const { components, color } = useTheme();
26
+ const { components } = useTheme();
27
27
  const theme = useAnimatedTheme();
28
28
  const SWITCH_WIDTH = size === 'medium' ? components.switch.md.width : components.switch.sm.width;
29
29
  const THUMB_SIZE =
@@ -11,7 +11,6 @@ const Tabs = ({
11
11
  size = 'md',
12
12
  disabled,
13
13
  children,
14
- withPanels,
15
14
  ...props
16
15
  }: TabsProps) => {
17
16
  // Collect child tab values