@nypl/design-system-react-components 0.25.13 → 0.27.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/CHANGELOG.md +85 -0
- package/README.md +10 -10
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +11 -9
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -4
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -6
- package/dist/components/Fieldset/Fieldset.d.ts +5 -6
- package/dist/components/Form/Form.d.ts +6 -6
- package/dist/components/Grid/GridTypes.d.ts +7 -7
- package/dist/components/Grid/SimpleGrid.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
- package/dist/components/Hero/Hero.d.ts +2 -1
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
- package/dist/components/Icons/Icon.d.ts +2 -1
- package/dist/components/Image/Image.d.ts +2 -2
- package/dist/components/Label/Label.d.ts +7 -4
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +11 -11
- package/dist/components/List/ListTypes.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts +2 -1
- package/dist/components/Logo/LogoSvgs.d.ts +2 -0
- package/dist/components/Logo/LogoTypes.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +4 -4
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +4 -6
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -6
- package/dist/components/SearchBar/SearchBar.d.ts +4 -4
- package/dist/components/Select/Select.d.ts +10 -6
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
- package/dist/components/Slider/Slider.d.ts +6 -4
- package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +4 -3
- package/dist/components/Template/Template.d.ts +4 -3
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +5 -5
- package/dist/components/Toggle/Toggle.d.ts +3 -4
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +1767 -1180
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +1774 -1188
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/hooks/useCarouselStyles.d.ts +3 -2
- package/dist/hooks/useNYPLTheme.d.ts +12 -0
- package/dist/index.d.ts +5 -2
- package/dist/styles.css +1 -1
- package/dist/theme/components/button.d.ts +10 -2
- package/dist/theme/components/card.d.ts +42 -22
- package/dist/theme/components/checkbox.d.ts +5 -4
- package/dist/theme/components/checkboxGroup.d.ts +1 -1
- package/dist/theme/components/componentWrapper.d.ts +2 -2
- package/dist/theme/components/customTable.d.ts +84 -1
- package/dist/theme/components/fieldset.d.ts +4 -14
- package/dist/theme/components/global.d.ts +23 -17
- package/dist/theme/components/heading.d.ts +53 -0
- package/dist/theme/components/helperErrorText.d.ts +1 -0
- package/dist/theme/components/hero.d.ts +20 -14
- package/dist/theme/components/label.d.ts +9 -10
- package/dist/theme/components/list.d.ts +99 -9
- package/dist/theme/components/radio.d.ts +6 -4
- package/dist/theme/components/radioGroup.d.ts +1 -1
- package/dist/theme/components/select.d.ts +28 -5
- package/dist/theme/components/skeletonLoader.d.ts +2 -2
- package/dist/theme/components/slider.d.ts +6 -3
- package/dist/theme/components/structuredContent.d.ts +197 -0
- package/dist/theme/components/textInput.d.ts +18 -6
- package/dist/theme/components/toggle.d.ts +7 -4
- package/dist/theme/foundations/global.d.ts +2 -0
- package/dist/theme/foundations/radii.d.ts +1 -0
- package/dist/theme/foundations/spacing.d.ts +46 -43
- package/package.json +17 -19
- package/src/components/Accordion/Accordion.stories.mdx +9 -9
- package/src/components/Accordion/Accordion.test.tsx +21 -0
- package/src/components/Accordion/Accordion.tsx +13 -9
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +276 -27
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -5
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +52 -31
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +8 -7
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
- package/src/components/Button/Button.stories.mdx +87 -23
- package/src/components/Button/Button.test.tsx +25 -0
- package/src/components/Button/Button.tsx +18 -7
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
- package/src/components/Card/Card.stories.mdx +287 -194
- package/src/components/Card/Card.test.tsx +102 -0
- package/src/components/Card/Card.tsx +73 -32
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +196 -36
- package/src/components/Chakra/Grid.stories.mdx +4 -4
- package/src/components/Checkbox/Checkbox.stories.mdx +62 -10
- package/src/components/Checkbox/Checkbox.test.tsx +32 -9
- package/src/components/Checkbox/Checkbox.tsx +20 -15
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +134 -7
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +65 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +137 -81
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +31 -21
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +332 -97
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
- package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
- package/src/components/DatePicker/DatePicker.test.tsx +89 -13
- package/src/components/DatePicker/DatePicker.tsx +62 -56
- package/src/components/DatePicker/_DatePicker.scss +71 -13
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
- package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
- package/src/components/Fieldset/Fieldset.test.tsx +58 -28
- package/src/components/Fieldset/Fieldset.tsx +35 -30
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
- package/src/components/Form/Form.stories.mdx +72 -39
- package/src/components/Form/Form.test.tsx +58 -15
- package/src/components/Form/Form.tsx +89 -67
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
- package/src/components/Grid/GridTypes.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +34 -6
- package/src/components/Grid/SimpleGrid.test.tsx +9 -0
- package/src/components/Grid/SimpleGrid.tsx +29 -20
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
- package/src/components/Heading/Heading.stories.mdx +36 -3
- package/src/components/Heading/Heading.test.tsx +10 -0
- package/src/components/Heading/Heading.tsx +56 -50
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +26 -7
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
- package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
- package/src/components/Hero/Hero.stories.mdx +125 -95
- package/src/components/Hero/Hero.test.tsx +33 -0
- package/src/components/Hero/Hero.tsx +135 -126
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -19
- package/src/components/HorizontalRule/HorizontalRule.tsx +9 -26
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
- package/src/components/Icons/Icon.stories.mdx +31 -6
- package/src/components/Icons/Icon.test.tsx +38 -0
- package/src/components/Icons/Icon.tsx +93 -76
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
- package/src/components/Image/Image.stories.mdx +29 -5
- package/src/components/Image/Image.test.tsx +8 -0
- package/src/components/Image/Image.tsx +38 -26
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
- package/src/components/Label/Label.stories.mdx +42 -20
- package/src/components/Label/Label.test.tsx +42 -17
- package/src/components/Label/Label.tsx +22 -13
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
- package/src/components/Link/Link.stories.mdx +25 -15
- package/src/components/Link/Link.test.tsx +21 -22
- package/src/components/Link/Link.tsx +8 -8
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
- package/src/components/List/List.stories.mdx +75 -40
- package/src/components/List/List.test.tsx +67 -19
- package/src/components/List/List.tsx +38 -25
- package/src/components/List/ListTypes.tsx +1 -1
- package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
- package/src/components/Logo/Logo.stories.mdx +30 -6
- package/src/components/Logo/Logo.test.tsx +17 -0
- package/src/components/Logo/Logo.tsx +18 -6
- package/src/components/Logo/LogoSvgs.tsx +4 -0
- package/src/components/Logo/LogoTypes.tsx +2 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
- package/src/components/Modal/Modal.stories.mdx +256 -136
- package/src/components/Modal/Modal.test.tsx +151 -9
- package/src/components/Modal/Modal.tsx +140 -20
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
- package/src/components/Notification/Notification.stories.mdx +25 -1
- package/src/components/Notification/Notification.test.tsx +23 -0
- package/src/components/Notification/Notification.tsx +46 -44
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
- package/src/components/Pagination/Pagination.stories.mdx +25 -6
- package/src/components/Pagination/Pagination.test.tsx +25 -0
- package/src/components/Pagination/Pagination.tsx +6 -6
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
- package/src/components/Placeholder/Placeholder.tsx +3 -1
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +81 -11
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -9
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
- package/src/components/Radio/Radio.stories.mdx +64 -12
- package/src/components/Radio/Radio.test.tsx +28 -8
- package/src/components/Radio/Radio.tsx +66 -63
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +103 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +224 -89
- package/src/components/RadioGroup/RadioGroup.test.tsx +122 -62
- package/src/components/RadioGroup/RadioGroup.tsx +106 -100
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1020
- package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
- package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
- package/src/components/SearchBar/SearchBar.tsx +17 -8
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
- package/src/components/Select/Select.stories.mdx +128 -49
- package/src/components/Select/Select.test.tsx +63 -16
- package/src/components/Select/Select.tsx +131 -92
- package/src/components/Select/SelectTypes.tsx +5 -0
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +765 -425
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +42 -10
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +8 -0
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +76 -72
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
- package/src/components/Slider/Slider.stories.mdx +91 -42
- package/src/components/Slider/Slider.test.tsx +65 -17
- package/src/components/Slider/Slider.tsx +26 -19
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
- package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
- package/src/components/StatusBadge/StatusBadge.test.tsx +16 -0
- package/src/components/StatusBadge/StatusBadge.tsx +25 -20
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
- package/src/components/StructuredContent/StructuredContent.stories.mdx +131 -12
- package/src/components/StructuredContent/StructuredContent.test.tsx +34 -0
- package/src/components/StructuredContent/StructuredContent.tsx +80 -75
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
- package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
- package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
- package/src/components/StyleGuide/ColorCard.tsx +1 -1
- package/src/components/StyleGuide/Colors.stories.mdx +1 -2
- package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
- package/src/components/StyleGuide/Forms.stories.mdx +27 -12
- package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
- package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
- package/src/components/StyleGuide/Typography.stories.mdx +30 -21
- package/src/components/Table/Table.stories.mdx +38 -11
- package/src/components/Table/Table.test.tsx +15 -0
- package/src/components/Table/Table.tsx +7 -7
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
- package/src/components/Tabs/Tabs.stories.mdx +52 -3
- package/src/components/Tabs/Tabs.test.tsx +16 -0
- package/src/components/Tabs/Tabs.tsx +10 -6
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
- package/src/components/Template/Template.stories.mdx +47 -43
- package/src/components/Template/Template.test.tsx +33 -0
- package/src/components/Template/Template.tsx +65 -60
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +191 -20
- package/src/components/Text/Text.stories.mdx +20 -1
- package/src/components/Text/Text.test.tsx +12 -0
- package/src/components/Text/Text.tsx +6 -4
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
- package/src/components/TextInput/TextInput.stories.mdx +65 -19
- package/src/components/TextInput/TextInput.test.tsx +42 -28
- package/src/components/TextInput/TextInput.tsx +121 -113
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
- package/src/components/Toggle/Toggle.stories.mdx +80 -22
- package/src/components/Toggle/Toggle.test.tsx +27 -9
- package/src/components/Toggle/Toggle.tsx +22 -18
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +128 -5
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +23 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +133 -126
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
- package/src/docs/Chakra.stories.mdx +50 -9
- package/src/docs/Welcome.stories.mdx +160 -41
- package/src/hooks/useCarouselStyles.stories.mdx +22 -2
- package/src/hooks/useCarouselStyles.ts +3 -2
- package/src/hooks/useNYPLTheme.stories.mdx +101 -0
- package/src/hooks/useNYPLTheme.ts +30 -6
- package/src/hooks/useWindowSize.stories.mdx +23 -0
- package/src/index.ts +5 -2
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles.scss +0 -1
- package/src/theme/components/button.ts +15 -7
- package/src/theme/components/card.ts +30 -19
- package/src/theme/components/checkbox.ts +10 -8
- package/src/theme/components/checkboxGroup.ts +1 -1
- package/src/theme/components/componentWrapper.ts +2 -2
- package/src/theme/components/customTable.ts +39 -31
- package/src/theme/components/fieldset.ts +1 -2
- package/src/theme/components/global.ts +25 -20
- package/src/theme/components/heading.ts +1 -1
- package/src/theme/components/helperErrorText.ts +1 -0
- package/src/theme/components/hero.ts +13 -15
- package/src/theme/components/label.ts +4 -3
- package/src/theme/components/list.ts +73 -66
- package/src/theme/components/notification.ts +2 -2
- package/src/theme/components/radio.ts +9 -9
- package/src/theme/components/radioGroup.ts +1 -1
- package/src/theme/components/select.ts +31 -22
- package/src/theme/components/skeletonLoader.ts +3 -3
- package/src/theme/components/slider.ts +8 -7
- package/src/theme/components/statusBadge.ts +2 -2
- package/src/theme/components/structuredContent.ts +66 -1
- package/src/theme/components/tabs.ts +2 -2
- package/src/theme/components/template.ts +9 -9
- package/src/theme/components/textInput.ts +13 -12
- package/src/theme/components/toggle.ts +17 -10
- package/src/theme/components/videoPlayer.ts +1 -1
- package/src/theme/foundations/colors.ts +1 -1
- package/src/theme/foundations/radii.ts +1 -0
- package/src/theme/foundations/spacing.ts +70 -22
- package/src/theme/foundations/typography.ts +2 -2
- package/src/utils/componentCategories.ts +1 -2
- package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
- package/dist/helpers/generateUUID.d.ts +0 -1
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/helpers/generateUUID.tsx +0 -5
|
@@ -47,10 +47,22 @@ import DSProvider from "../../theme/provider";
|
|
|
47
47
|
| Component Version | DS Version |
|
|
48
48
|
| ----------------- | ---------- |
|
|
49
49
|
| Added | `0.0.10` |
|
|
50
|
-
| Latest | `0.
|
|
50
|
+
| Latest | `0.26.0` |
|
|
51
|
+
|
|
52
|
+
## Table of Contents
|
|
53
|
+
|
|
54
|
+
- [Overview](#overview)
|
|
55
|
+
- [Component Props](#component-props)
|
|
56
|
+
- [Accessibility](#accessibility)
|
|
57
|
+
- [With HTML Children](#with-html-children)
|
|
58
|
+
- [Invalid State](#invalid-state)
|
|
59
|
+
|
|
60
|
+
## Overview
|
|
51
61
|
|
|
52
62
|
<Description of={HelperErrorText} />
|
|
53
63
|
|
|
64
|
+
## Component Props
|
|
65
|
+
|
|
54
66
|
<Canvas withToolbar>
|
|
55
67
|
<Story
|
|
56
68
|
name="HelperErrorText with Controls"
|
|
@@ -75,6 +87,54 @@ import DSProvider from "../../theme/provider";
|
|
|
75
87
|
|
|
76
88
|
<ArgsTable story="HelperErrorText with Controls" />
|
|
77
89
|
|
|
90
|
+
## Accessibility
|
|
91
|
+
|
|
92
|
+
In the "invalid" state when `isInvalid` is set to true, the text passed to the
|
|
93
|
+
`invalidText` prop will be presented to screen readers be default. If you need
|
|
94
|
+
to turn this off, set the `ariaLive` prop to `"off"`. This is used in DS "form"
|
|
95
|
+
components for invalid form submissions or incorrect values entered.
|
|
96
|
+
|
|
97
|
+
### ariaAtomic
|
|
98
|
+
|
|
99
|
+
The `ariaAtomic` prop sets the `aria-atomic` attribute and it is set to `true`
|
|
100
|
+
by default. This allows the entire DOM element to be presented to assistive
|
|
101
|
+
technologies. When it is set to `false`, only additionals or removals will be
|
|
102
|
+
read by assistive technologies.
|
|
103
|
+
|
|
104
|
+
### ariaLive
|
|
105
|
+
|
|
106
|
+
The `ariaLive` prop sets the `aria-live` attribute; `"polite"` is set by default
|
|
107
|
+
in the "invalid" state and `"off"` otherwise. This sets the priority of when the
|
|
108
|
+
text in this component should be read to users by assistive technologies. The
|
|
109
|
+
`"off"` value indicates that the content should not be presented, `"polite"` that
|
|
110
|
+
it will be announced at the next available time slot, and `"assertive"` that it
|
|
111
|
+
should be announced immediately.
|
|
112
|
+
|
|
113
|
+
<Canvas>
|
|
114
|
+
<Story
|
|
115
|
+
name="With Aria Controls"
|
|
116
|
+
args={{
|
|
117
|
+
ariaAtomic: true,
|
|
118
|
+
ariaLive: "polite",
|
|
119
|
+
isInvalid: true,
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
{(args) => (
|
|
123
|
+
<HelperErrorText
|
|
124
|
+
{...args}
|
|
125
|
+
text="Only invalid text can be read to screen readers with the appropriate aria-atomic and aria-live props."
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
</Story>
|
|
129
|
+
</Canvas>
|
|
130
|
+
|
|
131
|
+
Resources:
|
|
132
|
+
|
|
133
|
+
- [MDN ARIA live regions](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
|
|
134
|
+
- [W3C WAI-ARIA 1.1 - aria-live (property)](https://www.w3.org/TR/wai-aria-1.1/#aria-live)
|
|
135
|
+
- [W3C ARIA19: Using ARIA role=alert or Live Regions to Identify Errors](https://www.w3.org/TR/WCAG20-TECHS/ARIA19.html)
|
|
136
|
+
- [DigitalA11y WAI-ARIA:aria-live (Property)](https://www.digitala11y.com/aria-live-properties/)
|
|
137
|
+
|
|
78
138
|
## With HTML Children
|
|
79
139
|
|
|
80
140
|
The `HelperErrorText` component can render any React component or HTML element
|
|
@@ -93,8 +153,9 @@ through the `text` prop.
|
|
|
93
153
|
<HelperErrorText
|
|
94
154
|
text={
|
|
95
155
|
<Text>
|
|
96
|
-
This second example uses DS components, such
|
|
97
|
-
<Link href="#">`Link`</Link> component, and the `Text`
|
|
156
|
+
This second example uses Reservoir Design System (DS) components, such
|
|
157
|
+
as the <Link href="#">`Link`</Link> component, and the `Text`
|
|
158
|
+
component.
|
|
98
159
|
</Text>
|
|
99
160
|
}
|
|
100
161
|
/>
|
|
@@ -111,42 +172,3 @@ NYPL "invalid" styling.
|
|
|
111
172
|
<HelperErrorText isInvalid text="This is the error text :(" />
|
|
112
173
|
</Story>
|
|
113
174
|
</Canvas>
|
|
114
|
-
|
|
115
|
-
## With Aria Props
|
|
116
|
-
|
|
117
|
-
In the "invalid" state when `isInvalid` is set to true, the rendered text can be
|
|
118
|
-
presented to screen readers if `ariaAtomic` and `ariaLive` are set appropriately.
|
|
119
|
-
|
|
120
|
-
### ariaAtomic
|
|
121
|
-
|
|
122
|
-
The `ariaAtomic` prop sets the `aria-atomic` attribute; `true` by default. This
|
|
123
|
-
allows the entire DOM element to be presented to assistive technologies. When it
|
|
124
|
-
is set to `false`, only additionals or removals will be read by assistive
|
|
125
|
-
technologies.
|
|
126
|
-
|
|
127
|
-
### ariaLive
|
|
128
|
-
|
|
129
|
-
The `ariaLive` prop sets the `aria-live` attribute; `polite` by default in the
|
|
130
|
-
"invalid" state and `off` otherwise. This sets the priority of when the text in
|
|
131
|
-
this component should be read to users by assistive technologies. The `off` value
|
|
132
|
-
indicates that the content should not be presented, `polite` that it will be
|
|
133
|
-
announced at the next available time slot, and `assertive` that it should be
|
|
134
|
-
announced immediately.
|
|
135
|
-
|
|
136
|
-
<Canvas>
|
|
137
|
-
<Story
|
|
138
|
-
name="With Aria Controls"
|
|
139
|
-
args={{
|
|
140
|
-
ariaAtomic: true,
|
|
141
|
-
ariaLive: "polite",
|
|
142
|
-
isInvalid: true,
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
{(args) => (
|
|
146
|
-
<HelperErrorText
|
|
147
|
-
{...args}
|
|
148
|
-
text="Only invalid text can be read to screen readers with the appropriate aria-atomic and aria-live props."
|
|
149
|
-
/>
|
|
150
|
-
)}
|
|
151
|
-
</Story>
|
|
152
|
-
</Canvas>
|
|
@@ -90,10 +90,25 @@ describe("HelperErrorText", () => {
|
|
|
90
90
|
/>
|
|
91
91
|
)
|
|
92
92
|
.toJSON();
|
|
93
|
+
const withChakraProps = renderer
|
|
94
|
+
.create(
|
|
95
|
+
<HelperErrorText
|
|
96
|
+
id="chakra"
|
|
97
|
+
text="Text"
|
|
98
|
+
p="20px"
|
|
99
|
+
color="ui.red.primary"
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
.toJSON();
|
|
103
|
+
const withOtherProps = renderer
|
|
104
|
+
.create(<HelperErrorText id="props" text="Text" data-testid="props" />)
|
|
105
|
+
.toJSON();
|
|
93
106
|
|
|
94
107
|
expect(basic).toMatchSnapshot();
|
|
95
108
|
expect(invalid).toMatchSnapshot();
|
|
96
109
|
expect(withHTMLString).toMatchSnapshot();
|
|
97
110
|
expect(withHTMLElement).toMatchSnapshot();
|
|
111
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
112
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
98
113
|
});
|
|
99
114
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import { Box, useStyleConfig } from "@chakra-ui/react";
|
|
3
|
-
|
|
4
|
-
import generateUUID from "../../helpers/generateUUID";
|
|
5
3
|
|
|
6
4
|
export type AriaLiveValues = "assertive" | "off" | "polite";
|
|
7
5
|
export type HelperErrorTextType = string | JSX.Element;
|
|
@@ -13,11 +11,12 @@ interface HelperErrorTextProps {
|
|
|
13
11
|
* read the entire DOM element. When false, only changes (additionals or
|
|
14
12
|
* removals) will be read. True by default. */
|
|
15
13
|
ariaAtomic?: boolean;
|
|
16
|
-
/** Aria attribute
|
|
17
|
-
* indicates the priority of the text and when it should be presented to
|
|
18
|
-
* using screen readers; "off" indicates that the content should not be
|
|
19
|
-
* "polite" that it will be announced at the next available time
|
|
20
|
-
* "assertive" that it should be announced immediately.
|
|
14
|
+
/** Aria attribute used in the invalid state to read error text by default.
|
|
15
|
+
* This indicates the priority of the text and when it should be presented to
|
|
16
|
+
* users using screen readers; "off" indicates that the content should not be
|
|
17
|
+
* presented, "polite" that it will be announced at the next available time
|
|
18
|
+
* slot, and "assertive" that it should be announced immediately. This is set
|
|
19
|
+
* to "off" by default and to "polite" by when `isInvalid` is true. */
|
|
21
20
|
ariaLive?: AriaLiveValues;
|
|
22
21
|
/** Additional className to add. */
|
|
23
22
|
className?: string;
|
|
@@ -30,32 +29,38 @@ interface HelperErrorTextProps {
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
|
-
* Helper or
|
|
32
|
+
* Helper or error text for forms components.
|
|
34
33
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
isInvalid = false,
|
|
42
|
-
text,
|
|
43
|
-
}: HelperErrorTextProps) {
|
|
44
|
-
// Only announce the text in the invalid state.
|
|
45
|
-
const announceAriaLive = isInvalid;
|
|
46
|
-
const styles = useStyleConfig("HelperErrorText", { isInvalid });
|
|
47
|
-
const finalStyles = { ...styles, ...additionalStyles };
|
|
48
|
-
const props = {
|
|
49
|
-
"aria-atomic": ariaAtomic,
|
|
50
|
-
"aria-live": announceAriaLive ? ariaLive : "off",
|
|
51
|
-
className,
|
|
52
|
-
"data-isinvalid": isInvalid,
|
|
34
|
+
export const HelperErrorText = chakra(
|
|
35
|
+
({
|
|
36
|
+
additionalStyles = {},
|
|
37
|
+
ariaAtomic = true,
|
|
38
|
+
ariaLive = "polite",
|
|
39
|
+
className = "",
|
|
53
40
|
id,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
41
|
+
isInvalid = false,
|
|
42
|
+
text,
|
|
43
|
+
...rest
|
|
44
|
+
}: HelperErrorTextProps) => {
|
|
45
|
+
// Only announce the text in the invalid state.
|
|
46
|
+
const announceAriaLive = isInvalid;
|
|
47
|
+
const styles = useStyleConfig("HelperErrorText", { isInvalid });
|
|
48
|
+
const finalStyles = { ...styles, ...additionalStyles };
|
|
49
|
+
const props = {
|
|
50
|
+
"aria-atomic": ariaAtomic,
|
|
51
|
+
"aria-live": announceAriaLive ? ariaLive : "off",
|
|
52
|
+
className,
|
|
53
|
+
"data-isinvalid": isInvalid,
|
|
54
|
+
id,
|
|
55
|
+
__css: finalStyles,
|
|
56
|
+
...rest,
|
|
57
|
+
};
|
|
58
|
+
return typeof text === "string" ? (
|
|
59
|
+
<Box {...props} dangerouslySetInnerHTML={{ __html: text }} />
|
|
60
|
+
) : (
|
|
61
|
+
<Box {...props}>{text}</Box>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export default HelperErrorText;
|
|
@@ -4,7 +4,7 @@ exports[`HelperErrorText Renders the UI snapshot correctly 1`] = `
|
|
|
4
4
|
<div
|
|
5
5
|
aria-atomic={true}
|
|
6
6
|
aria-live="off"
|
|
7
|
-
className="
|
|
7
|
+
className="css-1xdhyk6"
|
|
8
8
|
dangerouslySetInnerHTML={
|
|
9
9
|
Object {
|
|
10
10
|
"__html": "Text",
|
|
@@ -19,7 +19,7 @@ exports[`HelperErrorText Renders the UI snapshot correctly 2`] = `
|
|
|
19
19
|
<div
|
|
20
20
|
aria-atomic={true}
|
|
21
21
|
aria-live="polite"
|
|
22
|
-
className="
|
|
22
|
+
className="css-1xdhyk6"
|
|
23
23
|
dangerouslySetInnerHTML={
|
|
24
24
|
Object {
|
|
25
25
|
"__html": "Text",
|
|
@@ -34,7 +34,7 @@ exports[`HelperErrorText Renders the UI snapshot correctly 3`] = `
|
|
|
34
34
|
<div
|
|
35
35
|
aria-atomic={true}
|
|
36
36
|
aria-live="polite"
|
|
37
|
-
className="
|
|
37
|
+
className="css-1xdhyk6"
|
|
38
38
|
dangerouslySetInnerHTML={
|
|
39
39
|
Object {
|
|
40
40
|
"__html": "This helper text <b>contains HTML in the string</b>.",
|
|
@@ -49,7 +49,7 @@ exports[`HelperErrorText Renders the UI snapshot correctly 4`] = `
|
|
|
49
49
|
<div
|
|
50
50
|
aria-atomic={true}
|
|
51
51
|
aria-live="polite"
|
|
52
|
-
className="
|
|
52
|
+
className="css-1xdhyk6"
|
|
53
53
|
data-isinvalid={true}
|
|
54
54
|
id="invalid"
|
|
55
55
|
>
|
|
@@ -60,3 +60,34 @@ exports[`HelperErrorText Renders the UI snapshot correctly 4`] = `
|
|
|
60
60
|
.
|
|
61
61
|
</div>
|
|
62
62
|
`;
|
|
63
|
+
|
|
64
|
+
exports[`HelperErrorText Renders the UI snapshot correctly 5`] = `
|
|
65
|
+
<div
|
|
66
|
+
aria-atomic={true}
|
|
67
|
+
aria-live="off"
|
|
68
|
+
className="css-10g9ftz"
|
|
69
|
+
dangerouslySetInnerHTML={
|
|
70
|
+
Object {
|
|
71
|
+
"__html": "Text",
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
data-isinvalid={false}
|
|
75
|
+
id="chakra"
|
|
76
|
+
/>
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
exports[`HelperErrorText Renders the UI snapshot correctly 6`] = `
|
|
80
|
+
<div
|
|
81
|
+
aria-atomic={true}
|
|
82
|
+
aria-live="off"
|
|
83
|
+
className="css-1xdhyk6"
|
|
84
|
+
dangerouslySetInnerHTML={
|
|
85
|
+
Object {
|
|
86
|
+
"__html": "Text",
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
data-isinvalid={false}
|
|
90
|
+
data-testid="props"
|
|
91
|
+
id="props"
|
|
92
|
+
/>
|
|
93
|
+
`;
|
|
@@ -63,7 +63,17 @@ const imageSrc = "https://placeimg.com/800/400/animals";
|
|
|
63
63
|
| Component Version | DS Version |
|
|
64
64
|
| ----------------- | ---------- |
|
|
65
65
|
| Added | `0.2.0` |
|
|
66
|
-
| Latest | `0.
|
|
66
|
+
| Latest | `0.26.0` |
|
|
67
|
+
|
|
68
|
+
## Table of Contents
|
|
69
|
+
|
|
70
|
+
- [Overview](#overview)
|
|
71
|
+
- [Component Props](#component-props)
|
|
72
|
+
- [Accessibility](#accessibility)
|
|
73
|
+
- [All Variations](#all-variations)
|
|
74
|
+
- [Color Variations for Secondary Hero](#color-variations-for-secondary-hero)
|
|
75
|
+
|
|
76
|
+
## Overview
|
|
67
77
|
|
|
68
78
|
<Description of={Hero} />
|
|
69
79
|
|
|
@@ -71,6 +81,8 @@ The `Hero` component is used to display a full width banner at the top of a page
|
|
|
71
81
|
The `Hero` will contain a required `h1` page title and may also include optional
|
|
72
82
|
descriptive text and images.
|
|
73
83
|
|
|
84
|
+
## Component Props
|
|
85
|
+
|
|
74
86
|
<Canvas withToolbar>
|
|
75
87
|
<Story
|
|
76
88
|
name="Hero with Controls"
|
|
@@ -150,101 +162,12 @@ descriptive text and images.
|
|
|
150
162
|
|
|
151
163
|
<ArgsTable story="Hero with Controls" />
|
|
152
164
|
|
|
153
|
-
##
|
|
154
|
-
|
|
155
|
-
The background color for the title bar in "Secondary" types changes based on
|
|
156
|
-
variants for the `Secondary` main variant. Before, components relied on the
|
|
157
|
-
parent wrapper's CSS class name for background color updates. Now, the proper
|
|
158
|
-
`HeroType` must be passed in.
|
|
165
|
+
## Accessibility
|
|
159
166
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
// Now
|
|
167
|
-
<Hero heroType={HeroTypes.SecondaryBooksAndMore} {...props} />
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
<Canvas>
|
|
171
|
-
<Story name="Color Variations for Secondary Hero">
|
|
172
|
-
<VStack spacing={10} align="stretch">
|
|
173
|
-
<Heading
|
|
174
|
-
id="books-heading"
|
|
175
|
-
level={HeadingLevels.Two}
|
|
176
|
-
text="HeroTypes.SecondaryBooksAndMore"
|
|
177
|
-
/>
|
|
178
|
-
<Hero
|
|
179
|
-
heading={
|
|
180
|
-
<Heading
|
|
181
|
-
level={HeadingLevels.One}
|
|
182
|
-
id="books-hero"
|
|
183
|
-
text="Books and More"
|
|
184
|
-
/>
|
|
185
|
-
}
|
|
186
|
-
heroType={HeroTypes.SecondaryBooksAndMore}
|
|
187
|
-
imageAlt={imageAlt}
|
|
188
|
-
imageSrc={imageSrc}
|
|
189
|
-
subHeaderText={secondarySubHeaderText}
|
|
190
|
-
/>
|
|
191
|
-
<Heading
|
|
192
|
-
id="location-heading"
|
|
193
|
-
level={HeadingLevels.Two}
|
|
194
|
-
text="HeroTypes.SecondaryLocations"
|
|
195
|
-
/>
|
|
196
|
-
<Hero
|
|
197
|
-
heading={
|
|
198
|
-
<Heading
|
|
199
|
-
level={HeadingLevels.One}
|
|
200
|
-
id="locations-hero"
|
|
201
|
-
text="Locations"
|
|
202
|
-
/>
|
|
203
|
-
}
|
|
204
|
-
heroType={HeroTypes.SecondaryLocations}
|
|
205
|
-
imageAlt={imageAlt}
|
|
206
|
-
imageSrc={imageSrc}
|
|
207
|
-
subHeaderText={secondarySubHeaderText}
|
|
208
|
-
/>
|
|
209
|
-
<Heading
|
|
210
|
-
id="research-heading"
|
|
211
|
-
level={HeadingLevels.Two}
|
|
212
|
-
text="HeroTypes.SecondaryResearch"
|
|
213
|
-
/>
|
|
214
|
-
<Hero
|
|
215
|
-
heading={
|
|
216
|
-
<Heading
|
|
217
|
-
level={HeadingLevels.One}
|
|
218
|
-
id="research-hero"
|
|
219
|
-
text="Research"
|
|
220
|
-
/>
|
|
221
|
-
}
|
|
222
|
-
heroType={HeroTypes.SecondaryResearch}
|
|
223
|
-
imageAlt={imageAlt}
|
|
224
|
-
imageSrc={imageSrc}
|
|
225
|
-
subHeaderText={secondarySubHeaderText}
|
|
226
|
-
/>
|
|
227
|
-
<Heading
|
|
228
|
-
id="whats-on-heading"
|
|
229
|
-
level={HeadingLevels.Two}
|
|
230
|
-
text="HeroTypes.SecondaryWhatsOn"
|
|
231
|
-
/>
|
|
232
|
-
<Hero
|
|
233
|
-
heading={
|
|
234
|
-
<Heading
|
|
235
|
-
level={HeadingLevels.One}
|
|
236
|
-
id="whats-on-hero"
|
|
237
|
-
text="What's On"
|
|
238
|
-
/>
|
|
239
|
-
}
|
|
240
|
-
heroType={HeroTypes.SecondaryWhatsOn}
|
|
241
|
-
imageAlt={imageAlt}
|
|
242
|
-
imageSrc={imageSrc}
|
|
243
|
-
subHeaderText={secondarySubHeaderText}
|
|
244
|
-
/>
|
|
245
|
-
</VStack>
|
|
246
|
-
</Story>
|
|
247
|
-
</Canvas>
|
|
167
|
+
The `Hero` component is commonly used as a banner below the page's header and
|
|
168
|
+
breadcrumbs and above the main content. This means that if the `Hero` displays
|
|
169
|
+
a heading element, it should be the first on the page and an `h1` element set
|
|
170
|
+
through `Heading`'s `level={HeadingLevels.One}`.
|
|
248
171
|
|
|
249
172
|
## All Variations
|
|
250
173
|
|
|
@@ -343,3 +266,110 @@ parent wrapper's CSS class name for background color updates. Now, the proper
|
|
|
343
266
|
</VStack>
|
|
344
267
|
</DSProvider>
|
|
345
268
|
</Canvas>
|
|
269
|
+
|
|
270
|
+
## Color Variations for Secondary Hero
|
|
271
|
+
|
|
272
|
+
The background color for the title bar in the "Secondary" `Hero` changes based
|
|
273
|
+
on the `HeroTypes` variants for the `Secondary` main variant.
|
|
274
|
+
|
|
275
|
+
```jsx
|
|
276
|
+
// Example `HeroTypes` "Secondary" variant.
|
|
277
|
+
<Hero heroType={HeroTypes.SecondaryBooksAndMore} {...props} />
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
<Canvas>
|
|
281
|
+
<Story name="Color Variations for Secondary Hero">
|
|
282
|
+
<VStack spacing={10} align="stretch">
|
|
283
|
+
<Heading
|
|
284
|
+
id="main-secondary-heading"
|
|
285
|
+
level={HeadingLevels.Two}
|
|
286
|
+
text="HeroTypes.Secondary"
|
|
287
|
+
/>
|
|
288
|
+
<Hero
|
|
289
|
+
heading={
|
|
290
|
+
<Heading
|
|
291
|
+
level={HeadingLevels.One}
|
|
292
|
+
id="main-secondary-hero"
|
|
293
|
+
text="Secondary"
|
|
294
|
+
/>
|
|
295
|
+
}
|
|
296
|
+
heroType={HeroTypes.Secondary}
|
|
297
|
+
imageAlt={imageAlt}
|
|
298
|
+
imageSrc={imageSrc}
|
|
299
|
+
subHeaderText={secondarySubHeaderText}
|
|
300
|
+
/>
|
|
301
|
+
<Heading
|
|
302
|
+
id="books-heading"
|
|
303
|
+
level={HeadingLevels.Two}
|
|
304
|
+
text="HeroTypes.SecondaryBooksAndMore"
|
|
305
|
+
/>
|
|
306
|
+
<Hero
|
|
307
|
+
heading={
|
|
308
|
+
<Heading
|
|
309
|
+
level={HeadingLevels.One}
|
|
310
|
+
id="books-hero"
|
|
311
|
+
text="Books and More"
|
|
312
|
+
/>
|
|
313
|
+
}
|
|
314
|
+
heroType={HeroTypes.SecondaryBooksAndMore}
|
|
315
|
+
imageAlt={imageAlt}
|
|
316
|
+
imageSrc={imageSrc}
|
|
317
|
+
subHeaderText={secondarySubHeaderText}
|
|
318
|
+
/>
|
|
319
|
+
<Heading
|
|
320
|
+
id="location-heading"
|
|
321
|
+
level={HeadingLevels.Two}
|
|
322
|
+
text="HeroTypes.SecondaryLocations"
|
|
323
|
+
/>
|
|
324
|
+
<Hero
|
|
325
|
+
heading={
|
|
326
|
+
<Heading
|
|
327
|
+
level={HeadingLevels.One}
|
|
328
|
+
id="locations-hero"
|
|
329
|
+
text="Locations"
|
|
330
|
+
/>
|
|
331
|
+
}
|
|
332
|
+
heroType={HeroTypes.SecondaryLocations}
|
|
333
|
+
imageAlt={imageAlt}
|
|
334
|
+
imageSrc={imageSrc}
|
|
335
|
+
subHeaderText={secondarySubHeaderText}
|
|
336
|
+
/>
|
|
337
|
+
<Heading
|
|
338
|
+
id="research-heading"
|
|
339
|
+
level={HeadingLevels.Two}
|
|
340
|
+
text="HeroTypes.SecondaryResearch"
|
|
341
|
+
/>
|
|
342
|
+
<Hero
|
|
343
|
+
heading={
|
|
344
|
+
<Heading
|
|
345
|
+
level={HeadingLevels.One}
|
|
346
|
+
id="research-hero"
|
|
347
|
+
text="Research"
|
|
348
|
+
/>
|
|
349
|
+
}
|
|
350
|
+
heroType={HeroTypes.SecondaryResearch}
|
|
351
|
+
imageAlt={imageAlt}
|
|
352
|
+
imageSrc={imageSrc}
|
|
353
|
+
subHeaderText={secondarySubHeaderText}
|
|
354
|
+
/>
|
|
355
|
+
<Heading
|
|
356
|
+
id="whats-on-heading"
|
|
357
|
+
level={HeadingLevels.Two}
|
|
358
|
+
text="HeroTypes.SecondaryWhatsOn"
|
|
359
|
+
/>
|
|
360
|
+
<Hero
|
|
361
|
+
heading={
|
|
362
|
+
<Heading
|
|
363
|
+
level={HeadingLevels.One}
|
|
364
|
+
id="whats-on-hero"
|
|
365
|
+
text="What's On"
|
|
366
|
+
/>
|
|
367
|
+
}
|
|
368
|
+
heroType={HeroTypes.SecondaryWhatsOn}
|
|
369
|
+
imageAlt={imageAlt}
|
|
370
|
+
imageSrc={imageSrc}
|
|
371
|
+
subHeaderText={secondarySubHeaderText}
|
|
372
|
+
/>
|
|
373
|
+
</VStack>
|
|
374
|
+
</Story>
|
|
375
|
+
</Canvas>
|
|
@@ -680,6 +680,37 @@ describe("Hero", () => {
|
|
|
680
680
|
/>
|
|
681
681
|
)
|
|
682
682
|
.toJSON();
|
|
683
|
+
const withChakraProps = renderer
|
|
684
|
+
.create(
|
|
685
|
+
<Hero
|
|
686
|
+
heroType={HeroTypes.Primary}
|
|
687
|
+
heading={
|
|
688
|
+
<Heading
|
|
689
|
+
level={HeadingLevels.One}
|
|
690
|
+
id="chakra"
|
|
691
|
+
text="Hero Primary"
|
|
692
|
+
/>
|
|
693
|
+
}
|
|
694
|
+
subHeaderText="Example Subtitle"
|
|
695
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
696
|
+
p="20px"
|
|
697
|
+
color="ui.error.primary"
|
|
698
|
+
/>
|
|
699
|
+
)
|
|
700
|
+
.toJSON();
|
|
701
|
+
const withOtherProps = renderer
|
|
702
|
+
.create(
|
|
703
|
+
<Hero
|
|
704
|
+
heroType={HeroTypes.Primary}
|
|
705
|
+
heading={
|
|
706
|
+
<Heading level={HeadingLevels.One} id="props" text="Hero Primary" />
|
|
707
|
+
}
|
|
708
|
+
subHeaderText="Example Subtitle"
|
|
709
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
710
|
+
data-testid="props"
|
|
711
|
+
/>
|
|
712
|
+
)
|
|
713
|
+
.toJSON();
|
|
683
714
|
|
|
684
715
|
expect(primary).toMatchSnapshot();
|
|
685
716
|
expect(secondary).toMatchSnapshot();
|
|
@@ -690,5 +721,7 @@ describe("Hero", () => {
|
|
|
690
721
|
expect(tertiary).toMatchSnapshot();
|
|
691
722
|
expect(campaign).toMatchSnapshot();
|
|
692
723
|
expect(fiftyFifty).toMatchSnapshot();
|
|
724
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
725
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
693
726
|
});
|
|
694
727
|
});
|