@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,5 +1,4 @@
|
|
|
1
1
|
import { Meta } from "@storybook/addon-docs";
|
|
2
|
-
import { withDesign } from "storybook-addon-designs";
|
|
3
2
|
|
|
4
3
|
import Card from "../Card/Card";
|
|
5
4
|
import List from "../List/List";
|
|
@@ -7,66 +6,106 @@ import { ListTypes } from "../List/ListTypes";
|
|
|
7
6
|
import { getCategory } from "../../utils/componentCategories";
|
|
8
7
|
import DSProvider from "../../theme/provider";
|
|
9
8
|
|
|
10
|
-
<Meta
|
|
11
|
-
title={getCategory("Spacing")}
|
|
12
|
-
decorators={[withDesign]}
|
|
13
|
-
parameters={{
|
|
14
|
-
design: {
|
|
15
|
-
type: "figma",
|
|
16
|
-
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=17249%3A13",
|
|
17
|
-
},
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
9
|
+
<Meta title={getCategory("Spacing")} />
|
|
20
10
|
|
|
21
11
|
# Spacing
|
|
22
12
|
|
|
23
|
-
| Table of Contents
|
|
24
|
-
|
|
|
25
|
-
| 1. [General Information](#general-information)
|
|
26
|
-
| 2. [
|
|
27
|
-
| 3. [Section Spacing](#section-spacing)
|
|
28
|
-
| 4. [Grid Spacing](#grid-spacing)
|
|
29
|
-
| 5. [
|
|
30
|
-
| 6. [
|
|
31
|
-
| 7. [Figma Reference](#figma-reference)
|
|
13
|
+
| Table of Contents |
|
|
14
|
+
| ---------------------------------------------------- |
|
|
15
|
+
| 1. [General Information](#general-information) |
|
|
16
|
+
| 2. [Default Spacing Values](#default-spacing-values) |
|
|
17
|
+
| 3. [Page Section Spacing](#page-section-spacing) |
|
|
18
|
+
| 4. [Grid Spacing](#grid-spacing) |
|
|
19
|
+
| 5. [Form Spacing](#form-spacing) |
|
|
20
|
+
| 6. [Tabular Data Spacing](#tabular-data-spacing) |
|
|
21
|
+
| 7. [Figma Reference](#figma-reference) |
|
|
32
22
|
|
|
33
23
|
## General Information
|
|
34
24
|
|
|
35
|
-
The DS spacing values are based on a root
|
|
25
|
+
The Reservoir Design System (DS) spacing values are based on a root unit
|
|
26
|
+
of `16px` (`1rem` = `16px`).
|
|
36
27
|
|
|
37
|
-
##
|
|
28
|
+
## Default Spacing Values
|
|
38
29
|
|
|
39
30
|
<DSProvider>
|
|
40
|
-
The following
|
|
41
|
-
|
|
42
|
-
|
|
|
43
|
-
| ------------------- | -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
44
|
-
| `--nypl-space-
|
|
45
|
-
| `--nypl-space-
|
|
46
|
-
| `--nypl-space-
|
|
47
|
-
| `--nypl-space-
|
|
48
|
-
| `--nypl-space-
|
|
49
|
-
| `--nypl-space-
|
|
50
|
-
| `--nypl-space-
|
|
51
|
-
| `--nypl-space-
|
|
31
|
+
The following default spacing values are available through the DS.
|
|
32
|
+
|
|
33
|
+
| JS Theme Object | CSS Variable | REM Equivalent | Pixel Equivalent | Visual Reference |
|
|
34
|
+
| --------------- | ------------------- | -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| `xxxs` | `--nypl-space-xxxs` | `0.125rem` | `2px` | <div style={{ width: "var(--nypl-space-xxxs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
36
|
+
| `xxs` | `--nypl-space-xxs` | `0.25rem` | `4px` | <div style={{ width: "var(--nypl-space-xxs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
37
|
+
| `xs` | `--nypl-space-xs` | `0.5rem` | `8px` | <div style={{ width: "var(--nypl-space-xs)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
38
|
+
| `s` | `--nypl-space-s` | `1rem` | `16px` | <div style={{ width: "var(--nypl-space-s)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
39
|
+
| `m` | `--nypl-space-m` | `1.5rem` | `24px` | <div style={{ width: "var(--nypl-space-m)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
40
|
+
| `l` | `--nypl-space-l` | `2rem` | `32px` | <div style={{ width: "var(--nypl-space-l)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
41
|
+
| `xl` | `--nypl-space-xl` | `3rem` | `48px` | <div style={{ width: "var(--nypl-space-xl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
42
|
+
| `xxl` | `--nypl-space-xxl` | `4rem` | `64px` | <div style={{ width: "var(--nypl-space-xxl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
43
|
+
| `xxxl` | `--nypl-space-xxxl` | `6rem` | `96px` | <div style={{ width: "var(--nypl-space-xxxl)", backgroundColor: "var(--nypl-colors-ui-focus)" }}> </div> |
|
|
52
44
|
|
|
53
45
|
</DSProvider>
|
|
54
46
|
|
|
55
|
-
## Section Spacing
|
|
47
|
+
## Page Section Spacing
|
|
56
48
|
|
|
57
|
-
In consuming apps, the major page sections should be separated vertically by
|
|
49
|
+
In consuming apps, the major page sections should be separated vertically by
|
|
50
|
+
`2rem`. This includes the space after the page global `header` and the space
|
|
51
|
+
before the global `footer`. Similarly, the major page sections should be
|
|
52
|
+
separated horizontally by `2rem`.
|
|
58
53
|
|
|
59
|
-
|
|
54
|
+
| | Value | JS Theme Object | CSS Variable |
|
|
55
|
+
| ---------------------- | ------ | --------------- | ---------------------------- |
|
|
56
|
+
| **Vertical Spacing** | `2rem` | `page.vstack` | `--nypl-spacing-page-vstack` |
|
|
57
|
+
| **Horizontal Spacing** | `2rem` | `page.hstack` | `--nypl-spacing-page-hstack` |
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
## Grid Spacing
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
When elements are displayed in a grid (i.e. Cards, Images, etc.), the space
|
|
62
|
+
between elements, both horizontal and vertical, should be `2rem`.
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
| | Value | JS Theme Object | CSS Variable |
|
|
65
|
+
| --------------- | ------ | --------------- | ----------------------------- |
|
|
66
|
+
| **Default Gap** | `2rem` | `grid.default` | `--nypl-spacing-grid-default` |
|
|
66
67
|
|
|
67
68
|
## Form Spacing
|
|
68
69
|
|
|
69
|
-
Form input components should have a `2rem`
|
|
70
|
+
Form input components should have a `2rem` space between each form input
|
|
71
|
+
component. This includes both vertical (column) and horizontal (row) stacking.
|
|
72
|
+
The DS [Form](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/components-form-elements-form--form-with-controls)
|
|
73
|
+
component has correct spacing incorporated into its UI structure and should
|
|
74
|
+
always be used when building forms. Please note that the spacing in the `Form`
|
|
75
|
+
component is identical to the spacing in the `Grid` component.
|
|
76
|
+
|
|
77
|
+
When `Checkbox` and `Radio` components are grouped together, the components
|
|
78
|
+
should have a `1rem` space between components for vertical (column) stacking
|
|
79
|
+
and a `2rem` space between components for horizontal (row) stacking. The DS
|
|
80
|
+
`CheckboxGroup` and `RadioGroup` components have the correct spacing built
|
|
81
|
+
|
|
82
|
+
in and should be used respectively when multiple `Checkbox` or `radio`
|
|
83
|
+
components are being used together.
|
|
84
|
+
|
|
85
|
+
When `Button` components are grouped together, the `Button` components should
|
|
86
|
+
have a `0.5rem` space between component. This includes both vertical (column)
|
|
87
|
+
and horizontal (row) stacking. The DS `ButtonGroup` component has the correct
|
|
88
|
+
spacing built in and should be used when multiple `Button` components are being
|
|
89
|
+
used together.
|
|
90
|
+
|
|
91
|
+
| | Value | JS Theme Object | CSS Variable |
|
|
92
|
+
| -------------------------------------- | -------- | ---------------------------- | ------------------------------------------- |
|
|
93
|
+
| **Default Form Gap** | `2rem` | `grid.default` | `--nypl-spacing-grid-default` |
|
|
94
|
+
| **Input Group Default Row Spacing** | `2rem` | `input.group.default.hstack` | `--nypl-spacing-input-group-default-hstack` |
|
|
95
|
+
| **Input Group Default Column Spacing** | `1rem` | `input.group.default.vstack` | `--nypl-spacing-input-group-default-vstack` |
|
|
96
|
+
| **Button Group Row Spacing** | `0.5rem` | `input.group.button.hstack` | `--nypl-spacing-input-group-button-hstack` |
|
|
97
|
+
| **Button Group Column Spacing** | `0.5rem` | `input.group.button.vstack` | `--nypl-spacing-input-group-button-vstack` |
|
|
98
|
+
|
|
99
|
+
## Tabular Data Spacing
|
|
100
|
+
|
|
101
|
+
When data is displayed in a tabular layout (i.e. rows and columns in a table,
|
|
102
|
+
a description list, etc.), the space between data cells in a row should be
|
|
103
|
+
`1.5rem` and the space between rows should be `2rem`.
|
|
104
|
+
|
|
105
|
+
| | Value | JS Theme Object | CSS Variable |
|
|
106
|
+
| -------------- | -------- | --------------- | ----------------------------- |
|
|
107
|
+
| **Column Gap** | `1.5rem` | `table.column` | `--nypl-spacing-table-column` |
|
|
108
|
+
| **Row Gap** | `2rem` | `table.row` | `--nypl-spacing-table-row` |
|
|
70
109
|
|
|
71
110
|
## Figma Reference
|
|
72
111
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Canvas, Meta } from "@storybook/addon-docs";
|
|
2
|
-
import { withDesign } from "storybook-addon-designs";
|
|
3
2
|
|
|
4
3
|
import Heading from "../Heading/Heading";
|
|
5
4
|
import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
@@ -10,16 +9,7 @@ import { TextSizes } from "../Text/TextTypes";
|
|
|
10
9
|
import { getCategory } from "../../utils/componentCategories";
|
|
11
10
|
import DSProvider from "../../theme/provider";
|
|
12
11
|
|
|
13
|
-
<Meta
|
|
14
|
-
title={getCategory("Typography")}
|
|
15
|
-
decorators={[withDesign]}
|
|
16
|
-
parameters={{
|
|
17
|
-
design: {
|
|
18
|
-
type: "figma",
|
|
19
|
-
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=10975%3A16",
|
|
20
|
-
},
|
|
21
|
-
}}
|
|
22
|
-
/>
|
|
12
|
+
<Meta title={getCategory("Typography")} />
|
|
23
13
|
|
|
24
14
|
# Typography
|
|
25
15
|
|
|
@@ -38,13 +28,18 @@ import DSProvider from "../../theme/provider";
|
|
|
38
28
|
|
|
39
29
|
## General Information
|
|
40
30
|
|
|
41
|
-
Consuming applications should utilize the
|
|
31
|
+
Consuming applications should utilize the Reservoir Design System (DS) standard
|
|
32
|
+
text components as much as possible. In cases where that is not possible, the
|
|
33
|
+
DS exposes CSS variables to assist with formatting text elements.
|
|
42
34
|
|
|
43
|
-
The sizing of all text elements in the Design System is based on `1rem` being
|
|
35
|
+
The sizing of all text elements in the Design System is based on `1rem` being
|
|
36
|
+
equal to `16px`.
|
|
44
37
|
|
|
45
38
|
## Heading Component
|
|
46
39
|
|
|
47
|
-
Use the
|
|
40
|
+
Use the DS [Heading](/docs/components-typography-styles-heading--heading-props)
|
|
41
|
+
component to render a standard HTML `<h>` tag. The `level` prop can be used to
|
|
42
|
+
set the specific `<h>` tag that you require.
|
|
48
43
|
|
|
49
44
|
<Canvas>
|
|
50
45
|
<DSProvider>
|
|
@@ -110,7 +105,9 @@ applied to any `Heading` element.
|
|
|
110
105
|
|
|
111
106
|
## Text Component
|
|
112
107
|
|
|
113
|
-
Use the
|
|
108
|
+
Use the DS [Text](/docs/components-typography-styles-text--text)
|
|
109
|
+
component to render a standard HTML `<p>` tag. The Text component is generally
|
|
110
|
+
used for body copy, captions and secondary captions.
|
|
114
111
|
|
|
115
112
|
<Canvas>
|
|
116
113
|
<DSProvider>
|
|
@@ -168,7 +165,9 @@ The `size` prop can be used to render a specific style from the DS default text
|
|
|
168
165
|
|
|
169
166
|
## Font Family
|
|
170
167
|
|
|
171
|
-
With website accessibility in mind, font choices for the DS were made with an
|
|
168
|
+
With website accessibility in mind, font choices for the DS were made with an
|
|
169
|
+
eye toward clarity and readability. Headings and body content use the
|
|
170
|
+
following font family assignment:
|
|
172
171
|
|
|
173
172
|
<Canvas>
|
|
174
173
|
<DSProvider>
|
|
@@ -184,11 +183,15 @@ The following CSS variables are available through the DS.
|
|
|
184
183
|
```
|
|
185
184
|
|
|
186
185
|
> **RECOMMENDATIONS**
|
|
187
|
-
> When making font selections for project based components outside the DS,
|
|
186
|
+
> When making font selections for project based components outside the DS,
|
|
187
|
+
> sans serif fonts display better on computers and mobile devices. Avoid
|
|
188
|
+
> decorative or overly stylized fonts, as they are often difficult to read even
|
|
189
|
+
> for users without visual impairments or reading Standard Text Default
|
|
188
190
|
|
|
189
191
|
## Font Color
|
|
190
192
|
|
|
191
|
-
All text within a project, unless specifically noted in mockups, should be
|
|
193
|
+
All text within a project, unless specifically noted in mockups, should be
|
|
194
|
+
black on a white background.
|
|
192
195
|
|
|
193
196
|
<Canvas>
|
|
194
197
|
<DSProvider>
|
|
@@ -203,7 +206,10 @@ All text within a project, unless specifically noted in mockups, should be black
|
|
|
203
206
|
</DSProvider>
|
|
204
207
|
</Canvas>
|
|
205
208
|
|
|
206
|
-
In cases where specific colors must be applied to text elements, the DS
|
|
209
|
+
In cases where specific colors must be applied to text elements, the DS
|
|
210
|
+
provides CSS variables for the full NYPL color palette. Refer to the
|
|
211
|
+
[Colors](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/style-guide-colors--colors-brand)
|
|
212
|
+
section of the Style Guide for details.
|
|
207
213
|
|
|
208
214
|
## Font Weight
|
|
209
215
|
|
|
@@ -347,7 +353,9 @@ The following font size design tokens are available through the DS.
|
|
|
347
353
|
|
|
348
354
|
## Text Case
|
|
349
355
|
|
|
350
|
-
In general, the New York Public Library uses Title Case for titles. This means
|
|
356
|
+
In general, the New York Public Library uses Title Case for titles. This means
|
|
357
|
+
only using capital letters for the principal words. Articles, conjunctions, and
|
|
358
|
+
prepositions do not get capital letters unless they start the title. For example:
|
|
351
359
|
|
|
352
360
|
<Canvas>
|
|
353
361
|
<DSProvider>
|
|
@@ -378,7 +386,8 @@ In general, the New York Public Library uses Title Case for titles. This means o
|
|
|
378
386
|
### Summaries
|
|
379
387
|
|
|
380
388
|
140 characters max<br />
|
|
381
|
-
Note: Online Exhibitions, with their longer, legacy summaries are an exception
|
|
389
|
+
Note: Online Exhibitions, with their longer, legacy summaries are an exception
|
|
390
|
+
to this.
|
|
382
391
|
|
|
383
392
|
<Canvas>
|
|
384
393
|
<DSProvider>
|
|
@@ -36,7 +36,19 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
36
36
|
| Component Version | DS Version |
|
|
37
37
|
| ----------------- | ---------- |
|
|
38
38
|
| Added | `0.25.9` |
|
|
39
|
-
| Latest | `0.
|
|
39
|
+
| Latest | `0.26.0` |
|
|
40
|
+
|
|
41
|
+
## Table of Contents
|
|
42
|
+
|
|
43
|
+
- [Overview](#overview)
|
|
44
|
+
- [Component Props](#component-props)
|
|
45
|
+
- [Accessibility](#accessibility)
|
|
46
|
+
- [With a title](#with-a-title)
|
|
47
|
+
- [With Row Dividers](#with-row-dividers)
|
|
48
|
+
- [With Row Headers](#with-row-headers)
|
|
49
|
+
- [With Custom Header Colors](#with-custom-header-colors)
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
40
52
|
|
|
41
53
|
<Description of={Table} />
|
|
42
54
|
|
|
@@ -64,6 +76,8 @@ export const tableData = [
|
|
|
64
76
|
],
|
|
65
77
|
];
|
|
66
78
|
|
|
79
|
+
## Component Props
|
|
80
|
+
|
|
67
81
|
<Canvas withToolbar>
|
|
68
82
|
<Story
|
|
69
83
|
name="Table"
|
|
@@ -87,16 +101,29 @@ export const tableData = [
|
|
|
87
101
|
|
|
88
102
|
## Accessibility
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
Internally, the HTML for the `Table` element is structured with proper semantic
|
|
105
|
+
use of the `table`, `caption`, `thead`, `tbody`, `tr`, and `td` HTML elements.
|
|
106
|
+
When titles are added through the `titleText` prop, the `caption` element will
|
|
107
|
+
be rendered above the `thead` element.
|
|
108
|
+
|
|
109
|
+
This component should be used to render tabular data only and not used for layout
|
|
110
|
+
purposes.
|
|
111
|
+
|
|
112
|
+
The first row and/or the first cell in a `tr` row can be headers. Each `th`
|
|
113
|
+
header cell has an appropriate scope attribute set to either `scope="col"` or
|
|
114
|
+
`scope="row"`. For example, every `th` cell in a `thead` `tr` row will have
|
|
115
|
+
`scope="col"`. Every `th` cell in a `tbody` `tr` row will have `scope="row"`.
|
|
116
|
+
These headers are visually different from the data. Use the `useRowHeaders`
|
|
117
|
+
prop to render the first cell in every row as a header. If a table has two levels
|
|
118
|
+
of headers (such as two levels of horizontal headers), break the data into two
|
|
119
|
+
separate tables.
|
|
120
|
+
|
|
121
|
+
Resources:
|
|
122
|
+
|
|
123
|
+
- [W3C Tables Tutorial](https://www.w3.org/WAI/tutorials/tables/)
|
|
124
|
+
- [MDN table: The Table element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table)
|
|
125
|
+
- [MDN HTML table advance features and accessibility](https://developer.mozilla.org/en-US/docs/Learn/HTML/Tables/Advanced)
|
|
126
|
+
- [Chakra UI Table](https://chakra-ui.com/docs/components/data-display/table)
|
|
100
127
|
|
|
101
128
|
## With a title
|
|
102
129
|
|
|
@@ -127,11 +127,26 @@ describe("Table", () => {
|
|
|
127
127
|
/>
|
|
128
128
|
)
|
|
129
129
|
.toJSON();
|
|
130
|
+
const withChakraProps = renderer
|
|
131
|
+
.create(
|
|
132
|
+
<Table
|
|
133
|
+
id="chakra"
|
|
134
|
+
tableData={tableData}
|
|
135
|
+
p="20px"
|
|
136
|
+
color="ui.error.primary"
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
.toJSON();
|
|
140
|
+
const withOtherProps = renderer
|
|
141
|
+
.create(<Table id="props" tableData={tableData} data-testid="props" />)
|
|
142
|
+
.toJSON();
|
|
130
143
|
|
|
131
144
|
expect(basic).toMatchSnapshot();
|
|
132
145
|
expect(withCaption).toMatchSnapshot();
|
|
133
146
|
expect(withHeaders).toMatchSnapshot();
|
|
134
147
|
expect(withRowHeaders).toMatchSnapshot();
|
|
135
148
|
expect(withCustomHeaderColors).toMatchSnapshot();
|
|
149
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
150
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
136
151
|
});
|
|
137
152
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import {
|
|
2
|
+
chakra,
|
|
3
3
|
Table as ChakraTable,
|
|
4
4
|
TableCaption as ChakraTableCaption,
|
|
5
5
|
Tbody as ChakraTbody,
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
Tr as ChakraTr,
|
|
10
10
|
useMultiStyleConfig,
|
|
11
11
|
} from "@chakra-ui/react";
|
|
12
|
-
|
|
13
|
-
import generateUUID from "../../helpers/generateUUID";
|
|
12
|
+
import * as React from "react";
|
|
14
13
|
|
|
15
14
|
export interface TableProps {
|
|
16
15
|
/** Additional class name for the `Table` component. */
|
|
@@ -39,17 +38,18 @@ export interface TableProps {
|
|
|
39
38
|
* Basic `Table` component used to organize and display tabular data in
|
|
40
39
|
* rows and columns.
|
|
41
40
|
*/
|
|
42
|
-
|
|
41
|
+
export const Table = chakra((props: React.PropsWithChildren<TableProps>) => {
|
|
43
42
|
const {
|
|
44
43
|
className,
|
|
45
44
|
columnHeaders,
|
|
46
45
|
columnHeadersBackgroundColor,
|
|
47
46
|
columnHeadersTextColor,
|
|
48
|
-
id
|
|
47
|
+
id,
|
|
49
48
|
showRowDividers = false,
|
|
50
49
|
tableData,
|
|
51
50
|
titleText,
|
|
52
51
|
useRowHeaders = false,
|
|
52
|
+
...rest
|
|
53
53
|
} = props;
|
|
54
54
|
|
|
55
55
|
const customColors = {};
|
|
@@ -117,12 +117,12 @@ function Table(props: React.PropsWithChildren<TableProps>) {
|
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
return (
|
|
120
|
-
<ChakraTable id={id} sx={styles} className={className}>
|
|
120
|
+
<ChakraTable id={id} sx={styles} className={className} {...rest}>
|
|
121
121
|
{tableCaption}
|
|
122
122
|
{columnHeadersElems}
|
|
123
123
|
{tableBodyElems()}
|
|
124
124
|
</ChakraTable>
|
|
125
125
|
);
|
|
126
|
-
}
|
|
126
|
+
});
|
|
127
127
|
|
|
128
128
|
export default Table;
|