@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
|
@@ -2,7 +2,6 @@ import { Meta } from "@storybook/addon-docs";
|
|
|
2
2
|
|
|
3
3
|
import Card from "../Card/Card";
|
|
4
4
|
import List from "../List/List";
|
|
5
|
-
import { ListTypes } from "../List/ListTypes";
|
|
6
5
|
import { getCategory } from "../../utils/componentCategories";
|
|
7
6
|
|
|
8
7
|
<Meta title={getCategory("Forms")} />
|
|
@@ -19,7 +18,8 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
19
18
|
|
|
20
19
|
## General Information
|
|
21
20
|
|
|
22
|
-
Use the [Form](https://nypl.github.io/nypl-design-system/
|
|
21
|
+
Use the [Form](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-form-elements-form--form-with-controls)
|
|
22
|
+
component to control the placement and spacing for standard HTML forms.
|
|
23
23
|
|
|
24
24
|
## Form Layout
|
|
25
25
|
|
|
@@ -2,7 +2,6 @@ import { Stack } from "@chakra-ui/react";
|
|
|
2
2
|
import { Canvas, Meta } from "@storybook/addon-docs";
|
|
3
3
|
|
|
4
4
|
import Icon from "../Icons/Icon";
|
|
5
|
-
import { IconColors, IconSizes, IconNames } from "../Icons/IconTypes";
|
|
6
5
|
import { getCategory } from "../../utils/componentCategories";
|
|
7
6
|
import DSProvider from "../../theme/provider";
|
|
8
7
|
|
|
@@ -21,124 +20,107 @@ import DSProvider from "../../theme/provider";
|
|
|
21
20
|
|
|
22
21
|
## General Information
|
|
23
22
|
|
|
24
|
-
Use the Reservoir Design System (DS) [Icon](https://nypl.github.io/nypl-design-system/
|
|
23
|
+
Use the Reservoir Design System (DS) [Icon](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-media-icons-icon--icon-with-controls)
|
|
25
24
|
component to render and control icons as `<svg>` elements within consuming apps.
|
|
26
25
|
|
|
27
26
|
The DS utilizes the `Filled` icons available in the [Material UI Design System](https://material-ui.com/components/material-icons/).
|
|
28
27
|
|
|
29
28
|
## Icon Examples
|
|
30
29
|
|
|
31
|
-
The graphic of the `Icon` component is handled through the `
|
|
32
|
-
for `Icon`, please refer to the [Icon](https://nypl.github.io/nypl-design-system/
|
|
30
|
+
The graphic of the `Icon` component is handled through the `name` prop. To see
|
|
31
|
+
all graphic options for `Icon`, please refer to the [Icon](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-media-icons-icon--icon-with-controls)
|
|
33
32
|
Storybook page.
|
|
34
33
|
|
|
35
34
|
<Canvas>
|
|
36
35
|
<DSProvider>
|
|
37
36
|
<Stack spacing="s" direction="row">
|
|
38
|
-
<Icon
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/>
|
|
43
|
-
<Icon
|
|
44
|
-
decorative
|
|
45
|
-
size={IconSizes.ExtraExtraExtraLarge}
|
|
46
|
-
name={IconNames.Close}
|
|
47
|
-
/>
|
|
48
|
-
<Icon
|
|
49
|
-
decorative
|
|
50
|
-
size={IconSizes.ExtraExtraExtraLarge}
|
|
51
|
-
name={IconNames.ErrorOutline}
|
|
52
|
-
/>
|
|
53
|
-
<Icon
|
|
54
|
-
decorative
|
|
55
|
-
size={IconSizes.ExtraExtraExtraLarge}
|
|
56
|
-
name={IconNames.SpeakerNotes}
|
|
57
|
-
/>
|
|
37
|
+
<Icon decorative size="xxxlarge" name="check" />
|
|
38
|
+
<Icon decorative size="xxxlarge" name="close" />
|
|
39
|
+
<Icon decorative size="xxxlarge" name="errorOutline" />
|
|
40
|
+
<Icon decorative size="xxxlarge" name="speakerNotes" />
|
|
58
41
|
</Stack>
|
|
59
42
|
</DSProvider>
|
|
60
43
|
</Canvas>
|
|
61
44
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
45
|
+
| Values for Examples Above |
|
|
46
|
+
| ------------------------- |
|
|
47
|
+
| `check` |
|
|
48
|
+
| `close` |
|
|
49
|
+
| `errorOutline` |
|
|
50
|
+
| `speakerNotes` |
|
|
68
51
|
|
|
69
52
|
## Icon Sizes
|
|
70
53
|
|
|
71
|
-
The size of the `Icon` component is handled through the `
|
|
54
|
+
The size of the `Icon` component is handled through the `size` prop.
|
|
72
55
|
|
|
73
56
|
<Canvas>
|
|
74
57
|
<DSProvider>
|
|
75
58
|
<Stack spacing="s" direction="row" alignItems="center">
|
|
76
|
-
<Icon size=
|
|
77
|
-
<Icon size=
|
|
78
|
-
<Icon size=
|
|
79
|
-
<Icon size=
|
|
80
|
-
<Icon size=
|
|
81
|
-
<Icon size=
|
|
59
|
+
<Icon size="small" name="check" />
|
|
60
|
+
<Icon size="medium" name="check" />
|
|
61
|
+
<Icon size="large" name="check" />
|
|
62
|
+
<Icon size="xlarge" name="check" />
|
|
63
|
+
<Icon size="xxlarge" name="check" />
|
|
64
|
+
<Icon size="xxxlarge" name="check" />
|
|
82
65
|
</Stack>
|
|
83
66
|
</DSProvider>
|
|
84
67
|
</Canvas>
|
|
85
68
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
69
|
+
| Value | CSS Value | CSS Variable |
|
|
70
|
+
| ---------- | ----------------- | ------------------ |
|
|
71
|
+
| `small` | `0.875rem` (14px) | n/a |
|
|
72
|
+
| `medium` | `1.125rem` (18px) | n/a |
|
|
73
|
+
| `large` | `1.5rem` (24px) | `--nypl-space-m` |
|
|
74
|
+
| `xlarge` | `2rem` (32px) | `--nypl-space-l` |
|
|
75
|
+
| `xxlarge` | `3rem` (48px) | `--nypl-space-xl` |
|
|
76
|
+
| `xxxlarge` | `4rem` (64px) | `--nypl-space-xxl` |
|
|
94
77
|
|
|
95
78
|
## Icon Colors
|
|
96
79
|
|
|
97
|
-
The color of the `Icon` component is handled through the `
|
|
98
|
-
|
|
80
|
+
The color of the `Icon` component is handled through the `color` prop. Icons in
|
|
81
|
+
NYPL projects should always be rendered with one color.
|
|
99
82
|
|
|
100
83
|
<Canvas>
|
|
101
84
|
<DSProvider>
|
|
102
85
|
<Stack spacing="s" direction="row">
|
|
103
|
-
<Icon size=
|
|
104
|
-
<Icon
|
|
105
|
-
|
|
106
|
-
size={IconSizes.ExtraExtraExtraLarge}
|
|
107
|
-
color={IconColors.BrandPrimary}
|
|
108
|
-
/>
|
|
109
|
-
<Icon
|
|
110
|
-
name={IconNames.Check}
|
|
111
|
-
size={IconSizes.ExtraExtraExtraLarge}
|
|
112
|
-
color={IconColors.SectionResearchPrimary}
|
|
113
|
-
/>
|
|
86
|
+
<Icon size="xxxlarge" name="check" />
|
|
87
|
+
<Icon name="check" size="xxxlarge" color="brand.primary" />
|
|
88
|
+
<Icon name="check" size="xxxlarge" color="section.research.primary" />
|
|
114
89
|
<Icon
|
|
115
|
-
name=
|
|
116
|
-
size=
|
|
117
|
-
color=
|
|
90
|
+
name="check"
|
|
91
|
+
size="xxxlarge"
|
|
92
|
+
color="section.research-library.schwartzman"
|
|
118
93
|
/>
|
|
119
94
|
<Icon
|
|
120
|
-
name=
|
|
121
|
-
size=
|
|
122
|
-
color=
|
|
95
|
+
name="check"
|
|
96
|
+
size="xxxlarge"
|
|
97
|
+
color="section.research-library.schomburg"
|
|
123
98
|
/>
|
|
124
99
|
</Stack>
|
|
125
100
|
</DSProvider>
|
|
126
101
|
</Canvas>
|
|
127
102
|
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
103
|
+
| Value | CSS Variable |
|
|
104
|
+
| -------------------------------------- | ---------------------------------------------------- |
|
|
105
|
+
| `ui.black` | `--nypl-colors-ui-black` |
|
|
106
|
+
| `ui.white` | `--nypl-colors-ui-white` |
|
|
107
|
+
| `brand.primary` | `--nypl-colors-brand-primary` |
|
|
108
|
+
| `brand.secondary` | `--nypl-colors-brand-secondary` |
|
|
109
|
+
| `section.blogs.primary` | `--nypl-colors-section-blogs-primary` |
|
|
110
|
+
| `section.blogs.secondary` | `--nypl-colors-section-blogs-secondary` |
|
|
111
|
+
| `section.books-and-more.primary` | `--nypl-colors-section-books-and-more-primary` |
|
|
112
|
+
| `section.books-and-more.secondary` | `--nypl-colors-section-books-and-more-secondary` |
|
|
113
|
+
| `section.education.primary` | `--nypl-colors-section-education-primary` |
|
|
114
|
+
| `section.education.secondary` | `--nypl-colors-section-education-secondary` |
|
|
115
|
+
| `section.locations.primary` | `--nypl-colors-section-locations-primary` |
|
|
116
|
+
| `section.locations.secondary` | `--nypl-colors-section-locations-secondary` |
|
|
117
|
+
| `section.research.primary` | `--nypl-colors-section-research-primary` |
|
|
118
|
+
| `section.research.secondary` | `--nypl-colors-section-research-secondary` |
|
|
119
|
+
| `section.research-library.lpa` | `--nypl-colors-section-research-library-lpa` |
|
|
120
|
+
| `section.research.library.schomburg` | `--nypl-colors-section-research-library-schomburg` |
|
|
121
|
+
| `section.research.library.schwartzman` | `--nypl-colors-section-research-library-schwartzman` |
|
|
122
|
+
| `section.whats-on.primary` | `--nypl-colors-section-whats-on-primary` |
|
|
123
|
+
| `section.whats-on.secondary` | `--nypl-colors-section-whats-on-secondary` |
|
|
142
124
|
|
|
143
125
|
## Development Notes
|
|
144
126
|
|
|
@@ -2,7 +2,6 @@ import { Meta } from "@storybook/addon-docs";
|
|
|
2
2
|
|
|
3
3
|
import Card from "../Card/Card";
|
|
4
4
|
import List from "../List/List";
|
|
5
|
-
import { ListTypes } from "../List/ListTypes";
|
|
6
5
|
import { getCategory } from "../../utils/componentCategories";
|
|
7
6
|
import DSProvider from "../../theme/provider";
|
|
8
7
|
|
|
@@ -69,7 +68,7 @@ between elements, both horizontal and vertical, should be `2rem`.
|
|
|
69
68
|
|
|
70
69
|
Form input components should have a `2rem` space between each form input
|
|
71
70
|
component. This includes both vertical (column) and horizontal (row) stacking.
|
|
72
|
-
The DS [Form](https://nypl.github.io/nypl-design-system/
|
|
71
|
+
The DS [Form](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-form-elements-form--form-with-controls)
|
|
73
72
|
component has correct spacing incorporated into its UI structure and should
|
|
74
73
|
always be used when building forms. Please note that the spacing in the `Form`
|
|
75
74
|
component is identical to the spacing in the `Grid` component.
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Canvas, Meta } from "@storybook/addon-docs";
|
|
2
2
|
|
|
3
3
|
import Heading from "../Heading/Heading";
|
|
4
|
-
import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
5
4
|
import List from "../List/List";
|
|
6
|
-
import { ListTypes } from "../List/ListTypes";
|
|
7
5
|
import Text from "../Text/Text";
|
|
8
|
-
import { TextSizes } from "../Text/TextTypes";
|
|
9
6
|
import { getCategory } from "../../utils/componentCategories";
|
|
10
7
|
import DSProvider from "../../theme/provider";
|
|
11
8
|
|
|
@@ -43,10 +40,10 @@ set the specific `<h>` tag that you require.
|
|
|
43
40
|
|
|
44
41
|
<Canvas>
|
|
45
42
|
<DSProvider>
|
|
46
|
-
<Heading level=
|
|
47
|
-
<Heading level=
|
|
48
|
-
<Heading level=
|
|
49
|
-
<Heading level=
|
|
43
|
+
<Heading level="one">Heading Level 1</Heading>
|
|
44
|
+
<Heading level="two">Heading Level 2</Heading>
|
|
45
|
+
<Heading level="three">Heading Level 3</Heading>
|
|
46
|
+
<Heading level="four">Heading Level 4</Heading>
|
|
50
47
|
</DSProvider>
|
|
51
48
|
</Canvas>
|
|
52
49
|
|
|
@@ -61,7 +58,7 @@ elements. For example, the `h1` element has the `Primary` style applied by defau
|
|
|
61
58
|
but a new style can be applied through the `size` prop. Any `size` style can be
|
|
62
59
|
applied to any `Heading` element.
|
|
63
60
|
|
|
64
|
-
<Heading level=
|
|
61
|
+
<Heading level="one" size="primary">
|
|
65
62
|
Primary Heading
|
|
66
63
|
</Heading>
|
|
67
64
|
|
|
@@ -71,7 +68,7 @@ applied to any `Heading` element.
|
|
|
71
68
|
| **Font Weight** | `300` | `fontWeight: "heading.primary"` | `font-weight: var(--nypl-fontWeights-heading-primary)` |
|
|
72
69
|
| **Line Height** | `1.1` | n/a | n/a |
|
|
73
70
|
|
|
74
|
-
<Heading level=
|
|
71
|
+
<Heading level="one" size="secondary">
|
|
75
72
|
Secondary Heading
|
|
76
73
|
</Heading>
|
|
77
74
|
|
|
@@ -81,7 +78,7 @@ applied to any `Heading` element.
|
|
|
81
78
|
| **Font Weight** | `500` | `fontWeight: "heading.secondary"` | `font-weight: var(--nypl-fontWeights-heading-secondary)` |
|
|
82
79
|
| **Line Height** | `1.25` | n/a | n/a |
|
|
83
80
|
|
|
84
|
-
<Heading level=
|
|
81
|
+
<Heading level="one" size="tertiary">
|
|
85
82
|
Tertiary Heading
|
|
86
83
|
</Heading>
|
|
87
84
|
|
|
@@ -91,7 +88,7 @@ applied to any `Heading` element.
|
|
|
91
88
|
| **Font Weight** | `500` | `fontWeight: "heading.tertiary"` | `font-weight: var(--nypl-fontWeights-heading-tertiary)` |
|
|
92
89
|
| **Line Height** | `1.25` | n/a | n/a |
|
|
93
90
|
|
|
94
|
-
<Heading level=
|
|
91
|
+
<Heading level="one" size="callout">
|
|
95
92
|
Callout Heading
|
|
96
93
|
</Heading>
|
|
97
94
|
|
|
@@ -129,7 +126,7 @@ The `size` prop can be used to render a specific style from the DS default text
|
|
|
129
126
|
- [Typography: Body Styles](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10975%3A52)
|
|
130
127
|
- [Typography: Other Styles](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10975%3A100)
|
|
131
128
|
|
|
132
|
-
<Text size=
|
|
129
|
+
<Text size="default">Default</Text>
|
|
133
130
|
|
|
134
131
|
| | Value | JS Theme Object | CSS Variable |
|
|
135
132
|
| --------------- | ------ | ---------------------------- | --------------------------------------------------- |
|
|
@@ -137,7 +134,7 @@ The `size` prop can be used to render a specific style from the DS default text
|
|
|
137
134
|
| **Font Weight** | `300` | `fontWeight: "text.default"` | `font-weight: var(--nypl-fontWeights-text-default)` |
|
|
138
135
|
| **Line Height** | `1.5` | `fontWeight: 1.5` | `font-weight: 1.5` |
|
|
139
136
|
|
|
140
|
-
<Text size=
|
|
137
|
+
<Text size="caption">Caption</Text>
|
|
141
138
|
|
|
142
139
|
| | Value | JS Theme Object | CSS Variable |
|
|
143
140
|
| --------------- | ---------- | ---------------------------- | --------------------------------------------------- |
|
|
@@ -145,7 +142,7 @@ The `size` prop can be used to render a specific style from the DS default text
|
|
|
145
142
|
| **Font Weight** | `300` | `fontWeight: "text.caption"` | `font-weight: var(--nypl-fontWeights-text-caption)` |
|
|
146
143
|
| **Line Height** | `1.25` | `fontWeight: 1.25` | `font-weight: 1.25` |
|
|
147
144
|
|
|
148
|
-
<Text size=
|
|
145
|
+
<Text size="tag">Tag</Text>
|
|
149
146
|
|
|
150
147
|
| | Value | JS Theme Object | CSS Variable |
|
|
151
148
|
| --------------- | --------- | ------------------------ | ----------------------------------------------- |
|
|
@@ -153,7 +150,7 @@ The `size` prop can be used to render a specific style from the DS default text
|
|
|
153
150
|
| **Font Weight** | `400` | `fontWeight: "text.tag"` | `font-weight: var(--nypl-fontWeights-text-tag)` |
|
|
154
151
|
| **Line Height** | `1.5` | `fontWeight: 1.5` | `font-weight: 1.5` |
|
|
155
152
|
|
|
156
|
-
<Text size=
|
|
153
|
+
<Text size="mini">Mini</Text>
|
|
157
154
|
|
|
158
155
|
| | Value | JS Theme Object | CSS Variable |
|
|
159
156
|
| --------------- | ---------- | ------------------------- | ------------------------------------------------ |
|
|
@@ -195,7 +192,7 @@ black on a white background.
|
|
|
195
192
|
|
|
196
193
|
<Canvas>
|
|
197
194
|
<DSProvider>
|
|
198
|
-
<Heading level=
|
|
195
|
+
<Heading level="three">Default Heading Color</Heading>
|
|
199
196
|
<Text>
|
|
200
197
|
This paragraph shows the default body text color. Curabitur blandit tempus
|
|
201
198
|
porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur
|
|
@@ -208,7 +205,7 @@ black on a white background.
|
|
|
208
205
|
|
|
209
206
|
In cases where specific colors must be applied to text elements, the DS
|
|
210
207
|
provides CSS variables for the full NYPL color palette. Refer to the
|
|
211
|
-
[Colors](https://nypl.github.io/nypl-design-system/
|
|
208
|
+
[Colors](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/style-guide-colors--page)
|
|
212
209
|
section of the Style Guide for details.
|
|
213
210
|
|
|
214
211
|
## Font Weight
|
|
@@ -359,7 +356,7 @@ prepositions do not get capital letters unless they start the title. For example
|
|
|
359
356
|
|
|
360
357
|
<Canvas>
|
|
361
358
|
<DSProvider>
|
|
362
|
-
<List type=
|
|
359
|
+
<List type="ul">
|
|
363
360
|
<li>Snow White and the Seven Dwarfs</li>
|
|
364
361
|
<li>The Last of the Mohicans</li>
|
|
365
362
|
<li>Spooky Books for Kids: The Ultimate Creepy Guide</li>
|
|
@@ -377,7 +374,7 @@ prepositions do not get capital letters unless they start the title. For example
|
|
|
377
374
|
|
|
378
375
|
<Canvas>
|
|
379
376
|
<DSProvider>
|
|
380
|
-
<Heading level=
|
|
377
|
+
<Heading level="three">
|
|
381
378
|
This is a Long Title to Show What 58 Characters Looks Like
|
|
382
379
|
</Heading>
|
|
383
380
|
</DSProvider>
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "@storybook/addon-docs";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
|
+
import Image from "../Image/Image";
|
|
10
11
|
import Table from "./Table";
|
|
11
12
|
import DSProvider from "../../theme/provider";
|
|
12
13
|
import { getCategory } from "../../utils/componentCategories";
|
|
@@ -36,7 +37,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
36
37
|
| Component Version | DS Version |
|
|
37
38
|
| ----------------- | ---------- |
|
|
38
39
|
| Added | `0.25.9` |
|
|
39
|
-
| Latest | `0.
|
|
40
|
+
| Latest | `0.28.0` |
|
|
40
41
|
|
|
41
42
|
## Table of Contents
|
|
42
43
|
|
|
@@ -47,6 +48,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
47
48
|
- [With Row Dividers](#with-row-dividers)
|
|
48
49
|
- [With Row Headers](#with-row-headers)
|
|
49
50
|
- [With Custom Header Colors](#with-custom-header-colors)
|
|
51
|
+
- [With JSX Elements](#with-jsx-elements)
|
|
50
52
|
|
|
51
53
|
## Overview
|
|
52
54
|
|
|
@@ -190,3 +192,85 @@ color contrast.
|
|
|
190
192
|
/>
|
|
191
193
|
</DSProvider>
|
|
192
194
|
</Canvas>
|
|
195
|
+
|
|
196
|
+
## With JSX Elements
|
|
197
|
+
|
|
198
|
+
export const characterHeaders = ["First Name", "Last Name", "Avatar"];
|
|
199
|
+
export const charactersData = [
|
|
200
|
+
[
|
|
201
|
+
"Tom",
|
|
202
|
+
"Nook",
|
|
203
|
+
<Image
|
|
204
|
+
alt="Tom Nook"
|
|
205
|
+
size="small"
|
|
206
|
+
src="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
207
|
+
/>,
|
|
208
|
+
],
|
|
209
|
+
[
|
|
210
|
+
"Isabelle",
|
|
211
|
+
"-",
|
|
212
|
+
,
|
|
213
|
+
<Image
|
|
214
|
+
alt="Isabelle"
|
|
215
|
+
size="small"
|
|
216
|
+
src="https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
217
|
+
/>,
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
"K.K.",
|
|
221
|
+
"Slider",
|
|
222
|
+
,
|
|
223
|
+
<Image
|
|
224
|
+
alt="K.K Slider"
|
|
225
|
+
size="small"
|
|
226
|
+
src="https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
227
|
+
/>,
|
|
228
|
+
],
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
It's possible to pass in JSX elements in the `tableData` prop.
|
|
232
|
+
|
|
233
|
+
```jsx
|
|
234
|
+
export const charactersData = [
|
|
235
|
+
[
|
|
236
|
+
"Tom",
|
|
237
|
+
"Nook",
|
|
238
|
+
<Image
|
|
239
|
+
alt="Tom Nook"
|
|
240
|
+
size="small"
|
|
241
|
+
src="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
242
|
+
/>,
|
|
243
|
+
],
|
|
244
|
+
[
|
|
245
|
+
"Isabelle",
|
|
246
|
+
"-",
|
|
247
|
+
,
|
|
248
|
+
<Image
|
|
249
|
+
alt="Isabelle"
|
|
250
|
+
size="small"
|
|
251
|
+
src="https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
252
|
+
/>,
|
|
253
|
+
],
|
|
254
|
+
[
|
|
255
|
+
"K.K.",
|
|
256
|
+
"Slider",
|
|
257
|
+
,
|
|
258
|
+
<Image
|
|
259
|
+
alt="K.K Slider"
|
|
260
|
+
size="small"
|
|
261
|
+
src="https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
262
|
+
/>,
|
|
263
|
+
],
|
|
264
|
+
];
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
<Canvas>
|
|
268
|
+
<DSProvider>
|
|
269
|
+
<Table
|
|
270
|
+
columnHeaders={characterHeaders}
|
|
271
|
+
id="jsx-example"
|
|
272
|
+
showRowDividers
|
|
273
|
+
tableData={charactersData}
|
|
274
|
+
/>
|
|
275
|
+
</DSProvider>
|
|
276
|
+
</Canvas>
|
|
@@ -3,6 +3,7 @@ import { render, screen } from "@testing-library/react";
|
|
|
3
3
|
import { axe } from "jest-axe";
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
|
+
import Image from "../Image/Image";
|
|
6
7
|
import Table from "./Table";
|
|
7
8
|
|
|
8
9
|
export const columnHeaders = [
|
|
@@ -14,7 +15,6 @@ export const columnHeaders = [
|
|
|
14
15
|
"Zipcode",
|
|
15
16
|
"State",
|
|
16
17
|
];
|
|
17
|
-
|
|
18
18
|
export const tableData = [
|
|
19
19
|
["Tom", "Nook", "Tanukichi", "Main Street", "New York", "23458", "NY"],
|
|
20
20
|
["Isabelle", "-", "Shizue", "Walnut Street", "New York", "23458", "NY"],
|
|
@@ -29,6 +29,41 @@ export const tableData = [
|
|
|
29
29
|
"NY",
|
|
30
30
|
],
|
|
31
31
|
];
|
|
32
|
+
export const characterHeaders = ["First Name", "Last Name", "Avatar"];
|
|
33
|
+
export const charactersData = [
|
|
34
|
+
[
|
|
35
|
+
"Tom",
|
|
36
|
+
"Nook",
|
|
37
|
+
<Image
|
|
38
|
+
alt="Tom Nook"
|
|
39
|
+
key="tom"
|
|
40
|
+
size="small"
|
|
41
|
+
src="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
42
|
+
/>,
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
"Isabelle",
|
|
46
|
+
"-",
|
|
47
|
+
,
|
|
48
|
+
<Image
|
|
49
|
+
alt="Isabelle"
|
|
50
|
+
key="isa"
|
|
51
|
+
size="small"
|
|
52
|
+
src="https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
53
|
+
/>,
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
"K.K.",
|
|
57
|
+
"Slider",
|
|
58
|
+
,
|
|
59
|
+
<Image
|
|
60
|
+
alt="K.K Slider"
|
|
61
|
+
key="kk"
|
|
62
|
+
size="small"
|
|
63
|
+
src="https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
|
|
64
|
+
/>,
|
|
65
|
+
],
|
|
66
|
+
];
|
|
32
67
|
|
|
33
68
|
describe("Table Accessibility", () => {
|
|
34
69
|
it("passes axe accessibility test with the columnHeaders and tableData prop", async () => {
|
|
@@ -80,6 +115,17 @@ describe("Table", () => {
|
|
|
80
115
|
);
|
|
81
116
|
});
|
|
82
117
|
|
|
118
|
+
it("renders JSX elements from the data array", () => {
|
|
119
|
+
render(
|
|
120
|
+
<Table
|
|
121
|
+
columnHeaders={characterHeaders}
|
|
122
|
+
id="jsx-example"
|
|
123
|
+
tableData={charactersData}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
expect(screen.getAllByRole("img")).toHaveLength(3);
|
|
127
|
+
});
|
|
128
|
+
|
|
83
129
|
it("renders the UI snapshot correctly", () => {
|
|
84
130
|
const basic = renderer
|
|
85
131
|
.create(<Table id="basic" tableData={tableData} />)
|
|
@@ -140,6 +186,15 @@ describe("Table", () => {
|
|
|
140
186
|
const withOtherProps = renderer
|
|
141
187
|
.create(<Table id="props" tableData={tableData} data-testid="props" />)
|
|
142
188
|
.toJSON();
|
|
189
|
+
const withJSXData = renderer
|
|
190
|
+
.create(
|
|
191
|
+
<Table
|
|
192
|
+
columnHeaders={characterHeaders}
|
|
193
|
+
id="jsx-example"
|
|
194
|
+
tableData={charactersData}
|
|
195
|
+
/>
|
|
196
|
+
)
|
|
197
|
+
.toJSON();
|
|
143
198
|
|
|
144
199
|
expect(basic).toMatchSnapshot();
|
|
145
200
|
expect(withCaption).toMatchSnapshot();
|
|
@@ -148,5 +203,6 @@ describe("Table", () => {
|
|
|
148
203
|
expect(withCustomHeaderColors).toMatchSnapshot();
|
|
149
204
|
expect(withChakraProps).toMatchSnapshot();
|
|
150
205
|
expect(withOtherProps).toMatchSnapshot();
|
|
206
|
+
expect(withJSXData).toMatchSnapshot();
|
|
151
207
|
});
|
|
152
208
|
});
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
} from "@chakra-ui/react";
|
|
12
12
|
import * as React from "react";
|
|
13
13
|
|
|
14
|
+
interface CustomColors {
|
|
15
|
+
backgroundColor?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
}
|
|
14
18
|
export interface TableProps {
|
|
15
19
|
/** Additional class name for the `Table` component. */
|
|
16
20
|
className?: string;
|
|
@@ -26,7 +30,7 @@ export interface TableProps {
|
|
|
26
30
|
* component. The default value is false. */
|
|
27
31
|
showRowDividers?: boolean;
|
|
28
32
|
/** Two-dimensional array used to populate the table rows. */
|
|
29
|
-
tableData: string[][];
|
|
33
|
+
tableData: (string | JSX.Element)[][];
|
|
30
34
|
/** Displays `Table` title element. */
|
|
31
35
|
titleText?: string;
|
|
32
36
|
/** If true, the first cell of each row in the `Table` component will be
|
|
@@ -41,7 +45,7 @@ export interface TableProps {
|
|
|
41
45
|
export const Table = chakra((props: React.PropsWithChildren<TableProps>) => {
|
|
42
46
|
const {
|
|
43
47
|
className,
|
|
44
|
-
columnHeaders,
|
|
48
|
+
columnHeaders = [],
|
|
45
49
|
columnHeadersBackgroundColor,
|
|
46
50
|
columnHeadersTextColor,
|
|
47
51
|
id,
|
|
@@ -51,8 +55,7 @@ export const Table = chakra((props: React.PropsWithChildren<TableProps>) => {
|
|
|
51
55
|
useRowHeaders = false,
|
|
52
56
|
...rest
|
|
53
57
|
} = props;
|
|
54
|
-
|
|
55
|
-
const customColors = {};
|
|
58
|
+
const customColors: CustomColors = {};
|
|
56
59
|
|
|
57
60
|
columnHeadersBackgroundColor &&
|
|
58
61
|
(customColors["backgroundColor"] = columnHeadersBackgroundColor);
|