@utilitywarehouse/hearth-react-native 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -3
- package/CHANGELOG.md +75 -6
- package/build/components/BottomSheet/BottomSheetScrollView.js +2 -0
- package/build/components/Checkbox/CheckboxGroup.d.ts +1 -1
- package/build/components/Checkbox/CheckboxGroup.js +2 -2
- package/build/components/Checkbox/CheckboxGroup.props.d.ts +2 -1
- package/build/components/Checkbox/CheckboxTileRoot.js +3 -0
- package/build/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/build/components/CurrencyInput/CurrencyInput.js +2 -6
- package/build/components/CurrencyInput/CurrencyInput.props.d.ts +6 -0
- package/build/components/DateInput/DateInputSegment.js +0 -1
- package/build/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/build/components/DatePickerInput/DatePickerInput.js +2 -2
- package/build/components/DatePickerInput/DatePickerInput.props.d.ts +6 -0
- package/build/components/FormField/FormField.context.d.ts +8 -2
- package/build/components/FormField/FormField.d.ts +1 -1
- package/build/components/FormField/FormField.js +24 -4
- package/build/components/FormField/FormField.props.d.ts +2 -0
- package/build/components/FormField/FormFieldLabel.d.ts +1 -1
- package/build/components/FormField/FormFieldLabel.js +3 -3
- package/build/components/FormField/FormFieldValid.js +2 -2
- package/build/components/Input/Input.js +48 -10
- package/build/components/Input/Input.props.d.ts +7 -1
- package/build/components/Label/Label.d.ts +1 -1
- package/build/components/Label/Label.js +5 -1
- package/build/components/Label/Label.props.d.ts +3 -2
- package/build/components/Modal/Modal.js +9 -0
- package/build/components/Radio/RadioGroup.d.ts +1 -1
- package/build/components/Radio/RadioGroup.js +2 -2
- package/build/components/Radio/RadioGroup.props.d.ts +1 -0
- package/build/components/RadioCard/RadioCard.d.ts +1 -1
- package/build/components/RadioCard/RadioCard.js +2 -2
- package/build/components/RadioCard/RadioCard.props.d.ts +1 -0
- package/build/components/Select/Select.d.ts +1 -1
- package/build/components/Select/Select.js +2 -2
- package/build/components/Select/Select.props.d.ts +10 -0
- package/build/components/Textarea/Textarea.d.ts +1 -1
- package/build/components/Textarea/Textarea.js +43 -6
- package/build/components/Textarea/Textarea.props.d.ts +8 -0
- package/build/components/VerificationInput/VerificationInput.d.ts +1 -1
- package/build/components/VerificationInput/VerificationInput.js +2 -2
- package/build/components/VerificationInput/VerificationInput.props.d.ts +4 -0
- package/docs/components/AllComponents.web.tsx +8 -5
- package/docs/theme-tokens.mdx +390 -2
- package/package.json +2 -2
- package/src/components/BottomSheet/BottomSheetScrollView.tsx +2 -0
- package/src/components/Checkbox/Checkbox.docs.mdx +32 -31
- package/src/components/Checkbox/CheckboxGroup.props.ts +2 -1
- package/src/components/Checkbox/CheckboxGroup.tsx +6 -1
- package/src/components/Checkbox/CheckboxTileRoot.tsx +3 -0
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +52 -9
- package/src/components/CurrencyInput/CurrencyInput.props.ts +6 -0
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +30 -1
- package/src/components/CurrencyInput/CurrencyInput.tsx +16 -8
- package/src/components/DateInput/DateInputSegment.tsx +0 -1
- package/src/components/DatePickerInput/DatePickerInput.docs.mdx +22 -0
- package/src/components/DatePickerInput/DatePickerInput.props.ts +6 -0
- package/src/components/DatePickerInput/DatePickerInput.tsx +17 -3
- package/src/components/FormField/FormField.context.ts +6 -1
- package/src/components/FormField/FormField.docs.mdx +30 -30
- package/src/components/FormField/FormField.props.ts +2 -0
- package/src/components/FormField/FormField.stories.tsx +8 -2
- package/src/components/FormField/FormField.tsx +38 -4
- package/src/components/FormField/FormFieldLabel.tsx +7 -3
- package/src/components/FormField/FormFieldValid.tsx +2 -2
- package/src/components/Input/Input.docs.mdx +67 -22
- package/src/components/Input/Input.props.ts +7 -1
- package/src/components/Input/Input.stories.tsx +9 -1
- package/src/components/Input/Input.tsx +124 -59
- package/src/components/Label/Label.props.ts +3 -2
- package/src/components/Label/Label.tsx +11 -1
- package/src/components/Modal/Modal.tsx +9 -0
- package/src/components/Radio/Radio.docs.mdx +31 -30
- package/src/components/Radio/RadioGroup.props.ts +1 -0
- package/src/components/Radio/RadioGroup.stories.tsx +6 -0
- package/src/components/Radio/RadioGroup.tsx +6 -1
- package/src/components/RadioCard/RadioCard.docs.mdx +31 -30
- package/src/components/RadioCard/RadioCard.props.ts +1 -0
- package/src/components/RadioCard/RadioCard.tsx +8 -2
- package/src/components/Select/Select.props.ts +10 -0
- package/src/components/Select/Select.tsx +3 -2
- package/src/components/Textarea/Textarea.docs.mdx +65 -17
- package/src/components/Textarea/Textarea.props.ts +8 -0
- package/src/components/Textarea/Textarea.stories.tsx +23 -2
- package/src/components/Textarea/Textarea.tsx +84 -19
- package/src/components/VerificationInput/VerificationInput.docs.mdx +1 -0
- package/src/components/VerificationInput/VerificationInput.props.ts +4 -1
- package/src/components/VerificationInput/VerificationInput.tsx +2 -0
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
> @utilitywarehouse/hearth-react-native@0.
|
|
2
|
+
> @utilitywarehouse/hearth-react-native@0.16.0 lint /home/runner/work/hearth/hearth/packages/react-native
|
|
3
3
|
> TIMING=1 eslint --max-warnings 0
|
|
4
4
|
|
|
5
5
|
Rule | Time (ms) | Relative
|
|
6
6
|
:----|----------:|--------:
|
|
7
|
-
Rule | Time (ms) | Relative
|
|
8
|
-
:----|----------:|--------:
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
# @utilitywarehouse/hearth-react-native
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#810](https://github.com/utilitywarehouse/hearth/pull/810) [`eae4c24`](https://github.com/utilitywarehouse/hearth/commit/eae4c24a421415247c720f88bb8341133340cc7b) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: All `Input` components accessibility improvements and you can now pass a label, helper text and validation to the `Input` component directly.
|
|
8
|
+
|
|
9
|
+
### Input accessibility improvements and FormField integration
|
|
10
|
+
|
|
11
|
+
The `Input` component has been updated to internally use `FormField`. This allows you to pass props like `label`, `helperText`, and validation status directly to the `Input` component, streamlining its usage.
|
|
12
|
+
|
|
13
|
+
We have also greatly improved accessibility behavior. The `Input` component now intelligently constructs `aria-label` and `accessibilityHint` based on the provided label, helper text, and validation state. To support this, `FormField` now has a mechanism to hide its own accessibility elements when a child component is handling them, preventing duplicate announcements.
|
|
14
|
+
|
|
15
|
+
#### Affected components
|
|
16
|
+
- `Input`
|
|
17
|
+
- `CurrencyInput`
|
|
18
|
+
- `DatePickerInput`
|
|
19
|
+
- `Textarea`
|
|
20
|
+
- `FormField`
|
|
21
|
+
|
|
22
|
+
#### Developer changes
|
|
23
|
+
|
|
24
|
+
You can now use `Input`, `CurrencyInput`, `DatePickerInput`, and `Textarea` without explicitly wrapping them in `FormField` for standard layouts:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
// Before
|
|
28
|
+
<FormField label="Email" helperText="Enter email">
|
|
29
|
+
<Input />
|
|
30
|
+
</FormField>
|
|
31
|
+
|
|
32
|
+
// After
|
|
33
|
+
<Input label="Email" helperText="Enter email" />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
No breaking changes. The `Input` component continues to support being wrapped externally by `FormField`.
|
|
37
|
+
|
|
38
|
+
#### References
|
|
39
|
+
- UWDS-4179
|
|
40
|
+
|
|
41
|
+
- [#803](https://github.com/utilitywarehouse/hearth/pull/803) [`8e96af6`](https://github.com/utilitywarehouse/hearth/commit/8e96af69f3a3498f264f2a6dc2416cdb6a298275) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Adds `labelVariant` prop to components with a label
|
|
42
|
+
|
|
43
|
+
### Adds `labelVariant` prop to components with a label
|
|
44
|
+
|
|
45
|
+
Added a `labelVariant` prop to allow consumers to choose between a body or heading style for component labels. Defaults to `body`.
|
|
46
|
+
|
|
47
|
+
#### Affected components
|
|
48
|
+
- `CheckboxGroup`
|
|
49
|
+
- `FormField`
|
|
50
|
+
- `Label`
|
|
51
|
+
- `RadioGroup`
|
|
52
|
+
- `RadioCard`
|
|
53
|
+
- `Select`
|
|
54
|
+
- `VerificationInput`
|
|
55
|
+
- `Input`
|
|
56
|
+
- `CurrencyInput`
|
|
57
|
+
- `DatePickerInput`
|
|
58
|
+
- `Textarea`
|
|
59
|
+
|
|
60
|
+
#### Developer changes
|
|
61
|
+
|
|
62
|
+
You can now pass `labelVariant="heading"` to these components to render the label as a heading instead of body text.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<FormField label="My Label" labelVariant="heading">
|
|
66
|
+
<Input />
|
|
67
|
+
</FormField>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 0.15.3
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- [#801](https://github.com/utilitywarehouse/hearth/pull/801) [`6d11339`](https://github.com/utilitywarehouse/hearth/commit/6d1133997b28efa104c282522a5708f1d4d8614c) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: `Modal` without handle heading padding issue
|
|
75
|
+
|
|
76
|
+
- [#796](https://github.com/utilitywarehouse/hearth/pull/796) [`f0ccadb`](https://github.com/utilitywarehouse/hearth/commit/f0ccadbb48fb7a7a70520d7521746a63421e01cc) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: `CheckboxTile` text wrapping issue
|
|
77
|
+
|
|
3
78
|
## 0.15.2
|
|
4
79
|
|
|
5
80
|
### Patch Changes
|
|
@@ -23,7 +98,6 @@
|
|
|
23
98
|
Added new props to `UL`, `OL`, and `ListItem` components to support custom list markers, including icons, images, and colors. This brings the functionality closer to CSS-like list styling. We also fixed a layout issue where list item text could overflow the container.
|
|
24
99
|
|
|
25
100
|
**Components affected**:
|
|
26
|
-
|
|
27
101
|
- `UL` (UnorderedList)
|
|
28
102
|
- `OL` (OrderedList)
|
|
29
103
|
- `ListItem`
|
|
@@ -43,7 +117,6 @@
|
|
|
43
117
|
```
|
|
44
118
|
|
|
45
119
|
Supported props:
|
|
46
|
-
|
|
47
120
|
- `listStyleImage`: React Element (e.g. `<Image />`)
|
|
48
121
|
- `listStyleIcon`: Icon component
|
|
49
122
|
- `listStyleWidth` / `listStyleHeight`: Dimensions for the marker (default: 20)
|
|
@@ -180,7 +253,6 @@
|
|
|
180
253
|
- [#567](https://github.com/utilitywarehouse/hearth/pull/567) [`b6869cf`](https://github.com/utilitywarehouse/hearth/commit/b6869cfaca7b3a5aacb27c06733f0243b6faa02a) Thanks [@MichalCiesliczka](https://github.com/MichalCiesliczka)! - Adds `ProgressStepper` component
|
|
181
254
|
|
|
182
255
|
- [#596](https://github.com/utilitywarehouse/hearth/pull/596) [`61f1073`](https://github.com/utilitywarehouse/hearth/commit/61f10735a42445b6e4eb90282a2b340317f1ec08) Thanks [@jordmccord](https://github.com/jordmccord)! - `List` component updates:
|
|
183
|
-
|
|
184
256
|
- [BREAKING] The `text` prop in `ListItem` is now `heading`.
|
|
185
257
|
- Added `ListAction` component.
|
|
186
258
|
- Added `badge` prop to `ListItem`.
|
|
@@ -188,7 +260,6 @@
|
|
|
188
260
|
- Removes `divider` prop from `List` and `ListItem`; dividers are now handled automatically.
|
|
189
261
|
|
|
190
262
|
- [#585](https://github.com/utilitywarehouse/hearth/pull/585) [`4894c34`](https://github.com/utilitywarehouse/hearth/commit/4894c34acaadcbbaba78fd64be2f8ae862200e1f) Thanks [@dorota-uw](https://github.com/dorota-uw)! - [BREAKING] `DescriptionListItem` updates:
|
|
191
|
-
|
|
192
263
|
- Removed `Link` props: `linkText`, `linkHref`, `linkIcon`, `linkIconPosition`, `linkOnPress`, `linkTarget`, `linkShowIcon`.
|
|
193
264
|
- Added `trailingContent` prop to allow custom trailing content (e.g. Link, Button).
|
|
194
265
|
- Added validation text support to `DescriptionListItem` via `invalidText` prop.
|
|
@@ -196,7 +267,6 @@
|
|
|
196
267
|
- [#572](https://github.com/utilitywarehouse/hearth/pull/572) [`9fa6499`](https://github.com/utilitywarehouse/hearth/commit/9fa6499b6eb1534c2ce7dc4352b1f848b94786ec) Thanks [@MichalCiesliczka](https://github.com/MichalCiesliczka)! - Adds `IndicatorIconButton` component
|
|
197
268
|
|
|
198
269
|
- [#596](https://github.com/utilitywarehouse/hearth/pull/596) [`61f1073`](https://github.com/utilitywarehouse/hearth/commit/61f10735a42445b6e4eb90282a2b340317f1ec08) Thanks [@jordmccord](https://github.com/jordmccord)! - [BREAKING] `SectionHeader` updates:
|
|
199
|
-
|
|
200
270
|
- Removed `Link` props: `linkText`, `linkOnPress`, `linkAccessibilityLabel`.
|
|
201
271
|
- Added `trailingContent` prop to allow custom trailing content (e.g. Link, Button).
|
|
202
272
|
- Added `badge` prop to display a `Badge` next to the heading.
|
|
@@ -248,7 +318,6 @@
|
|
|
248
318
|
- [#472](https://github.com/utilitywarehouse/hearth/pull/472) [`009fe4b`](https://github.com/utilitywarehouse/hearth/commit/009fe4bff4fc54e424f22629040f715d3d4714ea) Thanks [@jordmccord](https://github.com/jordmccord)! - Add `image` prop to `Checkbox` and `Radio` components
|
|
249
319
|
|
|
250
320
|
- [#500](https://github.com/utilitywarehouse/hearth/pull/500) [`cc49e74`](https://github.com/utilitywarehouse/hearth/commit/cc49e74e3736b9647e8c5576ce45020add258625) Thanks [@jordmccord](https://github.com/jordmccord)! - - Updated dependencies [[`8dac8c1`](https://github.com/utilitywarehouse/hearth/commit/8dac8c1def9083d8e4efa1385e0ee7be23428c46)]:
|
|
251
|
-
|
|
252
321
|
- @utilitywarehouse/hearth-react-native-icons@0.4.0
|
|
253
322
|
|
|
254
323
|
- [#499](https://github.com/utilitywarehouse/hearth/pull/499) [`7b6781c`](https://github.com/utilitywarehouse/hearth/commit/7b6781cc054cf9f1ed4969a2c663abceb526c249) Thanks [@jordmccord](https://github.com/jordmccord)! - Fixes dark mode styles for several components
|
|
@@ -14,6 +14,8 @@ const BottomSheetScrollView = ({ children, style, contentContainerStyle, isModal
|
|
|
14
14
|
const styles = StyleSheet.create((theme, rt) => ({
|
|
15
15
|
container: {
|
|
16
16
|
backgroundColor: theme.color.surface.neutral.strong,
|
|
17
|
+
borderTopLeftRadius: theme.components.bottomSheet.borderTopLeftRadius,
|
|
18
|
+
borderTopRightRadius: theme.components.bottomSheet.borderTopRightRadius,
|
|
17
19
|
},
|
|
18
20
|
contentContainer: {
|
|
19
21
|
paddingHorizontal: theme.components.bottomSheet.padding,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CheckboxGroupProps from './CheckboxGroup.props';
|
|
2
2
|
declare const CheckboxGroup: {
|
|
3
|
-
({ children, disabled, readonly, validationStatus, label, helperText, invalidText, validText, showValidationIcon, helperIcon, type, direction, gap, ...props }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, disabled, readonly, validationStatus, label, labelVariant, helperText, invalidText, validText, showValidationIcon, helperIcon, type, direction, gap, ...props }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default CheckboxGroup;
|
|
@@ -7,7 +7,7 @@ import { Label } from '../Label';
|
|
|
7
7
|
import { CheckboxGroup as CheckboxGroupComponent } from './Checkbox';
|
|
8
8
|
import { CheckboxGroupContext } from './CheckboxGroup.context';
|
|
9
9
|
import CheckboxGroupTextContent from './CheckboxGroupTextContent';
|
|
10
|
-
const CheckboxGroup = ({ children, disabled, readonly, validationStatus, label, helperText, invalidText, validText, showValidationIcon = true, helperIcon, type, direction = 'column', gap, ...props }) => {
|
|
10
|
+
const CheckboxGroup = ({ children, disabled, readonly, validationStatus, label, labelVariant = 'body', helperText, invalidText, validText, showValidationIcon = true, helperIcon, type, direction = 'column', gap, ...props }) => {
|
|
11
11
|
const value = useMemo(() => ({ disabled, validationStatus, type, direction }), [disabled, validationStatus, type, direction]);
|
|
12
12
|
const showHeader = !!label || !!helperText || !!invalidText || !!validText;
|
|
13
13
|
const childrenArray = React.Children.toArray(children);
|
|
@@ -16,7 +16,7 @@ const CheckboxGroup = ({ children, disabled, readonly, validationStatus, label,
|
|
|
16
16
|
// @ts-expect-error - child.type is not typed
|
|
17
17
|
(child.props.type === 'tile' || child.type.displayName === 'CheckboxTile'));
|
|
18
18
|
styles.useVariants({ type: childIsCard ? 'tile' : 'checkbox', direction });
|
|
19
|
-
return (_jsx(CheckboxGroupContext.Provider, { value: value, children: _jsxs(CheckboxGroupComponent, { ...props, value: props.value, isDisabled: disabled, isReadOnly: readonly, isCard: childIsCard, children: [showHeader && (_jsxs(CheckboxGroupTextContent, { children: [!!label && _jsx(Label, { disabled: disabled, children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })), _jsx(View, { style: [styles.container, styles.containerGap(gap)], children: children })] }) }));
|
|
19
|
+
return (_jsx(CheckboxGroupContext.Provider, { value: value, children: _jsxs(CheckboxGroupComponent, { ...props, value: props.value, isDisabled: disabled, isReadOnly: readonly, isCard: childIsCard, children: [showHeader && (_jsxs(CheckboxGroupTextContent, { children: [!!label && (_jsx(Label, { disabled: disabled, variant: labelVariant, children: label })), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })), _jsx(View, { style: [styles.container, styles.containerGap(gap)], children: children })] }) }));
|
|
20
20
|
};
|
|
21
21
|
const styles = StyleSheet.create(theme => ({
|
|
22
22
|
container: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { space } from '../../tokens';
|
|
3
2
|
import { ViewProps } from 'react-native';
|
|
3
|
+
import { space } from '../../tokens';
|
|
4
4
|
interface CheckboxGroupProps extends ViewProps {
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
value?: Array<string>;
|
|
@@ -8,6 +8,7 @@ interface CheckboxGroupProps extends ViewProps {
|
|
|
8
8
|
readonly?: boolean;
|
|
9
9
|
validationStatus?: 'valid' | 'invalid' | 'initial';
|
|
10
10
|
label?: string;
|
|
11
|
+
labelVariant?: 'heading' | 'body';
|
|
11
12
|
helperText?: string;
|
|
12
13
|
showValidationIcon?: boolean;
|
|
13
14
|
invalidText?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type CurrencyInputProps from './CurrencyInput.props';
|
|
2
2
|
declare const CurrencyInput: {
|
|
3
|
-
({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, required, disableGroupSeparator, value, onChangeText, ref, ...rest }: CurrencyInputProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, required, disableGroupSeparator, value, onChangeText, label, labelVariant, helperText, helperIcon, validText, invalidText, ref, ...rest }: CurrencyInputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default CurrencyInput;
|
|
@@ -3,12 +3,8 @@ import { Platform } from 'react-native';
|
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { formatThousands } from '../../utils';
|
|
5
5
|
import { DetailText } from '../DetailText';
|
|
6
|
-
import { useFormFieldContext } from '../FormField';
|
|
7
6
|
import { Input, InputField, InputSlot } from '../Input';
|
|
8
|
-
const CurrencyInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, required, disableGroupSeparator = false, value, onChangeText, ref, ...rest }) => {
|
|
9
|
-
const formFieldContext = useFormFieldContext();
|
|
10
|
-
const { disabled: formFieldDisabled } = formFieldContext;
|
|
11
|
-
const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
|
|
7
|
+
const CurrencyInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, required = true, disableGroupSeparator = false, value, onChangeText, label, labelVariant = 'body', helperText, helperIcon, validText, invalidText, ref, ...rest }) => {
|
|
12
8
|
const defaultFormat = '0.00';
|
|
13
9
|
const getPlaceholder = placeholder ?? defaultFormat;
|
|
14
10
|
const handleChangeText = (text) => {
|
|
@@ -21,7 +17,7 @@ const CurrencyInput = ({ validationStatus = 'initial', disabled, focused, readon
|
|
|
21
17
|
}
|
|
22
18
|
};
|
|
23
19
|
const displayValue = !disableGroupSeparator && typeof value === 'string' ? formatThousands(value) : value;
|
|
24
|
-
return (_jsxs(Input, { validationStatus:
|
|
20
|
+
return (_jsxs(Input, { validationStatus: validationStatus, disabled: disabled, readonly: readonly, focused: focused, required: required, style: styles.wrap, label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validText: validText, invalidText: invalidText, children: [_jsx(InputSlot, { children: _jsx(DetailText, { size: "4xl", style: styles.text, accessible: false, children: "\u00A3" }) }), _jsx(InputField, { ref: ref, inputMode: "decimal", inBottomSheet: inBottomSheet, accessibilityHint: 'Enter the amount in pounds and pence, for example "10.99"', ...rest, placeholder: getPlaceholder, keyboardType: "decimal-pad", style: styles.input, value: displayValue, onChangeText: handleChangeText })] }));
|
|
25
21
|
};
|
|
26
22
|
CurrencyInput.displayName = 'CurrencyInput';
|
|
27
23
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -11,6 +11,12 @@ export interface CurrencyInputBaseProps {
|
|
|
11
11
|
required?: boolean;
|
|
12
12
|
/** When not specifically disabled, the numeric value is automatically formatted with thousand separators (e.g. 1234 -> 1,234). */
|
|
13
13
|
disableGroupSeparator?: boolean;
|
|
14
|
+
label?: string;
|
|
15
|
+
labelVariant?: 'heading' | 'body';
|
|
16
|
+
helperText?: string;
|
|
17
|
+
helperIcon?: React.ComponentType;
|
|
18
|
+
validText?: string;
|
|
19
|
+
invalidText?: string;
|
|
14
20
|
}
|
|
15
21
|
export type CurrencyInputProps = CurrencyInputBaseProps & Omit<TextInputProps, 'children'> & ViewProps;
|
|
16
22
|
export default CurrencyInputProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DatePickerInputProps from './DatePickerInput.props';
|
|
2
2
|
declare const DatePickerInput: {
|
|
3
|
-
({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, format, openButtonLabel, autoCloseOnSelect, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }: DatePickerInputProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ validationStatus, disabled, focused, readonly, placeholder, inBottomSheet, format, openButtonLabel, autoCloseOnSelect, label, labelVariant, helperText, helperIcon, validText, invalidText, required, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }: DatePickerInputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default DatePickerInput;
|
|
@@ -19,7 +19,7 @@ const maskDefaultFormat = (value) => {
|
|
|
19
19
|
const year = digitsOnly.slice(4, 8);
|
|
20
20
|
return [day, month, year].filter(Boolean).join('/');
|
|
21
21
|
};
|
|
22
|
-
const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, format = DEFAULT_FORMAT, openButtonLabel = 'Open date picker', autoCloseOnSelect = true, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }) => {
|
|
22
|
+
const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, format = DEFAULT_FORMAT, openButtonLabel = 'Open date picker', autoCloseOnSelect = true, label, labelVariant, helperText, helperIcon, validText, invalidText, required = true, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }) => {
|
|
23
23
|
const formFieldContext = useFormFieldContext();
|
|
24
24
|
const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
|
|
25
25
|
const isDisabled = formFieldContext?.disabled ?? disabled;
|
|
@@ -109,7 +109,7 @@ const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, read
|
|
|
109
109
|
pickerRef.current?.close?.();
|
|
110
110
|
}, [pickerOnCancel]);
|
|
111
111
|
const placeholderValue = placeholder ?? format;
|
|
112
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Input, { validationStatus:
|
|
112
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Input, { validationStatus: validationStatus, disabled: disabled, readonly: readonly, focused: focused, label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validText: validText, invalidText: invalidText, required: required, style: styles.wrap, accessible: false, children: [_jsx(InputField, { editable: !isReadonly && !isDisabled, value: inputValue, placeholder: placeholderValue, onChangeText: handleTextChange, onBlur: handleBlur, onFocus: handleFocus, inBottomSheet: inBottomSheet, keyboardType: resolvedKeyboardType, inputMode: resolvedInputMode, accessibilityHint: resolvedAccessibilityHint, "aria-label": "Date input", accessibilityLabel: resolvedAccessibilityLabel, accessible: resolvedAccessible, accessibilityState: {
|
|
113
113
|
disabled: isDisabled || isReadonly,
|
|
114
114
|
}, importantForAccessibility: resolvedImportantForAccessibility, inputAccessoryViewID: Platform.OS === 'ios' ? accessoryViewID : undefined, ...textInputProps, style: [styles.input, inputStyle] }), !!inputValue && onClear && !isReadonly && !isDisabled && (_jsx(InputSlot, { accessibilityElementsHidden: false, children: _jsx(UnstyledIconButton, { accessibilityLabel: "Clear date", accessibilityHint: "Removes the current date", icon: CloseSmallIcon, onPress: handleClear }) })), _jsx(InputSlot, { accessibilityElementsHidden: false, children: _jsx(UnstyledIconButton, { accessibilityLabel: openButtonLabel, accessibilityHint: "Opens the date picker calendar", icon: CalendarSmallIcon, onPress: openPicker, disabled: isDisabled || isReadonly }) })] }), _jsx(DatePicker, { ref: pickerRef, mode: "single", date: selectedDate, onChange: handlePickerChange, onCancel: handleCancel, ...restDatePickerProps }), Platform.OS === 'ios' && accessoryViewID && (_jsx(DatePickerInputDoneButton, { accessoryViewID: accessoryViewID, closeKeyboard: closeKeyboard }))] }));
|
|
115
115
|
};
|
|
@@ -6,6 +6,12 @@ export interface DatePickerInputBaseProps {
|
|
|
6
6
|
validationStatus?: 'initial' | 'valid' | 'invalid';
|
|
7
7
|
readonly?: boolean;
|
|
8
8
|
focused?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
labelVariant?: 'heading' | 'body';
|
|
11
|
+
helperText?: string;
|
|
12
|
+
helperIcon?: React.ComponentType;
|
|
13
|
+
validText?: string;
|
|
14
|
+
invalidText?: string;
|
|
9
15
|
placeholder?: string;
|
|
10
16
|
inBottomSheet?: boolean;
|
|
11
17
|
required?: boolean;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { FormFieldBaseProps } from './FormField.props';
|
|
2
|
-
export declare const FormFieldContext: import("react").Context<FormFieldBaseProps
|
|
3
|
-
|
|
2
|
+
export declare const FormFieldContext: import("react").Context<FormFieldBaseProps & {
|
|
3
|
+
setShouldHandleAccessibility?: (value: boolean) => void;
|
|
4
|
+
shouldHandleAccessibility?: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useFormFieldContext: () => FormFieldBaseProps & {
|
|
7
|
+
setShouldHandleAccessibility?: (value: boolean) => void;
|
|
8
|
+
shouldHandleAccessibility?: boolean;
|
|
9
|
+
};
|
|
@@ -23,7 +23,7 @@ export declare const FormFieldInvalidText: {
|
|
|
23
23
|
};
|
|
24
24
|
export declare const FormFieldTextContent: typeof View;
|
|
25
25
|
declare const FormField: {
|
|
26
|
-
({ children, disabled, validationStatus, readonly, label, helperText, helperIcon, validText, invalidText, required, ...props }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
({ children, disabled, validationStatus, readonly, label, helperText, helperIcon, validText, invalidText, required, labelVariant, accessibilityHandledByChildren, ...props }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
displayName: string;
|
|
28
28
|
};
|
|
29
29
|
export default FormField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createFormControl } from '@gluestack-ui/form-control';
|
|
3
|
-
import { useMemo } from 'react';
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
4
|
import { View } from 'react-native';
|
|
5
5
|
import { HelperIcon, HelperText } from '../Helper';
|
|
6
6
|
import { FormFieldContext } from './FormField.context';
|
|
@@ -29,14 +29,34 @@ export const FormFieldHelperIcon = HelperIcon;
|
|
|
29
29
|
export const FormFieldValidText = HelperText;
|
|
30
30
|
export const FormFieldInvalidText = HelperText;
|
|
31
31
|
export const FormFieldTextContent = View;
|
|
32
|
-
const FormField = ({ children, disabled, validationStatus = 'initial', readonly, label, helperText, helperIcon, validText, invalidText, required = true, ...props }) => {
|
|
32
|
+
const FormField = ({ children, disabled, validationStatus = 'initial', readonly, label, helperText, helperIcon, validText, invalidText, required = true, labelVariant = 'body', accessibilityHandledByChildren = false, ...props }) => {
|
|
33
|
+
const [shouldHandleAccessibility, setShouldHandleAccessibility] = useState(accessibilityHandledByChildren);
|
|
33
34
|
const value = useMemo(() => ({
|
|
34
35
|
validationStatus,
|
|
35
36
|
disabled,
|
|
36
37
|
readonly,
|
|
37
38
|
required,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
label,
|
|
40
|
+
helperText,
|
|
41
|
+
helperIcon,
|
|
42
|
+
validText,
|
|
43
|
+
invalidText,
|
|
44
|
+
setShouldHandleAccessibility,
|
|
45
|
+
shouldHandleAccessibility,
|
|
46
|
+
}), [
|
|
47
|
+
validationStatus,
|
|
48
|
+
disabled,
|
|
49
|
+
readonly,
|
|
50
|
+
required,
|
|
51
|
+
label,
|
|
52
|
+
helperText,
|
|
53
|
+
helperIcon,
|
|
54
|
+
validText,
|
|
55
|
+
invalidText,
|
|
56
|
+
setShouldHandleAccessibility,
|
|
57
|
+
shouldHandleAccessibility,
|
|
58
|
+
]);
|
|
59
|
+
return (_jsx(FormFieldContext.Provider, { value: value, children: _jsxs(FormFieldComponent, { ...props, isDisabled: disabled, isReadOnly: readonly, children: [(!!label || !!helperText) && (_jsxs(FormFieldTextContent, { children: [!!label && (_jsxs(FormFieldLabelText, { variant: labelVariant, importantForAccessibility: shouldHandleAccessibility ? 'no' : undefined, accessibilityElementsHidden: shouldHandleAccessibility, children: [label, !required ? ` (Optional)` : ''] })), !!helperText && (_jsx(FormFieldHelper, { text: helperText, icon: helperIcon, showIcon: !!helperIcon, importantForAccessibility: shouldHandleAccessibility ? 'no' : undefined, accessibilityElementsHidden: shouldHandleAccessibility }))] })), children, !!validText && _jsx(FormFieldValid, { text: validText }), !!invalidText && _jsx(FormFieldInvalidComponent, { text: invalidText })] }) }));
|
|
40
60
|
};
|
|
41
61
|
FormField.displayName = 'FormField';
|
|
42
62
|
export default FormField;
|
|
@@ -5,11 +5,13 @@ export interface FormFieldBaseProps {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
readonly?: boolean;
|
|
7
7
|
label?: string;
|
|
8
|
+
labelVariant?: 'heading' | 'body';
|
|
8
9
|
helperText?: string;
|
|
9
10
|
helperIcon?: ComponentType;
|
|
10
11
|
validText?: string;
|
|
11
12
|
invalidText?: string;
|
|
12
13
|
required?: boolean;
|
|
14
|
+
accessibilityHandledByChildren?: boolean;
|
|
13
15
|
}
|
|
14
16
|
interface FormFieldProps extends FormFieldBaseProps, ViewProps {
|
|
15
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import LabelProps from '../Label/Label.props';
|
|
2
2
|
declare const FormFieldLabel: {
|
|
3
|
-
({ children }: Omit<LabelProps, "disabled">): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, ...props }: Omit<LabelProps, "disabled">): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default FormFieldLabel;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFormFieldContext } from './FormField.context';
|
|
3
2
|
import { Label } from '../Label';
|
|
4
|
-
|
|
3
|
+
import { useFormFieldContext } from './FormField.context';
|
|
4
|
+
const FormFieldLabel = ({ children, ...props }) => {
|
|
5
5
|
const { disabled } = useFormFieldContext();
|
|
6
|
-
return _jsx(Label, { disabled: disabled, children: children });
|
|
6
|
+
return (_jsx(Label, { disabled: disabled, ...props, children: children }));
|
|
7
7
|
};
|
|
8
8
|
FormFieldLabel.displayName = 'FormFieldLabel';
|
|
9
9
|
export default FormFieldLabel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFormFieldContext } from './FormField.context';
|
|
3
|
-
import { Helper } from '../Helper';
|
|
4
2
|
import { TickCircleSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import { Helper } from '../Helper';
|
|
4
|
+
import { useFormFieldContext } from './FormField.context';
|
|
5
5
|
const FormFieldValid = ({ children, icon = TickCircleSmallIcon, text, ...props }) => {
|
|
6
6
|
const { validationStatus, disabled } = useFormFieldContext();
|
|
7
7
|
return validationStatus === 'valid' ? (children ? (_jsx(Helper, { validationStatus: "valid", showIcon: true, disabled: disabled, ...props, children: children })) : (_jsx(Helper, { validationStatus: "valid", disabled: disabled, showIcon: true, icon: icon, text: text, ...props }))) : null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createInput } from '@gluestack-ui/input';
|
|
3
|
-
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
3
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
4
|
import { CloseSmallIcon, EyeOffSmallIcon, EyeSmallIcon, SearchMediumIcon, } from '@utilitywarehouse/hearth-react-native-icons';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
|
-
import { useFormFieldContext } from '../FormField';
|
|
6
|
+
import { FormField, useFormFieldContext } from '../FormField';
|
|
7
7
|
import { Spinner } from '../Spinner';
|
|
8
8
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
9
9
|
import InputFieldComponent from './InputField';
|
|
@@ -19,11 +19,21 @@ export const InputComponent = createInput({
|
|
|
19
19
|
export const InputSlot = InputComponent.Slot;
|
|
20
20
|
export const InputField = InputComponent.Input;
|
|
21
21
|
export const InputIcon = InputComponent.Icon;
|
|
22
|
-
const Input = forwardRef(({ validationStatus = 'initial', children, disabled, focused, readonly, leadingIcon, trailingIcon, type, showPasswordToggle = true, onClear, format, loading, clearable = false, required, inBottomSheet = false, style, ...props }, ref) => {
|
|
22
|
+
const Input = forwardRef(({ validationStatus = 'initial', children, disabled, focused, readonly, leadingIcon, trailingIcon, type, showPasswordToggle = true, onClear, format, loading, clearable = false, required = true, inBottomSheet = false, style, label, labelVariant, helperText, helperIcon, validText, invalidText, ...props }, ref) => {
|
|
23
23
|
const formFieldContext = useFormFieldContext();
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
24
|
+
const inputLabel = label ?? formFieldContext?.label;
|
|
25
|
+
const inputHelperText = helperText ?? formFieldContext?.helperText;
|
|
26
|
+
const inputValidText = validText ?? formFieldContext?.validText;
|
|
27
|
+
const inputInvalidText = invalidText ?? formFieldContext?.invalidText;
|
|
28
|
+
const inputRequired = required ?? formFieldContext?.required;
|
|
29
|
+
const inputDisabled = disabled ?? formFieldContext?.disabled;
|
|
30
|
+
const inputReadonly = readonly ?? formFieldContext?.readonly;
|
|
31
|
+
const inputValidationStatus = formFieldContext?.validationStatus ?? validationStatus;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (formFieldContext?.setShouldHandleAccessibility) {
|
|
34
|
+
formFieldContext.setShouldHandleAccessibility(true);
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
27
37
|
const [fieldType, setFieldType] = useState(type === 'password' ? 'password' : 'text');
|
|
28
38
|
const { color } = useTheme();
|
|
29
39
|
const inputRef = useRef(null);
|
|
@@ -46,11 +56,39 @@ const Input = forwardRef(({ validationStatus = 'initial', children, disabled, fo
|
|
|
46
56
|
}
|
|
47
57
|
return undefined;
|
|
48
58
|
})();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
const getAccessibilityLabel = () => {
|
|
60
|
+
let accessibilityLabel = '';
|
|
61
|
+
if (inputLabel) {
|
|
62
|
+
accessibilityLabel = accessibilityLabel + inputLabel;
|
|
63
|
+
}
|
|
64
|
+
if (inputRequired) {
|
|
65
|
+
accessibilityLabel = accessibilityLabel + ', required';
|
|
66
|
+
}
|
|
67
|
+
return accessibilityLabel || props.accessibilityLabel;
|
|
68
|
+
};
|
|
69
|
+
const getAccessibilityHint = () => {
|
|
70
|
+
let accessibilityHint = '';
|
|
71
|
+
if (inputHelperText) {
|
|
72
|
+
accessibilityHint = accessibilityHint + inputHelperText;
|
|
73
|
+
}
|
|
74
|
+
if (inputValidationStatus !== 'initial') {
|
|
75
|
+
if (accessibilityHint.length > 0) {
|
|
76
|
+
accessibilityHint = accessibilityHint + ', ';
|
|
77
|
+
}
|
|
78
|
+
if (inputValidationStatus === 'invalid' && inputInvalidText) {
|
|
79
|
+
accessibilityHint = accessibilityHint + inputInvalidText;
|
|
80
|
+
}
|
|
81
|
+
if (inputValidationStatus === 'valid' && inputValidText) {
|
|
82
|
+
accessibilityHint = accessibilityHint + inputValidText;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return accessibilityHint || props.accessibilityHint;
|
|
86
|
+
};
|
|
87
|
+
return (_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validText: validText, invalidText: invalidText, required: required, validationStatus: validationStatus, disabled: disabled, readonly: readonly, accessibilityHandledByChildren: true, children: _jsx(InputComponent, { ...(children ? props : {}), validationStatus: inputValidationStatus, isInvalid: inputValidationStatus === 'invalid', isReadOnly: inputReadonly, isDisabled: inputDisabled, isFocused: focused, type: type, isRequired: inputRequired, style: style, children: children ? (_jsx(_Fragment, { children: children })) : (_jsxs(_Fragment, { children: [!!leadingIconComponent && (_jsx(InputSlot, { children: _jsx(InputIcon, { as: leadingIconComponent }) })), _jsx(InputField
|
|
52
88
|
// @ts-expect-error - ref forwarding issue
|
|
53
|
-
|
|
89
|
+
, {
|
|
90
|
+
// @ts-expect-error - ref forwarding issue
|
|
91
|
+
ref: inputRef, type: fieldType, inputMode: getInputMode, inBottomSheet: inBottomSheet, ...props, "aria-label": getAccessibilityLabel(), accessibilityHint: getAccessibilityHint() }), shouldShowClear && (_jsx(InputSlot, { children: _jsx(UnstyledIconButton, { onPress: onClear, icon: CloseSmallIcon }) })), loading && (_jsx(InputSlot, { children: _jsx(Spinner, { size: "xs", color: color.icon.primary }) })), shouldShowPasswordToggle && (_jsx(InputSlot, { children: _jsx(UnstyledIconButton, { onPress: toggleFieldType, icon: fieldType === 'password' ? EyeSmallIcon : EyeOffSmallIcon }) })), !!trailingIcon && (_jsx(InputSlot, { children: _jsx(InputIcon, { as: trailingIcon }) }))] })) }) }));
|
|
54
92
|
});
|
|
55
93
|
Input.displayName = 'Input';
|
|
56
94
|
export default Input;
|
|
@@ -25,6 +25,13 @@ export interface InputBaseProps {
|
|
|
25
25
|
focused?: boolean;
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
inBottomSheet?: boolean;
|
|
28
|
+
label?: string;
|
|
29
|
+
labelVariant?: 'heading' | 'body';
|
|
30
|
+
helperText?: string;
|
|
31
|
+
helperIcon?: ComponentType;
|
|
32
|
+
validText?: string;
|
|
33
|
+
invalidText?: string;
|
|
34
|
+
required?: boolean;
|
|
28
35
|
}
|
|
29
36
|
export interface InputWithChildrenProps extends InputBaseProps, ViewProps {
|
|
30
37
|
children: ViewProps['children'];
|
|
@@ -36,7 +43,6 @@ export interface InputWithChildrenProps extends InputBaseProps, ViewProps {
|
|
|
36
43
|
onClear?: never;
|
|
37
44
|
leadingIcon?: never;
|
|
38
45
|
trailingIcon?: never;
|
|
39
|
-
required?: never;
|
|
40
46
|
}
|
|
41
47
|
interface InputWithoutChildrenBaseProps extends InputBaseProps, Omit<TextInputProps, 'children'> {
|
|
42
48
|
children?: never;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import LabelProps from './Label.props';
|
|
2
2
|
declare const Label: {
|
|
3
|
-
({ children, nested, disabled, style, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, nested, disabled, style, variant, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Label;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
import { BodyText } from '../BodyText';
|
|
4
|
-
|
|
4
|
+
import { Heading } from '../Heading';
|
|
5
|
+
const Label = ({ children, nested, disabled, style, variant = 'body', ...props }) => {
|
|
5
6
|
styles.useVariants({ disabled });
|
|
7
|
+
if (variant === 'heading') {
|
|
8
|
+
return (_jsx(Heading, { size: "md", style: [styles.text, style], ...props, children: children }));
|
|
9
|
+
}
|
|
6
10
|
return (_jsx(BodyText, { size: "md", weight: nested ? 'regular' : 'semibold', style: [styles.text, style], ...props, children: children }));
|
|
7
11
|
};
|
|
8
12
|
Label.displayName = 'Label';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
interface LabelProps extends
|
|
1
|
+
import { BodyTextProps } from '../BodyText';
|
|
2
|
+
interface LabelProps extends Omit<BodyTextProps, 'size' | 'weight'> {
|
|
3
3
|
nested?: boolean;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
variant?: 'heading' | 'body';
|
|
5
6
|
}
|
|
6
7
|
export default LabelProps;
|
|
@@ -104,6 +104,7 @@ const Modal = ({ ref, children, heading, description, showCloseButton = true, pr
|
|
|
104
104
|
bothButtons: !!(onPressPrimaryButton && onPressSecondaryButton),
|
|
105
105
|
noButtons,
|
|
106
106
|
stickyFooter,
|
|
107
|
+
showHandle: props.showHandle,
|
|
107
108
|
});
|
|
108
109
|
const footer = (_jsxs(View, { style: styles.footer, children: [onPressPrimaryButton && primaryButtonText ? (_jsx(Button, { onPress: handlePrimaryButtonPress, text: primaryButtonText, ...primaryButtonProps, variant: primaryButtonProps?.variant ?? 'solid', colorScheme: primaryButtonProps?.colorScheme ?? 'highlight' })) : null, onPressSecondaryButton && secondaryButtonText ? (_jsx(Button, { onPress: handleSecondaryButtonPress, text: secondaryButtonText, ...secondaryButtonProps, variant: secondaryButtonProps?.variant ?? 'outline', colorScheme: secondaryButtonProps?.colorScheme ?? 'functional' })) : null] }));
|
|
109
110
|
const content = (_jsx(_Fragment, { children: loading ? (_jsxs(View, { style: styles.loadingContainer, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Loading' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsx(Spinner, { size: "lg" }), _jsx(Heading, { size: "lg", textAlign: "center", children: "Loading..." })] })) : (_jsxs(View, { style: styles.container, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Modal content' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsxs(View, { style: styles.header, children: [_jsxs(View, { style: styles.headerTextContent, children: [heading && !image ? (_jsx(Heading, { size: "lg", accessible: true, children: heading })) : null, description && !image ? _jsx(BodyText, { accessible: true, children: description }) : null] }), showCloseButton ? (_jsx(UnstyledIconButton, { icon: CloseMediumIcon, onPress: handleCloseButtonPress, accessibilityLabel: "Close modal", ...closeButtonProps })) : null] }), image ? (_jsxs(View, { style: styles.imageContainer, children: [image, _jsxs(View, { style: styles.textContent, children: [heading ? (_jsx(Heading, { size: "lg", textAlign: "center", accessible: true, children: heading })) : null, description ? (_jsx(BodyText, { textAlign: "center", accessible: true, children: description })) : null] })] })) : null, children, !stickyFooter && !noButtons ? footer : null] })) }));
|
|
@@ -159,6 +160,14 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
159
160
|
header: {
|
|
160
161
|
flexDirection: 'row',
|
|
161
162
|
gap: theme.components.modal.gap,
|
|
163
|
+
variants: {
|
|
164
|
+
showHandle: {
|
|
165
|
+
true: {},
|
|
166
|
+
false: {
|
|
167
|
+
marginTop: -6,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
162
171
|
},
|
|
163
172
|
headerTextContent: {
|
|
164
173
|
flex: 1,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import RadioGroupProps from './RadioGroup.props';
|
|
2
2
|
declare const RadioGroup: {
|
|
3
|
-
({ children, disabled, readonly, validationStatus, label, helperText, invalidText, validText, showValidationIcon, helperIcon, type, direction, gap, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ children, disabled, readonly, validationStatus, label, labelVariant, helperText, invalidText, validText, showValidationIcon, helperIcon, type, direction, gap, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default RadioGroup;
|