@nypl/design-system-react-components 0.25.13 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.md +10 -10
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +11 -9
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -4
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -6
- package/dist/components/Fieldset/Fieldset.d.ts +5 -6
- package/dist/components/Form/Form.d.ts +6 -6
- package/dist/components/Grid/GridTypes.d.ts +7 -7
- package/dist/components/Grid/SimpleGrid.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
- package/dist/components/Hero/Hero.d.ts +2 -1
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
- package/dist/components/Icons/Icon.d.ts +2 -1
- package/dist/components/Image/Image.d.ts +2 -2
- package/dist/components/Label/Label.d.ts +7 -4
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +11 -11
- package/dist/components/List/ListTypes.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts +2 -1
- package/dist/components/Logo/LogoSvgs.d.ts +2 -0
- package/dist/components/Logo/LogoTypes.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +4 -4
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +4 -6
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -6
- package/dist/components/SearchBar/SearchBar.d.ts +4 -4
- package/dist/components/Select/Select.d.ts +10 -6
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
- package/dist/components/Slider/Slider.d.ts +6 -4
- package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +4 -3
- package/dist/components/Template/Template.d.ts +4 -3
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +5 -5
- package/dist/components/Toggle/Toggle.d.ts +3 -4
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +1767 -1180
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +1774 -1188
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/hooks/useCarouselStyles.d.ts +3 -2
- package/dist/hooks/useNYPLTheme.d.ts +12 -0
- package/dist/index.d.ts +5 -2
- package/dist/styles.css +1 -1
- package/dist/theme/components/button.d.ts +10 -2
- package/dist/theme/components/card.d.ts +42 -22
- package/dist/theme/components/checkbox.d.ts +5 -4
- package/dist/theme/components/checkboxGroup.d.ts +1 -1
- package/dist/theme/components/componentWrapper.d.ts +2 -2
- package/dist/theme/components/customTable.d.ts +84 -1
- package/dist/theme/components/fieldset.d.ts +4 -14
- package/dist/theme/components/global.d.ts +23 -17
- package/dist/theme/components/heading.d.ts +53 -0
- package/dist/theme/components/helperErrorText.d.ts +1 -0
- package/dist/theme/components/hero.d.ts +20 -14
- package/dist/theme/components/label.d.ts +9 -10
- package/dist/theme/components/list.d.ts +99 -9
- package/dist/theme/components/radio.d.ts +6 -4
- package/dist/theme/components/radioGroup.d.ts +1 -1
- package/dist/theme/components/select.d.ts +28 -5
- package/dist/theme/components/skeletonLoader.d.ts +2 -2
- package/dist/theme/components/slider.d.ts +6 -3
- package/dist/theme/components/structuredContent.d.ts +197 -0
- package/dist/theme/components/textInput.d.ts +18 -6
- package/dist/theme/components/toggle.d.ts +7 -4
- package/dist/theme/foundations/global.d.ts +2 -0
- package/dist/theme/foundations/radii.d.ts +1 -0
- package/dist/theme/foundations/spacing.d.ts +46 -43
- package/package.json +17 -19
- package/src/components/Accordion/Accordion.stories.mdx +9 -9
- package/src/components/Accordion/Accordion.test.tsx +21 -0
- package/src/components/Accordion/Accordion.tsx +13 -9
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +276 -27
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -5
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +52 -31
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +8 -7
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
- package/src/components/Button/Button.stories.mdx +87 -23
- package/src/components/Button/Button.test.tsx +25 -0
- package/src/components/Button/Button.tsx +18 -7
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
- package/src/components/Card/Card.stories.mdx +287 -194
- package/src/components/Card/Card.test.tsx +102 -0
- package/src/components/Card/Card.tsx +73 -32
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +196 -36
- package/src/components/Chakra/Grid.stories.mdx +4 -4
- package/src/components/Checkbox/Checkbox.stories.mdx +62 -10
- package/src/components/Checkbox/Checkbox.test.tsx +32 -9
- package/src/components/Checkbox/Checkbox.tsx +20 -15
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +134 -7
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +65 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +137 -81
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +31 -21
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +332 -97
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
- package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
- package/src/components/DatePicker/DatePicker.test.tsx +89 -13
- package/src/components/DatePicker/DatePicker.tsx +62 -56
- package/src/components/DatePicker/_DatePicker.scss +71 -13
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
- package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
- package/src/components/Fieldset/Fieldset.test.tsx +58 -28
- package/src/components/Fieldset/Fieldset.tsx +35 -30
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
- package/src/components/Form/Form.stories.mdx +72 -39
- package/src/components/Form/Form.test.tsx +58 -15
- package/src/components/Form/Form.tsx +89 -67
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
- package/src/components/Grid/GridTypes.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +34 -6
- package/src/components/Grid/SimpleGrid.test.tsx +9 -0
- package/src/components/Grid/SimpleGrid.tsx +29 -20
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
- package/src/components/Heading/Heading.stories.mdx +36 -3
- package/src/components/Heading/Heading.test.tsx +10 -0
- package/src/components/Heading/Heading.tsx +56 -50
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +26 -7
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
- package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
- package/src/components/Hero/Hero.stories.mdx +125 -95
- package/src/components/Hero/Hero.test.tsx +33 -0
- package/src/components/Hero/Hero.tsx +135 -126
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -19
- package/src/components/HorizontalRule/HorizontalRule.tsx +9 -26
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
- package/src/components/Icons/Icon.stories.mdx +31 -6
- package/src/components/Icons/Icon.test.tsx +38 -0
- package/src/components/Icons/Icon.tsx +93 -76
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
- package/src/components/Image/Image.stories.mdx +29 -5
- package/src/components/Image/Image.test.tsx +8 -0
- package/src/components/Image/Image.tsx +38 -26
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
- package/src/components/Label/Label.stories.mdx +42 -20
- package/src/components/Label/Label.test.tsx +42 -17
- package/src/components/Label/Label.tsx +22 -13
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
- package/src/components/Link/Link.stories.mdx +25 -15
- package/src/components/Link/Link.test.tsx +21 -22
- package/src/components/Link/Link.tsx +8 -8
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
- package/src/components/List/List.stories.mdx +75 -40
- package/src/components/List/List.test.tsx +67 -19
- package/src/components/List/List.tsx +38 -25
- package/src/components/List/ListTypes.tsx +1 -1
- package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
- package/src/components/Logo/Logo.stories.mdx +30 -6
- package/src/components/Logo/Logo.test.tsx +17 -0
- package/src/components/Logo/Logo.tsx +18 -6
- package/src/components/Logo/LogoSvgs.tsx +4 -0
- package/src/components/Logo/LogoTypes.tsx +2 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
- package/src/components/Modal/Modal.stories.mdx +256 -136
- package/src/components/Modal/Modal.test.tsx +151 -9
- package/src/components/Modal/Modal.tsx +140 -20
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
- package/src/components/Notification/Notification.stories.mdx +25 -1
- package/src/components/Notification/Notification.test.tsx +23 -0
- package/src/components/Notification/Notification.tsx +46 -44
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
- package/src/components/Pagination/Pagination.stories.mdx +25 -6
- package/src/components/Pagination/Pagination.test.tsx +25 -0
- package/src/components/Pagination/Pagination.tsx +6 -6
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
- package/src/components/Placeholder/Placeholder.tsx +3 -1
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +81 -11
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -9
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
- package/src/components/Radio/Radio.stories.mdx +64 -12
- package/src/components/Radio/Radio.test.tsx +28 -8
- package/src/components/Radio/Radio.tsx +66 -63
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +103 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +224 -89
- package/src/components/RadioGroup/RadioGroup.test.tsx +122 -62
- package/src/components/RadioGroup/RadioGroup.tsx +106 -100
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1020
- package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
- package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
- package/src/components/SearchBar/SearchBar.tsx +17 -8
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
- package/src/components/Select/Select.stories.mdx +128 -49
- package/src/components/Select/Select.test.tsx +63 -16
- package/src/components/Select/Select.tsx +131 -92
- package/src/components/Select/SelectTypes.tsx +5 -0
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +765 -425
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +42 -10
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +8 -0
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +76 -72
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
- package/src/components/Slider/Slider.stories.mdx +91 -42
- package/src/components/Slider/Slider.test.tsx +65 -17
- package/src/components/Slider/Slider.tsx +26 -19
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
- package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
- package/src/components/StatusBadge/StatusBadge.test.tsx +16 -0
- package/src/components/StatusBadge/StatusBadge.tsx +25 -20
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
- package/src/components/StructuredContent/StructuredContent.stories.mdx +131 -12
- package/src/components/StructuredContent/StructuredContent.test.tsx +34 -0
- package/src/components/StructuredContent/StructuredContent.tsx +80 -75
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
- package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
- package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
- package/src/components/StyleGuide/ColorCard.tsx +1 -1
- package/src/components/StyleGuide/Colors.stories.mdx +1 -2
- package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
- package/src/components/StyleGuide/Forms.stories.mdx +27 -12
- package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
- package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
- package/src/components/StyleGuide/Typography.stories.mdx +30 -21
- package/src/components/Table/Table.stories.mdx +38 -11
- package/src/components/Table/Table.test.tsx +15 -0
- package/src/components/Table/Table.tsx +7 -7
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
- package/src/components/Tabs/Tabs.stories.mdx +52 -3
- package/src/components/Tabs/Tabs.test.tsx +16 -0
- package/src/components/Tabs/Tabs.tsx +10 -6
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
- package/src/components/Template/Template.stories.mdx +47 -43
- package/src/components/Template/Template.test.tsx +33 -0
- package/src/components/Template/Template.tsx +65 -60
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +191 -20
- package/src/components/Text/Text.stories.mdx +20 -1
- package/src/components/Text/Text.test.tsx +12 -0
- package/src/components/Text/Text.tsx +6 -4
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
- package/src/components/TextInput/TextInput.stories.mdx +65 -19
- package/src/components/TextInput/TextInput.test.tsx +42 -28
- package/src/components/TextInput/TextInput.tsx +121 -113
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
- package/src/components/Toggle/Toggle.stories.mdx +80 -22
- package/src/components/Toggle/Toggle.test.tsx +27 -9
- package/src/components/Toggle/Toggle.tsx +22 -18
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +128 -5
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +23 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +133 -126
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
- package/src/docs/Chakra.stories.mdx +50 -9
- package/src/docs/Welcome.stories.mdx +160 -41
- package/src/hooks/useCarouselStyles.stories.mdx +22 -2
- package/src/hooks/useCarouselStyles.ts +3 -2
- package/src/hooks/useNYPLTheme.stories.mdx +101 -0
- package/src/hooks/useNYPLTheme.ts +30 -6
- package/src/hooks/useWindowSize.stories.mdx +23 -0
- package/src/index.ts +5 -2
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles.scss +0 -1
- package/src/theme/components/button.ts +15 -7
- package/src/theme/components/card.ts +30 -19
- package/src/theme/components/checkbox.ts +10 -8
- package/src/theme/components/checkboxGroup.ts +1 -1
- package/src/theme/components/componentWrapper.ts +2 -2
- package/src/theme/components/customTable.ts +39 -31
- package/src/theme/components/fieldset.ts +1 -2
- package/src/theme/components/global.ts +25 -20
- package/src/theme/components/heading.ts +1 -1
- package/src/theme/components/helperErrorText.ts +1 -0
- package/src/theme/components/hero.ts +13 -15
- package/src/theme/components/label.ts +4 -3
- package/src/theme/components/list.ts +73 -66
- package/src/theme/components/notification.ts +2 -2
- package/src/theme/components/radio.ts +9 -9
- package/src/theme/components/radioGroup.ts +1 -1
- package/src/theme/components/select.ts +31 -22
- package/src/theme/components/skeletonLoader.ts +3 -3
- package/src/theme/components/slider.ts +8 -7
- package/src/theme/components/statusBadge.ts +2 -2
- package/src/theme/components/structuredContent.ts +66 -1
- package/src/theme/components/tabs.ts +2 -2
- package/src/theme/components/template.ts +9 -9
- package/src/theme/components/textInput.ts +13 -12
- package/src/theme/components/toggle.ts +17 -10
- package/src/theme/components/videoPlayer.ts +1 -1
- package/src/theme/foundations/colors.ts +1 -1
- package/src/theme/foundations/radii.ts +1 -0
- package/src/theme/foundations/spacing.ts +70 -22
- package/src/theme/foundations/typography.ts +2 -2
- package/src/utils/componentCategories.ts +1 -2
- package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
- package/dist/helpers/generateUUID.d.ts +0 -1
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/helpers/generateUUID.tsx +0 -5
|
@@ -49,10 +49,21 @@ export const enumValues = getStorybookEnumValues(
|
|
|
49
49
|
| Component Version | DS Version |
|
|
50
50
|
| ----------------- | ---------- |
|
|
51
51
|
| Added | `0.18.7` |
|
|
52
|
-
| Latest | `0.
|
|
52
|
+
| Latest | `0.26.0` |
|
|
53
|
+
|
|
54
|
+
## Table of Contents
|
|
55
|
+
|
|
56
|
+
- [Overview](#overview)
|
|
57
|
+
- [Component Props](#component-props)
|
|
58
|
+
- [Accessibility](#accessibility)
|
|
59
|
+
- [Patterns](#patterns)
|
|
60
|
+
|
|
61
|
+
## Overview
|
|
53
62
|
|
|
54
63
|
<Description of={StatusBadge} />
|
|
55
64
|
|
|
65
|
+
## Component Props
|
|
66
|
+
|
|
56
67
|
<Canvas withToolbar>
|
|
57
68
|
<Story
|
|
58
69
|
name="StatusBadge"
|
|
@@ -73,6 +84,13 @@ export const enumValues = getStorybookEnumValues(
|
|
|
73
84
|
|
|
74
85
|
<ArgsTable story="StatusBadge" />
|
|
75
86
|
|
|
87
|
+
## Accessibility
|
|
88
|
+
|
|
89
|
+
The visual aspect of the `StatusBadge` component displays three different status
|
|
90
|
+
levels through the use of three different colors. It is important to assign
|
|
91
|
+
the appropriate text so that the user can understand the priority level of the
|
|
92
|
+
`StatusBadge`, and not rely just on the color.
|
|
93
|
+
|
|
76
94
|
## Patterns
|
|
77
95
|
|
|
78
96
|
### Higher Barrier
|
|
@@ -47,9 +47,25 @@ describe("StatusBadge", () => {
|
|
|
47
47
|
</StatusBadge>
|
|
48
48
|
)
|
|
49
49
|
.toJSON();
|
|
50
|
+
const withChakraProps = renderer
|
|
51
|
+
.create(
|
|
52
|
+
<StatusBadge id="chakra" p="20px" color="ui.error.primary">
|
|
53
|
+
Registration Required
|
|
54
|
+
</StatusBadge>
|
|
55
|
+
)
|
|
56
|
+
.toJSON();
|
|
57
|
+
const withOtherProps = renderer
|
|
58
|
+
.create(
|
|
59
|
+
<StatusBadge id="props" data-testid="props">
|
|
60
|
+
Registration Required
|
|
61
|
+
</StatusBadge>
|
|
62
|
+
)
|
|
63
|
+
.toJSON();
|
|
50
64
|
|
|
51
65
|
expect(low).toMatchSnapshot();
|
|
52
66
|
expect(medium).toMatchSnapshot();
|
|
53
67
|
expect(high).toMatchSnapshot();
|
|
68
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
69
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
54
70
|
});
|
|
55
71
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import { Box, useStyleConfig } from "@chakra-ui/react";
|
|
3
3
|
|
|
4
4
|
import { StatusBadgeTypes } from "./StatusBadgeTypes";
|
|
5
|
-
import generateUUID from "../../helpers/generateUUID";
|
|
6
|
-
|
|
7
5
|
export interface StatusBadgeProps {
|
|
8
6
|
/** Additional class for the component */
|
|
9
7
|
className?: string;
|
|
@@ -14,24 +12,31 @@ export interface StatusBadgeProps {
|
|
|
14
12
|
level?: StatusBadgeTypes;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The `StatusBadge` component is used to display a visual badge for three
|
|
17
|
+
* different status levels.
|
|
18
|
+
*/
|
|
19
|
+
export const StatusBadge = chakra(
|
|
20
|
+
(props: React.PropsWithChildren<StatusBadgeProps>) => {
|
|
21
|
+
const {
|
|
22
|
+
children,
|
|
23
|
+
className,
|
|
24
|
+
id,
|
|
25
|
+
level = StatusBadgeTypes.Low,
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
28
|
+
const styles = useStyleConfig("StatusBadge", { variant: level });
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
if (!children) {
|
|
31
|
+
console.warn("NYPL Reservoir StatusBadge: No children were passed.");
|
|
32
|
+
}
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
34
|
+
return (
|
|
35
|
+
<Box id={id} className={className} __css={styles} {...rest}>
|
|
36
|
+
{children}
|
|
37
|
+
</Box>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
);
|
|
36
41
|
|
|
37
42
|
export default StatusBadge;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`StatusBadge renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
className="css-
|
|
5
|
+
className="css-1xdhyk6"
|
|
6
6
|
id="low"
|
|
7
7
|
>
|
|
8
8
|
Registration Required
|
|
@@ -11,7 +11,7 @@ exports[`StatusBadge renders the UI snapshot correctly 1`] = `
|
|
|
11
11
|
|
|
12
12
|
exports[`StatusBadge renders the UI snapshot correctly 2`] = `
|
|
13
13
|
<div
|
|
14
|
-
className="css-
|
|
14
|
+
className="css-1xdhyk6"
|
|
15
15
|
id="medium"
|
|
16
16
|
>
|
|
17
17
|
Registration Required
|
|
@@ -20,9 +20,28 @@ exports[`StatusBadge renders the UI snapshot correctly 2`] = `
|
|
|
20
20
|
|
|
21
21
|
exports[`StatusBadge renders the UI snapshot correctly 3`] = `
|
|
22
22
|
<div
|
|
23
|
-
className="css-
|
|
23
|
+
className="css-1xdhyk6"
|
|
24
24
|
id="high"
|
|
25
25
|
>
|
|
26
26
|
Registration Required
|
|
27
27
|
</div>
|
|
28
28
|
`;
|
|
29
|
+
|
|
30
|
+
exports[`StatusBadge renders the UI snapshot correctly 4`] = `
|
|
31
|
+
<div
|
|
32
|
+
className="css-kle7zy"
|
|
33
|
+
id="chakra"
|
|
34
|
+
>
|
|
35
|
+
Registration Required
|
|
36
|
+
</div>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`StatusBadge renders the UI snapshot correctly 5`] = `
|
|
40
|
+
<div
|
|
41
|
+
className="css-1xdhyk6"
|
|
42
|
+
data-testid="props"
|
|
43
|
+
id="props"
|
|
44
|
+
>
|
|
45
|
+
Registration Required
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
@@ -77,7 +77,7 @@ export const imageSizeEnumValues = getStorybookEnumValues(
|
|
|
77
77
|
| Component Version | DS Version |
|
|
78
78
|
| ----------------- | ---------- |
|
|
79
79
|
| Added | `0.25.9` |
|
|
80
|
-
| Latest | `0.
|
|
80
|
+
| Latest | `0.26.0` |
|
|
81
81
|
|
|
82
82
|
## Table of Contents
|
|
83
83
|
|
|
@@ -161,10 +161,18 @@ export const imageSizeEnumValues = getStorybookEnumValues(
|
|
|
161
161
|
|
|
162
162
|
## Accessibility
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
The `StructuredContent` component is a structured container around a specific
|
|
165
|
+
set of content. While the main image can be controlled through the `imageProps`
|
|
166
|
+
prop, the content will not always be controlled. If the content that is being
|
|
167
|
+
passed is coming from a CMS, the content can contain any set of HTML elements that
|
|
168
|
+
are _not_ controlled through Reservoir DS components. While this component
|
|
169
|
+
attempts to style the added elements, we cannot guarantee that the content will
|
|
170
|
+
be accessible. Please review your content and make sure that:
|
|
171
|
+
|
|
172
|
+
- The content's font-size to be scaled to 200% without content overlapping.
|
|
173
|
+
- Any additional images have descriptive (but not too lengthy) alt text.
|
|
174
|
+
- Any additional heading levels should not be skipped. Meaning, a `<h2>` should
|
|
175
|
+
not be followed by a `<h4>`.
|
|
168
176
|
- Any links or text with colors should have a 4.5:1 contrast ratio.
|
|
169
177
|
|
|
170
178
|
## With HTML String Text Content
|
|
@@ -173,7 +181,7 @@ The following body content is passed as a string to the `bodyContent` prop. It
|
|
|
173
181
|
includes HTML tags in the string.
|
|
174
182
|
|
|
175
183
|
<Canvas>
|
|
176
|
-
<Story name="With
|
|
184
|
+
<Story name="With HTML String Text Content">
|
|
177
185
|
<StructuredContent
|
|
178
186
|
calloutText="This is the callout text"
|
|
179
187
|
headingText="Heading text"
|
|
@@ -261,12 +269,69 @@ The following content is passed as HTML DOM elements to the `bodyContent` prop.
|
|
|
261
269
|
Feugiat nisl pretium fusce id velit ut tortor. Porttitor leo a diam
|
|
262
270
|
sollicitudin tempor id eu nisl nunc.
|
|
263
271
|
</p>
|
|
264
|
-
<
|
|
265
|
-
|
|
266
|
-
<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
272
|
+
<h3 id="dates-times">Dates and Times</h3>
|
|
273
|
+
<table role="table" id="times-table">
|
|
274
|
+
<thead>
|
|
275
|
+
<tr role="row">
|
|
276
|
+
<th scope="col">Day</th>
|
|
277
|
+
<th scope="col">Time</th>
|
|
278
|
+
<th scope="col">Presentation</th>
|
|
279
|
+
<th scope="col">Topic</th>
|
|
280
|
+
</tr>
|
|
281
|
+
</thead>
|
|
282
|
+
<tbody>
|
|
283
|
+
<tr role="row">
|
|
284
|
+
<td>Sunday</td>
|
|
285
|
+
<td>7:00 PM</td>
|
|
286
|
+
<td>Tom Nook</td>
|
|
287
|
+
<td>Manhattan</td>
|
|
288
|
+
</tr>
|
|
289
|
+
<tr role="row">
|
|
290
|
+
<td>Monday</td>
|
|
291
|
+
<td>7:00 PM</td>
|
|
292
|
+
<td>Tom Nook</td>
|
|
293
|
+
<td>The Bronx</td>
|
|
294
|
+
</tr>
|
|
295
|
+
<tr role="row">
|
|
296
|
+
<td>Tuesday</td>
|
|
297
|
+
<td>7:00 PM</td>
|
|
298
|
+
<td>Tom Nook</td>
|
|
299
|
+
<td>Queens</td>
|
|
300
|
+
</tr>
|
|
301
|
+
<tr role="row">
|
|
302
|
+
<td>Wednesday</td>
|
|
303
|
+
<td>7:00 PM</td>
|
|
304
|
+
<td>Tom Nook</td>
|
|
305
|
+
<td>Staten Island</td>
|
|
306
|
+
</tr>
|
|
307
|
+
<tr role="row">
|
|
308
|
+
<td>Thursday</td>
|
|
309
|
+
<td>7:00 PM</td>
|
|
310
|
+
<td>Tom Nook</td>
|
|
311
|
+
<td>Brooklyn</td>
|
|
312
|
+
</tr>
|
|
313
|
+
<tr role="row">
|
|
314
|
+
<td>Friday</td>
|
|
315
|
+
<td>7:00 PM</td>
|
|
316
|
+
<td>Tom Nook</td>
|
|
317
|
+
<td>Long Island</td>
|
|
318
|
+
</tr>
|
|
319
|
+
<tr role="row">
|
|
320
|
+
<td>Saturday</td>
|
|
321
|
+
<td>7:00 PM</td>
|
|
322
|
+
<td>Tom Nook</td>
|
|
323
|
+
<td>Upstate</td>
|
|
324
|
+
</tr>
|
|
325
|
+
</tbody>
|
|
326
|
+
</table>
|
|
327
|
+
<h3 id="parting-thoughts">Parting Thoughts</h3>
|
|
328
|
+
<ol id="thoughts-list">
|
|
329
|
+
<li>All text was read</li>
|
|
330
|
+
<li>The two videos were watched</li>
|
|
331
|
+
<li>All images were reviewed</li>
|
|
332
|
+
<li>Notes were taken on a small notepad</li>
|
|
333
|
+
<li>You enjoyed yourself</li>
|
|
334
|
+
</ol>
|
|
270
335
|
<p>
|
|
271
336
|
<i>
|
|
272
337
|
Mauris nunc congue nisi vitae suscipit tellus mauris a diam. Purus
|
|
@@ -283,6 +348,60 @@ The following content is passed as HTML DOM elements to the `bodyContent` prop.
|
|
|
283
348
|
pharetra.
|
|
284
349
|
</i>
|
|
285
350
|
</p>
|
|
351
|
+
<section id="definition-doc-list">
|
|
352
|
+
<h2>Episode Forty-Two: Readings and Resources</h2>
|
|
353
|
+
<dl>
|
|
354
|
+
<dt>Hillary Ballon and Kenneth T. Jackson, eds.</dt>
|
|
355
|
+
<dd>
|
|
356
|
+
<em>
|
|
357
|
+
<a
|
|
358
|
+
id="link-10"
|
|
359
|
+
href="https://www.nypl.org/research/research-catalog/bib/b22154388"
|
|
360
|
+
>
|
|
361
|
+
Robert Moses and the Modern City: The Transformation of New
|
|
362
|
+
York
|
|
363
|
+
</a>
|
|
364
|
+
</em>{" "}
|
|
365
|
+
(W.W. Norton & Co., 2007).
|
|
366
|
+
</dd>
|
|
367
|
+
<dt>The Brooklyn Battery Bridge</dt>
|
|
368
|
+
<dd>
|
|
369
|
+
"
|
|
370
|
+
<a
|
|
371
|
+
id="link-11"
|
|
372
|
+
href="https://www.nypap.org/preservation-history/brooklyn-battery-bridge/"
|
|
373
|
+
>
|
|
374
|
+
The Brooklyn Battery Bridge
|
|
375
|
+
</a>
|
|
376
|
+
," New York Preservation Archives Project.
|
|
377
|
+
</dd>
|
|
378
|
+
<dt>Robert Caro</dt>
|
|
379
|
+
<dd>
|
|
380
|
+
<em>
|
|
381
|
+
<a
|
|
382
|
+
id="link-12"
|
|
383
|
+
href="https://www.nypl.org/research/research-catalog/bib/b21586756"
|
|
384
|
+
>
|
|
385
|
+
The Power Broker: Robert Moses and the Fall of New York
|
|
386
|
+
</a>
|
|
387
|
+
</em>{" "}
|
|
388
|
+
(Vintage Books, 1975).
|
|
389
|
+
</dd>
|
|
390
|
+
<dt>Anthony Flint</dt>
|
|
391
|
+
<dd>
|
|
392
|
+
<em>
|
|
393
|
+
<a
|
|
394
|
+
id="link-13"
|
|
395
|
+
href="https://www.nypl.org/research/research-catalog/bib/b20538453"
|
|
396
|
+
>
|
|
397
|
+
Wrestling with Moses: How Jane Jacobs Took on New York's
|
|
398
|
+
Master Builder and Transformed the American City
|
|
399
|
+
</a>
|
|
400
|
+
</em>{" "}
|
|
401
|
+
(Random House, 2009).
|
|
402
|
+
</dd>
|
|
403
|
+
</dl>
|
|
404
|
+
</section>
|
|
286
405
|
</>
|
|
287
406
|
}
|
|
288
407
|
/>
|
|
@@ -380,6 +380,15 @@ describe("StructuredContent", () => {
|
|
|
380
380
|
bodyContent={htmlStringBodyContent}
|
|
381
381
|
headingText="Heading text"
|
|
382
382
|
id="withoutCalloutText"
|
|
383
|
+
/>
|
|
384
|
+
)
|
|
385
|
+
.toJSON();
|
|
386
|
+
const withChakraProps = renderer
|
|
387
|
+
.create(
|
|
388
|
+
<StructuredContent
|
|
389
|
+
calloutText="This is the callout text"
|
|
390
|
+
headingText="Heading text"
|
|
391
|
+
id="withChakraProps"
|
|
383
392
|
imageProps={{
|
|
384
393
|
alt: "Image alt text",
|
|
385
394
|
aspectRatio: ImageRatios.Original,
|
|
@@ -389,6 +398,29 @@ describe("StructuredContent", () => {
|
|
|
389
398
|
size: ImageSizes.Medium,
|
|
390
399
|
src: "https://placeimg.com/400/300/animals",
|
|
391
400
|
}}
|
|
401
|
+
bodyContent={htmlStringBodyContent}
|
|
402
|
+
p="20px"
|
|
403
|
+
color="ui.error.primary"
|
|
404
|
+
/>
|
|
405
|
+
)
|
|
406
|
+
.toJSON();
|
|
407
|
+
const withOtherProps = renderer
|
|
408
|
+
.create(
|
|
409
|
+
<StructuredContent
|
|
410
|
+
calloutText="This is the callout text"
|
|
411
|
+
headingText="Heading text"
|
|
412
|
+
id="withOtherProps"
|
|
413
|
+
imageProps={{
|
|
414
|
+
alt: "Image alt text",
|
|
415
|
+
aspectRatio: ImageRatios.Original,
|
|
416
|
+
caption: "Image caption",
|
|
417
|
+
credit: "Image credit",
|
|
418
|
+
position: StructuredContentImagePosition.Left,
|
|
419
|
+
size: ImageSizes.Medium,
|
|
420
|
+
src: "https://placeimg.com/400/300/animals",
|
|
421
|
+
}}
|
|
422
|
+
bodyContent={htmlStringBodyContent}
|
|
423
|
+
data-testid="props"
|
|
392
424
|
/>
|
|
393
425
|
)
|
|
394
426
|
.toJSON();
|
|
@@ -399,5 +431,7 @@ describe("StructuredContent", () => {
|
|
|
399
431
|
expect(withImageWithoutCaptionOrCredit).toMatchSnapshot();
|
|
400
432
|
expect(withoutHeading).toMatchSnapshot();
|
|
401
433
|
expect(withoutCalloutText).toMatchSnapshot();
|
|
434
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
435
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
402
436
|
});
|
|
403
437
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import { Box, chakra, useMultiStyleConfig } from "@chakra-ui/react";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import { Box, useMultiStyleConfig } from "@chakra-ui/react";
|
|
3
3
|
|
|
4
4
|
import Heading from "../Heading/Heading";
|
|
5
5
|
import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
6
6
|
import Image, { ComponentImageProps, ImageProps } from "../Image/Image";
|
|
7
7
|
import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
|
|
8
8
|
import { StructuredContentImagePosition } from "./StructuredContentTypes";
|
|
9
|
-
import generateUUID from "../../helpers/generateUUID";
|
|
10
9
|
|
|
11
10
|
interface StructuredContentImageProps extends ComponentImageProps {
|
|
12
11
|
/** Optional value to control the positioning of the internal `Image` component.
|
|
@@ -33,7 +32,7 @@ export interface StructuredContentProps {
|
|
|
33
32
|
* Internal component used in the `StructuredContent` component
|
|
34
33
|
* that renders the DS `Image` component.
|
|
35
34
|
*/
|
|
36
|
-
|
|
35
|
+
const StructuredContentImage = chakra((props: ImageProps) => {
|
|
37
36
|
const {
|
|
38
37
|
additionalFigureStyles,
|
|
39
38
|
additionalImageStyles,
|
|
@@ -60,84 +59,90 @@ function StructuredContentImage(props: ImageProps) {
|
|
|
60
59
|
src={src}
|
|
61
60
|
/>
|
|
62
61
|
);
|
|
63
|
-
}
|
|
62
|
+
});
|
|
64
63
|
|
|
65
64
|
/**
|
|
66
65
|
* The `StructuredContent` component that displays a heading, callout content,
|
|
67
66
|
* an image, and body content. All are optional except for body content.
|
|
68
67
|
*/
|
|
69
|
-
export
|
|
70
|
-
props: React.PropsWithChildren<StructuredContentProps>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
68
|
+
export const StructuredContent = chakra(
|
|
69
|
+
(props: React.PropsWithChildren<StructuredContentProps>) => {
|
|
70
|
+
const {
|
|
71
|
+
calloutText,
|
|
72
|
+
className,
|
|
73
|
+
headingText,
|
|
74
|
+
id,
|
|
75
|
+
imageProps = {
|
|
76
|
+
alt: "",
|
|
77
|
+
aspectRatio: ImageRatios.Square,
|
|
78
|
+
caption: undefined,
|
|
79
|
+
component: undefined,
|
|
80
|
+
credit: undefined,
|
|
81
|
+
position: StructuredContentImagePosition.Left,
|
|
82
|
+
size: ImageSizes.Medium,
|
|
83
|
+
src: "",
|
|
84
|
+
},
|
|
85
|
+
bodyContent,
|
|
86
|
+
...rest
|
|
87
|
+
} = props;
|
|
88
|
+
const hasImage = imageProps.src || imageProps.component;
|
|
89
|
+
const hasFigureImage = imageProps.caption || imageProps.credit;
|
|
90
|
+
const styles = useMultiStyleConfig("StructuredContent", {
|
|
91
|
+
hasFigureImage,
|
|
92
|
+
imageAspectRatio: imageProps.aspectRatio,
|
|
93
|
+
imagePosition: imageProps.position,
|
|
94
|
+
});
|
|
95
|
+
const finalBodyContent =
|
|
96
|
+
typeof bodyContent === "string" ? (
|
|
97
|
+
<div
|
|
98
|
+
className="structuredcontent-body"
|
|
99
|
+
dangerouslySetInnerHTML={{ __html: bodyContent }}
|
|
100
|
+
/>
|
|
101
|
+
) : (
|
|
102
|
+
<Box className="structuredcontent-body">{bodyContent}</Box>
|
|
103
|
+
);
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
if (hasImage && !imageProps.alt) {
|
|
106
|
+
console.warn(
|
|
107
|
+
"NYPL Reservoir StructuredContent: The `imageProps.alt` prop is required " +
|
|
108
|
+
"when using an image."
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Box id={id} className={className} __css={styles} {...rest}>
|
|
114
|
+
{headingText && (
|
|
115
|
+
<Heading id={`${id}-heading`} level={HeadingLevels.Two}>
|
|
116
|
+
{headingText}
|
|
117
|
+
</Heading>
|
|
118
|
+
)}
|
|
119
|
+
{calloutText && (
|
|
120
|
+
<Heading
|
|
121
|
+
id={`${id}-callout`}
|
|
122
|
+
level={HeadingLevels.Three}
|
|
123
|
+
size={HeadingSizes.Callout}
|
|
124
|
+
>
|
|
125
|
+
{calloutText}
|
|
126
|
+
</Heading>
|
|
127
|
+
)}
|
|
128
|
+
{hasImage && (
|
|
129
|
+
<StructuredContentImage
|
|
130
|
+
additionalFigureStyles={styles.imageFigure}
|
|
131
|
+
additionalImageStyles={styles.image}
|
|
132
|
+
additionalWrapperStyles={styles.imageWrapper}
|
|
133
|
+
alt={imageProps.alt}
|
|
134
|
+
component={imageProps.component}
|
|
135
|
+
aspectRatio={imageProps.aspectRatio}
|
|
136
|
+
caption={imageProps.caption}
|
|
137
|
+
credit={imageProps.credit}
|
|
138
|
+
size={imageProps.size}
|
|
139
|
+
src={imageProps.src ? imageProps.src : null}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
{finalBodyContent}
|
|
143
|
+
</Box>
|
|
107
144
|
);
|
|
108
145
|
}
|
|
146
|
+
);
|
|
109
147
|
|
|
110
|
-
|
|
111
|
-
<Box id={id} className={className} __css={styles}>
|
|
112
|
-
{headingText && (
|
|
113
|
-
<Heading id={`${id}-heading`} level={HeadingLevels.Two}>
|
|
114
|
-
{headingText}
|
|
115
|
-
</Heading>
|
|
116
|
-
)}
|
|
117
|
-
{calloutText && (
|
|
118
|
-
<Heading
|
|
119
|
-
id={`${id}-callout`}
|
|
120
|
-
level={HeadingLevels.Three}
|
|
121
|
-
size={HeadingSizes.Callout}
|
|
122
|
-
>
|
|
123
|
-
{calloutText}
|
|
124
|
-
</Heading>
|
|
125
|
-
)}
|
|
126
|
-
{hasImage && (
|
|
127
|
-
<StructuredContentImage
|
|
128
|
-
additionalFigureStyles={styles.imageFigure}
|
|
129
|
-
additionalImageStyles={styles.image}
|
|
130
|
-
additionalWrapperStyles={styles.imageWrapper}
|
|
131
|
-
alt={imageProps.alt}
|
|
132
|
-
component={imageProps.component}
|
|
133
|
-
aspectRatio={imageProps.aspectRatio}
|
|
134
|
-
caption={imageProps.caption}
|
|
135
|
-
credit={imageProps.credit}
|
|
136
|
-
size={imageProps.size}
|
|
137
|
-
src={imageProps.src ? imageProps.src : null}
|
|
138
|
-
/>
|
|
139
|
-
)}
|
|
140
|
-
{finalBodyContent}
|
|
141
|
-
</Box>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
148
|
+
export default StructuredContent;
|