@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
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import { LinkTypes } from "./LinkTypes";
|
|
5
4
|
import Icon from "../Icons/Icon";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
|
|
6
|
+
export type LinkTypes =
|
|
7
|
+
| "action"
|
|
8
|
+
| "backwards"
|
|
9
|
+
| "button"
|
|
10
|
+
| "default"
|
|
11
|
+
| "external"
|
|
12
|
+
| "forwards";
|
|
12
13
|
export interface LinkProps {
|
|
13
|
-
/** Optionally pass in additional Chakra-based styles. */
|
|
14
|
-
additionalStyles?: { [key: string]: any };
|
|
15
|
-
/** Additional attributes, such as `rel=nofollow`, to pass to the `<a>` tag. */
|
|
16
|
-
attributes?: { [key: string]: any };
|
|
17
14
|
/** Any child node passed to the component. */
|
|
18
15
|
children: React.ReactNode;
|
|
19
16
|
/** Additional class name to render in the `Link` component. */
|
|
@@ -28,21 +25,25 @@ export interface LinkProps {
|
|
|
28
25
|
|
|
29
26
|
/**
|
|
30
27
|
* Renders the `Link` children components with a direction arrow icon based
|
|
31
|
-
* on the `
|
|
28
|
+
* on the `"backwards"` or `"forwards"` `linkType` value.
|
|
32
29
|
*/
|
|
33
|
-
function getWithDirectionIcon(
|
|
30
|
+
function getWithDirectionIcon(
|
|
31
|
+
children: JSX.Element,
|
|
32
|
+
type: LinkTypes,
|
|
33
|
+
linkId: string
|
|
34
|
+
) {
|
|
34
35
|
let iconRotation;
|
|
35
36
|
let iconAlign;
|
|
36
37
|
let icon = null;
|
|
37
38
|
|
|
38
39
|
// An icon needs a position in order for it to be created and
|
|
39
40
|
// rendered in the link.
|
|
40
|
-
if (type ===
|
|
41
|
-
iconRotation =
|
|
42
|
-
iconAlign =
|
|
43
|
-
} else if (type ===
|
|
44
|
-
iconRotation =
|
|
45
|
-
iconAlign =
|
|
41
|
+
if (type === "backwards") {
|
|
42
|
+
iconRotation = "rotate90";
|
|
43
|
+
iconAlign = "left";
|
|
44
|
+
} else if (type === "forwards") {
|
|
45
|
+
iconRotation = "rotate270";
|
|
46
|
+
iconAlign = "right";
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
const iconId = `${linkId}-icon`;
|
|
@@ -53,29 +54,29 @@ function getWithDirectionIcon(children, type: LinkTypes, linkId) {
|
|
|
53
54
|
className="more-link"
|
|
54
55
|
iconRotation={iconRotation}
|
|
55
56
|
id={iconId}
|
|
56
|
-
name=
|
|
57
|
-
size=
|
|
57
|
+
name="arrow"
|
|
58
|
+
size="medium"
|
|
58
59
|
/>
|
|
59
60
|
);
|
|
60
61
|
|
|
61
62
|
return (
|
|
62
63
|
<>
|
|
63
|
-
{type ===
|
|
64
|
+
{type === "backwards" && icon}
|
|
64
65
|
{children}
|
|
65
|
-
{type ===
|
|
66
|
+
{type === "forwards" && icon}
|
|
66
67
|
</>
|
|
67
68
|
);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
function getExternalIcon(children, linkId) {
|
|
71
|
+
function getExternalIcon(children: JSX.Element, linkId: string) {
|
|
71
72
|
const iconId = `${linkId}-icon`;
|
|
72
73
|
const icon = (
|
|
73
74
|
<Icon
|
|
74
|
-
align={
|
|
75
|
+
align={"right"}
|
|
75
76
|
className="more-link"
|
|
76
77
|
id={iconId}
|
|
77
|
-
name=
|
|
78
|
-
size=
|
|
78
|
+
name="actionLaunch"
|
|
79
|
+
size="medium"
|
|
79
80
|
/>
|
|
80
81
|
);
|
|
81
82
|
|
|
@@ -93,25 +94,16 @@ function getExternalIcon(children, linkId) {
|
|
|
93
94
|
*/
|
|
94
95
|
export const Link = chakra(
|
|
95
96
|
React.forwardRef<HTMLAnchorElement, LinkProps>((props, ref: any) => {
|
|
96
|
-
const {
|
|
97
|
-
additionalStyles = {},
|
|
98
|
-
attributes,
|
|
99
|
-
children,
|
|
100
|
-
className,
|
|
101
|
-
href,
|
|
102
|
-
id,
|
|
103
|
-
type = LinkTypes.Default,
|
|
104
|
-
...rest
|
|
105
|
-
} = props;
|
|
97
|
+
const { children, className, href, id, type = "default", ...rest } = props;
|
|
106
98
|
|
|
107
99
|
// Merge the necessary props alongside any extra props for the
|
|
108
100
|
// anchor element.
|
|
109
101
|
const linkProps = {
|
|
110
102
|
id,
|
|
111
103
|
href,
|
|
112
|
-
...
|
|
104
|
+
...rest,
|
|
113
105
|
};
|
|
114
|
-
// The
|
|
106
|
+
// The "default" type.
|
|
115
107
|
let variant = "link";
|
|
116
108
|
|
|
117
109
|
if (typeof children === "string" && !href) {
|
|
@@ -119,28 +111,27 @@ export const Link = chakra(
|
|
|
119
111
|
}
|
|
120
112
|
|
|
121
113
|
if (
|
|
122
|
-
type ===
|
|
123
|
-
type ===
|
|
124
|
-
type ===
|
|
125
|
-
type ===
|
|
114
|
+
type === "action" ||
|
|
115
|
+
type === "forwards" ||
|
|
116
|
+
type === "backwards" ||
|
|
117
|
+
type === "external"
|
|
126
118
|
) {
|
|
127
119
|
variant = "moreLink";
|
|
128
|
-
} else if (type ===
|
|
120
|
+
} else if (type === "button") {
|
|
129
121
|
variant = "button";
|
|
130
122
|
}
|
|
131
123
|
const style = useStyleConfig("Link", { variant });
|
|
124
|
+
const rel = type === "external" ? "nofollow" : null;
|
|
125
|
+
const target = type === "external" ? "_blank" : null;
|
|
132
126
|
// Render with specific direction arrows if the type is
|
|
133
127
|
// Forwards or Backwards. Or render with the launch icon
|
|
134
128
|
// if the type is External. Otherwise, do not add an icon.
|
|
135
129
|
const newChildren =
|
|
136
|
-
((type ===
|
|
137
|
-
getWithDirectionIcon(children, type, id)) ||
|
|
138
|
-
(type ===
|
|
130
|
+
((type === "forwards" || type === "backwards") &&
|
|
131
|
+
getWithDirectionIcon(children as JSX.Element, type, id)) ||
|
|
132
|
+
(type === "external" && getExternalIcon(children as JSX.Element, id)) ||
|
|
139
133
|
children;
|
|
140
134
|
|
|
141
|
-
const rel = type === LinkTypes.External ? "nofollow" : null;
|
|
142
|
-
const target = type === LinkTypes.External ? "_blank" : null;
|
|
143
|
-
|
|
144
135
|
if (!href) {
|
|
145
136
|
// React Types error makes this fail:
|
|
146
137
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/32832
|
|
@@ -151,7 +142,7 @@ export const Link = chakra(
|
|
|
151
142
|
const childrenToClone: any = children[0] ? children[0] : children;
|
|
152
143
|
const childProps = childrenToClone.props;
|
|
153
144
|
return (
|
|
154
|
-
<Box as="span" __css={style}
|
|
145
|
+
<Box as="span" __css={style}>
|
|
155
146
|
{React.cloneElement(
|
|
156
147
|
childrenToClone,
|
|
157
148
|
{
|
|
@@ -161,9 +152,6 @@ export const Link = chakra(
|
|
|
161
152
|
ref,
|
|
162
153
|
rel,
|
|
163
154
|
target,
|
|
164
|
-
// Useful if more styles are needed for the custom
|
|
165
|
-
// anchor element or link component.
|
|
166
|
-
style: additionalStyles,
|
|
167
155
|
},
|
|
168
156
|
[childrenToClone.props.children]
|
|
169
157
|
)}
|
|
@@ -178,8 +166,7 @@ export const Link = chakra(
|
|
|
178
166
|
rel={rel}
|
|
179
167
|
target={target}
|
|
180
168
|
{...linkProps}
|
|
181
|
-
__css={
|
|
182
|
-
{...rest}
|
|
169
|
+
__css={style}
|
|
183
170
|
>
|
|
184
171
|
{newChildren}
|
|
185
172
|
</Box>
|
|
@@ -115,7 +115,7 @@ exports[`Link renders the UI snapshot correctly 4`] = `
|
|
|
115
115
|
focusable={false}
|
|
116
116
|
id="external-link-icon"
|
|
117
117
|
role="img"
|
|
118
|
-
title="
|
|
118
|
+
title="actionLaunch icon"
|
|
119
119
|
viewBox="0 0 24 24"
|
|
120
120
|
>
|
|
121
121
|
<g
|
|
@@ -209,7 +209,6 @@ exports[`Link renders the UI snapshot correctly 7`] = `
|
|
|
209
209
|
href="#existing-anchor-tag"
|
|
210
210
|
id="anchor-link"
|
|
211
211
|
rel={null}
|
|
212
|
-
style={Object {}}
|
|
213
212
|
target={null}
|
|
214
213
|
>
|
|
215
214
|
check link
|
|
@@ -8,16 +8,10 @@ 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
11
|
import Image from "../Image/Image";
|
|
13
12
|
import Link from "../Link/Link";
|
|
14
|
-
import { LinkTypes } from "../Link/LinkTypes";
|
|
15
13
|
import List from "./List";
|
|
16
|
-
import { ListTypes } from "./ListTypes";
|
|
17
14
|
import { getCategory } from "../../utils/componentCategories";
|
|
18
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
19
|
-
|
|
20
|
-
export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
|
|
21
15
|
|
|
22
16
|
<Meta
|
|
23
17
|
title={getCategory("List")}
|
|
@@ -31,7 +25,6 @@ export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
|
|
|
31
25
|
jest: ["List.test.tsx"],
|
|
32
26
|
}}
|
|
33
27
|
argTypes={{
|
|
34
|
-
additionalStyles: { control: false },
|
|
35
28
|
children: { table: { disable: true } },
|
|
36
29
|
className: { control: false },
|
|
37
30
|
id: { control: false },
|
|
@@ -39,9 +32,7 @@ export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
|
|
|
39
32
|
listItems: { control: false },
|
|
40
33
|
noStyling: { table: { defaultValue: { summary: false } } },
|
|
41
34
|
type: {
|
|
42
|
-
|
|
43
|
-
options: enumValues.options,
|
|
44
|
-
table: { defaultValue: { summary: "ListTypes.Unordered" } },
|
|
35
|
+
table: { defaultValue: { summary: "ul" } },
|
|
45
36
|
},
|
|
46
37
|
}}
|
|
47
38
|
/>
|
|
@@ -51,7 +42,7 @@ export const enumValues = getStorybookEnumValues(ListTypes, "ListTypes");
|
|
|
51
42
|
| Component Version | DS Version |
|
|
52
43
|
| ----------------- | ---------- |
|
|
53
44
|
| Added | `0.7.0` |
|
|
54
|
-
| Latest | `0.
|
|
45
|
+
| Latest | `0.28.0` |
|
|
55
46
|
|
|
56
47
|
## Table of Contents
|
|
57
48
|
|
|
@@ -154,19 +145,18 @@ export const descriptions = [
|
|
|
154
145
|
<Story
|
|
155
146
|
name="List with Controls"
|
|
156
147
|
args={{
|
|
157
|
-
additionalStyles: undefined,
|
|
158
148
|
className: undefined,
|
|
159
149
|
id: "nypl-list",
|
|
160
150
|
inline: false,
|
|
161
151
|
listItems: undefined,
|
|
162
152
|
noStyling: false,
|
|
163
153
|
title: "Middle-Earth Peoples",
|
|
164
|
-
type: "
|
|
154
|
+
type: "ul",
|
|
165
155
|
}}
|
|
166
156
|
>
|
|
167
157
|
{(args) => (
|
|
168
|
-
<List {...args}
|
|
169
|
-
{args.type !== "
|
|
158
|
+
<List {...args}>
|
|
159
|
+
{args.type !== "dl"
|
|
170
160
|
? itemGroups.map((item, i) => <li key={i}>{item}</li>)
|
|
171
161
|
: descriptions.map((item, i) => [
|
|
172
162
|
<dt key={`dt_${i}`}>{item.term}</dt>,
|
|
@@ -205,12 +195,12 @@ may still use this name. In the Reservoir Design System, we will use the
|
|
|
205
195
|
- [W3C Using description lists](https://www.w3.org/WAI/WCAG21/Techniques/html/H40.html)
|
|
206
196
|
- [MDN dl: The Description List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl)
|
|
207
197
|
|
|
208
|
-
To render a description list, pass in `
|
|
209
|
-
|
|
210
|
-
|
|
198
|
+
To render a description list, pass in `"dl"` to the `type` prop. The optional
|
|
199
|
+
`title` prop will now render above the description list element. This type of
|
|
200
|
+
list renders `dt` and `dd` elements.
|
|
211
201
|
|
|
212
202
|
```jsx
|
|
213
|
-
<List type=
|
|
203
|
+
<List type="dl">
|
|
214
204
|
<dt>Term</dt>
|
|
215
205
|
<dd>Description</dd>
|
|
216
206
|
</List>
|
|
@@ -237,7 +227,7 @@ This type of list renders `dt` and `dd` elements.
|
|
|
237
227
|
}}
|
|
238
228
|
>
|
|
239
229
|
{(args) => (
|
|
240
|
-
<List {...args} type=
|
|
230
|
+
<List {...args} type="dl">
|
|
241
231
|
{descriptions.map((item, i) => [
|
|
242
232
|
<dt key={`dt_${i}`}>{item.term}</dt>,
|
|
243
233
|
<dd key={`dd_${i}`}>{item.description}</dd>,
|
|
@@ -271,7 +261,7 @@ An example with HTML elements inside of the `dd` elements.
|
|
|
271
261
|
}}
|
|
272
262
|
>
|
|
273
263
|
{(args) => (
|
|
274
|
-
<List {...args} type=
|
|
264
|
+
<List {...args} type="dl">
|
|
275
265
|
<dt>Authors</dt>
|
|
276
266
|
<dd>
|
|
277
267
|
<a href="#">Chirwa, Ephraim Wadonda, author</a>
|
|
@@ -320,14 +310,13 @@ children elements or the `listItems` prop should be passed but not both.
|
|
|
320
310
|
|
|
321
311
|
### Unordered and Ordered
|
|
322
312
|
|
|
323
|
-
For lists of type `
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
passed into `listItems`.
|
|
313
|
+
For lists of type `"ul"` (unorderd) or `"ol"` (ordered), `li` list item elements
|
|
314
|
+
can be passed as children. If that's not possible but the data to render is
|
|
315
|
+
stored as an array of strings, then that data array can be passed into `listItems`.
|
|
327
316
|
|
|
328
317
|
```jsx
|
|
329
318
|
<!-- With `li` elements -->
|
|
330
|
-
<List type={
|
|
319
|
+
<List type={ul}>
|
|
331
320
|
<li>Mahi-mahi</li>
|
|
332
321
|
<li>Golden trout</li>
|
|
333
322
|
<li>Rainbowfish</li>
|
|
@@ -336,19 +325,19 @@ passed into `listItems`.
|
|
|
336
325
|
|
|
337
326
|
<!-- With `itemList` data prop -->
|
|
338
327
|
const fishArray = ["Mahi-mahi", "Golden trout", "Rainbowfish", "Suckerfish"];
|
|
339
|
-
<List type={
|
|
328
|
+
<List type={ul} listItems={fishArray} />
|
|
340
329
|
```
|
|
341
330
|
|
|
342
331
|
### Description
|
|
343
332
|
|
|
344
|
-
For lists of type `
|
|
333
|
+
For lists of type `"dl"` (description), `dt` and `dd` elements can be
|
|
345
334
|
passed as children. If that's not possible but the data to render is stored as
|
|
346
335
|
an array of objects, then that data array can be passed into `listItems`. The
|
|
347
336
|
object must have two keys, `term` and `description`.
|
|
348
337
|
|
|
349
338
|
```jsx
|
|
350
339
|
// With `dt`/`dd` elements
|
|
351
|
-
<List type=
|
|
340
|
+
<List type="dl" title="Animal Crossing Fish">
|
|
352
341
|
<dt>Mahi-mahi</dt>
|
|
353
342
|
<dd>The mahi-mahi is an ocean fish known...</dd>
|
|
354
343
|
<dt>Golden trout</dt>
|
|
@@ -381,7 +370,7 @@ const fishDescriptions = [
|
|
|
381
370
|
<List
|
|
382
371
|
listItems={fishDescriptions}
|
|
383
372
|
title="Animal Crossing Fish"
|
|
384
|
-
type=
|
|
373
|
+
type="dl"
|
|
385
374
|
/>
|
|
386
375
|
```
|
|
387
376
|
|
|
@@ -399,6 +388,6 @@ const fishDescriptions = [
|
|
|
399
388
|
type: { control: false },
|
|
400
389
|
}}
|
|
401
390
|
>
|
|
402
|
-
{(args) => <List {...args} type=
|
|
391
|
+
{(args) => <List {...args} type="dl" />}
|
|
403
392
|
</Story>
|
|
404
393
|
</Canvas>
|
|
@@ -4,7 +4,6 @@ import { axe } from "jest-axe";
|
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
6
|
import List from "./List";
|
|
7
|
-
import { ListTypes } from "./ListTypes";
|
|
8
7
|
|
|
9
8
|
const fishArray = ["Mahi-mahi", "Golden trout", "Rainbowfish", "Suckerfish"];
|
|
10
9
|
const fishDescriptions = [
|
|
@@ -21,32 +20,32 @@ const fishDescriptions = [
|
|
|
21
20
|
describe("List Accessibility", () => {
|
|
22
21
|
it("passes axe accessibility test for unordered list", async () => {
|
|
23
22
|
const { container, rerender } = render(
|
|
24
|
-
<List type=
|
|
23
|
+
<List type="ul">
|
|
25
24
|
<li>Mahi-mahi</li>
|
|
26
25
|
<li>Golden trout</li>
|
|
27
26
|
</List>
|
|
28
27
|
);
|
|
29
28
|
expect(await axe(container)).toHaveNoViolations();
|
|
30
29
|
|
|
31
|
-
rerender(<List type=
|
|
30
|
+
rerender(<List type="ul" listItems={fishArray} />);
|
|
32
31
|
expect(await axe(container)).toHaveNoViolations();
|
|
33
32
|
});
|
|
34
33
|
it("passes axe accessibility test for ordered list", async () => {
|
|
35
34
|
const { container, rerender } = render(
|
|
36
|
-
<List type=
|
|
35
|
+
<List type="ol">
|
|
37
36
|
<li>Mahi-mahi</li>
|
|
38
37
|
<li>Golden trout</li>
|
|
39
38
|
</List>
|
|
40
39
|
);
|
|
41
40
|
expect(await axe(container)).toHaveNoViolations();
|
|
42
41
|
|
|
43
|
-
rerender(<List type=
|
|
42
|
+
rerender(<List type="ol" listItems={fishArray} />);
|
|
44
43
|
expect(await axe(container)).toHaveNoViolations();
|
|
45
44
|
});
|
|
46
45
|
it("passes axe accessibility test for description list", async () => {
|
|
47
46
|
const { container } = render(
|
|
48
47
|
<List
|
|
49
|
-
type=
|
|
48
|
+
type="dl"
|
|
50
49
|
title="Animal Crossing Fish"
|
|
51
50
|
listItems={fishDescriptions}
|
|
52
51
|
/>
|
|
@@ -58,7 +57,7 @@ describe("List Accessibility", () => {
|
|
|
58
57
|
describe("List", () => {
|
|
59
58
|
it("renders unordered list", () => {
|
|
60
59
|
render(
|
|
61
|
-
<List type=
|
|
60
|
+
<List type="ul">
|
|
62
61
|
<li>Mahi-mahi</li>
|
|
63
62
|
<li>Golden trout</li>
|
|
64
63
|
</List>
|
|
@@ -70,7 +69,7 @@ describe("List", () => {
|
|
|
70
69
|
});
|
|
71
70
|
|
|
72
71
|
it("renders unordered list with the `listItems` prop", () => {
|
|
73
|
-
render(<List type=
|
|
72
|
+
render(<List type="ul" listItems={fishArray} />);
|
|
74
73
|
|
|
75
74
|
expect(screen.getAllByRole("listitem")).toHaveLength(4);
|
|
76
75
|
expect(screen.getByText("Mahi-mahi")).toBeInTheDocument();
|
|
@@ -81,7 +80,7 @@ describe("List", () => {
|
|
|
81
80
|
|
|
82
81
|
it("renders ordered list", () => {
|
|
83
82
|
render(
|
|
84
|
-
<List type=
|
|
83
|
+
<List type="ol">
|
|
85
84
|
<li>Mahi-mahi</li>
|
|
86
85
|
<li>Golden trout</li>
|
|
87
86
|
</List>
|
|
@@ -93,7 +92,7 @@ describe("List", () => {
|
|
|
93
92
|
});
|
|
94
93
|
|
|
95
94
|
it("renders ordered list with the `listItems` prop", () => {
|
|
96
|
-
render(<List type=
|
|
95
|
+
render(<List type="ol" listItems={fishArray} />);
|
|
97
96
|
|
|
98
97
|
expect(screen.getAllByRole("listitem")).toHaveLength(4);
|
|
99
98
|
expect(screen.getByText("Mahi-mahi")).toBeInTheDocument();
|
|
@@ -104,7 +103,7 @@ describe("List", () => {
|
|
|
104
103
|
|
|
105
104
|
it("returns description list", () => {
|
|
106
105
|
render(
|
|
107
|
-
<List type=
|
|
106
|
+
<List type="dl">
|
|
108
107
|
<dt>Mahi-mahi</dt>
|
|
109
108
|
<dd>The mahi-mahi is an ocean fish known...</dd>
|
|
110
109
|
</List>
|
|
@@ -119,7 +118,7 @@ describe("List", () => {
|
|
|
119
118
|
it("returns description list with the `listItems` prop", () => {
|
|
120
119
|
render(
|
|
121
120
|
<List
|
|
122
|
-
type=
|
|
121
|
+
type="dl"
|
|
123
122
|
title="Animal Crossing Fish"
|
|
124
123
|
listItems={fishDescriptions}
|
|
125
124
|
/>
|
|
@@ -130,7 +129,7 @@ describe("List", () => {
|
|
|
130
129
|
it("consoles a warning when children and the `listItems` prop are both passed", () => {
|
|
131
130
|
const warn = jest.spyOn(console, "warn");
|
|
132
131
|
render(
|
|
133
|
-
<List type=
|
|
132
|
+
<List type="ol" listItems={fishArray}>
|
|
134
133
|
<li>Mahi-mahi</li>
|
|
135
134
|
<li>Golden trout</li>
|
|
136
135
|
<li>Rainbowfish</li>
|
|
@@ -145,7 +144,7 @@ describe("List", () => {
|
|
|
145
144
|
|
|
146
145
|
it("consoles a warning when no children are passed or the `listItems` prop is not passed", () => {
|
|
147
146
|
const warn = jest.spyOn(console, "warn");
|
|
148
|
-
render(<List type=
|
|
147
|
+
render(<List type="ol"></List>);
|
|
149
148
|
expect(warn).toHaveBeenCalledWith(
|
|
150
149
|
"NYPL Reservoir List: Pass in either `<li>` children or pass data in " +
|
|
151
150
|
"the `listItems` prop, not both."
|
|
@@ -155,7 +154,7 @@ describe("List", () => {
|
|
|
155
154
|
it("consoles a warning when you pass an ordered or unordered list children that aren't <li>s", () => {
|
|
156
155
|
const warn = jest.spyOn(console, "warn");
|
|
157
156
|
render(
|
|
158
|
-
<List type=
|
|
157
|
+
<List type="ol">
|
|
159
158
|
<span>Mahi-mahi</span>
|
|
160
159
|
<span>Golden trout</span>
|
|
161
160
|
<span>Rainbowfish</span>
|
|
@@ -169,7 +168,7 @@ describe("List", () => {
|
|
|
169
168
|
it("consoles a warning when you pass a description list children that aren't `<dt>`s or `<dd>`s", () => {
|
|
170
169
|
const warn = jest.spyOn(console, "warn");
|
|
171
170
|
render(
|
|
172
|
-
<List type=
|
|
171
|
+
<List type="dl">
|
|
173
172
|
<span>Mahi-mahi</span>
|
|
174
173
|
<span>Golden trout</span>
|
|
175
174
|
<span>Rainbowfish</span>
|
|
@@ -183,34 +182,21 @@ describe("List", () => {
|
|
|
183
182
|
|
|
184
183
|
it("Renders the UI snapshot correctly", () => {
|
|
185
184
|
const unordered = renderer
|
|
186
|
-
.create(
|
|
187
|
-
<List id="unordered" type={ListTypes.Unordered} listItems={fishArray} />
|
|
188
|
-
)
|
|
185
|
+
.create(<List id="unordered" type="ul" listItems={fishArray} />)
|
|
189
186
|
.toJSON();
|
|
190
187
|
const unorderedNoStyling = renderer
|
|
191
|
-
.create(
|
|
192
|
-
<List
|
|
193
|
-
id="ordered"
|
|
194
|
-
type={ListTypes.Unordered}
|
|
195
|
-
listItems={fishArray}
|
|
196
|
-
noStyling
|
|
197
|
-
/>
|
|
198
|
-
)
|
|
188
|
+
.create(<List id="ordered" type="ul" listItems={fishArray} noStyling />)
|
|
199
189
|
.toJSON();
|
|
200
190
|
const ordered = renderer
|
|
201
191
|
.create(
|
|
202
|
-
<List
|
|
203
|
-
id="unordered-no-styling"
|
|
204
|
-
type={ListTypes.Ordered}
|
|
205
|
-
listItems={fishArray}
|
|
206
|
-
/>
|
|
192
|
+
<List id="unordered-no-styling" type="ol" listItems={fishArray} />
|
|
207
193
|
)
|
|
208
194
|
.toJSON();
|
|
209
195
|
const orderedNoStyling = renderer
|
|
210
196
|
.create(
|
|
211
197
|
<List
|
|
212
198
|
id="ordered-no-styling"
|
|
213
|
-
type=
|
|
199
|
+
type="ol"
|
|
214
200
|
listItems={fishArray}
|
|
215
201
|
noStyling
|
|
216
202
|
/>
|
|
@@ -220,7 +206,7 @@ describe("List", () => {
|
|
|
220
206
|
.create(
|
|
221
207
|
<List
|
|
222
208
|
id="description"
|
|
223
|
-
type=
|
|
209
|
+
type="dl"
|
|
224
210
|
title="Animal Crossing Fish"
|
|
225
211
|
listItems={fishDescriptions}
|
|
226
212
|
/>
|
|
@@ -230,7 +216,7 @@ describe("List", () => {
|
|
|
230
216
|
.create(
|
|
231
217
|
<List
|
|
232
218
|
id="chakra"
|
|
233
|
-
type=
|
|
219
|
+
type="ul"
|
|
234
220
|
listItems={fishArray}
|
|
235
221
|
p="20px"
|
|
236
222
|
color="ui.error.primary"
|
|
@@ -239,19 +225,14 @@ describe("List", () => {
|
|
|
239
225
|
.toJSON();
|
|
240
226
|
const withOtherPropsUnordered = renderer
|
|
241
227
|
.create(
|
|
242
|
-
<List
|
|
243
|
-
id="other"
|
|
244
|
-
type={ListTypes.Unordered}
|
|
245
|
-
listItems={fishArray}
|
|
246
|
-
data-testid="other"
|
|
247
|
-
/>
|
|
228
|
+
<List id="other" type="ul" listItems={fishArray} data-testid="other" />
|
|
248
229
|
)
|
|
249
230
|
.toJSON();
|
|
250
231
|
const withChakraPropsDescription = renderer
|
|
251
232
|
.create(
|
|
252
233
|
<List
|
|
253
234
|
id="chakra"
|
|
254
|
-
type=
|
|
235
|
+
type="dl"
|
|
255
236
|
title="Animal Crossing Fish"
|
|
256
237
|
listItems={fishDescriptions}
|
|
257
238
|
p="20px"
|
|
@@ -263,7 +244,7 @@ describe("List", () => {
|
|
|
263
244
|
.create(
|
|
264
245
|
<List
|
|
265
246
|
id="other"
|
|
266
|
-
type=
|
|
247
|
+
type="dl"
|
|
267
248
|
title="Animal Crossing Fish"
|
|
268
249
|
listItems={fishDescriptions}
|
|
269
250
|
data-testid="other"
|