@nypl/design-system-react-components 0.26.1 → 1.0.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 +54 -0
- package/README.md +7 -7
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/dist/components/Button/Button.d.ts +2 -10
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +10 -8
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/SimpleGrid.d.ts +6 -3
- package/dist/components/Heading/Heading.d.ts +2 -5
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
- package/dist/components/Hero/Hero.d.ts +13 -9
- package/dist/components/Icons/Icon.d.ts +6 -5
- package/dist/components/Icons/IconSvgs.d.ts +21 -21
- package/dist/components/Image/Image.d.ts +8 -5
- package/dist/components/Link/Link.d.ts +1 -9
- package/dist/components/List/List.d.ts +7 -11
- package/dist/components/Logo/Logo.d.ts +2 -5
- package/dist/components/Logo/LogoSvgs.d.ts +39 -39
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +2 -5
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
- package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Template/Template.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +21 -9
- package/dist/components/Toggle/Toggle.d.ts +1 -5
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +983 -1222
- 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 +982 -1285
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/types.d.ts +1 -0
- package/dist/index.d.ts +27 -48
- package/dist/styles.css +1 -1
- package/dist/theme/components/buttonGroup.d.ts +11 -0
- package/dist/theme/components/card.d.ts +104 -8
- package/dist/theme/components/componentWrapper.d.ts +4 -3
- package/dist/theme/components/customTable.d.ts +11 -14
- package/dist/theme/components/fieldset.d.ts +4 -3
- package/dist/theme/components/helperErrorText.d.ts +4 -3
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/horizontalRule.d.ts +4 -3
- package/dist/theme/components/icon.d.ts +47743 -1
- package/dist/theme/components/image.d.ts +563 -10
- package/dist/theme/components/label.d.ts +4 -3
- package/dist/theme/components/list.d.ts +6 -7
- package/dist/theme/components/logo.d.ts +474 -1
- package/dist/theme/components/notification.d.ts +20 -16
- package/dist/theme/components/progressIndicator.d.ts +6 -4
- package/dist/theme/components/select.d.ts +4 -10
- package/dist/theme/components/skeletonLoader.d.ts +14 -10
- package/dist/theme/components/skipNavigation.d.ts +22 -0
- package/dist/theme/components/slider.d.ts +7 -6
- package/dist/theme/components/structuredContent.d.ts +10 -9
- package/dist/theme/components/text.d.ts +7 -1
- package/dist/theme/components/toggle.d.ts +6 -4
- package/dist/theme/provider.d.ts +2 -4
- package/dist/utils/componentCategories.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +5 -0
- package/dist/utils/utils.d.ts +2 -18
- package/package.json +15 -16
- package/src/__tests__/setup.ts +3 -3
- package/src/__tests__/utils/utils.test.ts +1 -23
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
- package/src/components/Accordion/Accordion.stories.mdx +43 -44
- package/src/components/Accordion/Accordion.test.tsx +5 -13
- package/src/components/Accordion/Accordion.tsx +14 -18
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
- package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
- package/src/components/Button/Button.stories.mdx +89 -126
- package/src/components/Button/Button.test.tsx +16 -30
- package/src/components/Button/Button.tsx +14 -20
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
- package/src/components/Card/Card.stories.mdx +144 -178
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Chakra/Box.stories.mdx +3 -7
- package/src/components/Chakra/Center.stories.mdx +6 -24
- package/src/components/Chakra/Flex.stories.mdx +5 -7
- package/src/components/Chakra/Grid.stories.mdx +1 -1
- package/src/components/Chakra/Stack.stories.mdx +10 -11
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +20 -13
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
- package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
- package/src/components/DatePicker/DatePicker.test.tsx +21 -19
- package/src/components/DatePicker/DatePicker.tsx +57 -49
- package/src/components/Form/Form.stories.mdx +46 -31
- package/src/components/Form/Form.test.tsx +1 -18
- package/src/components/Form/Form.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
- package/src/components/Grid/SimpleGrid.test.tsx +7 -9
- package/src/components/Grid/SimpleGrid.tsx +14 -11
- package/src/components/Heading/Heading.stories.mdx +27 -72
- package/src/components/Heading/Heading.test.tsx +18 -44
- package/src/components/Heading/Heading.tsx +7 -10
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
- package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
- package/src/components/Hero/Hero.stories.mdx +219 -216
- package/src/components/Hero/Hero.test.tsx +107 -223
- package/src/components/Hero/Hero.tsx +63 -61
- package/src/components/Icons/Icon.stories.mdx +172 -118
- package/src/components/Icons/Icon.test.tsx +8 -16
- package/src/components/Icons/Icon.tsx +75 -29
- package/src/components/Icons/IconSvgs.tsx +42 -42
- package/src/components/Image/Image.stories.mdx +45 -132
- package/src/components/Image/Image.test.tsx +16 -31
- package/src/components/Image/Image.tsx +28 -12
- package/src/components/Link/Link.stories.mdx +30 -94
- package/src/components/Link/Link.test.tsx +25 -75
- package/src/components/Link/Link.tsx +43 -56
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
- package/src/components/List/List.stories.mdx +20 -31
- package/src/components/List/List.test.tsx +24 -43
- package/src/components/List/List.tsx +25 -36
- package/src/components/Logo/Logo.stories.mdx +94 -50
- package/src/components/Logo/Logo.test.tsx +10 -19
- package/src/components/Logo/Logo.tsx +50 -17
- package/src/components/Logo/LogoSvgs.tsx +78 -78
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
- package/src/components/Modal/Modal.stories.mdx +245 -139
- package/src/components/Modal/Modal.test.tsx +147 -10
- 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 +10 -28
- package/src/components/Notification/Notification.test.tsx +9 -12
- package/src/components/Notification/Notification.tsx +34 -37
- package/src/components/Pagination/Pagination.stories.mdx +3 -4
- package/src/components/Pagination/Pagination.tsx +15 -10
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +9 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
- package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
- package/src/components/RadioGroup/RadioGroup.tsx +28 -24
- package/src/components/SearchBar/SearchBar.stories.mdx +4 -4
- package/src/components/SearchBar/SearchBar.test.tsx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +14 -22
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
- package/src/components/Select/Select.stories.mdx +10 -25
- package/src/components/Select/Select.test.tsx +6 -7
- package/src/components/Select/Select.tsx +28 -35
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
- package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
- package/src/components/Slider/Slider.stories.mdx +19 -53
- package/src/components/Slider/Slider.test.tsx +2 -2
- package/src/components/Slider/Slider.tsx +10 -12
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
- package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
- package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
- package/src/components/StatusBadge/StatusBadge.tsx +3 -10
- package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
- package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
- package/src/components/StructuredContent/StructuredContent.tsx +9 -18
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
- package/src/components/StyleGuide/Buttons.stories.mdx +63 -63
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +9 -10
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +2 -2
- package/src/components/StyleGuide/Iconography.stories.mdx +60 -78
- package/src/components/StyleGuide/Spacing.stories.mdx +1 -2
- package/src/components/StyleGuide/Typography.stories.mdx +16 -19
- package/src/components/Table/Table.stories.mdx +85 -1
- package/src/components/Table/Table.test.tsx +57 -1
- package/src/components/Table/Table.tsx +7 -4
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
- package/src/components/Tabs/Tabs.stories.mdx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +26 -27
- package/src/components/Template/Template.stories.mdx +49 -54
- package/src/components/Template/Template.tsx +9 -3
- package/src/components/Text/Text.stories.mdx +5 -11
- package/src/components/Text/Text.test.tsx +3 -6
- package/src/components/Text/Text.tsx +3 -5
- package/src/components/TextInput/TextInput.stories.mdx +10 -22
- package/src/components/TextInput/TextInput.test.tsx +32 -62
- package/src/components/TextInput/TextInput.tsx +61 -30
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
- package/src/components/Toggle/Toggle.stories.mdx +5 -16
- package/src/components/Toggle/Toggle.test.tsx +2 -3
- package/src/components/Toggle/Toggle.tsx +9 -10
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
- package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
- package/src/docs/Chakra.stories.mdx +14 -11
- package/src/docs/Welcome.stories.mdx +23 -43
- package/src/helpers/types.ts +1 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useNYPLTheme.stories.mdx +3 -6
- package/src/index.ts +52 -46
- package/src/styles.scss +0 -1
- package/src/theme/components/buttonGroup.ts +10 -0
- package/src/theme/components/card.ts +50 -15
- package/src/theme/components/componentWrapper.ts +5 -1
- package/src/theme/components/customTable.ts +8 -2
- package/src/theme/components/fieldset.ts +5 -1
- package/src/theme/components/helperErrorText.ts +5 -1
- package/src/theme/components/hero.ts +2 -2
- package/src/theme/components/horizontalRule.ts +5 -1
- package/src/theme/components/icon.ts +7 -1
- package/src/theme/components/image.ts +14 -3
- package/src/theme/components/label.ts +5 -1
- package/src/theme/components/list.ts +8 -2
- package/src/theme/components/logo.ts +5 -1
- package/src/theme/components/notification.ts +38 -14
- package/src/theme/components/progressIndicator.ts +10 -5
- package/src/theme/components/select.ts +5 -6
- package/src/theme/components/skeletonLoader.ts +8 -2
- package/src/theme/components/skipNavigation.ts +26 -0
- package/src/theme/components/slider.ts +13 -1
- package/src/theme/components/structuredContent.ts +11 -1
- package/src/theme/components/text.ts +12 -5
- package/src/theme/components/toggle.ts +9 -3
- package/src/theme/foundations/colors.ts +6 -9
- package/src/theme/index.ts +4 -0
- package/src/theme/provider.tsx +1 -1
- package/src/utils/componentCategories.ts +13 -5
- package/src/utils/interfaces.ts +5 -0
- package/src/utils/utils.ts +2 -32
- package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
- package/dist/components/Button/ButtonTypes.d.ts +0 -8
- package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
- package/dist/components/Form/FormTypes.d.ts +0 -2
- package/dist/components/Grid/GridTypes.d.ts +0 -9
- package/dist/components/Heading/HeadingTypes.d.ts +0 -14
- package/dist/components/Hero/HeroTypes.d.ts +0 -12
- package/dist/components/Icons/IconTypes.d.ts +0 -77
- package/dist/components/Image/ImageTypes.d.ts +0 -22
- package/dist/components/Link/LinkTypes.d.ts +0 -8
- package/dist/components/List/ListTypes.d.ts +0 -5
- package/dist/components/Logo/LogoTypes.d.ts +0 -54
- package/dist/components/Notification/NotificationTypes.d.ts +0 -5
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
- package/dist/components/Select/SelectTypes.d.ts +0 -8
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
- package/dist/components/Text/TextTypes.d.ts +0 -6
- package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
- package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
- package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
- package/dist/helpers/enums.d.ts +0 -4
- package/dist/utils/siteSections.d.ts +0 -2
- package/src/components/Accordion/AccordionTypes.tsx +0 -5
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
- package/src/components/Button/ButtonTypes.tsx +0 -8
- package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
- package/src/components/Form/FormTypes.tsx +0 -3
- package/src/components/Grid/GridTypes.tsx +0 -9
- package/src/components/Heading/HeadingTypes.tsx +0 -15
- package/src/components/Hero/HeroTypes.tsx +0 -20
- package/src/components/Icons/IconTypes.tsx +0 -83
- package/src/components/Image/ImageTypes.ts +0 -24
- package/src/components/Link/LinkTypes.tsx +0 -8
- package/src/components/List/ListTypes.tsx +0 -5
- package/src/components/Logo/LogoTypes.tsx +0 -56
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/components/Notification/NotificationTypes.tsx +0 -5
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
- package/src/components/Select/SelectTypes.tsx +0 -10
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
- package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
- package/src/components/Text/TextTypes.tsx +0 -6
- package/src/components/TextInput/TextInputTypes.tsx +0 -48
- package/src/components/Toggle/ToggleTypes.tsx +0 -4
- package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
- package/src/helpers/enums.ts +0 -4
- package/src/utils/siteSections.ts +0 -10
|
@@ -8,8 +8,6 @@ import {
|
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
10
|
import Heading from "../Heading/Heading";
|
|
11
|
-
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
12
|
-
import { GridGaps } from "../Grid/GridTypes";
|
|
13
11
|
import SimpleGrid from "../Grid/SimpleGrid";
|
|
14
12
|
import Slider from "./Slider";
|
|
15
13
|
import { getCategory } from "../../utils/componentCategories";
|
|
@@ -76,7 +74,7 @@ import DSProvider from "../../theme/provider";
|
|
|
76
74
|
| Component Version | DS Version |
|
|
77
75
|
| ----------------- | ---------- |
|
|
78
76
|
| Added | `0.25.4` |
|
|
79
|
-
| Latest | `0.
|
|
77
|
+
| Latest | `0.28.0` |
|
|
80
78
|
|
|
81
79
|
## Table of Contents
|
|
82
80
|
|
|
@@ -160,10 +158,10 @@ Resources:
|
|
|
160
158
|
### Slider Accessibility Implementation
|
|
161
159
|
|
|
162
160
|
Chakra's `Slider` component is accessible and, as recommended, we pass in an
|
|
163
|
-
`aria-label` to their `Slider` component. On top of that, the Reservoir Design
|
|
164
|
-
System (DS) `Slider` component's `<label>` points to the `<input>` element
|
|
165
|
-
which shows the current value. This `input` element also has its own
|
|
166
|
-
`aria-label`. When the input box is hidden, the `for` attribute in the `label`
|
|
161
|
+
`aria-label` to their `Slider` component. On top of that, the Reservoir Design
|
|
162
|
+
System (DS) `Slider` component's `<label>` points to the `<input>` element
|
|
163
|
+
which shows the current value. This `input` element also has its own
|
|
164
|
+
`aria-label`. When the input box is hidden, the `for` attribute in the `label`
|
|
167
165
|
element is removed.
|
|
168
166
|
|
|
169
167
|
Note that Chakra handles its single slider thumb aria attributes: `aria-valuemin`,
|
|
@@ -233,11 +231,7 @@ Note that Chakra handles its two slider thumbs aria attributes: `aria-valuemin`,
|
|
|
233
231
|
|
|
234
232
|
<Canvas>
|
|
235
233
|
<DSProvider>
|
|
236
|
-
<Heading
|
|
237
|
-
id="heading-single-default"
|
|
238
|
-
level={HeadingLevels.Four}
|
|
239
|
-
text="Default State"
|
|
240
|
-
/>
|
|
234
|
+
<Heading id="heading-single-default" level="four" text="Default State" />
|
|
241
235
|
<Slider
|
|
242
236
|
defaultValue={50}
|
|
243
237
|
helperText="Component helper text."
|
|
@@ -250,11 +244,7 @@ Note that Chakra handles its two slider thumbs aria attributes: `aria-valuemin`,
|
|
|
250
244
|
|
|
251
245
|
<Canvas>
|
|
252
246
|
<DSProvider>
|
|
253
|
-
<Heading
|
|
254
|
-
id="heading-single-errored"
|
|
255
|
-
level={HeadingLevels.Four}
|
|
256
|
-
text="Errored State"
|
|
257
|
-
/>
|
|
247
|
+
<Heading id="heading-single-errored" level="four" text="Errored State" />
|
|
258
248
|
<Slider
|
|
259
249
|
defaultValue={50}
|
|
260
250
|
helperText="Component helper text."
|
|
@@ -268,11 +258,7 @@ Note that Chakra handles its two slider thumbs aria attributes: `aria-valuemin`,
|
|
|
268
258
|
|
|
269
259
|
<Canvas>
|
|
270
260
|
<DSProvider>
|
|
271
|
-
<Heading
|
|
272
|
-
id="heading-single-required"
|
|
273
|
-
level={HeadingLevels.Four}
|
|
274
|
-
text="Required State"
|
|
275
|
-
/>
|
|
261
|
+
<Heading id="heading-single-required" level="four" text="Required State" />
|
|
276
262
|
<Slider
|
|
277
263
|
defaultValue={50}
|
|
278
264
|
helperText="Component helper text."
|
|
@@ -286,11 +272,7 @@ Note that Chakra handles its two slider thumbs aria attributes: `aria-valuemin`,
|
|
|
286
272
|
|
|
287
273
|
<Canvas>
|
|
288
274
|
<DSProvider>
|
|
289
|
-
<Heading
|
|
290
|
-
id="heading-single-disabled"
|
|
291
|
-
level={HeadingLevels.Four}
|
|
292
|
-
text="Disabled State"
|
|
293
|
-
/>
|
|
275
|
+
<Heading id="heading-single-disabled" level="four" text="Disabled State" />
|
|
294
276
|
<Slider
|
|
295
277
|
defaultValue={50}
|
|
296
278
|
helperText="Component helper text."
|
|
@@ -308,11 +290,7 @@ To enable the Range Slider, set the `isRangeSlider` prop to true.
|
|
|
308
290
|
|
|
309
291
|
<Canvas>
|
|
310
292
|
<DSProvider>
|
|
311
|
-
<Heading
|
|
312
|
-
id="heading-range-default"
|
|
313
|
-
level={HeadingLevels.Four}
|
|
314
|
-
text="Default State"
|
|
315
|
-
/>
|
|
293
|
+
<Heading id="heading-range-default" level="four" text="Default State" />
|
|
316
294
|
<Slider
|
|
317
295
|
defaultValue={[25, 75]}
|
|
318
296
|
helperText="Component helper text."
|
|
@@ -326,12 +304,8 @@ To enable the Range Slider, set the `isRangeSlider` prop to true.
|
|
|
326
304
|
|
|
327
305
|
<Canvas>
|
|
328
306
|
<DSProvider>
|
|
329
|
-
<Heading
|
|
330
|
-
|
|
331
|
-
level={HeadingLevels.Four}
|
|
332
|
-
text="Errored State"
|
|
333
|
-
/>
|
|
334
|
-
<SimpleGrid columns={1} gap={GridGaps.Large}>
|
|
307
|
+
<Heading id="heading-range-errored" level="four" text="Errored State" />
|
|
308
|
+
<SimpleGrid columns={1} gap="grid.l">
|
|
335
309
|
<Slider
|
|
336
310
|
defaultValue={[25, 75]}
|
|
337
311
|
helperText="Component helper text."
|
|
@@ -364,11 +338,7 @@ To enable the Range Slider, set the `isRangeSlider` prop to true.
|
|
|
364
338
|
|
|
365
339
|
<Canvas>
|
|
366
340
|
<DSProvider>
|
|
367
|
-
<Heading
|
|
368
|
-
id="heading-range-required"
|
|
369
|
-
level={HeadingLevels.Four}
|
|
370
|
-
text="Required State"
|
|
371
|
-
/>
|
|
341
|
+
<Heading id="heading-range-required" level="four" text="Required State" />
|
|
372
342
|
<Slider
|
|
373
343
|
defaultValue={[25, 75]}
|
|
374
344
|
helperText="Component helper text."
|
|
@@ -383,11 +353,7 @@ To enable the Range Slider, set the `isRangeSlider` prop to true.
|
|
|
383
353
|
|
|
384
354
|
<Canvas>
|
|
385
355
|
<DSProvider>
|
|
386
|
-
<Heading
|
|
387
|
-
id="heading-range-disabled"
|
|
388
|
-
level={HeadingLevels.Four}
|
|
389
|
-
text="Disabled State"
|
|
390
|
-
/>
|
|
356
|
+
<Heading id="heading-range-disabled" level="four" text="Disabled State" />
|
|
391
357
|
<Slider
|
|
392
358
|
defaultValue={[25, 75]}
|
|
393
359
|
helperText="Component helper text."
|
|
@@ -409,10 +375,10 @@ input are hidden.
|
|
|
409
375
|
<DSProvider>
|
|
410
376
|
<Heading
|
|
411
377
|
id="heading-single-labels"
|
|
412
|
-
level=
|
|
378
|
+
level="four"
|
|
413
379
|
text="With and Without Component Labels"
|
|
414
380
|
/>
|
|
415
|
-
<SimpleGrid columns={1} gap=
|
|
381
|
+
<SimpleGrid columns={1} gap="grid.xl">
|
|
416
382
|
<Slider
|
|
417
383
|
defaultValue={50}
|
|
418
384
|
helperText="Component helper text."
|
|
@@ -466,10 +432,10 @@ For the following examples, all labels are hidden.
|
|
|
466
432
|
<DSProvider>
|
|
467
433
|
<Heading
|
|
468
434
|
id="heading-single-labels-inputs"
|
|
469
|
-
level=
|
|
435
|
+
level="four"
|
|
470
436
|
text="With and Without Internal Inputs and Labels"
|
|
471
437
|
/>
|
|
472
|
-
<SimpleGrid columns={1} gap=
|
|
438
|
+
<SimpleGrid columns={1} gap="grid.xl">
|
|
473
439
|
<Slider
|
|
474
440
|
defaultValue={50}
|
|
475
441
|
helperText="Component helper text."
|
|
@@ -516,7 +482,7 @@ In the following examples, all the labels are hidden.
|
|
|
516
482
|
|
|
517
483
|
<Canvas>
|
|
518
484
|
<DSProvider>
|
|
519
|
-
<SimpleGrid columns={1} gap=
|
|
485
|
+
<SimpleGrid columns={1} gap="grid.xl">
|
|
520
486
|
<Slider
|
|
521
487
|
defaultValue={[15, 75]}
|
|
522
488
|
helperText="Component helper text."
|
|
@@ -320,8 +320,8 @@ describe("Slider", () => {
|
|
|
320
320
|
|
|
321
321
|
it("gets the current value through the onChange callback function", () => {
|
|
322
322
|
let currentValue = 0;
|
|
323
|
-
function onChange(value) {
|
|
324
|
-
currentValue = value;
|
|
323
|
+
function onChange(value: number | number[]) {
|
|
324
|
+
currentValue = value as number;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
render(
|
|
@@ -17,8 +17,7 @@ import Label from "../Label/Label";
|
|
|
17
17
|
import HelperErrorText, {
|
|
18
18
|
HelperErrorTextType,
|
|
19
19
|
} from "../HelperErrorText/HelperErrorText";
|
|
20
|
-
import TextInput from "../TextInput/TextInput";
|
|
21
|
-
import { TextInputTypes } from "../TextInput/TextInputTypes";
|
|
20
|
+
import TextInput, { TextInputTypes } from "../TextInput/TextInput";
|
|
22
21
|
|
|
23
22
|
export interface SliderProps {
|
|
24
23
|
/** Additional class name for the Slider component. */
|
|
@@ -121,9 +120,7 @@ export const Slider = chakra((props: React.PropsWithChildren<SliderProps>) => {
|
|
|
121
120
|
if (isRangeSlider && currentValue[0] > currentValue[1]) {
|
|
122
121
|
finalIsInvalid = true;
|
|
123
122
|
}
|
|
124
|
-
const footnote
|
|
125
|
-
? invalidText
|
|
126
|
-
: helperText;
|
|
123
|
+
const footnote = finalIsInvalid ? invalidText : helperText;
|
|
127
124
|
const styles = useMultiStyleConfig("CustomSlider", {
|
|
128
125
|
isDisabled,
|
|
129
126
|
isInvalid: finalIsInvalid,
|
|
@@ -151,15 +148,16 @@ export const Slider = chakra((props: React.PropsWithChildren<SliderProps>) => {
|
|
|
151
148
|
};
|
|
152
149
|
// Props that the two `TextInput` components use.
|
|
153
150
|
const textInputSharedProps = {
|
|
154
|
-
attributes: { max, min },
|
|
155
151
|
isDisabled,
|
|
156
152
|
isInvalid: finalIsInvalid,
|
|
157
153
|
isRequired,
|
|
154
|
+
max,
|
|
155
|
+
min,
|
|
158
156
|
// Never show the label or helper text for the `TextInput` component.
|
|
159
157
|
showHelperInvalidText: false,
|
|
160
158
|
showLabel: false,
|
|
161
159
|
step,
|
|
162
|
-
type: TextInputTypes
|
|
160
|
+
type: "number" as TextInputTypes,
|
|
163
161
|
};
|
|
164
162
|
/**
|
|
165
163
|
* This returns either the "start" or "end" `TextInput` component. Note that
|
|
@@ -222,7 +220,7 @@ export const Slider = chakra((props: React.PropsWithChildren<SliderProps>) => {
|
|
|
222
220
|
<TextInput
|
|
223
221
|
id={`${id}-textInput-${type}`}
|
|
224
222
|
labelText={updatedLabel}
|
|
225
|
-
|
|
223
|
+
__css={{
|
|
226
224
|
...styles.textInput,
|
|
227
225
|
// Specific margins for each text input to
|
|
228
226
|
// push the elements inside.
|
|
@@ -244,11 +242,11 @@ export const Slider = chakra((props: React.PropsWithChildren<SliderProps>) => {
|
|
|
244
242
|
aria-label={
|
|
245
243
|
!showLabel
|
|
246
244
|
? [`${labelText} - start value`, `${labelText} - end value`]
|
|
247
|
-
:
|
|
245
|
+
: undefined
|
|
248
246
|
}
|
|
249
247
|
// Both slider thumbs need values and should be in an array,
|
|
250
248
|
// even if it's the same label.
|
|
251
|
-
aria-labelledby={showLabel ? [`${id}-label`, `${id}-label`] :
|
|
249
|
+
aria-labelledby={showLabel ? [`${id}-label`, `${id}-label`] : undefined}
|
|
252
250
|
value={currentValue as number[]}
|
|
253
251
|
// Make the thumbs larger.
|
|
254
252
|
size="lg"
|
|
@@ -262,7 +260,7 @@ export const Slider = chakra((props: React.PropsWithChildren<SliderProps>) => {
|
|
|
262
260
|
</ChakraRangeSlider>
|
|
263
261
|
) : (
|
|
264
262
|
<ChakraSlider
|
|
265
|
-
aria-label={!showLabel ? labelText :
|
|
263
|
+
aria-label={!showLabel ? labelText : undefined}
|
|
266
264
|
aria-labelledby={`${id}-label`}
|
|
267
265
|
value={currentValue as number}
|
|
268
266
|
// Make the thumb larger.
|
|
@@ -289,7 +287,7 @@ export const Slider = chakra((props: React.PropsWithChildren<SliderProps>) => {
|
|
|
289
287
|
htmlFor={
|
|
290
288
|
showBoxes
|
|
291
289
|
? `${id}-textInput-${isRangeSlider ? "start" : "end"}`
|
|
292
|
-
:
|
|
290
|
+
: ""
|
|
293
291
|
}
|
|
294
292
|
isRequired={showRequiredLabel && isRequired}
|
|
295
293
|
>
|
|
@@ -856,7 +856,7 @@ exports[`Slider Range Slider renders the UI snapshot correctly 6`] = `
|
|
|
856
856
|
>
|
|
857
857
|
<label
|
|
858
858
|
className="css-1xdhyk6"
|
|
859
|
-
htmlFor=
|
|
859
|
+
htmlFor=""
|
|
860
860
|
id="noVisibleValues-label"
|
|
861
861
|
>
|
|
862
862
|
Label
|
|
@@ -1139,7 +1139,6 @@ exports[`Slider Single Slider renders the UI snapshot correctly 1`] = `
|
|
|
1139
1139
|
/>
|
|
1140
1140
|
</div>
|
|
1141
1141
|
<div
|
|
1142
|
-
aria-label={null}
|
|
1143
1142
|
aria-labelledby="defaultSlider-label"
|
|
1144
1143
|
aria-orientation="horizontal"
|
|
1145
1144
|
aria-valuemax={100}
|
|
@@ -1269,7 +1268,6 @@ exports[`Slider Single Slider renders the UI snapshot correctly 2`] = `
|
|
|
1269
1268
|
/>
|
|
1270
1269
|
</div>
|
|
1271
1270
|
<div
|
|
1272
|
-
aria-label={null}
|
|
1273
1271
|
aria-labelledby="errored-label"
|
|
1274
1272
|
aria-orientation="horizontal"
|
|
1275
1273
|
aria-valuemax={100}
|
|
@@ -1403,7 +1401,6 @@ exports[`Slider Single Slider renders the UI snapshot correctly 3`] = `
|
|
|
1403
1401
|
/>
|
|
1404
1402
|
</div>
|
|
1405
1403
|
<div
|
|
1406
|
-
aria-label={null}
|
|
1407
1404
|
aria-labelledby="required-label"
|
|
1408
1405
|
aria-orientation="horizontal"
|
|
1409
1406
|
aria-valuemax={100}
|
|
@@ -1537,7 +1534,6 @@ exports[`Slider Single Slider renders the UI snapshot correctly 4`] = `
|
|
|
1537
1534
|
</div>
|
|
1538
1535
|
<div
|
|
1539
1536
|
aria-disabled={true}
|
|
1540
|
-
aria-label={null}
|
|
1541
1537
|
aria-labelledby="disabled-label"
|
|
1542
1538
|
aria-orientation="horizontal"
|
|
1543
1539
|
aria-valuemax={100}
|
|
@@ -1722,7 +1718,7 @@ exports[`Slider Single Slider renders the UI snapshot correctly 6`] = `
|
|
|
1722
1718
|
>
|
|
1723
1719
|
<label
|
|
1724
1720
|
className="css-1xdhyk6"
|
|
1725
|
-
htmlFor=
|
|
1721
|
+
htmlFor=""
|
|
1726
1722
|
id="noVisibleValues-label"
|
|
1727
1723
|
>
|
|
1728
1724
|
Label
|
|
@@ -1771,7 +1767,6 @@ exports[`Slider Single Slider renders the UI snapshot correctly 6`] = `
|
|
|
1771
1767
|
/>
|
|
1772
1768
|
</div>
|
|
1773
1769
|
<div
|
|
1774
|
-
aria-label={null}
|
|
1775
1770
|
aria-labelledby="noVisibleValues-label"
|
|
1776
1771
|
aria-orientation="horizontal"
|
|
1777
1772
|
aria-valuemax={100}
|
|
@@ -1958,7 +1953,6 @@ exports[`Slider Single Slider renders the UI snapshot correctly 8`] = `
|
|
|
1958
1953
|
/>
|
|
1959
1954
|
</div>
|
|
1960
1955
|
<div
|
|
1961
|
-
aria-label={null}
|
|
1962
1956
|
aria-labelledby="chakra-label"
|
|
1963
1957
|
aria-orientation="horizontal"
|
|
1964
1958
|
aria-valuemax={100}
|
|
@@ -2089,7 +2083,6 @@ exports[`Slider Single Slider renders the UI snapshot correctly 9`] = `
|
|
|
2089
2083
|
/>
|
|
2090
2084
|
</div>
|
|
2091
2085
|
<div
|
|
2092
|
-
aria-label={null}
|
|
2093
2086
|
aria-labelledby="props-label"
|
|
2094
2087
|
aria-orientation="horizontal"
|
|
2095
2088
|
aria-valuemax={100}
|
|
@@ -9,15 +9,8 @@ import {
|
|
|
9
9
|
import { withDesign } from "storybook-addon-designs";
|
|
10
10
|
|
|
11
11
|
import StatusBadge from "./StatusBadge";
|
|
12
|
-
import { StatusBadgeTypes } from "./StatusBadgeTypes";
|
|
13
12
|
import { getCategory } from "../../utils/componentCategories";
|
|
14
13
|
import DSProvider from "../../theme/provider";
|
|
15
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
16
|
-
|
|
17
|
-
export const enumValues = getStorybookEnumValues(
|
|
18
|
-
StatusBadgeTypes,
|
|
19
|
-
"StatusBadgeTypes"
|
|
20
|
-
);
|
|
21
14
|
|
|
22
15
|
<Meta
|
|
23
16
|
title={getCategory("StatusBadge")}
|
|
@@ -34,9 +27,7 @@ export const enumValues = getStorybookEnumValues(
|
|
|
34
27
|
className: { control: false },
|
|
35
28
|
id: { control: false },
|
|
36
29
|
level: {
|
|
37
|
-
|
|
38
|
-
table: { defaultValue: { summary: "StatusBadgeTypes.Low" } },
|
|
39
|
-
options: enumValues.options,
|
|
30
|
+
table: { defaultValue: { summary: "low" } },
|
|
40
31
|
},
|
|
41
32
|
text: {
|
|
42
33
|
description: "Only used for Storybook",
|
|
@@ -49,7 +40,7 @@ export const enumValues = getStorybookEnumValues(
|
|
|
49
40
|
| Component Version | DS Version |
|
|
50
41
|
| ----------------- | ---------- |
|
|
51
42
|
| Added | `0.18.7` |
|
|
52
|
-
| Latest | `0.
|
|
43
|
+
| Latest | `0.28.0` |
|
|
53
44
|
|
|
54
45
|
## Table of Contents
|
|
55
46
|
|
|
@@ -70,15 +61,11 @@ export const enumValues = getStorybookEnumValues(
|
|
|
70
61
|
args={{
|
|
71
62
|
className: undefined,
|
|
72
63
|
id: "statusBadge-id",
|
|
73
|
-
level: "
|
|
64
|
+
level: "low",
|
|
74
65
|
text: "Registration Required",
|
|
75
66
|
}}
|
|
76
67
|
>
|
|
77
|
-
{(args) =>
|
|
78
|
-
<StatusBadge level={enumValues.getValue(args.level)}>
|
|
79
|
-
{args.text}
|
|
80
|
-
</StatusBadge>
|
|
81
|
-
)}
|
|
68
|
+
{(args) => <StatusBadge level={args.level}>{args.text}</StatusBadge>}
|
|
82
69
|
</Story>
|
|
83
70
|
</Canvas>
|
|
84
71
|
|
|
@@ -101,10 +88,8 @@ Used in instances where the associated message is the highest barrier. Use
|
|
|
101
88
|
<Canvas>
|
|
102
89
|
<DSProvider>
|
|
103
90
|
<VStack spacing="s" align="stretch">
|
|
104
|
-
<StatusBadge level=
|
|
105
|
-
|
|
106
|
-
</StatusBadge>
|
|
107
|
-
<StatusBadge level={StatusBadgeTypes.Medium}>Cancelled</StatusBadge>
|
|
91
|
+
<StatusBadge level="high">On-Site Access Only</StatusBadge>
|
|
92
|
+
<StatusBadge level="medium">Cancelled</StatusBadge>
|
|
108
93
|
</VStack>
|
|
109
94
|
</DSProvider>
|
|
110
95
|
</Canvas>
|
|
@@ -4,7 +4,6 @@ import { axe } from "jest-axe";
|
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
6
|
import StatusBadge from "./StatusBadge";
|
|
7
|
-
import { StatusBadgeTypes } from "./StatusBadgeTypes";
|
|
8
7
|
|
|
9
8
|
describe("StatusBadge Accessibility", () => {
|
|
10
9
|
it("passes axe accessibility test", async () => {
|
|
@@ -35,14 +34,14 @@ describe("StatusBadge", () => {
|
|
|
35
34
|
.toJSON();
|
|
36
35
|
const medium = renderer
|
|
37
36
|
.create(
|
|
38
|
-
<StatusBadge id="medium" level=
|
|
37
|
+
<StatusBadge id="medium" level="medium">
|
|
39
38
|
Registration Required
|
|
40
39
|
</StatusBadge>
|
|
41
40
|
)
|
|
42
41
|
.toJSON();
|
|
43
42
|
const high = renderer
|
|
44
43
|
.create(
|
|
45
|
-
<StatusBadge id="high" level=
|
|
44
|
+
<StatusBadge id="high" level="high">
|
|
46
45
|
Registration Required
|
|
47
46
|
</StatusBadge>
|
|
48
47
|
)
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export type StatusBadgeTypes = "low" | "medium" | "high";
|
|
5
5
|
export interface StatusBadgeProps {
|
|
6
6
|
/** Additional class for the component */
|
|
7
7
|
className?: string;
|
|
8
8
|
/** ID that other components can cross reference for accessibility purposes */
|
|
9
9
|
id?: string;
|
|
10
|
-
/** Level of the status badge
|
|
11
|
-
* `StatusBadgeTypes.Low`. */
|
|
10
|
+
/** Level of the status badge. Defaults to `"low"`. */
|
|
12
11
|
level?: StatusBadgeTypes;
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -18,13 +17,7 @@ export interface StatusBadgeProps {
|
|
|
18
17
|
*/
|
|
19
18
|
export const StatusBadge = chakra(
|
|
20
19
|
(props: React.PropsWithChildren<StatusBadgeProps>) => {
|
|
21
|
-
const {
|
|
22
|
-
children,
|
|
23
|
-
className,
|
|
24
|
-
id,
|
|
25
|
-
level = StatusBadgeTypes.Low,
|
|
26
|
-
...rest
|
|
27
|
-
} = props;
|
|
20
|
+
const { children, className, id, level = "low", ...rest } = props;
|
|
28
21
|
const styles = useStyleConfig("StatusBadge", { variant: level });
|
|
29
22
|
|
|
30
23
|
if (!children) {
|
|
@@ -7,25 +7,9 @@ import {
|
|
|
7
7
|
} from "@storybook/addon-docs";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
|
-
import { ImageRatios, ImageSizes, ImageTypes } from "../Image/ImageTypes";
|
|
11
10
|
import StructuredContent from "./StructuredContent";
|
|
12
|
-
import { StructuredContentImagePosition } from "./StructuredContentTypes";
|
|
13
11
|
import DSProvider from "../../theme/provider";
|
|
14
12
|
import { getCategory } from "../../utils/componentCategories";
|
|
15
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
16
|
-
|
|
17
|
-
export const imageAspectRatioEnumValues = getStorybookEnumValues(
|
|
18
|
-
ImageRatios,
|
|
19
|
-
"ImageRatios"
|
|
20
|
-
);
|
|
21
|
-
export const imagePositionEnumValues = getStorybookEnumValues(
|
|
22
|
-
StructuredContentImagePosition,
|
|
23
|
-
"StructuredContentImagePosition"
|
|
24
|
-
);
|
|
25
|
-
export const imageSizeEnumValues = getStorybookEnumValues(
|
|
26
|
-
ImageSizes,
|
|
27
|
-
"ImageSizes"
|
|
28
|
-
);
|
|
29
13
|
|
|
30
14
|
<Meta
|
|
31
15
|
title={getCategory("StructuredContent")}
|
|
@@ -42,32 +26,20 @@ export const imageSizeEnumValues = getStorybookEnumValues(
|
|
|
42
26
|
className: { control: false },
|
|
43
27
|
id: { control: false },
|
|
44
28
|
"imageProps.aspectRatio": {
|
|
45
|
-
control: {
|
|
46
|
-
type: "select",
|
|
47
|
-
},
|
|
48
29
|
table: {
|
|
49
|
-
defaultValue: { summary: "
|
|
30
|
+
defaultValue: { summary: "square" },
|
|
50
31
|
},
|
|
51
|
-
options: imageAspectRatioEnumValues.options,
|
|
52
32
|
},
|
|
53
33
|
"imageProps.component": { control: false },
|
|
54
34
|
"imageProps.position": {
|
|
55
|
-
control: {
|
|
56
|
-
type: "select",
|
|
57
|
-
},
|
|
58
35
|
table: {
|
|
59
|
-
defaultValue: { summary: "
|
|
36
|
+
defaultValue: { summary: "left" },
|
|
60
37
|
},
|
|
61
|
-
options: imagePositionEnumValues.options,
|
|
62
38
|
},
|
|
63
39
|
"imageProps.size": {
|
|
64
|
-
control: {
|
|
65
|
-
type: "select",
|
|
66
|
-
},
|
|
67
40
|
table: {
|
|
68
|
-
defaultValue: { summary: "
|
|
41
|
+
defaultValue: { summary: "medium" },
|
|
69
42
|
},
|
|
70
|
-
options: imageSizeEnumValues.options,
|
|
71
43
|
},
|
|
72
44
|
}}
|
|
73
45
|
/>
|
|
@@ -77,7 +49,7 @@ export const imageSizeEnumValues = getStorybookEnumValues(
|
|
|
77
49
|
| Component Version | DS Version |
|
|
78
50
|
| ----------------- | ---------- |
|
|
79
51
|
| Added | `0.25.9` |
|
|
80
|
-
| Latest | `0.
|
|
52
|
+
| Latest | `0.28.0` |
|
|
81
53
|
|
|
82
54
|
## Table of Contents
|
|
83
55
|
|
|
@@ -127,29 +99,29 @@ export const imageSizeEnumValues = getStorybookEnumValues(
|
|
|
127
99
|
headingText: "Heading text",
|
|
128
100
|
id: "structured-content",
|
|
129
101
|
"imageProps.alt": "Image alt text",
|
|
130
|
-
"imageProps.aspectRatio": "
|
|
102
|
+
"imageProps.aspectRatio": "square",
|
|
131
103
|
"imageProps.caption": "Image caption",
|
|
132
104
|
"imageProps.component": undefined,
|
|
133
105
|
"imageProps.credit": "Image credit",
|
|
134
|
-
"imageProps.position": "
|
|
135
|
-
"imageProps.size": "
|
|
106
|
+
"imageProps.position": "left",
|
|
107
|
+
"imageProps.size": "medium",
|
|
136
108
|
"imageProps.src": "https://placeimg.com/400/300/animals",
|
|
137
109
|
}}
|
|
138
110
|
>
|
|
139
111
|
{(args) => (
|
|
140
112
|
<StructuredContent
|
|
141
|
-
{
|
|
113
|
+
bodyContent={args.bodyContent}
|
|
114
|
+
calloutText={args.calloutText}
|
|
115
|
+
className={args.className}
|
|
116
|
+
headingText={args.headingText}
|
|
117
|
+
id={args.id}
|
|
142
118
|
imageProps={{
|
|
143
119
|
alt: args["imageProps.alt"],
|
|
144
|
-
aspectRatio:
|
|
145
|
-
args["imageProps.aspectRatio"]
|
|
146
|
-
),
|
|
120
|
+
aspectRatio: args["imageProps.aspectRatio"],
|
|
147
121
|
caption: args["imageProps.caption"],
|
|
148
122
|
credit: args["imageProps.credit"],
|
|
149
|
-
position:
|
|
150
|
-
|
|
151
|
-
),
|
|
152
|
-
size: imageSizeEnumValues.getValue(args["imageProps.size"]),
|
|
123
|
+
position: args["imageProps.position"],
|
|
124
|
+
size: args["imageProps.size"],
|
|
153
125
|
src: args["imageProps.src"],
|
|
154
126
|
}}
|
|
155
127
|
/>
|
|
@@ -187,11 +159,11 @@ includes HTML tags in the string.
|
|
|
187
159
|
headingText="Heading text"
|
|
188
160
|
imageProps={{
|
|
189
161
|
alt: "Image alt text",
|
|
190
|
-
aspectRatio:
|
|
162
|
+
aspectRatio: "original",
|
|
191
163
|
caption: "Image caption",
|
|
192
164
|
credit: "Image credit",
|
|
193
|
-
position:
|
|
194
|
-
size:
|
|
165
|
+
position: "left",
|
|
166
|
+
size: "medium",
|
|
195
167
|
src: "https://placeimg.com/400/300/animals",
|
|
196
168
|
}}
|
|
197
169
|
bodyContent={
|
|
@@ -236,11 +208,11 @@ The following content is passed as HTML DOM elements to the `bodyContent` prop.
|
|
|
236
208
|
headingText="Heading text"
|
|
237
209
|
imageProps={{
|
|
238
210
|
alt: "Image alt text",
|
|
239
|
-
aspectRatio:
|
|
211
|
+
aspectRatio: "original",
|
|
240
212
|
caption: "Image caption",
|
|
241
213
|
credit: "Image credit",
|
|
242
|
-
position:
|
|
243
|
-
size:
|
|
214
|
+
position: "left",
|
|
215
|
+
size: "medium",
|
|
244
216
|
src: "https://placeimg.com/400/300/animals",
|
|
245
217
|
}}
|
|
246
218
|
bodyContent={
|
|
@@ -419,11 +391,11 @@ but no callout content. The second component does not have an image.
|
|
|
419
391
|
headingText="Heading text"
|
|
420
392
|
imageProps={{
|
|
421
393
|
alt: "Image alt text",
|
|
422
|
-
aspectRatio:
|
|
394
|
+
aspectRatio: "original",
|
|
423
395
|
caption: "Image caption",
|
|
424
396
|
credit: "Image credit",
|
|
425
|
-
position:
|
|
426
|
-
size:
|
|
397
|
+
position: "left",
|
|
398
|
+
size: "medium",
|
|
427
399
|
src: "https://placeimg.com/400/300/animals",
|
|
428
400
|
}}
|
|
429
401
|
bodyContent={
|
|
@@ -485,11 +457,11 @@ The third one does not contain an image.
|
|
|
485
457
|
headingText="Heading text"
|
|
486
458
|
imageProps={{
|
|
487
459
|
alt: "Image alt text",
|
|
488
|
-
aspectRatio:
|
|
460
|
+
aspectRatio: "original",
|
|
489
461
|
caption: "Image caption",
|
|
490
462
|
credit: "Image credit",
|
|
491
|
-
position:
|
|
492
|
-
size:
|
|
463
|
+
position: "left",
|
|
464
|
+
size: "medium",
|
|
493
465
|
src: "https://placeimg.com/400/300/animals",
|
|
494
466
|
}}
|
|
495
467
|
bodyContent={
|
|
@@ -558,9 +530,9 @@ text content. The second one has a callout content and image spanning full width
|
|
|
558
530
|
headingText="Heading text"
|
|
559
531
|
imageProps={{
|
|
560
532
|
alt: "Image alt text",
|
|
561
|
-
aspectRatio:
|
|
562
|
-
position:
|
|
563
|
-
size:
|
|
533
|
+
aspectRatio: "original",
|
|
534
|
+
position: "center",
|
|
535
|
+
size: "medium",
|
|
564
536
|
src: "https://placeimg.com/400/300/animals",
|
|
565
537
|
}}
|
|
566
538
|
bodyContent={
|