@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
|
@@ -1,67 +1,70 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is based on:
|
|
3
|
-
* root size of 16px or 1rem
|
|
4
|
-
* 1 spacing unit is 4px or 0.25rem
|
|
5
|
-
*
|
|
6
|
-
* Chakra's mental model: If you need a spacing of 40px, divide it by 4.
|
|
7
|
-
* That'll give you 10. Then use it in your component.
|
|
8
|
-
*
|
|
9
|
-
* The DS uses eight CSS variables/values found in "src/styles/03-space/_space.css":
|
|
10
|
-
* --nypl-space-xxs = 4px or 0.25rem
|
|
11
|
-
* --nypl-space-xs = 8px or 0.5rem
|
|
12
|
-
* --nypl-space-s = 16px or 1rem
|
|
13
|
-
* --nypl-space-m = 24px or 1.5rem
|
|
14
|
-
* --nypl-space-l = 32px or 2rem
|
|
15
|
-
* --nypl-space-xl = 48px or 3rem
|
|
16
|
-
* --nypl-space-xxl = 64px or 4rem
|
|
17
|
-
* --nypl-space-xxxl = 96px or 6rem
|
|
18
|
-
*
|
|
19
|
-
* @note Even though all the following values are available through Chakra,
|
|
20
|
-
* we recommend to only use the spacing values that map to the DS values
|
|
21
|
-
* declared above.
|
|
22
|
-
*
|
|
23
|
-
* Chakra Number Value | Chakra Name value | DS Variable
|
|
24
|
-
* ------------------- | ----------------- | -----------------
|
|
25
|
-
* 0.5 | xxxs | --nypl-space-xxxs
|
|
26
|
-
* 1 | xxs | --nypl-space-xxs
|
|
27
|
-
* 2 | xs | --nypl-space-xs
|
|
28
|
-
* 4 | s | --nypl-space-s
|
|
29
|
-
* 6 | m | --nypl-space-m
|
|
30
|
-
* 8 | l | --nypl-space-l
|
|
31
|
-
* 12 | xl | --nypl-space-xl
|
|
32
|
-
* 16 | xxl | --nypl-space-xxl
|
|
33
|
-
* 24 | xxxl | --nypl-space-xxxl
|
|
34
|
-
*/
|
|
35
1
|
export declare const spacing: {
|
|
2
|
+
xxxs: string;
|
|
3
|
+
xxs: string;
|
|
4
|
+
xs: string;
|
|
5
|
+
s: string;
|
|
6
|
+
m: string;
|
|
7
|
+
l: string;
|
|
8
|
+
xl: string;
|
|
9
|
+
xxl: string;
|
|
10
|
+
xxxl: string;
|
|
11
|
+
input: {
|
|
12
|
+
group: {
|
|
13
|
+
button: {
|
|
14
|
+
hstack: string;
|
|
15
|
+
vstack: string;
|
|
16
|
+
};
|
|
17
|
+
default: {
|
|
18
|
+
hstack: string;
|
|
19
|
+
vstack: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
inset: {
|
|
24
|
+
default: string;
|
|
25
|
+
extranarrow: string;
|
|
26
|
+
extrawide: string;
|
|
27
|
+
narrow: string;
|
|
28
|
+
wide: string;
|
|
29
|
+
};
|
|
30
|
+
grid: {
|
|
31
|
+
default: string;
|
|
32
|
+
xxs: string;
|
|
33
|
+
xs: string;
|
|
34
|
+
s: string;
|
|
35
|
+
m: string;
|
|
36
|
+
l: string;
|
|
37
|
+
xl: string;
|
|
38
|
+
xxl: string;
|
|
39
|
+
};
|
|
40
|
+
page: {
|
|
41
|
+
hstack: string;
|
|
42
|
+
vstack: string;
|
|
43
|
+
};
|
|
44
|
+
table: {
|
|
45
|
+
column: string;
|
|
46
|
+
row: string;
|
|
47
|
+
};
|
|
36
48
|
px: string;
|
|
37
49
|
0: string;
|
|
38
|
-
xxxs: string;
|
|
39
50
|
0.5: string;
|
|
40
|
-
xxs: string;
|
|
41
51
|
1: string;
|
|
42
52
|
1.5: string;
|
|
43
|
-
xs: string;
|
|
44
53
|
2: string;
|
|
45
54
|
2.5: string;
|
|
46
55
|
3: string;
|
|
47
56
|
3.5: string;
|
|
48
|
-
s: string;
|
|
49
57
|
4: string;
|
|
50
58
|
5: string;
|
|
51
|
-
m: string;
|
|
52
59
|
6: string;
|
|
53
60
|
7: string;
|
|
54
|
-
l: string;
|
|
55
61
|
8: string;
|
|
56
62
|
9: string;
|
|
57
63
|
10: string;
|
|
58
|
-
xl: string;
|
|
59
64
|
12: string;
|
|
60
65
|
14: string;
|
|
61
|
-
xxl: string;
|
|
62
66
|
16: string;
|
|
63
67
|
20: string;
|
|
64
|
-
xxxl: string;
|
|
65
68
|
24: string;
|
|
66
69
|
28: string;
|
|
67
70
|
32: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nypl/design-system-react-components",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Design System React Components",
|
|
3
|
+
"version": "0.27.0",
|
|
4
|
+
"description": "NYPL Reservoir Design System React Components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/NYPL/nypl-design-system/"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"size": "size-limit",
|
|
33
33
|
"analyze": "size-limit --why",
|
|
34
34
|
"generate-sass-resources": "gulp",
|
|
35
|
-
"storybook": "start-storybook -p 6006",
|
|
36
|
-
"build-storybook": "npm run prebuild:storybook && build-storybook -c .storybook -o ./
|
|
35
|
+
"storybook": "start-storybook -p 6006 -s ./.storybook/public",
|
|
36
|
+
"build-storybook:v0": "npm run prebuild:storybook && build-storybook -c .storybook -o ./reservoir/v0",
|
|
37
37
|
"prebuild:storybook": "npm run test:generate-output"
|
|
38
38
|
},
|
|
39
39
|
"lint-staged": {
|
|
@@ -57,28 +57,28 @@
|
|
|
57
57
|
}
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@chakra-ui/react": ">=1.
|
|
61
|
-
"@chakra-ui/system": ">=1.
|
|
62
|
-
"@emotion/react": "11.4.1",
|
|
63
|
-
"@emotion/styled": "11.3.0",
|
|
64
|
-
"framer-motion": "4.1.17",
|
|
60
|
+
"@chakra-ui/react": ">=1.8.5",
|
|
61
|
+
"@chakra-ui/system": ">=1.11.0",
|
|
62
|
+
"@emotion/react": ">=11.4.1",
|
|
63
|
+
"@emotion/styled": ">=11.3.0",
|
|
64
|
+
"framer-motion": "^4.1.17",
|
|
65
65
|
"he": "1.2.0",
|
|
66
66
|
"react-datepicker": "4.1.1",
|
|
67
67
|
"system-font-css": "2.0.2",
|
|
68
|
-
"typescript": "4.3.5"
|
|
69
|
-
"uuid": "8.3.2"
|
|
68
|
+
"typescript": "4.3.5"
|
|
70
69
|
},
|
|
71
70
|
"peerDependencies": {
|
|
72
|
-
"@chakra-ui/react": ">=1.
|
|
73
|
-
"@chakra-ui/system": ">=1.
|
|
71
|
+
"@chakra-ui/react": ">=1.8.0",
|
|
72
|
+
"@chakra-ui/system": ">=1.10.0",
|
|
74
73
|
"@emotion/react": ">=11.4.1",
|
|
75
74
|
"@emotion/styled": ">=11.3.0",
|
|
76
|
-
"framer-motion": "
|
|
75
|
+
"framer-motion": "^4.1.17",
|
|
77
76
|
"react": ">=16.13.0",
|
|
78
77
|
"react-dom": ">=16.13.0"
|
|
79
78
|
},
|
|
80
79
|
"devDependencies": {
|
|
81
80
|
"@babel/core": "7.14.6",
|
|
81
|
+
"@chakra-ui/storybook-addon": "1.0.3",
|
|
82
82
|
"@mdx-js/react": "1.6.22",
|
|
83
83
|
"@size-limit/preset-small-lib": "5.0.1",
|
|
84
84
|
"@storybook/addon-a11y": "6.4.19",
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
"@storybook/addon-essentials": "6.4.19",
|
|
88
88
|
"@storybook/addon-jest": "6.4.19",
|
|
89
89
|
"@storybook/addon-links": "6.4.19",
|
|
90
|
-
"@storybook/addon-queryparams": "6.2.9",
|
|
91
90
|
"@storybook/addons": "6.4.19",
|
|
92
91
|
"@storybook/react": "6.4.19",
|
|
93
92
|
"@svgr/rollup": "5.5.0",
|
|
@@ -125,12 +124,11 @@
|
|
|
125
124
|
"node-sass-glob-importer": "5.3.2",
|
|
126
125
|
"normalize.css": "8.0.1",
|
|
127
126
|
"prettier": "2.4.1",
|
|
128
|
-
"react": "
|
|
127
|
+
"react": "17.0.2",
|
|
129
128
|
"react-autosuggest": "10.0.2",
|
|
130
129
|
"react-docgen-typescript-loader": "3.1.0",
|
|
131
|
-
"react-dom": "
|
|
132
|
-
"react-
|
|
133
|
-
"react-test-renderer": "16.14.0",
|
|
130
|
+
"react-dom": "17.0.2",
|
|
131
|
+
"react-test-renderer": "17.0.2",
|
|
134
132
|
"rollup-plugin-postcss": "4.0.0",
|
|
135
133
|
"rollup-plugin-svg": "2.0.0",
|
|
136
134
|
"sass": "1.35.1",
|
|
@@ -39,7 +39,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
39
39
|
| Component Version | DS Version |
|
|
40
40
|
| ----------------- | ---------- |
|
|
41
41
|
| Added | `0.1.0` |
|
|
42
|
-
| Latest | `0.
|
|
42
|
+
| Latest | `0.26.0` |
|
|
43
43
|
|
|
44
44
|
## Table of Contents
|
|
45
45
|
|
|
@@ -111,13 +111,13 @@ const accordionData = [
|
|
|
111
111
|
label: "Tom Nook",
|
|
112
112
|
panel: (
|
|
113
113
|
<Card
|
|
114
|
-
layout={LayoutTypes.Row}
|
|
115
114
|
imageProps={{
|
|
116
115
|
alt: "Alt text",
|
|
117
116
|
aspectRatio: ImageRatios.TwoByOne,
|
|
118
117
|
src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
119
118
|
}}
|
|
120
119
|
isCentered
|
|
120
|
+
layout={LayoutTypes.Row}
|
|
121
121
|
>
|
|
122
122
|
<CardHeading level={HeadingLevels.Four} id="heading1">
|
|
123
123
|
Tom Nook
|
|
@@ -148,13 +148,13 @@ const accordionData = [
|
|
|
148
148
|
label: "Tom Nook",
|
|
149
149
|
panel: (
|
|
150
150
|
<Card
|
|
151
|
-
layout={LayoutTypes.Row}
|
|
152
151
|
imageProps={{
|
|
153
152
|
alt: "Alt text",
|
|
154
153
|
aspectRatio: ImageRatios.TwoByOne,
|
|
155
154
|
src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
156
155
|
}}
|
|
157
156
|
isCentered
|
|
157
|
+
layout={LayoutTypes.Row}
|
|
158
158
|
>
|
|
159
159
|
<CardHeading level={HeadingLevels.Four} id="heading1">
|
|
160
160
|
Tom Nook
|
|
@@ -196,13 +196,13 @@ export const faqContent = [
|
|
|
196
196
|
label: "Tom Nook",
|
|
197
197
|
panel: (
|
|
198
198
|
<Card
|
|
199
|
-
layout={LayoutTypes.Row}
|
|
200
199
|
imageProps={{
|
|
201
200
|
alt: "Alt text",
|
|
202
201
|
aspectRatio: ImageRatios.TwoByOne,
|
|
203
202
|
src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
204
203
|
}}
|
|
205
204
|
isCentered
|
|
205
|
+
layout={LayoutTypes.Row}
|
|
206
206
|
>
|
|
207
207
|
<CardHeading level={HeadingLevels.Four} id="heading1-tom">
|
|
208
208
|
Tom Nook
|
|
@@ -219,13 +219,13 @@ export const faqContent = [
|
|
|
219
219
|
label: "Isabelle",
|
|
220
220
|
panel: (
|
|
221
221
|
<Card
|
|
222
|
-
layout={LayoutTypes.Row}
|
|
223
222
|
imageProps={{
|
|
224
223
|
alt: "Alt text",
|
|
225
224
|
aspectRatio: ImageRatios.TwoByOne,
|
|
226
225
|
src: "https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
227
226
|
}}
|
|
228
227
|
isCentered
|
|
228
|
+
layout={LayoutTypes.Row}
|
|
229
229
|
>
|
|
230
230
|
<CardHeading level={HeadingLevels.Four} id="heading1-isabelle">
|
|
231
231
|
Isabelle
|
|
@@ -244,13 +244,13 @@ export const faqContent = [
|
|
|
244
244
|
label: "K.K. Slider",
|
|
245
245
|
panel: (
|
|
246
246
|
<Card
|
|
247
|
-
layout={LayoutTypes.Row}
|
|
248
247
|
imageProps={{
|
|
249
248
|
alt: "Alt text",
|
|
250
249
|
aspectRatio: ImageRatios.TwoByOne,
|
|
251
250
|
src: "https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
252
251
|
}}
|
|
253
252
|
isCentered
|
|
253
|
+
layout={LayoutTypes.Row}
|
|
254
254
|
>
|
|
255
255
|
<CardHeading level={HeadingLevels.Four} id="heading1-kkslider">
|
|
256
256
|
K.K. Slider
|
|
@@ -284,13 +284,13 @@ export const faqContent = [
|
|
|
284
284
|
label: "Tom Nook",
|
|
285
285
|
panel: (
|
|
286
286
|
<Card
|
|
287
|
-
layout={LayoutTypes.Row}
|
|
288
287
|
imageProps={{
|
|
289
288
|
alt: "Alt text",
|
|
290
289
|
aspectRatio: ImageRatios.TwoByOne,
|
|
291
290
|
src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
292
291
|
}}
|
|
293
292
|
isCentered
|
|
293
|
+
layout={LayoutTypes.Row}
|
|
294
294
|
>
|
|
295
295
|
<CardHeading level={HeadingLevels.Four} id="heading1-tom">
|
|
296
296
|
Tom Nook
|
|
@@ -307,13 +307,13 @@ export const faqContent = [
|
|
|
307
307
|
label: "Isabelle",
|
|
308
308
|
panel: (
|
|
309
309
|
<Card
|
|
310
|
-
layout={LayoutTypes.Row}
|
|
311
310
|
imageProps={{
|
|
312
311
|
alt: "Alt text",
|
|
313
312
|
aspectRatio: ImageRatios.TwoByOne,
|
|
314
313
|
src: "https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
315
314
|
}}
|
|
316
315
|
isCentered
|
|
316
|
+
layout={LayoutTypes.Row}
|
|
317
317
|
>
|
|
318
318
|
<CardHeading level={HeadingLevels.Four} id="heading1-isabelle">
|
|
319
319
|
Isabelle
|
|
@@ -332,13 +332,13 @@ export const faqContent = [
|
|
|
332
332
|
label: "K.K. Slider",
|
|
333
333
|
panel: (
|
|
334
334
|
<Card
|
|
335
|
-
layout={LayoutTypes.Row}
|
|
336
335
|
imageProps={{
|
|
337
336
|
alt: "Alt text",
|
|
338
337
|
aspectRatio: ImageRatios.TwoByOne,
|
|
339
338
|
src: "https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
|
|
340
339
|
}}
|
|
341
340
|
isCentered
|
|
341
|
+
layout={LayoutTypes.Row}
|
|
342
342
|
>
|
|
343
343
|
<CardHeading level={HeadingLevels.Four} id="heading1-kkslider">
|
|
344
344
|
K.K. Slider
|
|
@@ -215,9 +215,30 @@ describe("Accordion", () => {
|
|
|
215
215
|
/>
|
|
216
216
|
)
|
|
217
217
|
.toJSON();
|
|
218
|
+
const withChakraProps = renderer
|
|
219
|
+
.create(
|
|
220
|
+
<Accordion
|
|
221
|
+
accordionData={accordionData}
|
|
222
|
+
id="accordian"
|
|
223
|
+
p="s"
|
|
224
|
+
color="ui.error.primary"
|
|
225
|
+
/>
|
|
226
|
+
)
|
|
227
|
+
.toJSON();
|
|
228
|
+
const withOtherProps = renderer
|
|
229
|
+
.create(
|
|
230
|
+
<Accordion
|
|
231
|
+
accordionData={accordionData}
|
|
232
|
+
id="accordian"
|
|
233
|
+
data-testid="testid"
|
|
234
|
+
/>
|
|
235
|
+
)
|
|
236
|
+
.toJSON();
|
|
218
237
|
|
|
219
238
|
expect(primary).toMatchSnapshot();
|
|
220
239
|
expect(defaultOpen).toMatchSnapshot();
|
|
240
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
241
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
221
242
|
expect(withError).toMatchSnapshot();
|
|
222
243
|
expect(withWarning).toMatchSnapshot();
|
|
223
244
|
});
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import {
|
|
3
|
-
Box,
|
|
4
2
|
Accordion as ChakraAccordion,
|
|
5
3
|
AccordionItem,
|
|
6
4
|
AccordionButton,
|
|
7
5
|
AccordionPanel,
|
|
6
|
+
Box,
|
|
7
|
+
chakra,
|
|
8
8
|
} from "@chakra-ui/react";
|
|
9
|
+
import * as React from "react";
|
|
9
10
|
|
|
10
11
|
import { AccordionTypes } from "./AccordionTypes";
|
|
11
12
|
import Icon from "../Icons/Icon";
|
|
12
13
|
import { IconNames, IconSizes } from "../Icons/IconTypes";
|
|
13
|
-
import generateUUID from "../../helpers/generateUUID";
|
|
14
|
-
|
|
15
14
|
export interface AccordionDataProps {
|
|
16
15
|
accordionType?: AccordionTypes;
|
|
17
16
|
label: string;
|
|
@@ -91,7 +90,7 @@ const getElementsFromData = (data = [], id) => {
|
|
|
91
90
|
bg:
|
|
92
91
|
!content.accordionType ||
|
|
93
92
|
content.accordionType === "default"
|
|
94
|
-
? "ui.gray.light-
|
|
93
|
+
? "ui.gray.light-cool"
|
|
95
94
|
: bgColorByAccordionType,
|
|
96
95
|
}}
|
|
97
96
|
_hover={{
|
|
@@ -121,16 +120,21 @@ const getElementsFromData = (data = [], id) => {
|
|
|
121
120
|
* Accordion component that shows content on toggle. Can be used to display
|
|
122
121
|
* multiple accordion items together.
|
|
123
122
|
*/
|
|
124
|
-
|
|
125
|
-
const { accordionData, id
|
|
123
|
+
export const Accordion = chakra((props: AccordionProps) => {
|
|
124
|
+
const { accordionData, id, isDefaultOpen = false, ...rest } = props;
|
|
126
125
|
|
|
127
126
|
// Pass `0` to open the first accordion in the 0-index based array.
|
|
128
127
|
const openFirstAccordion = isDefaultOpen ? 0 : undefined;
|
|
129
128
|
return (
|
|
130
|
-
<ChakraAccordion
|
|
129
|
+
<ChakraAccordion
|
|
130
|
+
id={id}
|
|
131
|
+
defaultIndex={[openFirstAccordion]}
|
|
132
|
+
allowMultiple
|
|
133
|
+
{...rest}
|
|
134
|
+
>
|
|
131
135
|
{getElementsFromData(accordionData, id)}
|
|
132
136
|
</ChakraAccordion>
|
|
133
137
|
);
|
|
134
|
-
}
|
|
138
|
+
});
|
|
135
139
|
|
|
136
140
|
export default Accordion;
|