@nypl/design-system-react-components 0.25.13 → 0.26.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 +58 -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/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 +1663 -1139
- 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 +1667 -1143
- 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 +4 -1
- 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 +34 -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 +5 -6
- 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 +195 -35
- 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 -1
- package/src/components/Link/Link.test.tsx +21 -0
- 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 +13 -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 +24 -4
- 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 +125 -92
- package/src/components/Select/SelectTypes.tsx +5 -0
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +749 -409
- 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 +4 -1
- package/src/styles/base/_place-holder.scss +1 -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 +35 -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/helpers/generateUUID.tsx +0 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Accordion Renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
className="chakra-accordion css-
|
|
5
|
+
className="chakra-accordion css-1xdhyk6"
|
|
6
6
|
id="accordian"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
@@ -11,7 +11,7 @@ exports[`Accordion Renders the UI snapshot correctly 1`] = `
|
|
|
11
11
|
<button
|
|
12
12
|
aria-controls="accordion-panel-accordian-item-0"
|
|
13
13
|
aria-expanded={false}
|
|
14
|
-
className="chakra-accordion__button css-
|
|
14
|
+
className="chakra-accordion__button css-1v42wmb"
|
|
15
15
|
disabled={false}
|
|
16
16
|
id="accordion-button-accordian-item-0"
|
|
17
17
|
onClick={[Function]}
|
|
@@ -26,7 +26,7 @@ exports[`Accordion Renders the UI snapshot correctly 1`] = `
|
|
|
26
26
|
</div>
|
|
27
27
|
<svg
|
|
28
28
|
aria-hidden={true}
|
|
29
|
-
className="chakra-icon css-
|
|
29
|
+
className="chakra-icon css-1grhd2q"
|
|
30
30
|
focusable={false}
|
|
31
31
|
id="accordion-accordian-icon-0"
|
|
32
32
|
role="img"
|
|
@@ -75,14 +75,14 @@ exports[`Accordion Renders the UI snapshot correctly 1`] = `
|
|
|
75
75
|
role="region"
|
|
76
76
|
>
|
|
77
77
|
<div
|
|
78
|
-
className="css-
|
|
78
|
+
className="css-1xdhyk6"
|
|
79
79
|
id="card"
|
|
80
80
|
>
|
|
81
81
|
<div
|
|
82
82
|
className="css-0"
|
|
83
83
|
>
|
|
84
84
|
<div
|
|
85
|
-
className="the-wrap
|
|
85
|
+
className="the-wrap css-1u8qly9"
|
|
86
86
|
>
|
|
87
87
|
<div
|
|
88
88
|
className="the-crop css-0"
|
|
@@ -99,13 +99,14 @@ exports[`Accordion Renders the UI snapshot correctly 1`] = `
|
|
|
99
99
|
className="card-body css-0"
|
|
100
100
|
>
|
|
101
101
|
<h4
|
|
102
|
-
className="chakra-heading css-
|
|
102
|
+
className="chakra-heading css-1xdhyk6"
|
|
103
103
|
id="heading1"
|
|
104
|
+
layout="row"
|
|
104
105
|
>
|
|
105
106
|
Gerry Kellman
|
|
106
107
|
</h4>
|
|
107
108
|
<div
|
|
108
|
-
className="css-
|
|
109
|
+
className="css-1xdhyk6"
|
|
109
110
|
>
|
|
110
111
|
Gerri is
|
|
111
112
|
<b>
|
|
@@ -123,7 +124,7 @@ exports[`Accordion Renders the UI snapshot correctly 1`] = `
|
|
|
123
124
|
|
|
124
125
|
exports[`Accordion Renders the UI snapshot correctly 2`] = `
|
|
125
126
|
<div
|
|
126
|
-
className="chakra-accordion css-
|
|
127
|
+
className="chakra-accordion css-1xdhyk6"
|
|
127
128
|
id="accordian"
|
|
128
129
|
>
|
|
129
130
|
<div
|
|
@@ -132,7 +133,7 @@ exports[`Accordion Renders the UI snapshot correctly 2`] = `
|
|
|
132
133
|
<button
|
|
133
134
|
aria-controls="accordion-panel-accordian-item-0"
|
|
134
135
|
aria-expanded={false}
|
|
135
|
-
className="chakra-accordion__button css-
|
|
136
|
+
className="chakra-accordion__button css-1v42wmb"
|
|
136
137
|
disabled={false}
|
|
137
138
|
id="accordion-button-accordian-item-0"
|
|
138
139
|
onClick={[Function]}
|
|
@@ -147,7 +148,7 @@ exports[`Accordion Renders the UI snapshot correctly 2`] = `
|
|
|
147
148
|
</div>
|
|
148
149
|
<svg
|
|
149
150
|
aria-hidden={true}
|
|
150
|
-
className="chakra-icon css-
|
|
151
|
+
className="chakra-icon css-1grhd2q"
|
|
151
152
|
focusable={false}
|
|
152
153
|
id="accordion-accordian-icon-0"
|
|
153
154
|
role="img"
|
|
@@ -196,14 +197,14 @@ exports[`Accordion Renders the UI snapshot correctly 2`] = `
|
|
|
196
197
|
role="region"
|
|
197
198
|
>
|
|
198
199
|
<div
|
|
199
|
-
className="css-
|
|
200
|
+
className="css-1xdhyk6"
|
|
200
201
|
id="card"
|
|
201
202
|
>
|
|
202
203
|
<div
|
|
203
204
|
className="css-0"
|
|
204
205
|
>
|
|
205
206
|
<div
|
|
206
|
-
className="the-wrap
|
|
207
|
+
className="the-wrap css-1u8qly9"
|
|
207
208
|
>
|
|
208
209
|
<div
|
|
209
210
|
className="the-crop css-0"
|
|
@@ -220,13 +221,14 @@ exports[`Accordion Renders the UI snapshot correctly 2`] = `
|
|
|
220
221
|
className="card-body css-0"
|
|
221
222
|
>
|
|
222
223
|
<h4
|
|
223
|
-
className="chakra-heading css-
|
|
224
|
+
className="chakra-heading css-1xdhyk6"
|
|
224
225
|
id="heading1"
|
|
226
|
+
layout="row"
|
|
225
227
|
>
|
|
226
228
|
Gerry Kellman
|
|
227
229
|
</h4>
|
|
228
230
|
<div
|
|
229
|
-
className="css-
|
|
231
|
+
className="css-1xdhyk6"
|
|
230
232
|
>
|
|
231
233
|
Gerri is
|
|
232
234
|
<b>
|
|
@@ -244,7 +246,7 @@ exports[`Accordion Renders the UI snapshot correctly 2`] = `
|
|
|
244
246
|
|
|
245
247
|
exports[`Accordion Renders the UI snapshot correctly 3`] = `
|
|
246
248
|
<div
|
|
247
|
-
className="chakra-accordion css-
|
|
249
|
+
className="chakra-accordion css-1t0bvx9"
|
|
248
250
|
id="accordian"
|
|
249
251
|
>
|
|
250
252
|
<div
|
|
@@ -253,7 +255,7 @@ exports[`Accordion Renders the UI snapshot correctly 3`] = `
|
|
|
253
255
|
<button
|
|
254
256
|
aria-controls="accordion-panel-accordian-item-0"
|
|
255
257
|
aria-expanded={false}
|
|
256
|
-
className="chakra-accordion__button css-
|
|
258
|
+
className="chakra-accordion__button css-1v42wmb"
|
|
257
259
|
disabled={false}
|
|
258
260
|
id="accordion-button-accordian-item-0"
|
|
259
261
|
onClick={[Function]}
|
|
@@ -268,7 +270,7 @@ exports[`Accordion Renders the UI snapshot correctly 3`] = `
|
|
|
268
270
|
</div>
|
|
269
271
|
<svg
|
|
270
272
|
aria-hidden={true}
|
|
271
|
-
className="chakra-icon css-
|
|
273
|
+
className="chakra-icon css-1grhd2q"
|
|
272
274
|
focusable={false}
|
|
273
275
|
id="accordion-accordian-icon-0"
|
|
274
276
|
role="img"
|
|
@@ -317,14 +319,14 @@ exports[`Accordion Renders the UI snapshot correctly 3`] = `
|
|
|
317
319
|
role="region"
|
|
318
320
|
>
|
|
319
321
|
<div
|
|
320
|
-
className="css-
|
|
322
|
+
className="css-1xdhyk6"
|
|
321
323
|
id="card"
|
|
322
324
|
>
|
|
323
325
|
<div
|
|
324
326
|
className="css-0"
|
|
325
327
|
>
|
|
326
328
|
<div
|
|
327
|
-
className="the-wrap
|
|
329
|
+
className="the-wrap css-1u8qly9"
|
|
328
330
|
>
|
|
329
331
|
<div
|
|
330
332
|
className="the-crop css-0"
|
|
@@ -341,13 +343,14 @@ exports[`Accordion Renders the UI snapshot correctly 3`] = `
|
|
|
341
343
|
className="card-body css-0"
|
|
342
344
|
>
|
|
343
345
|
<h4
|
|
344
|
-
className="chakra-heading css-
|
|
346
|
+
className="chakra-heading css-1xdhyk6"
|
|
345
347
|
id="heading1"
|
|
348
|
+
layout="row"
|
|
346
349
|
>
|
|
347
350
|
Gerry Kellman
|
|
348
351
|
</h4>
|
|
349
352
|
<div
|
|
350
|
-
className="css-
|
|
353
|
+
className="css-1xdhyk6"
|
|
351
354
|
>
|
|
352
355
|
Gerri is
|
|
353
356
|
<b>
|
|
@@ -365,7 +368,252 @@ exports[`Accordion Renders the UI snapshot correctly 3`] = `
|
|
|
365
368
|
|
|
366
369
|
exports[`Accordion Renders the UI snapshot correctly 4`] = `
|
|
367
370
|
<div
|
|
368
|
-
className="chakra-accordion css-
|
|
371
|
+
className="chakra-accordion css-1xdhyk6"
|
|
372
|
+
data-testid="testid"
|
|
373
|
+
id="accordian"
|
|
374
|
+
>
|
|
375
|
+
<div
|
|
376
|
+
className="chakra-accordion__item css-1fsnuue"
|
|
377
|
+
>
|
|
378
|
+
<button
|
|
379
|
+
aria-controls="accordion-panel-accordian-item-0"
|
|
380
|
+
aria-expanded={false}
|
|
381
|
+
className="chakra-accordion__button css-1v42wmb"
|
|
382
|
+
disabled={false}
|
|
383
|
+
id="accordion-button-accordian-item-0"
|
|
384
|
+
onClick={[Function]}
|
|
385
|
+
onFocus={[Function]}
|
|
386
|
+
onKeyDown={[Function]}
|
|
387
|
+
type="button"
|
|
388
|
+
>
|
|
389
|
+
<div
|
|
390
|
+
className="css-1eziwv"
|
|
391
|
+
>
|
|
392
|
+
Gerry Kellman
|
|
393
|
+
</div>
|
|
394
|
+
<svg
|
|
395
|
+
aria-hidden={true}
|
|
396
|
+
className="chakra-icon css-1grhd2q"
|
|
397
|
+
focusable={false}
|
|
398
|
+
id="accordion-accordian-icon-0"
|
|
399
|
+
role="img"
|
|
400
|
+
title="plus icon"
|
|
401
|
+
viewBox="0 0 24 24"
|
|
402
|
+
>
|
|
403
|
+
<g
|
|
404
|
+
stroke="currentColor"
|
|
405
|
+
strokeWidth="1.5"
|
|
406
|
+
>
|
|
407
|
+
<path
|
|
408
|
+
d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
|
|
409
|
+
fill="none"
|
|
410
|
+
strokeLinecap="round"
|
|
411
|
+
/>
|
|
412
|
+
<path
|
|
413
|
+
d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
|
|
414
|
+
fill="currentColor"
|
|
415
|
+
strokeLinecap="round"
|
|
416
|
+
/>
|
|
417
|
+
<circle
|
|
418
|
+
cx="12"
|
|
419
|
+
cy="12"
|
|
420
|
+
fill="none"
|
|
421
|
+
r="11.25"
|
|
422
|
+
strokeMiterlimit="10"
|
|
423
|
+
/>
|
|
424
|
+
</g>
|
|
425
|
+
</svg>
|
|
426
|
+
</button>
|
|
427
|
+
<div
|
|
428
|
+
className="chakra-collapse"
|
|
429
|
+
style={
|
|
430
|
+
Object {
|
|
431
|
+
"display": "none",
|
|
432
|
+
"height": "0px",
|
|
433
|
+
"opacity": 0,
|
|
434
|
+
"overflow": "hidden",
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
>
|
|
438
|
+
<div
|
|
439
|
+
aria-labelledby="accordion-button-accordian-item-0"
|
|
440
|
+
className="chakra-accordion__panel css-0"
|
|
441
|
+
id="accordion-panel-accordian-item-0"
|
|
442
|
+
role="region"
|
|
443
|
+
>
|
|
444
|
+
<div
|
|
445
|
+
className="css-1xdhyk6"
|
|
446
|
+
id="card"
|
|
447
|
+
>
|
|
448
|
+
<div
|
|
449
|
+
className="css-0"
|
|
450
|
+
>
|
|
451
|
+
<div
|
|
452
|
+
className="the-wrap css-1u8qly9"
|
|
453
|
+
>
|
|
454
|
+
<div
|
|
455
|
+
className="the-crop css-0"
|
|
456
|
+
>
|
|
457
|
+
<img
|
|
458
|
+
alt="Alt text"
|
|
459
|
+
className="css-0"
|
|
460
|
+
src="https://cdn.onebauer.media/one/media/6176/76fd/405b/ab5f/f20f/2d52/gerri-1500-1.jpg?format=jpg&quality=80&width=850&ratio=1-1&resize=aspectfit"
|
|
461
|
+
/>
|
|
462
|
+
</div>
|
|
463
|
+
</div>
|
|
464
|
+
</div>
|
|
465
|
+
<div
|
|
466
|
+
className="card-body css-0"
|
|
467
|
+
>
|
|
468
|
+
<h4
|
|
469
|
+
className="chakra-heading css-1xdhyk6"
|
|
470
|
+
id="heading1"
|
|
471
|
+
layout="row"
|
|
472
|
+
>
|
|
473
|
+
Gerry Kellman
|
|
474
|
+
</h4>
|
|
475
|
+
<div
|
|
476
|
+
className="css-1xdhyk6"
|
|
477
|
+
>
|
|
478
|
+
Gerri is
|
|
479
|
+
<b>
|
|
480
|
+
one of Logan's most trusted confidantes
|
|
481
|
+
</b>
|
|
482
|
+
, one who serves many roles within the company. She's one of the most powerful people at Waystar Royco outside of the family itself.
|
|
483
|
+
</div>
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
</div>
|
|
489
|
+
</div>
|
|
490
|
+
`;
|
|
491
|
+
|
|
492
|
+
exports[`Accordion Renders the UI snapshot correctly 5`] = `
|
|
493
|
+
<div
|
|
494
|
+
className="chakra-accordion css-1xdhyk6"
|
|
495
|
+
id="accordian"
|
|
496
|
+
>
|
|
497
|
+
<div
|
|
498
|
+
className="chakra-accordion__item css-1fsnuue"
|
|
499
|
+
>
|
|
500
|
+
<button
|
|
501
|
+
aria-controls="accordion-panel-accordian-item-0"
|
|
502
|
+
aria-expanded={false}
|
|
503
|
+
className="chakra-accordion__button css-1m4sr3t"
|
|
504
|
+
disabled={false}
|
|
505
|
+
id="accordion-button-accordian-item-0"
|
|
506
|
+
onClick={[Function]}
|
|
507
|
+
onFocus={[Function]}
|
|
508
|
+
onKeyDown={[Function]}
|
|
509
|
+
type="button"
|
|
510
|
+
>
|
|
511
|
+
<div
|
|
512
|
+
className="css-1eziwv"
|
|
513
|
+
>
|
|
514
|
+
Gerry Kellman
|
|
515
|
+
</div>
|
|
516
|
+
<svg
|
|
517
|
+
aria-hidden={true}
|
|
518
|
+
className="chakra-icon css-1grhd2q"
|
|
519
|
+
focusable={false}
|
|
520
|
+
id="accordion-accordian-icon-0"
|
|
521
|
+
role="img"
|
|
522
|
+
title="plus icon"
|
|
523
|
+
viewBox="0 0 24 24"
|
|
524
|
+
>
|
|
525
|
+
<g
|
|
526
|
+
stroke="currentColor"
|
|
527
|
+
strokeWidth="1.5"
|
|
528
|
+
>
|
|
529
|
+
<path
|
|
530
|
+
d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
|
|
531
|
+
fill="none"
|
|
532
|
+
strokeLinecap="round"
|
|
533
|
+
/>
|
|
534
|
+
<path
|
|
535
|
+
d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
|
|
536
|
+
fill="currentColor"
|
|
537
|
+
strokeLinecap="round"
|
|
538
|
+
/>
|
|
539
|
+
<circle
|
|
540
|
+
cx="12"
|
|
541
|
+
cy="12"
|
|
542
|
+
fill="none"
|
|
543
|
+
r="11.25"
|
|
544
|
+
strokeMiterlimit="10"
|
|
545
|
+
/>
|
|
546
|
+
</g>
|
|
547
|
+
</svg>
|
|
548
|
+
</button>
|
|
549
|
+
<div
|
|
550
|
+
className="chakra-collapse"
|
|
551
|
+
style={
|
|
552
|
+
Object {
|
|
553
|
+
"display": "none",
|
|
554
|
+
"height": "0px",
|
|
555
|
+
"opacity": 0,
|
|
556
|
+
"overflow": "hidden",
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
>
|
|
560
|
+
<div
|
|
561
|
+
aria-labelledby="accordion-button-accordian-item-0"
|
|
562
|
+
className="chakra-accordion__panel css-0"
|
|
563
|
+
id="accordion-panel-accordian-item-0"
|
|
564
|
+
role="region"
|
|
565
|
+
>
|
|
566
|
+
<div
|
|
567
|
+
className="css-1xdhyk6"
|
|
568
|
+
id="card"
|
|
569
|
+
>
|
|
570
|
+
<div
|
|
571
|
+
className="css-0"
|
|
572
|
+
>
|
|
573
|
+
<div
|
|
574
|
+
className="the-wrap css-1u8qly9"
|
|
575
|
+
>
|
|
576
|
+
<div
|
|
577
|
+
className="the-crop css-0"
|
|
578
|
+
>
|
|
579
|
+
<img
|
|
580
|
+
alt="Alt text"
|
|
581
|
+
className="css-0"
|
|
582
|
+
src="https://cdn.onebauer.media/one/media/6176/76fd/405b/ab5f/f20f/2d52/gerri-1500-1.jpg?format=jpg&quality=80&width=850&ratio=1-1&resize=aspectfit"
|
|
583
|
+
/>
|
|
584
|
+
</div>
|
|
585
|
+
</div>
|
|
586
|
+
</div>
|
|
587
|
+
<div
|
|
588
|
+
className="card-body css-0"
|
|
589
|
+
>
|
|
590
|
+
<h4
|
|
591
|
+
className="chakra-heading css-1xdhyk6"
|
|
592
|
+
id="heading1"
|
|
593
|
+
layout="row"
|
|
594
|
+
>
|
|
595
|
+
Gerry Kellman
|
|
596
|
+
</h4>
|
|
597
|
+
<div
|
|
598
|
+
className="css-1xdhyk6"
|
|
599
|
+
>
|
|
600
|
+
Gerri is
|
|
601
|
+
<b>
|
|
602
|
+
one of Logan's most trusted confidantes
|
|
603
|
+
</b>
|
|
604
|
+
, one who serves many roles within the company. She's one of the most powerful people at Waystar Royco outside of the family itself.
|
|
605
|
+
</div>
|
|
606
|
+
</div>
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
</div>
|
|
610
|
+
</div>
|
|
611
|
+
</div>
|
|
612
|
+
`;
|
|
613
|
+
|
|
614
|
+
exports[`Accordion Renders the UI snapshot correctly 6`] = `
|
|
615
|
+
<div
|
|
616
|
+
className="chakra-accordion css-1xdhyk6"
|
|
369
617
|
id="accordian"
|
|
370
618
|
>
|
|
371
619
|
<div
|
|
@@ -389,7 +637,7 @@ exports[`Accordion Renders the UI snapshot correctly 4`] = `
|
|
|
389
637
|
</div>
|
|
390
638
|
<svg
|
|
391
639
|
aria-hidden={true}
|
|
392
|
-
className="chakra-icon css-
|
|
640
|
+
className="chakra-icon css-1grhd2q"
|
|
393
641
|
focusable={false}
|
|
394
642
|
id="accordion-accordian-icon-0"
|
|
395
643
|
role="img"
|
|
@@ -438,14 +686,14 @@ exports[`Accordion Renders the UI snapshot correctly 4`] = `
|
|
|
438
686
|
role="region"
|
|
439
687
|
>
|
|
440
688
|
<div
|
|
441
|
-
className="css-
|
|
689
|
+
className="css-1xdhyk6"
|
|
442
690
|
id="card"
|
|
443
691
|
>
|
|
444
692
|
<div
|
|
445
693
|
className="css-0"
|
|
446
694
|
>
|
|
447
695
|
<div
|
|
448
|
-
className="the-wrap
|
|
696
|
+
className="the-wrap css-1u8qly9"
|
|
449
697
|
>
|
|
450
698
|
<div
|
|
451
699
|
className="the-crop css-0"
|
|
@@ -462,13 +710,14 @@ exports[`Accordion Renders the UI snapshot correctly 4`] = `
|
|
|
462
710
|
className="card-body css-0"
|
|
463
711
|
>
|
|
464
712
|
<h4
|
|
465
|
-
className="chakra-heading css-
|
|
713
|
+
className="chakra-heading css-1xdhyk6"
|
|
466
714
|
id="heading1"
|
|
715
|
+
layout="row"
|
|
467
716
|
>
|
|
468
717
|
Gerry Kellman
|
|
469
718
|
</h4>
|
|
470
719
|
<div
|
|
471
|
-
className="css-
|
|
720
|
+
className="css-1xdhyk6"
|
|
472
721
|
>
|
|
473
722
|
Gerri is
|
|
474
723
|
<b>
|
|
@@ -8,12 +8,13 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
8
8
|
|
|
9
9
|
# Autosuggest
|
|
10
10
|
|
|
11
|
-
The
|
|
11
|
+
The Reservoir Design System (DS) does not have its own `Autosuggest` component. Instead,
|
|
12
12
|
we are currently using the
|
|
13
13
|
[react-autosuggest](https://www.npmjs.com/package/react-autosuggest) package.
|
|
14
14
|
We recommend using this package in your application and wrapping it in a [custom
|
|
15
|
-
component](#code-implementation). The
|
|
16
|
-
classes from the `react-autosuggest` package, so the look
|
|
15
|
+
component](#code-implementation). The Reservoir Design System (DS) does have custom
|
|
16
|
+
styling that targets the classes from the `react-autosuggest` package, so the look
|
|
17
|
+
and feel will be consistent.
|
|
17
18
|
|
|
18
19
|
In the following previews, you'll notice that there is a lot of white space underneath
|
|
19
20
|
every input element. Since the suggestion dropdown will appear on top of page content,
|
|
@@ -49,7 +49,17 @@ export const enumValues = getStorybookEnumValues(
|
|
|
49
49
|
| Component Version | DS Version |
|
|
50
50
|
| ----------------- | ---------- |
|
|
51
51
|
| Added | `0.0.3` |
|
|
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
|
+
- [Long Titles](#long-titles)
|
|
60
|
+
- [Color Variations](#color-variations)
|
|
61
|
+
|
|
62
|
+
## Overview
|
|
53
63
|
|
|
54
64
|
<Description of={Breadcrumbs} />
|
|
55
65
|
|
|
@@ -57,6 +67,8 @@ The `Breadcrumbs` component is a navigation element that provides a breadcrumb
|
|
|
57
67
|
path that reflects the site structure and allows a user to navigate to any page
|
|
58
68
|
available in the breadcrumb hierarchy.
|
|
59
69
|
|
|
70
|
+
## Component Props
|
|
71
|
+
|
|
60
72
|
<Canvas withToolbar>
|
|
61
73
|
<Story
|
|
62
74
|
name="Breadcrumbs with Controls"
|
|
@@ -86,13 +98,17 @@ available in the breadcrumb hierarchy.
|
|
|
86
98
|
### Accessibility
|
|
87
99
|
|
|
88
100
|
Only one `Breadcrumbs` component should be rendered on a page. This is because
|
|
89
|
-
only one HTML `<nav>` element with `aria-label` attribute of
|
|
90
|
-
should be rendered. The DS `Breadcrumbs` component
|
|
91
|
-
so only one component must be rendered on a page.
|
|
101
|
+
only one HTML `<nav>` element with an `aria-label` attribute value of
|
|
102
|
+
"Breadcrumbs" should be rendered on a page. The DS `Breadcrumbs` component
|
|
103
|
+
renders this HTML landmark so only one component must be rendered on a page.
|
|
104
|
+
|
|
105
|
+
Internally, links are organized in a `ul` list element. The current page link is
|
|
106
|
+
denoted by an `aria-current` attribute value of "page".
|
|
92
107
|
|
|
93
108
|
- [W3 Breadcrumbs Practice](https://www.w3.org/TR/wai-aria-practices/examples/breadcrumb/index.html)
|
|
109
|
+
- [Chakra UI Breadcrumb](https://chakra-ui.com/docs/components/navigation/breadcrumb)
|
|
94
110
|
|
|
95
|
-
|
|
111
|
+
## Long Titles
|
|
96
112
|
|
|
97
113
|
<Canvas>
|
|
98
114
|
<DSProvider>
|
|
@@ -34,6 +34,37 @@ describe("Breadcrumbs Accessibility", () => {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
describe("Breadcrumbs", () => {
|
|
38
|
+
const breadcrumbsData = [
|
|
39
|
+
{ url: "#string1", text: "string1" },
|
|
40
|
+
{ url: "#string2", text: "string2" },
|
|
41
|
+
{ url: "#string3", text: "string3" },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
it("Renders a tag with custom text", () => {
|
|
45
|
+
render(<Breadcrumbs breadcrumbsData={breadcrumbsData} />);
|
|
46
|
+
|
|
47
|
+
// The last breadcrumb (the active page) is not a link.
|
|
48
|
+
expect(screen.getAllByRole("link")).toHaveLength(2);
|
|
49
|
+
expect(screen.getAllByRole("link")[0]).toHaveTextContent("string1");
|
|
50
|
+
expect(screen.getAllByRole("link")[1]).toHaveTextContent("string2");
|
|
51
|
+
expect(screen.getByText(/string3/)).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("Renders icon", () => {
|
|
55
|
+
const { container } = render(
|
|
56
|
+
<Breadcrumbs breadcrumbsData={breadcrumbsData} />
|
|
57
|
+
);
|
|
58
|
+
expect(container.querySelector(".breadcrumbs-icon")).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("Throws error when nothing is passed into Breadcrumb", () => {
|
|
62
|
+
expect(() => render(<Breadcrumbs breadcrumbsData={[]} />)).toThrowError(
|
|
63
|
+
"NYPL Reservoir Breadcrumbs: No data was passed to the `breadcrumbsData` prop."
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
37
68
|
describe("Breadcrumbs Snapshot", () => {
|
|
38
69
|
it("Renders the UI snapshot correctly", () => {
|
|
39
70
|
const breadcrumbsData = [
|
|
@@ -94,6 +125,25 @@ describe("Breadcrumbs Snapshot", () => {
|
|
|
94
125
|
/>
|
|
95
126
|
)
|
|
96
127
|
.toJSON();
|
|
128
|
+
const withChakraProps = renderer
|
|
129
|
+
.create(
|
|
130
|
+
<Breadcrumbs
|
|
131
|
+
breadcrumbsData={breadcrumbsData}
|
|
132
|
+
id="breadcrumbs-test"
|
|
133
|
+
p="s"
|
|
134
|
+
color="ui.error.primary"
|
|
135
|
+
/>
|
|
136
|
+
)
|
|
137
|
+
.toJSON();
|
|
138
|
+
const withOtherProps = renderer
|
|
139
|
+
.create(
|
|
140
|
+
<Breadcrumbs
|
|
141
|
+
breadcrumbsData={breadcrumbsData}
|
|
142
|
+
id="breadcrumbs-test"
|
|
143
|
+
data-testid="testid"
|
|
144
|
+
/>
|
|
145
|
+
)
|
|
146
|
+
.toJSON();
|
|
97
147
|
|
|
98
148
|
expect(breadcrumbsSnapshot).toMatchSnapshot();
|
|
99
149
|
expect(breadcrumbsVariantColor).toMatchSnapshot();
|
|
@@ -101,36 +151,7 @@ describe("Breadcrumbs Snapshot", () => {
|
|
|
101
151
|
expect(breadcrumbsLocationsVariant).toMatchSnapshot();
|
|
102
152
|
expect(breadcrumbsEducationVariant).toMatchSnapshot();
|
|
103
153
|
expect(breadcrumbsAdditionalStyles).toMatchSnapshot();
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
describe("Breadcrumbs Testing", () => {
|
|
108
|
-
const breadcrumbsData = [
|
|
109
|
-
{ url: "#string1", text: "string1" },
|
|
110
|
-
{ url: "#string2", text: "string2" },
|
|
111
|
-
{ url: "#string3", text: "string3" },
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
it("Renders a tag with custom text", () => {
|
|
115
|
-
render(<Breadcrumbs breadcrumbsData={breadcrumbsData} />);
|
|
116
|
-
|
|
117
|
-
// The last breadcrumb (the active page) is not a link.
|
|
118
|
-
expect(screen.getAllByRole("link")).toHaveLength(2);
|
|
119
|
-
expect(screen.getAllByRole("link")[0]).toHaveTextContent("string1");
|
|
120
|
-
expect(screen.getAllByRole("link")[1]).toHaveTextContent("string2");
|
|
121
|
-
expect(screen.getByText(/string3/)).toBeInTheDocument();
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it("Renders icon", () => {
|
|
125
|
-
const { container } = render(
|
|
126
|
-
<Breadcrumbs breadcrumbsData={breadcrumbsData} />
|
|
127
|
-
);
|
|
128
|
-
expect(container.querySelector(".breadcrumbs-icon")).toBeInTheDocument();
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it("Throws error when nothing is passed into Breadcrumb", () => {
|
|
132
|
-
expect(() => render(<Breadcrumbs breadcrumbsData={[]} />)).toThrowError(
|
|
133
|
-
"NYPL Reservoir Breadcrumbs: No data was passed to the `breadcrumbsData` prop."
|
|
134
|
-
);
|
|
154
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
155
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
135
156
|
});
|
|
136
157
|
});
|