@utilitywarehouse/hearth-react-native 0.32.0 → 0.32.2
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 +15 -18
- package/CHANGELOG.md +30 -1
- package/build/components/Badge/Badge.js +2 -2
- package/build/components/Card/Card.props.d.ts +1 -1
- package/build/components/Card/CardRoot.js +19 -0
- package/build/components/Input/Input.js +13 -31
- package/build/components/StepperInput/StepperInput.js +12 -29
- package/build/components/Tabs/Tab.js +2 -2
- package/build/components/Textarea/Textarea.js +12 -30
- package/build/components/VerificationInput/VerificationInput.js +12 -22
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useFormFieldAccessibility.d.ts +17 -0
- package/build/hooks/useFormFieldAccessibility.js +32 -0
- package/build/hooks/useFormFieldAccessibility.test.d.ts +1 -0
- package/build/hooks/useFormFieldAccessibility.test.js +56 -0
- package/docs/changelog.mdx +84 -0
- package/package.json +11 -9
- package/src/components/Badge/Badge.tsx +2 -2
- package/src/components/Banner/Banner.stories.tsx +14 -0
- package/src/components/Card/Card.docs.mdx +16 -17
- package/src/components/Card/Card.props.ts +1 -0
- package/src/components/Card/Card.stories.tsx +35 -21
- package/src/components/Card/CardRoot.tsx +19 -0
- package/src/components/Icon/Icon.docs.mdx +1 -1
- package/src/components/Input/Input.tsx +14 -35
- package/src/components/List/List.docs.mdx +4 -2
- package/src/components/StepperInput/StepperInput.tsx +13 -40
- package/src/components/Tabs/Tab.tsx +2 -2
- package/src/components/Textarea/Textarea.tsx +13 -34
- package/src/components/VerificationInput/VerificationInput.tsx +13 -25
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useFormFieldAccessibility.test.tsx +74 -0
- package/src/hooks/useFormFieldAccessibility.ts +67 -0
package/docs/changelog.mdx
CHANGED
|
@@ -9,6 +9,90 @@ import { BackToTopButton, NextPrevPage } from './components';
|
|
|
9
9
|
The changelog for the Hearth React Native library. Here you can find all the changes, improvements, and bug fixes for each version.
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
## 0.32.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#1164](https://github.com/utilitywarehouse/hearth/pull/1164) [`c8848d9`](https://github.com/utilitywarehouse/hearth/commit/c8848d9b01611e4c25b9caef7f211b8c623432c4) Thanks [@MichalCiesliczka](https://github.com/MichalCiesliczka)! - 🐛 [FIX]: Badge and Tabs now adapt their height for larger accessibility font sizes.
|
|
17
|
+
|
|
18
|
+
When larger text sizes are enabled (for example in iOS accessibility settings),
|
|
19
|
+
Badge and Tabs no longer clip text within fixed-height layouts. Their containers
|
|
20
|
+
now grow to fit scaled text while keeping the default visual sizing at standard
|
|
21
|
+
font settings.
|
|
22
|
+
|
|
23
|
+
**Components affected**:
|
|
24
|
+
- Badge
|
|
25
|
+
- Tab
|
|
26
|
+
|
|
27
|
+
**Developer changes**:
|
|
28
|
+
|
|
29
|
+
No code changes are required.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`e4167f2`](https://github.com/utilitywarehouse/hearth/commit/e4167f27325dacc0cbc1feae456697387162aa77)]:
|
|
32
|
+
- @utilitywarehouse/hearth-react-native-icons@0.8.1
|
|
33
|
+
|
|
34
|
+
## 0.32.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- [#1144](https://github.com/utilitywarehouse/hearth/pull/1144) [`85459f2`](https://github.com/utilitywarehouse/hearth/commit/85459f2f4d7dcd8a99685a11dcda070530cee8dc) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: Add the missing `highlight` color scheme support across the `Banner` and `Card` components.
|
|
39
|
+
|
|
40
|
+
## 0.32.0
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- [#1134](https://github.com/utilitywarehouse/hearth/pull/1134) [`8824186`](https://github.com/utilitywarehouse/hearth/commit/ebccb55afebcbd47508d7992614b2495c7839cc6) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Add `Roundel` status indicator component.
|
|
45
|
+
|
|
46
|
+
`Roundel` is a compact status indicator with `success`, `pending`, and `error` variants, intended for inline state cues.
|
|
47
|
+
|
|
48
|
+
**Components affected**:
|
|
49
|
+
|
|
50
|
+
- `Roundel`
|
|
51
|
+
|
|
52
|
+
**Developer changes**:
|
|
53
|
+
|
|
54
|
+
Import and use `Roundel` from `@utilitywarehouse/hearth-react-native`:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { Roundel } from '@utilitywarehouse/hearth-react-native';
|
|
58
|
+
|
|
59
|
+
<Roundel variant="success" />;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- [#1132](https://github.com/utilitywarehouse/hearth/pull/1132) [`8824186`](https://github.com/utilitywarehouse/hearth/commit/882418633ee8c3a11e204329d07363dc411996dc) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Add the `Rating` component
|
|
63
|
+
|
|
64
|
+
**Components affected**:
|
|
65
|
+
- `Rating`
|
|
66
|
+
|
|
67
|
+
**Developer changes**:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { Rating } from '@utilitywarehouse/hearth-react-native';
|
|
71
|
+
|
|
72
|
+
const MyComponent = () => <Rating value={3} />;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- [#1129](https://github.com/utilitywarehouse/hearth/pull/1129) [`ec385a8`](https://github.com/utilitywarehouse/hearth/commit/ec385a8185bfa4ec7f4d5f1366ecc069a98cbba8) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Add `StepperInput` for controlled numeric input with increment and decrement buttons.
|
|
76
|
+
|
|
77
|
+
`StepperInput` is a new React Native form component for adjusting numeric values with direct text entry and dedicated step controls. It supports min and max bounds, configurable step size, validation and helper text through `FormField`, and an opt-in `focusInputOnStepPress` prop for keyboard-first flows.
|
|
78
|
+
|
|
79
|
+
**Components affected**:
|
|
80
|
+
- `StepperInput`
|
|
81
|
+
|
|
82
|
+
**Developer changes**:
|
|
83
|
+
|
|
84
|
+
Import and use `StepperInput` from `@utilitywarehouse/hearth-react-native`:
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { StepperInput } from '@utilitywarehouse/hearth-react-native';
|
|
88
|
+
|
|
89
|
+
<StepperInput label="Guests" min={1} max={10} value={value} onChangeText={setValue} />;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- [#1133](https://github.com/utilitywarehouse/hearth/pull/1133) [`5cae98e`](https://github.com/utilitywarehouse/hearth/commit/5cae98e640a708a7d99eaf0395b7b52e71b8e6ec) Thanks [@jordmccord](https://github.com/jordmccord)! - 💅 [ENHANCEMENT]: Add a `defaultHeight` prop to `Textarea` so the initial height can be configured.
|
|
95
|
+
|
|
12
96
|
## 0.31.1
|
|
13
97
|
|
|
14
98
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilitywarehouse/hearth-react-native",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
4
4
|
"description": "Utility Warehouse React Native UI library",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@storybook/addon-vitest": "^10.2.1",
|
|
34
34
|
"@storybook/react-native-web-vite": "^10.2.1",
|
|
35
35
|
"@types/prismjs": "^1.26.5",
|
|
36
|
+
"@types/react-dom": "^19.1.6",
|
|
36
37
|
"@types/react": "^19.1.10",
|
|
37
38
|
"@vitest/browser": "^3.2.4",
|
|
38
39
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"playwright": "^1.55.1",
|
|
42
43
|
"prismjs": "^1.30.0",
|
|
43
44
|
"react": "^19.1.0",
|
|
45
|
+
"react-dom": "^19.1.0",
|
|
44
46
|
"react-native": "0.80.0",
|
|
45
47
|
"react-native-edge-to-edge": "1.6.1",
|
|
46
48
|
"react-native-gesture-handler": "2.28.0",
|
|
@@ -58,9 +60,9 @@
|
|
|
58
60
|
"vite-plugin-svgr": "^4.5.0",
|
|
59
61
|
"vitest": "^3.2.4",
|
|
60
62
|
"@utilitywarehouse/hearth-fonts": "^0.0.4",
|
|
61
|
-
"@utilitywarehouse/hearth-react-icons": "^0.8.
|
|
62
|
-
"@utilitywarehouse/hearth-react-native-icons": "^0.8.
|
|
63
|
-
"@utilitywarehouse/hearth-svg-assets": "^0.6.
|
|
63
|
+
"@utilitywarehouse/hearth-react-icons": "^0.8.1",
|
|
64
|
+
"@utilitywarehouse/hearth-react-native-icons": "^0.8.1",
|
|
65
|
+
"@utilitywarehouse/hearth-svg-assets": "^0.6.1",
|
|
64
66
|
"@utilitywarehouse/hearth-tokens": "^0.2.4"
|
|
65
67
|
},
|
|
66
68
|
"peerDependencies": {
|
|
@@ -79,19 +81,19 @@
|
|
|
79
81
|
"clean": "rm -rf node_modules rm -rf build .turbo",
|
|
80
82
|
"generateColours": "node ./scripts/generateColours.js",
|
|
81
83
|
"copyTokens": "node ./scripts/copyTokens.js",
|
|
82
|
-
"
|
|
84
|
+
"copy:changelog": "node ./scripts/copyChangelog.js",
|
|
83
85
|
"lint:fix": "TIMING=1 eslint --fix .",
|
|
84
86
|
"lint": "TIMING=1 eslint .",
|
|
85
87
|
"build": "tsc",
|
|
86
88
|
"watch": "tsc --watch",
|
|
87
89
|
"figma:create": "figma connect create",
|
|
88
90
|
"figma:publish": "figma connect publish",
|
|
89
|
-
"test": "
|
|
91
|
+
"test": "vitest run --config vitest.unit.config.ts",
|
|
90
92
|
"test:storybook": "vitest run --project storybook",
|
|
91
|
-
"dev": "npm run
|
|
93
|
+
"dev": "npm run copy:changelog && storybook dev -p 6006",
|
|
92
94
|
"dev:docs": "storybook dev -p 6002 --no-open --docs",
|
|
93
|
-
"build:storybook": "npm run
|
|
94
|
-
"build:storybook:docs": "npm run
|
|
95
|
+
"build:storybook": "npm run copy:changelog && storybook build",
|
|
96
|
+
"build:storybook:docs": "npm run copy:changelog && storybook build --docs",
|
|
95
97
|
"chromatic": "npx chromatic --project-token=chpt_cce0fb1ebd95d2a --build-script-name build:storybook"
|
|
96
98
|
}
|
|
97
99
|
}
|
|
@@ -78,11 +78,11 @@ const styles = StyleSheet.create(theme => ({
|
|
|
78
78
|
size: {
|
|
79
79
|
sm: {
|
|
80
80
|
paddingVertical: theme.components.badge.sm.paddingVertical,
|
|
81
|
-
|
|
81
|
+
minHeight: theme.components.badge.sm.height,
|
|
82
82
|
},
|
|
83
83
|
md: {
|
|
84
84
|
paddingVertical: theme.components.badge.md.paddingVertical,
|
|
85
|
-
|
|
85
|
+
minHeight: theme.components.badge.md.height,
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
88
|
flatBase: {
|
|
@@ -55,6 +55,7 @@ const meta = {
|
|
|
55
55
|
'insurance',
|
|
56
56
|
'cashback',
|
|
57
57
|
'pig',
|
|
58
|
+
'highlight',
|
|
58
59
|
],
|
|
59
60
|
},
|
|
60
61
|
iconContainerVariant: {
|
|
@@ -548,6 +549,19 @@ export const ColorSchemes: Story = {
|
|
|
548
549
|
</Button>
|
|
549
550
|
}
|
|
550
551
|
/>
|
|
552
|
+
<Banner
|
|
553
|
+
icon={HomeMediumIcon}
|
|
554
|
+
iconContainerColor="highlight"
|
|
555
|
+
iconContainerVariant="emphasis"
|
|
556
|
+
colorScheme="highlight"
|
|
557
|
+
heading="Highlight Yellow"
|
|
558
|
+
description="Banner with highlight color scheme."
|
|
559
|
+
button={
|
|
560
|
+
<Button size="sm" onPress={() => console.log('Action pressed')}>
|
|
561
|
+
Action
|
|
562
|
+
</Button>
|
|
563
|
+
}
|
|
564
|
+
/>
|
|
551
565
|
</Flex>
|
|
552
566
|
</View>
|
|
553
567
|
);
|
|
@@ -61,23 +61,22 @@ const MyComponent = () => (
|
|
|
61
61
|
|
|
62
62
|
## Props
|
|
63
63
|
|
|
64
|
-
| Property | Type
|
|
65
|
-
| -------------- |
|
|
66
|
-
| variant | `'subtle' \| 'emphasis' `
|
|
67
|
-
| colorScheme | `'neutralStrong' \| 'neutralSubtle' \| '
|
|
68
|
-
| shadowColor | `'functional' \| 'brand' \| 'energy' \| 'broadband' \| 'mobile' `<br /> `'insurance' \| 'cashback' \| 'pig'`
|
|
69
|
-
| noPadding | `boolean`
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
| columnGap | `number` | The column gap between the content. | `0` |
|
|
64
|
+
| Property | Type | Description | Default |
|
|
65
|
+
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | ----------------- |
|
|
66
|
+
| variant | `'subtle' \| 'emphasis' ` | The variant of the card. | `'subtle'` |
|
|
67
|
+
| colorScheme | `'neutralStrong' \| 'neutralSubtle' \| 'brand' \| 'energy'` <br /> `'broadband' \| 'mobile' \| 'insurance' \| 'cashback' \|` <br /> `'highlight' \| 'pig'` | The color scheme of the card. | `'neutralStrong'` |
|
|
68
|
+
| shadowColor | `'functional' \| 'brand' \| 'energy' \| 'broadband' \| 'mobile' `<br /> `'insurance' \| 'cashback' \| 'pig'` | The shadow color of the card. | `-` |
|
|
69
|
+
| noPadding | `boolean` | Whether or not the card has padding. | `false` |
|
|
70
|
+
| onPress | `() => void` | Callback function to be called. | `-` |
|
|
71
|
+
| disabled | `boolean` | Whether the card is disabled. | `false` |
|
|
72
|
+
| spacing | `'none' \| '2xs' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl'` | The space between the content. | `none` |
|
|
73
|
+
| alignItems | `'flex-start' \| 'flex-end' \| `<br />`'center' \| 'stretch' \| 'baseline'` | The align items of the flex container. | `flex-start` |
|
|
74
|
+
| justifyContent | `'flex-start' \| 'flex-end' \| 'center' \| 'space-between' \| `<br />` 'space-around' \| 'space-evenly'` | The justify content of the flex container. | `flex-start` |
|
|
75
|
+
| flexWrap | `'wrap' \| 'nowrap' \| 'wrap-reverse'` | The wrap of the flex container. | `nowrap` |
|
|
76
|
+
| flexDirection | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | The direction of the flex container. | `column` |
|
|
77
|
+
| gap | `number` | The gap between the content. | `0` |
|
|
78
|
+
| rowGap | `number` | The row gap between the content. | `0` |
|
|
79
|
+
| columnGap | `number` | The column gap between the content. | `0` |
|
|
81
80
|
|
|
82
81
|
### `CardPressHandler` Props
|
|
83
82
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-native';
|
|
2
2
|
import { BellMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
3
4
|
import { Card, CardAction, CardActions, CardPressHandler } from '.';
|
|
4
5
|
import { VariantTitle } from '../../../docs/components';
|
|
5
6
|
import { BodyText } from '../BodyText';
|
|
@@ -7,6 +8,8 @@ import { Button } from '../Button';
|
|
|
7
8
|
import { Flex } from '../Flex';
|
|
8
9
|
import { Heading } from '../Heading';
|
|
9
10
|
|
|
11
|
+
type CardStoryProps = ComponentProps<typeof Card>;
|
|
12
|
+
|
|
10
13
|
const meta = {
|
|
11
14
|
title: 'Stories / Card',
|
|
12
15
|
component: Card,
|
|
@@ -31,6 +34,7 @@ const meta = {
|
|
|
31
34
|
'brand',
|
|
32
35
|
'energy',
|
|
33
36
|
'broadband',
|
|
37
|
+
'highlight',
|
|
34
38
|
'mobile',
|
|
35
39
|
'insurance',
|
|
36
40
|
'cashback',
|
|
@@ -65,7 +69,7 @@ export default meta;
|
|
|
65
69
|
type Story = StoryObj<typeof meta>;
|
|
66
70
|
|
|
67
71
|
export const Playground: Story = {
|
|
68
|
-
render: ({ children, ...props }) => {
|
|
72
|
+
render: ({ children, ...props }: CardStoryProps) => {
|
|
69
73
|
return (
|
|
70
74
|
<Card {...props}>
|
|
71
75
|
<BodyText>{children as string}</BodyText>
|
|
@@ -75,7 +79,7 @@ export const Playground: Story = {
|
|
|
75
79
|
};
|
|
76
80
|
|
|
77
81
|
export const WithActions: Story = {
|
|
78
|
-
render: ({ children, ...props }) => {
|
|
82
|
+
render: ({ children, ...props }: CardStoryProps) => {
|
|
79
83
|
return (
|
|
80
84
|
<Flex gap="400">
|
|
81
85
|
<Card
|
|
@@ -139,7 +143,7 @@ export const WithOnlyAction: Story = {
|
|
|
139
143
|
args: {
|
|
140
144
|
variant: 'emphasis',
|
|
141
145
|
},
|
|
142
|
-
render: ({ ...props }) => {
|
|
146
|
+
render: ({ ...props }: CardStoryProps) => {
|
|
143
147
|
return (
|
|
144
148
|
<Card {...props} flexDirection="column" alignItems="stretch" spacing="md">
|
|
145
149
|
<CardActions>
|
|
@@ -159,7 +163,7 @@ export const Variants: Story = {
|
|
|
159
163
|
parameters: {
|
|
160
164
|
controls: { exclude: ['variant', 'colorScheme'] },
|
|
161
165
|
},
|
|
162
|
-
render: ({ children, ...props }) => {
|
|
166
|
+
render: ({ children, ...props }: CardStoryProps) => {
|
|
163
167
|
return (
|
|
164
168
|
<Flex spacing="lg">
|
|
165
169
|
<VariantTitle title="Subtle - White">
|
|
@@ -182,76 +186,86 @@ export const Variants: Story = {
|
|
|
182
186
|
<BodyText>{children as string}</BodyText>
|
|
183
187
|
</Card>
|
|
184
188
|
</VariantTitle>
|
|
185
|
-
<VariantTitle title="
|
|
189
|
+
<VariantTitle title="Brand - Subtle">
|
|
186
190
|
<Card {...props} colorScheme="brand" variant="subtle">
|
|
187
191
|
<BodyText>{children as string}</BodyText>
|
|
188
192
|
</Card>
|
|
189
193
|
</VariantTitle>
|
|
190
|
-
<VariantTitle title="
|
|
194
|
+
<VariantTitle title="Brand - Emphasis">
|
|
191
195
|
<Card {...props} colorScheme="brand" variant="emphasis">
|
|
192
196
|
<BodyText inverted>{children as string}</BodyText>
|
|
193
197
|
</Card>
|
|
194
198
|
</VariantTitle>
|
|
195
|
-
<VariantTitle title="Energy
|
|
199
|
+
<VariantTitle title="Energy - Subtle">
|
|
196
200
|
<Card {...props} colorScheme="energy" variant="subtle">
|
|
197
201
|
<BodyText>{children as string}</BodyText>
|
|
198
202
|
</Card>
|
|
199
203
|
</VariantTitle>
|
|
200
|
-
<VariantTitle title="Energy
|
|
204
|
+
<VariantTitle title="Energy - Emphasis">
|
|
201
205
|
<Card {...props} colorScheme="energy" variant="emphasis">
|
|
202
206
|
<BodyText>{children as string}</BodyText>
|
|
203
207
|
</Card>
|
|
204
208
|
</VariantTitle>
|
|
205
|
-
<VariantTitle title="Broadband
|
|
209
|
+
<VariantTitle title="Broadband - Subtle">
|
|
206
210
|
<Card {...props} colorScheme="broadband" variant="subtle">
|
|
207
211
|
<BodyText>{children as string}</BodyText>
|
|
208
212
|
</Card>
|
|
209
213
|
</VariantTitle>
|
|
210
|
-
<VariantTitle title="Broadband
|
|
214
|
+
<VariantTitle title="Broadband - Emphasis">
|
|
211
215
|
<Card {...props} colorScheme="broadband" variant="emphasis">
|
|
212
216
|
<BodyText>{children as string}</BodyText>
|
|
213
217
|
</Card>
|
|
214
218
|
</VariantTitle>
|
|
215
|
-
<VariantTitle title="Mobile
|
|
219
|
+
<VariantTitle title="Mobile - Subtle">
|
|
216
220
|
<Card {...props} colorScheme="mobile" variant="subtle">
|
|
217
221
|
<BodyText>{children as string}</BodyText>
|
|
218
222
|
</Card>
|
|
219
223
|
</VariantTitle>
|
|
220
|
-
<VariantTitle title="Mobile
|
|
224
|
+
<VariantTitle title="Mobile - Emphasis">
|
|
221
225
|
<Card {...props} colorScheme="mobile" variant="emphasis">
|
|
222
226
|
<BodyText>{children as string}</BodyText>
|
|
223
227
|
</Card>
|
|
224
228
|
</VariantTitle>
|
|
225
|
-
<VariantTitle title="Insurance
|
|
229
|
+
<VariantTitle title="Insurance - Subtle">
|
|
226
230
|
<Card {...props} colorScheme="insurance" variant="subtle">
|
|
227
231
|
<BodyText>{children as string}</BodyText>
|
|
228
232
|
</Card>
|
|
229
233
|
</VariantTitle>
|
|
230
|
-
<VariantTitle title="Insurance
|
|
234
|
+
<VariantTitle title="Insurance - Emphasis">
|
|
231
235
|
<Card {...props} colorScheme="insurance" variant="emphasis">
|
|
232
236
|
<BodyText>{children as string}</BodyText>
|
|
233
237
|
</Card>
|
|
234
238
|
</VariantTitle>
|
|
235
|
-
<VariantTitle title="Cashback
|
|
239
|
+
<VariantTitle title="Cashback - Subtle">
|
|
236
240
|
<Card {...props} colorScheme="cashback" variant="subtle">
|
|
237
241
|
<BodyText>{children as string}</BodyText>
|
|
238
242
|
</Card>
|
|
239
243
|
</VariantTitle>
|
|
240
|
-
<VariantTitle title="Cashback
|
|
244
|
+
<VariantTitle title="Cashback - Emphasis">
|
|
241
245
|
<Card {...props} colorScheme="cashback" variant="emphasis">
|
|
242
246
|
<BodyText>{children as string}</BodyText>
|
|
243
247
|
</Card>
|
|
244
248
|
</VariantTitle>
|
|
245
|
-
<VariantTitle title="Piggy
|
|
249
|
+
<VariantTitle title="Piggy - Subtle">
|
|
246
250
|
<Card {...props} colorScheme="pig" variant="subtle">
|
|
247
251
|
<BodyText>{children as string}</BodyText>
|
|
248
252
|
</Card>
|
|
249
253
|
</VariantTitle>
|
|
250
|
-
<VariantTitle title="Piggy
|
|
254
|
+
<VariantTitle title="Piggy - Emphasis">
|
|
251
255
|
<Card {...props} colorScheme="pig" variant="emphasis">
|
|
252
256
|
<BodyText>{children as string}</BodyText>
|
|
253
257
|
</Card>
|
|
254
258
|
</VariantTitle>
|
|
259
|
+
<VariantTitle title="Highlight - Subtle">
|
|
260
|
+
<Card {...props} colorScheme="highlight" variant="subtle">
|
|
261
|
+
<BodyText>{children as string}</BodyText>
|
|
262
|
+
</Card>
|
|
263
|
+
</VariantTitle>
|
|
264
|
+
<VariantTitle title="Highlight - Emphasis">
|
|
265
|
+
<Card {...props} colorScheme="highlight" variant="emphasis">
|
|
266
|
+
<BodyText>{children as string}</BodyText>
|
|
267
|
+
</Card>
|
|
268
|
+
</VariantTitle>
|
|
255
269
|
</Flex>
|
|
256
270
|
);
|
|
257
271
|
},
|
|
@@ -264,7 +278,7 @@ export const WithShadow: Story = {
|
|
|
264
278
|
parameters: {
|
|
265
279
|
controls: { exclude: ['variant'] },
|
|
266
280
|
},
|
|
267
|
-
render: ({ children, ...props }) => {
|
|
281
|
+
render: ({ children, ...props }: CardStoryProps) => {
|
|
268
282
|
return (
|
|
269
283
|
<Flex spacing="lg">
|
|
270
284
|
<VariantTitle title="Subtle - White - Shadow">
|
|
@@ -286,7 +300,7 @@ export const Interactive: Story = {
|
|
|
286
300
|
parameters: {
|
|
287
301
|
controls: { exclude: ['variant', 'colorScheme'] },
|
|
288
302
|
},
|
|
289
|
-
render: ({ children, ...props }) => {
|
|
303
|
+
render: ({ children, ...props }: CardStoryProps) => {
|
|
290
304
|
return (
|
|
291
305
|
<Flex spacing="lg">
|
|
292
306
|
<VariantTitle title="Pressable - Subtle - White">
|
|
@@ -164,6 +164,9 @@ const styles = StyleSheet.create(theme => ({
|
|
|
164
164
|
pig: {
|
|
165
165
|
borderWidth: theme.components.card.brand.borderWidth,
|
|
166
166
|
},
|
|
167
|
+
highlight: {
|
|
168
|
+
borderWidth: theme.components.card.brand.borderWidth,
|
|
169
|
+
},
|
|
167
170
|
},
|
|
168
171
|
shadowColor: {
|
|
169
172
|
functional: {
|
|
@@ -331,6 +334,22 @@ const styles = StyleSheet.create(theme => ({
|
|
|
331
334
|
borderColor: theme.color.border.strong,
|
|
332
335
|
},
|
|
333
336
|
},
|
|
337
|
+
{
|
|
338
|
+
variant: 'subtle',
|
|
339
|
+
colorScheme: 'highlight',
|
|
340
|
+
styles: {
|
|
341
|
+
backgroundColor: theme.color.surface.highlight.subtle,
|
|
342
|
+
borderColor: theme.color.border.strong,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
variant: 'emphasis',
|
|
347
|
+
colorScheme: 'highlight',
|
|
348
|
+
styles: {
|
|
349
|
+
backgroundColor: theme.color.surface.highlight.default,
|
|
350
|
+
borderColor: theme.color.border.strong,
|
|
351
|
+
},
|
|
352
|
+
},
|
|
334
353
|
],
|
|
335
354
|
},
|
|
336
355
|
}));
|
|
@@ -34,7 +34,7 @@ Icons are often used to enhance the usability and accessibility of digital produ
|
|
|
34
34
|
You can either use the React Native components directy from our `@utilitywarehouse/hearth-react-native-icons` package or use the `Icon`
|
|
35
35
|
component from our `@utilitywarehouse/hearth-react-native` package to render the icons with utility props such as `color`.
|
|
36
36
|
|
|
37
|
-
We
|
|
37
|
+
We recommend that you use the `Icon` component to ensure that the icons are styled correctly and consistently across your application.
|
|
38
38
|
The `Icon` component also provides additional functionality such as handling different color modes and sizes as well as automatically applying
|
|
39
39
|
light and dark mode colors from the theme.
|
|
40
40
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
EyeSmallIcon,
|
|
10
10
|
SearchMediumIcon,
|
|
11
11
|
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
12
|
-
import { useTheme } from '../../hooks';
|
|
12
|
+
import { useFormFieldAccessibility, useTheme } from '../../hooks';
|
|
13
13
|
import { BodyText } from '../BodyText';
|
|
14
14
|
import { FormField, useFormFieldContext } from '../FormField';
|
|
15
15
|
import { Spinner } from '../Spinner';
|
|
@@ -75,7 +75,7 @@ const Input = forwardRef<TextInput, InputProps>(
|
|
|
75
75
|
if (formFieldContext?.setShouldHandleAccessibility) {
|
|
76
76
|
formFieldContext.setShouldHandleAccessibility(true);
|
|
77
77
|
}
|
|
78
|
-
}, []);
|
|
78
|
+
}, [formFieldContext]);
|
|
79
79
|
|
|
80
80
|
const [fieldType, setFieldType] = useState<'password' | 'text'>(
|
|
81
81
|
type === 'password' ? 'password' : 'text'
|
|
@@ -88,6 +88,16 @@ const Input = forwardRef<TextInput, InputProps>(
|
|
|
88
88
|
|
|
89
89
|
const shouldShowPasswordToggle = type === 'password' && showPasswordToggle;
|
|
90
90
|
const shouldShowClear = clearable && !!(props as InputWithoutChildrenProps)?.value;
|
|
91
|
+
const { accessibilityHint, accessibilityLabel } = useFormFieldAccessibility({
|
|
92
|
+
label: inputLabel,
|
|
93
|
+
helperText: inputHelperText,
|
|
94
|
+
validText: inputValidText,
|
|
95
|
+
invalidText: inputInvalidText,
|
|
96
|
+
required: inputRequired,
|
|
97
|
+
validationStatus: inputValidationStatus,
|
|
98
|
+
fallbackLabel: props.accessibilityLabel,
|
|
99
|
+
fallbackHint: props.accessibilityHint,
|
|
100
|
+
});
|
|
91
101
|
|
|
92
102
|
const toggleFieldType = () => {
|
|
93
103
|
setFieldType(fieldType === 'password' ? 'text' : 'password');
|
|
@@ -107,37 +117,6 @@ const Input = forwardRef<TextInput, InputProps>(
|
|
|
107
117
|
return undefined;
|
|
108
118
|
})();
|
|
109
119
|
|
|
110
|
-
const getAccessibilityLabel = () => {
|
|
111
|
-
let accessibilityLabel = '';
|
|
112
|
-
if (inputLabel) {
|
|
113
|
-
accessibilityLabel = accessibilityLabel + inputLabel;
|
|
114
|
-
}
|
|
115
|
-
if (inputRequired) {
|
|
116
|
-
accessibilityLabel = accessibilityLabel + ', required';
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return accessibilityLabel || props.accessibilityLabel;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const getAccessibilityHint = () => {
|
|
123
|
-
let accessibilityHint = '';
|
|
124
|
-
if (inputHelperText) {
|
|
125
|
-
accessibilityHint = accessibilityHint + inputHelperText;
|
|
126
|
-
}
|
|
127
|
-
if (inputValidationStatus !== 'initial') {
|
|
128
|
-
if (accessibilityHint.length > 0) {
|
|
129
|
-
accessibilityHint = accessibilityHint + ', ';
|
|
130
|
-
}
|
|
131
|
-
if (inputValidationStatus === 'invalid' && inputInvalidText) {
|
|
132
|
-
accessibilityHint = accessibilityHint + inputInvalidText;
|
|
133
|
-
}
|
|
134
|
-
if (inputValidationStatus === 'valid' && inputValidText) {
|
|
135
|
-
accessibilityHint = accessibilityHint + inputValidText;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return accessibilityHint || props.accessibilityHint;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
120
|
return (
|
|
142
121
|
<FormField
|
|
143
122
|
label={label}
|
|
@@ -188,8 +167,8 @@ const Input = forwardRef<TextInput, InputProps>(
|
|
|
188
167
|
inputMode={getInputMode}
|
|
189
168
|
inBottomSheet={inBottomSheet}
|
|
190
169
|
{...props}
|
|
191
|
-
aria-label={
|
|
192
|
-
accessibilityHint={
|
|
170
|
+
aria-label={accessibilityLabel}
|
|
171
|
+
accessibilityHint={accessibilityHint}
|
|
193
172
|
/>
|
|
194
173
|
{shouldShowClear && (
|
|
195
174
|
<InputSlot>
|
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
import { BackToTopButton, BadgeList, UsageWrap, ViewFigmaButton } from '../../../docs/components';
|
|
33
33
|
import * as Stories from './List.stories';
|
|
34
34
|
|
|
35
|
+
import StorybookLink from '../../../../../shared/storybook/StorybookLink';
|
|
36
|
+
|
|
35
37
|
<Meta title="Components / List" />
|
|
36
38
|
|
|
37
39
|
<ViewFigmaButton url="https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components-%26-Tokens?node-id=1-163" />
|
|
@@ -146,11 +148,11 @@ are ignored, so conditional list items will not affect which item loses the top
|
|
|
146
148
|
|
|
147
149
|
#### - `ListItemHeading`
|
|
148
150
|
|
|
149
|
-
Has all props of the
|
|
151
|
+
Has all props of the <StorybookLink to="typography-body-text">`BodyText` component</StorybookLink>.
|
|
150
152
|
|
|
151
153
|
#### - `ListItemHelperText`
|
|
152
154
|
|
|
153
|
-
Has all props of the
|
|
155
|
+
Has all props of the <StorybookLink to="typography-body-text">`BodyText` component</StorybookLink>.
|
|
154
156
|
|
|
155
157
|
#### - `ListItemTrailingContent`
|
|
156
158
|
|