@nypl/design-system-react-components 0.26.0 → 0.28.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 +56 -0
- 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 +977 -1213
- 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 +976 -1276
- 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 +143 -177
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +1 -1
- package/src/components/Chakra/Box.stories.mdx +2 -6
- package/src/components/Chakra/Center.stories.mdx +5 -23
- package/src/components/Chakra/Flex.stories.mdx +4 -6
- package/src/components/Chakra/Stack.stories.mdx +9 -10
- 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/Checkbox/__snapshots__/Checkbox.test.tsx.snap +9 -9
- 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 +24 -35
- 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 +1 -1
- 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 +62 -62
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +7 -8
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +0 -1
- package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +15 -18
- 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/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,24 +8,11 @@ import {
|
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
10
|
import SimpleGrid from "./SimpleGrid";
|
|
11
|
-
import { GridGaps } from "./GridTypes";
|
|
12
11
|
import Card, { CardHeading, CardContent, CardActions } from "../Card/Card";
|
|
13
|
-
import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
14
12
|
import Icon from "../Icons/Icon";
|
|
15
|
-
import {
|
|
16
|
-
IconNames,
|
|
17
|
-
LogoNames,
|
|
18
|
-
IconSizes,
|
|
19
|
-
IconRotationTypes,
|
|
20
|
-
} from "../Icons/IconTypes";
|
|
21
13
|
import Image from "../Image/Image";
|
|
22
|
-
import { ImageRatios } from "../Image/ImageTypes";
|
|
23
|
-
import { LayoutTypes } from "../../helpers/enums";
|
|
24
14
|
import { getCategory } from "../../utils/componentCategories";
|
|
25
15
|
import DSProvider from "../../theme/provider";
|
|
26
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
27
|
-
|
|
28
|
-
export const enumValues = getStorybookEnumValues(GridGaps, "GridGaps");
|
|
29
16
|
|
|
30
17
|
<Meta
|
|
31
18
|
title={getCategory("SimpleGrid")}
|
|
@@ -45,8 +32,16 @@ export const enumValues = getStorybookEnumValues(GridGaps, "GridGaps");
|
|
|
45
32
|
},
|
|
46
33
|
gap: {
|
|
47
34
|
control: { type: "select" },
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
table: { defaultValue: { summary: "grid.l" } },
|
|
36
|
+
options: [
|
|
37
|
+
"grid.xxs",
|
|
38
|
+
"grid.xs",
|
|
39
|
+
"grid.s",
|
|
40
|
+
"grid.m",
|
|
41
|
+
"grid.l",
|
|
42
|
+
"grid.xl",
|
|
43
|
+
"grid.xxl",
|
|
44
|
+
],
|
|
50
45
|
},
|
|
51
46
|
id: { control: false },
|
|
52
47
|
}}
|
|
@@ -57,7 +52,7 @@ export const enumValues = getStorybookEnumValues(GridGaps, "GridGaps");
|
|
|
57
52
|
| Component Version | DS Version |
|
|
58
53
|
| ----------------- | ---------- |
|
|
59
54
|
| Added | `0.25.1` |
|
|
60
|
-
| Latest | `0.
|
|
55
|
+
| Latest | `0.28.0` |
|
|
61
56
|
|
|
62
57
|
## Table of Contents
|
|
63
58
|
|
|
@@ -87,20 +82,20 @@ will be triggered.
|
|
|
87
82
|
args={{
|
|
88
83
|
className: undefined,
|
|
89
84
|
columns: undefined,
|
|
90
|
-
gap: "
|
|
85
|
+
gap: "grid.l",
|
|
91
86
|
id: "simpleGrid-id",
|
|
92
87
|
}}
|
|
93
88
|
>
|
|
94
89
|
{(args) => (
|
|
95
|
-
<SimpleGrid {...args}
|
|
90
|
+
<SimpleGrid {...args}>
|
|
96
91
|
<Card
|
|
97
92
|
imageProps={{
|
|
98
93
|
alt: "Alt text",
|
|
99
|
-
aspectRatio:
|
|
94
|
+
aspectRatio: "twoByOne",
|
|
100
95
|
src: "https://placeimg.com/400/220/animals",
|
|
101
96
|
}}
|
|
102
97
|
>
|
|
103
|
-
<CardHeading level=
|
|
98
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
104
99
|
<CardContent>
|
|
105
100
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
106
101
|
libero, a pharetra augue.
|
|
@@ -109,11 +104,11 @@ will be triggered.
|
|
|
109
104
|
<Card
|
|
110
105
|
imageProps={{
|
|
111
106
|
alt: "Alt text",
|
|
112
|
-
aspectRatio:
|
|
107
|
+
aspectRatio: "twoByOne",
|
|
113
108
|
src: "https://placeimg.com/400/220/animals",
|
|
114
109
|
}}
|
|
115
110
|
>
|
|
116
|
-
<CardHeading level=
|
|
111
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
117
112
|
<CardContent>
|
|
118
113
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
119
114
|
libero, a pharetra augue.
|
|
@@ -122,11 +117,11 @@ will be triggered.
|
|
|
122
117
|
<Card
|
|
123
118
|
imageProps={{
|
|
124
119
|
alt: "Alt text",
|
|
125
|
-
aspectRatio:
|
|
120
|
+
aspectRatio: "twoByOne",
|
|
126
121
|
src: "https://placeimg.com/400/240/animals",
|
|
127
122
|
}}
|
|
128
123
|
>
|
|
129
|
-
<CardHeading level=
|
|
124
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
130
125
|
<CardContent>
|
|
131
126
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
132
127
|
libero, a pharetra augue.
|
|
@@ -135,11 +130,11 @@ will be triggered.
|
|
|
135
130
|
<Card
|
|
136
131
|
imageProps={{
|
|
137
132
|
alt: "Alt text",
|
|
138
|
-
aspectRatio:
|
|
133
|
+
aspectRatio: "twoByOne",
|
|
139
134
|
src: "https://placeimg.com/400/260/animals",
|
|
140
135
|
}}
|
|
141
136
|
>
|
|
142
|
-
<CardHeading level=
|
|
137
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
143
138
|
<CardContent>
|
|
144
139
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
145
140
|
libero, a pharetra augue.
|
|
@@ -148,11 +143,11 @@ will be triggered.
|
|
|
148
143
|
<Card
|
|
149
144
|
imageProps={{
|
|
150
145
|
alt: "Alt text",
|
|
151
|
-
aspectRatio:
|
|
146
|
+
aspectRatio: "twoByOne",
|
|
152
147
|
src: "https://placeimg.com/400/320/animals",
|
|
153
148
|
}}
|
|
154
149
|
>
|
|
155
|
-
<CardHeading level=
|
|
150
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
156
151
|
<CardContent>
|
|
157
152
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
158
153
|
libero, a pharetra augue.
|
|
@@ -161,11 +156,11 @@ will be triggered.
|
|
|
161
156
|
<Card
|
|
162
157
|
imageProps={{
|
|
163
158
|
alt: "Alt text",
|
|
164
|
-
aspectRatio:
|
|
159
|
+
aspectRatio: "twoByOne",
|
|
165
160
|
src: "https://placeimg.com/400/300/animals",
|
|
166
161
|
}}
|
|
167
162
|
>
|
|
168
|
-
<CardHeading level=
|
|
163
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
169
164
|
<CardContent>
|
|
170
165
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
171
166
|
libero, a pharetra augue.
|
|
@@ -197,15 +192,42 @@ Resources:
|
|
|
197
192
|
This example is rendering `Icon` components with the `columns` prop set to `5`.
|
|
198
193
|
|
|
199
194
|
export const icons = [];
|
|
200
|
-
|
|
201
|
-
|
|
195
|
+
export const iconNames = [
|
|
196
|
+
"accessibilityFull",
|
|
197
|
+
"accessibilityPartial",
|
|
198
|
+
"actionCheckCircle",
|
|
199
|
+
"actionHelpDefault",
|
|
200
|
+
"actionHelpOutline",
|
|
201
|
+
"alertNotificationImportant",
|
|
202
|
+
"actionLaunch",
|
|
203
|
+
"arrow",
|
|
204
|
+
"check",
|
|
205
|
+
"clock",
|
|
206
|
+
"close",
|
|
207
|
+
"download",
|
|
208
|
+
"errorFilled",
|
|
209
|
+
"errorOutline",
|
|
210
|
+
"fileTypeAudio",
|
|
211
|
+
"fileTypeDoc",
|
|
212
|
+
"fileTypeGenericDoc",
|
|
213
|
+
"fileTypeImage",
|
|
214
|
+
"fileTypePdf",
|
|
215
|
+
"fileTypeSpreadsheet",
|
|
216
|
+
"fileTypeVideo",
|
|
217
|
+
"headset",
|
|
218
|
+
"minus",
|
|
219
|
+
"plus",
|
|
220
|
+
"search",
|
|
221
|
+
"speakerNotes",
|
|
222
|
+
"utilityAccountFilled",
|
|
223
|
+
"utilityAccountUnfilled",
|
|
224
|
+
"utilityHamburger",
|
|
225
|
+
"utilitySearch",
|
|
226
|
+
];
|
|
227
|
+
for (const name in iconNames) {
|
|
228
|
+
const iname = `Example icon: ${iconNames[name]}`;
|
|
202
229
|
const iconRender = (
|
|
203
|
-
<Icon
|
|
204
|
-
key={icon}
|
|
205
|
-
name={IconNames[icon]}
|
|
206
|
-
size={IconSizes.ExtraExtraExtraLarge}
|
|
207
|
-
titleText={iname}
|
|
208
|
-
/>
|
|
230
|
+
<Icon key={name} name={iconNames[name]} size="xxxlarge" title={iname} />
|
|
209
231
|
);
|
|
210
232
|
icons.push(iconRender);
|
|
211
233
|
}
|
|
@@ -218,7 +240,8 @@ for (const icon in IconNames) {
|
|
|
218
240
|
|
|
219
241
|
### Images
|
|
220
242
|
|
|
221
|
-
This example is rendering square `Image` components with the `columns` prop set
|
|
243
|
+
This example is rendering square `Image` components with the `columns` prop set
|
|
244
|
+
to `6`.
|
|
222
245
|
|
|
223
246
|
<Canvas>
|
|
224
247
|
<DSProvider>
|
|
@@ -247,7 +270,8 @@ This example is rendering square `Image` components with the `columns` prop set
|
|
|
247
270
|
|
|
248
271
|
### Horizontal Cards
|
|
249
272
|
|
|
250
|
-
This example is rendering horizontal `Card` components with the `columns` prop
|
|
273
|
+
This example is rendering horizontal `Card` components with the `columns` prop
|
|
274
|
+
set to `1`.
|
|
251
275
|
|
|
252
276
|
<Canvas>
|
|
253
277
|
<DSProvider>
|
|
@@ -255,14 +279,14 @@ This example is rendering horizontal `Card` components with the `columns` prop s
|
|
|
255
279
|
<Card
|
|
256
280
|
imageProps={{
|
|
257
281
|
alt: "Alt text",
|
|
258
|
-
aspectRatio:
|
|
282
|
+
aspectRatio: "fourByThree",
|
|
259
283
|
src: "https://placeimg.com/400/200/animals",
|
|
260
284
|
}}
|
|
261
285
|
isBordered
|
|
262
286
|
isCentered
|
|
263
|
-
layout=
|
|
287
|
+
layout="row"
|
|
264
288
|
>
|
|
265
|
-
<CardHeading level=
|
|
289
|
+
<CardHeading level="four" id="heading1">
|
|
266
290
|
Card Heading
|
|
267
291
|
</CardHeading>
|
|
268
292
|
<CardContent>
|
|
@@ -274,14 +298,14 @@ This example is rendering horizontal `Card` components with the `columns` prop s
|
|
|
274
298
|
<Card
|
|
275
299
|
imageProps={{
|
|
276
300
|
alt: "Alt text",
|
|
277
|
-
aspectRatio:
|
|
301
|
+
aspectRatio: "fourByThree",
|
|
278
302
|
src: "https://placeimg.com/410/210/animals",
|
|
279
303
|
}}
|
|
280
304
|
isBordered
|
|
281
305
|
isCentered
|
|
282
|
-
layout=
|
|
306
|
+
layout="row"
|
|
283
307
|
>
|
|
284
|
-
<CardHeading level=
|
|
308
|
+
<CardHeading level="four" id="heading2">
|
|
285
309
|
Card Heading
|
|
286
310
|
</CardHeading>
|
|
287
311
|
<CardContent>
|
|
@@ -293,14 +317,14 @@ This example is rendering horizontal `Card` components with the `columns` prop s
|
|
|
293
317
|
<Card
|
|
294
318
|
imageProps={{
|
|
295
319
|
alt: "Alt text",
|
|
296
|
-
aspectRatio:
|
|
320
|
+
aspectRatio: "fourByThree",
|
|
297
321
|
src: "https://placeimg.com/320/320/animals",
|
|
298
322
|
}}
|
|
299
323
|
isBordered
|
|
300
324
|
isCentered
|
|
301
|
-
layout=
|
|
325
|
+
layout="row"
|
|
302
326
|
>
|
|
303
|
-
<CardHeading level=
|
|
327
|
+
<CardHeading level="four" id="heading3">
|
|
304
328
|
Card Heading
|
|
305
329
|
</CardHeading>
|
|
306
330
|
<CardContent>
|
|
@@ -3,10 +3,8 @@ import { render } from "@testing-library/react";
|
|
|
3
3
|
import { axe } from "jest-axe";
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
|
-
import SimpleGrid from "./SimpleGrid";
|
|
7
6
|
import Card, { CardHeading, CardContent } from "../Card/Card";
|
|
8
|
-
import
|
|
9
|
-
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
7
|
+
import SimpleGrid from "./SimpleGrid";
|
|
10
8
|
|
|
11
9
|
describe("Grid Accessibility", () => {
|
|
12
10
|
it("passes axe accessibility test with children components", async () => {
|
|
@@ -15,11 +13,11 @@ describe("Grid Accessibility", () => {
|
|
|
15
13
|
<Card
|
|
16
14
|
imageProps={{
|
|
17
15
|
alt: "Alt text",
|
|
18
|
-
aspectRatio:
|
|
16
|
+
aspectRatio: "twoByOne",
|
|
19
17
|
src: "https://placeimg.com/500/200/animals",
|
|
20
18
|
}}
|
|
21
19
|
>
|
|
22
|
-
<CardHeading level=
|
|
20
|
+
<CardHeading level="two">Card Heading</CardHeading>
|
|
23
21
|
<CardContent>
|
|
24
22
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
25
23
|
libero, a pharetra augue.
|
|
@@ -28,11 +26,11 @@ describe("Grid Accessibility", () => {
|
|
|
28
26
|
<Card
|
|
29
27
|
imageProps={{
|
|
30
28
|
alt: "Alt text",
|
|
31
|
-
aspectRatio:
|
|
29
|
+
aspectRatio: "twoByOne",
|
|
32
30
|
src: "https://placeimg.com/400/220/animals",
|
|
33
31
|
}}
|
|
34
32
|
>
|
|
35
|
-
<CardHeading level=
|
|
33
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
36
34
|
<CardContent>
|
|
37
35
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
38
36
|
libero, a pharetra augue.
|
|
@@ -41,11 +39,11 @@ describe("Grid Accessibility", () => {
|
|
|
41
39
|
<Card
|
|
42
40
|
imageProps={{
|
|
43
41
|
alt: "Alt text",
|
|
44
|
-
aspectRatio:
|
|
42
|
+
aspectRatio: "twoByOne",
|
|
45
43
|
src: "https://placeimg.com/400/240/animals",
|
|
46
44
|
}}
|
|
47
45
|
>
|
|
48
|
-
<CardHeading level=
|
|
46
|
+
<CardHeading level="three">Card Heading</CardHeading>
|
|
49
47
|
<CardContent>
|
|
50
48
|
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
51
49
|
libero, a pharetra augue.
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { chakra, SimpleGrid as ChakraSimpleGrid } from "@chakra-ui/react";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export type GridGaps =
|
|
5
|
+
| "grid.xxs"
|
|
6
|
+
| "grid.xs"
|
|
7
|
+
| "grid.s"
|
|
8
|
+
| "grid.m"
|
|
9
|
+
| "grid.l"
|
|
10
|
+
| "grid.xl"
|
|
11
|
+
| "grid.xxl";
|
|
5
12
|
export interface SimpleGridProps {
|
|
6
13
|
/** Additional class name. */
|
|
7
14
|
className?: string;
|
|
8
|
-
/** Optional numeric value to override the default column count; the default
|
|
15
|
+
/** Optional numeric value to override the default column count; the default
|
|
16
|
+
* column count is 3. */
|
|
9
17
|
columns?: number;
|
|
10
|
-
/** Optional gap size; if omitted, the default `large` (2rem / 32px) spacing
|
|
18
|
+
/** Optional gap size; if omitted, the default `large` (2rem / 32px) spacing
|
|
19
|
+
* will be used; `IMPORTANT: for standard grid layouts, this prop should
|
|
20
|
+
* not be used.` */
|
|
11
21
|
gap?: GridGaps;
|
|
12
22
|
/** ID that other components can cross reference for accessibility purposes */
|
|
13
23
|
id?: string;
|
|
@@ -15,14 +25,7 @@ export interface SimpleGridProps {
|
|
|
15
25
|
|
|
16
26
|
export const SimpleGrid = chakra(
|
|
17
27
|
(props: React.PropsWithChildren<SimpleGridProps>) => {
|
|
18
|
-
const {
|
|
19
|
-
children,
|
|
20
|
-
columns,
|
|
21
|
-
className,
|
|
22
|
-
gap = GridGaps.Large,
|
|
23
|
-
id,
|
|
24
|
-
...rest
|
|
25
|
-
} = props;
|
|
28
|
+
const { children, columns, className, gap = "grid.l", id, ...rest } = props;
|
|
26
29
|
|
|
27
30
|
const responsiveCols = columns
|
|
28
31
|
? { base: 1, md: columns }
|
|
@@ -8,18 +8,7 @@ import {
|
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
10
|
import Heading from "./Heading";
|
|
11
|
-
import { HeadingSizes, HeadingLevels } from "./HeadingTypes";
|
|
12
11
|
import { getCategory } from "../../utils/componentCategories";
|
|
13
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
14
|
-
|
|
15
|
-
export const sizesEnumValues = getStorybookEnumValues(
|
|
16
|
-
HeadingSizes,
|
|
17
|
-
"HeadingSizes"
|
|
18
|
-
);
|
|
19
|
-
export const levelsEnumValues = getStorybookEnumValues(
|
|
20
|
-
HeadingLevels,
|
|
21
|
-
"HeadingLevels"
|
|
22
|
-
);
|
|
23
12
|
|
|
24
13
|
<Meta
|
|
25
14
|
title={getCategory("Heading")}
|
|
@@ -33,17 +22,10 @@ export const levelsEnumValues = getStorybookEnumValues(
|
|
|
33
22
|
jest: ["Heading.test.tsx"],
|
|
34
23
|
}}
|
|
35
24
|
argTypes={{
|
|
36
|
-
additionalStyles: { control: false },
|
|
37
25
|
className: { control: false },
|
|
38
26
|
id: { control: false },
|
|
39
27
|
level: {
|
|
40
|
-
|
|
41
|
-
options: levelsEnumValues.options,
|
|
42
|
-
table: { defaultValue: { summary: "HeadingLevels.Two" } },
|
|
43
|
-
},
|
|
44
|
-
size: {
|
|
45
|
-
control: { type: "select" },
|
|
46
|
-
options: sizesEnumValues.options,
|
|
28
|
+
table: { defaultValue: { summary: "two" } },
|
|
47
29
|
},
|
|
48
30
|
}}
|
|
49
31
|
/>
|
|
@@ -53,7 +35,7 @@ export const levelsEnumValues = getStorybookEnumValues(
|
|
|
53
35
|
| Component Version | DS Version |
|
|
54
36
|
| ----------------- | ---------- |
|
|
55
37
|
| Added | `0.0.4` |
|
|
56
|
-
| Latest | `0.
|
|
38
|
+
| Latest | `0.28.0` |
|
|
57
39
|
|
|
58
40
|
## Table of Contents
|
|
59
41
|
|
|
@@ -79,23 +61,16 @@ semantic elements can be overwritten using the `size` prop.
|
|
|
79
61
|
<Story
|
|
80
62
|
name="Heading with Controls"
|
|
81
63
|
args={{
|
|
82
|
-
additionalStyles: undefined,
|
|
83
64
|
className: undefined,
|
|
84
65
|
id: "heading-id",
|
|
85
|
-
level: "
|
|
66
|
+
level: "two",
|
|
86
67
|
size: undefined,
|
|
87
68
|
text: "Default Heading",
|
|
88
69
|
url: undefined,
|
|
89
70
|
urlClass: undefined,
|
|
90
71
|
}}
|
|
91
72
|
>
|
|
92
|
-
{(args) =>
|
|
93
|
-
<Heading
|
|
94
|
-
{...args}
|
|
95
|
-
level={levelsEnumValues.getValue(args.level)}
|
|
96
|
-
size={args.size && sizesEnumValues.getValue(args.size)}
|
|
97
|
-
/>
|
|
98
|
-
)}
|
|
73
|
+
{(args) => <Heading {...args} />}
|
|
99
74
|
</Story>
|
|
100
75
|
</Canvas>
|
|
101
76
|
|
|
@@ -125,36 +100,16 @@ Resources:
|
|
|
125
100
|
<Canvas>
|
|
126
101
|
<Story name="Default Heading Styles">
|
|
127
102
|
<div>
|
|
128
|
-
<Heading
|
|
129
|
-
|
|
130
|
-
level={HeadingLevels.One}
|
|
131
|
-
text="<h1> Heading 1 - HeadingLevels.One"
|
|
132
|
-
/>
|
|
133
|
-
<Heading
|
|
134
|
-
id="heading-two"
|
|
135
|
-
level={HeadingLevels.Two}
|
|
136
|
-
text="<h2> Heading 2 - HeadingLevels.Two"
|
|
137
|
-
/>
|
|
103
|
+
<Heading id="heading-one" level="one" text="<h1> Heading 1 - 'one'" />
|
|
104
|
+
<Heading id="heading-two" level="two" text="<h2> Heading 2 - 'two'" />
|
|
138
105
|
<Heading
|
|
139
106
|
id="heading-three"
|
|
140
|
-
level=
|
|
141
|
-
text="<h3> Heading 3 -
|
|
142
|
-
/>
|
|
143
|
-
<Heading
|
|
144
|
-
id="heading-four"
|
|
145
|
-
level={HeadingLevels.Four}
|
|
146
|
-
text="<h4> Heading 4 - HeadingLevels.Four"
|
|
147
|
-
/>
|
|
148
|
-
<Heading
|
|
149
|
-
id="heading-five"
|
|
150
|
-
level={HeadingLevels.Five}
|
|
151
|
-
text="<h5> Heading 5 - HeadingLevels.Five"
|
|
152
|
-
/>
|
|
153
|
-
<Heading
|
|
154
|
-
id="heading-six"
|
|
155
|
-
level={HeadingLevels.Six}
|
|
156
|
-
text="<h6> Heading 6 - HeadingLevels.Six"
|
|
107
|
+
level="three"
|
|
108
|
+
text="<h3> Heading 3 - 'three'"
|
|
157
109
|
/>
|
|
110
|
+
<Heading id="heading-four" level="four" text="<h4> Heading 4 - 'four'" />
|
|
111
|
+
<Heading id="heading-five" level="five" text="<h5> Heading 5 - 'five'" />
|
|
112
|
+
<Heading id="heading-six" level="six" text="<h6> Heading 6 - 'six'" />
|
|
158
113
|
</div>
|
|
159
114
|
</Story>
|
|
160
115
|
</Canvas>
|
|
@@ -162,34 +117,34 @@ Resources:
|
|
|
162
117
|
## Size Styles
|
|
163
118
|
|
|
164
119
|
Note: The `level` prop for the `Heading`s in the next example are all set to
|
|
165
|
-
`level=
|
|
120
|
+
`level="one"`.
|
|
166
121
|
|
|
167
122
|
<Canvas>
|
|
168
123
|
<Story name="Size Styles">
|
|
169
124
|
<div>
|
|
170
125
|
<Heading
|
|
171
126
|
id="heading-primary"
|
|
172
|
-
level=
|
|
173
|
-
size=
|
|
174
|
-
text="<h1>
|
|
127
|
+
level="one"
|
|
128
|
+
size="primary"
|
|
129
|
+
text="<h1> 'primary'"
|
|
175
130
|
/>
|
|
176
131
|
<Heading
|
|
177
132
|
id="heading-secondary"
|
|
178
|
-
level=
|
|
179
|
-
size=
|
|
180
|
-
text="<h1>
|
|
133
|
+
level="one"
|
|
134
|
+
size="secondary"
|
|
135
|
+
text="<h1> 'secondary'"
|
|
181
136
|
/>
|
|
182
137
|
<Heading
|
|
183
138
|
id="heading-tertiary"
|
|
184
|
-
level=
|
|
185
|
-
size=
|
|
186
|
-
text="<h1>
|
|
139
|
+
level="one"
|
|
140
|
+
size="tertiary"
|
|
141
|
+
text="<h1> 'tertiary'"
|
|
187
142
|
/>
|
|
188
143
|
<Heading
|
|
189
144
|
id="heading-callout"
|
|
190
|
-
level=
|
|
191
|
-
size=
|
|
192
|
-
text="<h1>
|
|
145
|
+
level="one"
|
|
146
|
+
size="callout"
|
|
147
|
+
text="<h1> 'callout'"
|
|
193
148
|
/>
|
|
194
149
|
</div>
|
|
195
150
|
</Story>
|
|
@@ -199,7 +154,7 @@ Note: The `level` prop for the `Heading`s in the next example are all set to
|
|
|
199
154
|
|
|
200
155
|
<Canvas>
|
|
201
156
|
<Story name="Heading with Bold Text">
|
|
202
|
-
<Heading id="headingWithBold" level=
|
|
157
|
+
<Heading id="headingWithBold" level="one">
|
|
203
158
|
<>
|
|
204
159
|
Heading with a <b>Bold</b> Word
|
|
205
160
|
</>
|
|
@@ -215,12 +170,12 @@ When the `url` prop is passed to `Heading`, a child `<a>` element is created and
|
|
|
215
170
|
<Story name="Headings with Links">
|
|
216
171
|
<Heading
|
|
217
172
|
id="heading-with-link-url"
|
|
218
|
-
level=
|
|
173
|
+
level="two"
|
|
219
174
|
text="Heading with URL Props"
|
|
220
175
|
url="http://apple.com"
|
|
221
176
|
urlClass="special-link"
|
|
222
177
|
/>
|
|
223
|
-
<Heading id="heading-with-link-child"
|
|
178
|
+
<Heading id="heading-with-link-child">
|
|
224
179
|
<>
|
|
225
180
|
Heading with a Word <a href="#hello">Link</a>
|
|
226
181
|
</>
|