@nypl/design-system-react-components 0.25.11 → 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 +151 -0
- package/README.md +14 -26
- package/dist/components/Accordion/Accordion.d.ts +6 -4
- package/dist/components/Accordion/AccordionTypes.d.ts +5 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +2 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +22 -29
- package/dist/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +9 -6
- 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 +5 -5
- package/dist/components/Heading/HeadingTypes.d.ts +1 -1
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
- package/dist/components/Hero/Hero.d.ts +9 -5
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
- package/dist/components/Icons/Icon.d.ts +2 -1
- package/dist/components/Icons/IconTypes.d.ts +10 -7
- package/dist/components/Image/Image.d.ts +27 -9
- package/dist/components/Image/ImageTypes.d.ts +4 -4
- 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 +8 -0
- package/dist/components/Logo/LogoTypes.d.ts +10 -2
- package/dist/components/Notification/Notification.d.ts +7 -7
- package/dist/components/Pagination/Pagination.d.ts +8 -4
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +5 -7
- package/dist/components/RadioGroup/RadioGroup.d.ts +16 -8
- package/dist/components/SearchBar/SearchBar.d.ts +5 -5
- package/dist/components/Select/Select.d.ts +12 -8
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -6
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -4
- 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 +10 -23
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +7 -6
- package/dist/components/Template/Template.d.ts +18 -9
- package/dist/components/Text/Text.d.ts +4 -4
- package/dist/components/Text/TextTypes.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +7 -7
- package/dist/components/Toggle/Toggle.d.ts +8 -10
- package/dist/components/Toggle/{ToggleSizes.d.ts → ToggleTypes.d.ts} +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +2802 -1686
- 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 +2811 -1699
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/enums.d.ts +4 -0
- package/dist/hooks/useCarouselStyles.d.ts +3 -2
- package/dist/hooks/useNYPLTheme.d.ts +12 -0
- package/dist/index.d.ts +11 -9
- package/dist/styles.css +1 -1
- package/dist/theme/components/accordion.d.ts +7 -12
- package/dist/theme/components/breadcrumb.d.ts +6 -0
- package/dist/theme/components/button.d.ts +10 -2
- package/dist/theme/components/card.d.ts +44 -24
- package/dist/theme/components/checkbox.d.ts +6 -6
- package/dist/theme/components/checkboxGroup.d.ts +4 -2
- 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 +6 -14
- package/dist/theme/components/global.d.ts +37 -29
- package/dist/theme/components/globalMixins.d.ts +8 -8
- 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 +21 -15
- package/dist/theme/components/image.d.ts +1 -1
- package/dist/theme/components/label.d.ts +9 -10
- package/dist/theme/components/list.d.ts +105 -9
- package/dist/theme/components/notification.d.ts +7 -4
- package/dist/theme/components/pagination.d.ts +2 -5
- package/dist/theme/components/radio.d.ts +10 -6
- package/dist/theme/components/radioGroup.d.ts +4 -2
- package/dist/theme/components/select.d.ts +38 -13
- package/dist/theme/components/skeletonLoader.d.ts +2 -2
- package/dist/theme/components/slider.d.ts +14 -7
- package/dist/theme/components/structuredContent.d.ts +197 -0
- package/dist/theme/components/textInput.d.ts +22 -14
- package/dist/theme/components/toggle.d.ts +25 -6
- package/dist/theme/foundations/global.d.ts +33 -3
- package/dist/theme/foundations/radii.d.ts +1 -0
- package/dist/theme/foundations/spacing.d.ts +46 -43
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +5 -6
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +34 -0
- package/src/components/Accordion/Accordion.stories.mdx +150 -66
- package/src/components/Accordion/Accordion.test.tsx +65 -17
- package/src/components/Accordion/Accordion.tsx +61 -27
- package/src/components/Accordion/AccordionTypes.tsx +5 -0
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +505 -14
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +53 -18
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +66 -35
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +14 -13
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +2 -1
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +308 -10
- 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 +493 -329
- package/src/components/Card/Card.test.tsx +138 -18
- package/src/components/Card/Card.tsx +151 -85
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +220 -100
- package/src/components/Chakra/Center.stories.mdx +2 -2
- package/src/components/Chakra/Grid.stories.mdx +4 -4
- package/src/components/Checkbox/Checkbox.stories.mdx +73 -9
- package/src/components/Checkbox/Checkbox.test.tsx +89 -10
- package/src/components/Checkbox/Checkbox.tsx +27 -16
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +209 -6
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +135 -23
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +216 -90
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +39 -26
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +493 -89
- 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 +94 -15
- package/src/components/DatePicker/DatePicker.tsx +67 -58
- 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 +118 -47
- package/src/components/Form/Form.test.tsx +59 -16
- package/src/components/Form/Form.tsx +89 -65
- 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 +87 -41
- package/src/components/Grid/SimpleGrid.test.tsx +24 -9
- 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 +56 -25
- package/src/components/Heading/Heading.test.tsx +17 -7
- package/src/components/Heading/Heading.tsx +60 -58
- package/src/components/Heading/HeadingTypes.tsx +1 -1
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +27 -8
- 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 +143 -113
- package/src/components/Hero/Hero.test.tsx +146 -58
- package/src/components/Hero/Hero.tsx +144 -112
- 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 -17
- package/src/components/HorizontalRule/HorizontalRule.tsx +9 -25
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
- package/src/components/Icons/Icon.stories.mdx +80 -23
- package/src/components/Icons/Icon.test.tsx +51 -2
- package/src/components/Icons/Icon.tsx +93 -71
- package/src/components/Icons/IconTypes.tsx +9 -6
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
- package/src/components/Image/Image.stories.mdx +160 -71
- package/src/components/Image/Image.test.tsx +40 -48
- package/src/components/Image/Image.tsx +80 -48
- package/src/components/Image/ImageTypes.ts +4 -4
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +84 -21
- 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 +16 -9
- 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 +73 -22
- package/src/components/List/List.tsx +44 -28
- 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 +40 -16
- package/src/components/Logo/Logo.test.tsx +29 -2
- package/src/components/Logo/Logo.tsx +28 -11
- package/src/components/Logo/LogoSvgs.tsx +16 -0
- package/src/components/Logo/LogoTypes.tsx +9 -1
- 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 +34 -5
- package/src/components/Notification/Notification.test.tsx +43 -9
- package/src/components/Notification/Notification.tsx +59 -55
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +256 -32
- package/src/components/Pagination/Pagination.stories.mdx +76 -13
- package/src/components/Pagination/Pagination.test.tsx +116 -5
- package/src/components/Pagination/Pagination.tsx +54 -29
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +247 -30
- package/src/components/Placeholder/Placeholder.tsx +3 -1
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +87 -13
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +20 -10
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
- package/src/components/Radio/Radio.stories.mdx +75 -11
- package/src/components/Radio/Radio.test.tsx +83 -9
- package/src/components/Radio/Radio.tsx +70 -61
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +168 -10
- package/src/components/RadioGroup/RadioGroup.stories.mdx +293 -94
- package/src/components/RadioGroup/RadioGroup.test.tsx +193 -68
- package/src/components/RadioGroup/RadioGroup.tsx +110 -101
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1258 -902
- package/src/components/SearchBar/SearchBar.stories.mdx +104 -39
- package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +66 -6
- package/src/components/SearchBar/SearchBar.tsx +23 -13
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
- package/src/components/Select/Select.stories.mdx +151 -62
- package/src/components/Select/Select.test.tsx +56 -44
- package/src/components/Select/Select.tsx +125 -104
- 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 +53 -23
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +14 -8
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +80 -78
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
- package/src/components/Slider/Slider.stories.mdx +123 -41
- package/src/components/Slider/Slider.test.tsx +65 -17
- package/src/components/Slider/Slider.tsx +34 -24
- 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 +19 -1
- 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 +229 -61
- package/src/components/StructuredContent/StructuredContent.test.tsx +162 -101
- package/src/components/StructuredContent/StructuredContent.tsx +98 -103
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -9
- package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
- package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
- package/src/components/StyleGuide/ColorCard.tsx +4 -4
- package/src/components/StyleGuide/Colors.stories.mdx +34 -20
- 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 +47 -33
- package/src/components/Table/Table.stories.mdx +38 -11
- package/src/components/Table/Table.test.tsx +16 -1
- package/src/components/Table/Table.tsx +10 -8
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
- package/src/components/Tabs/Tabs.stories.mdx +59 -10
- package/src/components/Tabs/Tabs.test.tsx +29 -11
- package/src/components/Tabs/Tabs.tsx +28 -21
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
- package/src/components/Template/Template.stories.mdx +73 -32
- package/src/components/Template/Template.test.tsx +68 -5
- package/src/components/Template/Template.tsx +86 -72
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +195 -22
- package/src/components/Text/Text.stories.mdx +32 -15
- package/src/components/Text/Text.test.tsx +14 -11
- package/src/components/Text/Text.tsx +13 -16
- package/src/components/Text/TextTypes.tsx +1 -1
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
- package/src/components/TextInput/TextInput.stories.mdx +73 -27
- package/src/components/TextInput/TextInput.test.tsx +65 -50
- package/src/components/TextInput/TextInput.tsx +123 -115
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
- package/src/components/Toggle/Toggle.stories.mdx +74 -26
- package/src/components/Toggle/Toggle.test.tsx +41 -10
- package/src/components/Toggle/Toggle.tsx +31 -27
- package/src/components/Toggle/{ToggleSizes.tsx → ToggleTypes.tsx} +1 -1
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +195 -8
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +41 -6
- package/src/components/VideoPlayer/VideoPlayer.tsx +134 -120
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
- package/src/docs/Chakra.stories.mdx +51 -10
- package/src/docs/Welcome.stories.mdx +168 -0
- package/src/{components/Card/CardTypes.tsx → helpers/enums.ts} +2 -2
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useCarouselStyles.stories.mdx +30 -0
- package/src/hooks/useCarouselStyles.ts +3 -2
- package/src/hooks/useNYPLTheme.stories.mdx +101 -0
- package/src/hooks/useNYPLTheme.ts +31 -7
- package/src/hooks/useWindowSize.stories.mdx +23 -0
- package/src/index.ts +11 -15
- package/src/styles/base/_place-holder.scss +3 -1
- package/src/styles.scss +0 -2
- package/src/theme/components/accordion.ts +7 -12
- package/src/theme/components/breadcrumb.ts +7 -0
- package/src/theme/components/button.ts +15 -7
- package/src/theme/components/card.ts +56 -36
- package/src/theme/components/checkbox.ts +12 -14
- package/src/theme/components/checkboxGroup.ts +4 -2
- package/src/theme/components/componentWrapper.ts +2 -2
- package/src/theme/components/customTable.ts +39 -31
- package/src/theme/components/fieldset.ts +3 -2
- package/src/theme/components/global.ts +42 -33
- package/src/theme/components/globalMixins.ts +8 -8
- package/src/theme/components/heading.ts +1 -1
- package/src/theme/components/helperErrorText.ts +1 -0
- package/src/theme/components/hero.ts +14 -16
- package/src/theme/components/icon.ts +5 -2
- package/src/theme/components/image.ts +1 -1
- package/src/theme/components/label.ts +4 -3
- package/src/theme/components/list.ts +76 -65
- package/src/theme/components/notification.ts +10 -7
- package/src/theme/components/pagination.ts +2 -5
- package/src/theme/components/progressIndicator.ts +3 -3
- package/src/theme/components/radio.ts +11 -14
- package/src/theme/components/radioGroup.ts +4 -2
- package/src/theme/components/select.ts +37 -18
- package/src/theme/components/skeletonLoader.ts +3 -3
- package/src/theme/components/slider.ts +19 -15
- 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 +76 -42
- package/src/theme/components/videoPlayer.ts +1 -1
- package/src/theme/foundations/colors.ts +20 -13
- package/src/theme/foundations/global.ts +17 -5
- package/src/theme/foundations/radii.ts +1 -0
- package/src/theme/foundations/spacing.ts +70 -22
- package/src/theme/foundations/typography.ts +3 -3
- package/src/utils/componentCategories.ts +28 -21
- package/src/utils/utils.ts +28 -0
- package/dist/components/Card/CardTypes.d.ts +0 -4
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +0 -4
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -13
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +0 -4
- package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
- package/dist/helpers/generateUUID.d.ts +0 -1
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +0 -4
- package/src/components/Pagination/Pagination.stories.tsx +0 -54
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +0 -4
- package/src/docs/Intro.stories.mdx +0 -53
- package/src/helpers/generateUUID.tsx +0 -5
- package/src/styles/base/_03-base.scss +0 -25
- package/src/styles/base/_04-focus.scss +0 -22
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Meta } from "@storybook/addon-docs";
|
|
2
2
|
|
|
3
|
+
import Button from "../components/Button/Button";
|
|
4
|
+
import Text from "../components/Text/Text";
|
|
5
|
+
import DSProvider from "../theme/provider";
|
|
6
|
+
|
|
3
7
|
<Meta title="Chakra UI" />
|
|
4
8
|
|
|
5
9
|
# Chakra UI
|
|
@@ -10,19 +14,20 @@ import { Meta } from "@storybook/addon-docs";
|
|
|
10
14
|
| 2. [DSProvider](#dsprovider) |
|
|
11
15
|
| 3. [Components](#components) |
|
|
12
16
|
| 4. [Styling](#styling) |
|
|
13
|
-
| 5. [
|
|
14
|
-
|
|
|
17
|
+
| 5. [Style Props](#style-props) |
|
|
18
|
+
| 6. [Hooks](#hooks) |
|
|
19
|
+
| 7. [Testing](#testing) |
|
|
15
20
|
|
|
16
21
|
## Why Chakra UI?
|
|
17
22
|
|
|
18
|
-
The
|
|
23
|
+
The Reservoir Design System (DS) project was influenced by other design systems but
|
|
19
24
|
ultimately we decided to initially build DS components from scratch rather than
|
|
20
25
|
use another design system as its foundation. To better help all the projects at
|
|
21
26
|
NYPL and to better scale with all the components we have built and still need to
|
|
22
|
-
build, we decided to integrate Chakra UI into the
|
|
27
|
+
build, we decided to integrate Chakra UI into the DS.
|
|
23
28
|
|
|
24
29
|
Chakra UI is an open source component library that is opinionated and uses design
|
|
25
|
-
and development patterns that various projects at NYPL use. Since the
|
|
30
|
+
and development patterns that various projects at NYPL use. Since the DS
|
|
26
31
|
will be the foundation for all NYPL projects moving forward, using Chakra will
|
|
27
32
|
help us align all projects so similar patterns are used throughout various teams
|
|
28
33
|
and projects.
|
|
@@ -38,7 +43,7 @@ We recommend to read Chakra's own [documentation](https://chakra-ui.com/docs/get
|
|
|
38
43
|
to get up to speed on it. This file will provide information on how it is used
|
|
39
44
|
in the DS but we rely on Chakra's documentation.
|
|
40
45
|
|
|
41
|
-
If you need help updating to a newer version of the
|
|
46
|
+
If you need help updating to a newer version of the DS, check out
|
|
42
47
|
our [Chakra Migration Guide](https://github.com/NYPL/nypl-design-system/blob/development/CHAKRA_MIGRATION_GUIDE.md).
|
|
43
48
|
|
|
44
49
|
## DSProvider
|
|
@@ -64,7 +69,7 @@ const Application = (props) => {
|
|
|
64
69
|
return (
|
|
65
70
|
<DSProvider>
|
|
66
71
|
<header>...</header>
|
|
67
|
-
<div className="my-app
|
|
72
|
+
<div className="my-app">
|
|
68
73
|
// ...
|
|
69
74
|
{children}
|
|
70
75
|
</div>
|
|
@@ -411,6 +416,42 @@ All typography values can be found in the `src/theme/foundations/typography.ts`
|
|
|
411
416
|
file. These values declare the font family, font sizes, and font weights to use
|
|
412
417
|
for all text.
|
|
413
418
|
|
|
419
|
+
## Style Props
|
|
420
|
+
|
|
421
|
+
NYPL Reservoir components are built around the Chakra UI library. While Reservoir
|
|
422
|
+
components may use the corresponding Chakra UI component, that is not always the
|
|
423
|
+
case. Every Reservoir component, however, does make use of the Chakra UI
|
|
424
|
+
"style props" pattern. This means that it is possible to pass in CSS rules to a
|
|
425
|
+
component, including the shorthand versions. These style props will target the
|
|
426
|
+
wrapper element of the component; this means if you want to target a specific
|
|
427
|
+
element or component in a Reservoir component, you won't be able to with style
|
|
428
|
+
props.
|
|
429
|
+
|
|
430
|
+
<DSProvider>
|
|
431
|
+
<Text isBold>
|
|
432
|
+
While this is available to use, it is not recommended. If you see a need to
|
|
433
|
+
override styles, please reach out to the NYPL Reservoir team for assistance.
|
|
434
|
+
</Text>
|
|
435
|
+
</DSProvider>
|
|
436
|
+
|
|
437
|
+
In the following example, the `Button` component has been passed `p` and `maxW`
|
|
438
|
+
props which are shorthand for "padding" and "max-width", respectively.
|
|
439
|
+
|
|
440
|
+
```jsx
|
|
441
|
+
<Button p="s" maxW="200px">
|
|
442
|
+
Button
|
|
443
|
+
</Button>
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
<DSProvider>
|
|
447
|
+
<Button p="s" maxW="200px">
|
|
448
|
+
Button
|
|
449
|
+
</Button>
|
|
450
|
+
</DSProvider>
|
|
451
|
+
|
|
452
|
+
Find more information and a full list of all the available props, check the Chakra
|
|
453
|
+
UI [Style Props page](https://chakra-ui.com/docs/styled-system/features/style-props).
|
|
454
|
+
|
|
414
455
|
## Hooks
|
|
415
456
|
|
|
416
457
|
The following hooks are available to use and can be imported from
|
|
@@ -514,6 +555,6 @@ Use the `style` attribute in HTML components to add inline styles.
|
|
|
514
555
|
## Testing
|
|
515
556
|
|
|
516
557
|
Do not re-test Chakra components that are re-exported since they are already
|
|
517
|
-
tested in the `@chakra-ui/react` package. We
|
|
518
|
-
|
|
519
|
-
|
|
558
|
+
tested in the `@chakra-ui/react` package. We expect all new components composed
|
|
559
|
+
with Chakra components to have tests for functionality and styling, including
|
|
560
|
+
snapshot tests.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Meta } from "@storybook/addon-docs";
|
|
2
|
+
|
|
3
|
+
import { Box, Center, Circle, VStack, Square } from "@chakra-ui/react";
|
|
4
|
+
import Card, { CardHeading, CardContent } from "../components/Card/Card";
|
|
5
|
+
import Hero from "../components/Hero/Hero";
|
|
6
|
+
import { HeroTypes } from "../components/Hero/HeroTypes";
|
|
7
|
+
import Heading from "../components/Heading/Heading";
|
|
8
|
+
import {
|
|
9
|
+
HeadingLevels,
|
|
10
|
+
HeadingSizes,
|
|
11
|
+
} from "../components/Heading/HeadingTypes";
|
|
12
|
+
import Icon from "../components/Icons/Icon";
|
|
13
|
+
import {
|
|
14
|
+
IconColors,
|
|
15
|
+
IconNames,
|
|
16
|
+
IconSizes,
|
|
17
|
+
} from "../components/Icons/IconTypes";
|
|
18
|
+
import Image from "../components/Image/Image";
|
|
19
|
+
import Link from "../components/Link/Link";
|
|
20
|
+
import { LinkTypes } from "../components/Link/LinkTypes";
|
|
21
|
+
import Logo from "../components/Logo/Logo";
|
|
22
|
+
import { LogoNames, LogoSizes } from "../components/Logo/LogoTypes";
|
|
23
|
+
import SimpleGrid from "../components/Grid/SimpleGrid";
|
|
24
|
+
import Text from "../components/Text/Text";
|
|
25
|
+
import { TextSizes } from "../components/Text/TextTypes";
|
|
26
|
+
import DSProvider from "../theme/provider";
|
|
27
|
+
|
|
28
|
+
<Meta title="Welcome" />
|
|
29
|
+
|
|
30
|
+
<DSProvider>
|
|
31
|
+
<VStack spacing="s">
|
|
32
|
+
<Center>
|
|
33
|
+
<Logo name={LogoNames.ReservoirVerticalColor} size={LogoSizes.Small} />
|
|
34
|
+
</Center>
|
|
35
|
+
<Box>
|
|
36
|
+
<Center>
|
|
37
|
+
<Heading level={HeadingLevels.One} size={HeadingSizes.Tertiary}>
|
|
38
|
+
The React Component Library of the New York Public Library
|
|
39
|
+
</Heading>
|
|
40
|
+
</Center>
|
|
41
|
+
<Text>
|
|
42
|
+
Reservoir is NYPL's open-source extensible React component library for
|
|
43
|
+
products and experiences, with accessibility as its core. Aiming to
|
|
44
|
+
provide design and user experience consistency, Reservoir is the
|
|
45
|
+
foundation for all digital properties in the NYPL landscape, offering
|
|
46
|
+
functional components that implement the NYPL style standards.
|
|
47
|
+
</Text>
|
|
48
|
+
</Box>
|
|
49
|
+
<SimpleGrid>
|
|
50
|
+
<Box
|
|
51
|
+
style={{
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
border: "1px solid #ccc",
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexDirection: "column",
|
|
56
|
+
padding: "24px",
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<Icon
|
|
60
|
+
name={IconNames.ActionCheckCircle}
|
|
61
|
+
size={IconSizes.ExtraExtraLarge}
|
|
62
|
+
color={IconColors.SectionEducationSecondary}
|
|
63
|
+
additionalStyles={{
|
|
64
|
+
marginBottom: "s",
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
<Card isCentered>
|
|
68
|
+
<CardHeading id="main-heading1" level={HeadingLevels.Three}>
|
|
69
|
+
Get Started
|
|
70
|
+
</CardHeading>
|
|
71
|
+
<CardContent>
|
|
72
|
+
<Text size={TextSizes.Caption}>
|
|
73
|
+
To start using Reservoir Design System, refer to Reservoir's
|
|
74
|
+
Github{" "}
|
|
75
|
+
<Link
|
|
76
|
+
href="https://github.com/NYPL/nypl-design-system/wiki"
|
|
77
|
+
type={LinkTypes.External}
|
|
78
|
+
>
|
|
79
|
+
Wiki
|
|
80
|
+
</Link>{" "}
|
|
81
|
+
and{" "}
|
|
82
|
+
<Link
|
|
83
|
+
href="https://github.com/NYPL/nypl-design-system/blob/development/README.md"
|
|
84
|
+
type={LinkTypes.External}
|
|
85
|
+
>
|
|
86
|
+
ReadMe
|
|
87
|
+
</Link>{" "}
|
|
88
|
+
to setup your project. You can also learn about our component
|
|
89
|
+
architecture and additional documentation.
|
|
90
|
+
</Text>
|
|
91
|
+
</CardContent>
|
|
92
|
+
</Card>
|
|
93
|
+
</Box>
|
|
94
|
+
<Box
|
|
95
|
+
style={{
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
border: "1px solid #ccc",
|
|
98
|
+
display: "flex",
|
|
99
|
+
flexDirection: "column",
|
|
100
|
+
padding: "24px",
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<Icon
|
|
104
|
+
name={IconNames.Search}
|
|
105
|
+
size={IconSizes.ExtraExtraLarge}
|
|
106
|
+
color={IconColors.SectionEducationSecondary}
|
|
107
|
+
additionalStyles={{
|
|
108
|
+
marginBottom: "s",
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
<Card isCentered>
|
|
112
|
+
<CardHeading id="main-heading1" level={HeadingLevels.Three}>
|
|
113
|
+
Find Components
|
|
114
|
+
</CardHeading>
|
|
115
|
+
<CardContent>
|
|
116
|
+
<Text size={TextSizes.Caption}>
|
|
117
|
+
For your convenience, the Reservoir Design System components have
|
|
118
|
+
been organized into logical categories based on both form and
|
|
119
|
+
function. Please refer to the <b>COMPONENTS</b> section in the
|
|
120
|
+
Storybook sidebar.
|
|
121
|
+
</Text>
|
|
122
|
+
</CardContent>
|
|
123
|
+
</Card>
|
|
124
|
+
</Box>
|
|
125
|
+
<Box
|
|
126
|
+
style={{
|
|
127
|
+
alignItems: "center",
|
|
128
|
+
border: "1px solid #ccc",
|
|
129
|
+
display: "flex",
|
|
130
|
+
flexDirection: "column",
|
|
131
|
+
padding: "24px",
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<Icon
|
|
135
|
+
name={IconNames.FileTypeSpreadsheet}
|
|
136
|
+
size={IconSizes.ExtraExtraLarge}
|
|
137
|
+
color={IconColors.SectionEducationSecondary}
|
|
138
|
+
additionalStyles={{
|
|
139
|
+
marginBottom: "s",
|
|
140
|
+
}}
|
|
141
|
+
/>
|
|
142
|
+
<Card isCentered>
|
|
143
|
+
<CardHeading id="main-heading1" level={HeadingLevels.Three}>
|
|
144
|
+
View the Code
|
|
145
|
+
</CardHeading>
|
|
146
|
+
<CardContent>
|
|
147
|
+
<Text size="caption">
|
|
148
|
+
The Reservoir Design System React component library is currently
|
|
149
|
+
published on{" "}
|
|
150
|
+
<Link
|
|
151
|
+
href="https://www.npmjs.com/package/@nypl/design-system-react-components"
|
|
152
|
+
type={LinkTypes.External}
|
|
153
|
+
>
|
|
154
|
+
npm
|
|
155
|
+
</Link>
|
|
156
|
+
. If you're looking to contribute to this project, checkout the <Link
|
|
157
|
+
href="https://github.com/NYPL/nypl-design-system"
|
|
158
|
+
type={LinkTypes.External}
|
|
159
|
+
>
|
|
160
|
+
nypl-design-system
|
|
161
|
+
</Link> repo on Github for more information.
|
|
162
|
+
</Text>
|
|
163
|
+
</CardContent>
|
|
164
|
+
</Card>
|
|
165
|
+
</Box>
|
|
166
|
+
</SimpleGrid>
|
|
167
|
+
</VStack>
|
|
168
|
+
</DSProvider>
|
|
@@ -10,7 +10,7 @@ describe("useNYPLTheme", () => {
|
|
|
10
10
|
const { result } = renderHook(() => useNYPLTheme());
|
|
11
11
|
|
|
12
12
|
expect(warn).toHaveBeenCalledWith(
|
|
13
|
-
"
|
|
13
|
+
"NYPL Reservoir useNYPLTheme: hook must be used inside of `<DSProvider />`."
|
|
14
14
|
);
|
|
15
15
|
expect(result.current).toEqual({});
|
|
16
16
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Meta, Description } from "@storybook/addon-docs";
|
|
2
|
+
|
|
3
|
+
import { getCategory } from "../utils/componentCategories";
|
|
4
|
+
|
|
5
|
+
<Meta title={getCategory("useCarouselStyles")} />
|
|
6
|
+
|
|
7
|
+
# useCarouselStyles
|
|
8
|
+
|
|
9
|
+
| Hook Version | DS Version |
|
|
10
|
+
| ------------ | ---------- |
|
|
11
|
+
| Added | `0.25.2` |
|
|
12
|
+
| Latest | `0.25.2` |
|
|
13
|
+
|
|
14
|
+
This custom hook, inspired by this [codesandbox example](https://codesandbox.io/s/fxjeo),
|
|
15
|
+
exposes functions used for carousel-like components that have sliding features.
|
|
16
|
+
The two main functions are `prevSlide` and `nextSlide` used for buttons to
|
|
17
|
+
navigate between slides, and a `carouselStyle` style object for the main wrapper
|
|
18
|
+
element. If the carousel should programmatically slide to the first slide, use
|
|
19
|
+
the `goToStart` function.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
For a full implementation examle, view the [`Tabs` component](https://github.com/NYPL/nypl-design-system/blob/development/src/components/Tabs/Tabs.tsx).
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
const { prevSlide, nextSlide, carouselStyle, goToStart } = useCarouselStyles(
|
|
27
|
+
slidesCount,
|
|
28
|
+
slideWidth
|
|
29
|
+
);
|
|
30
|
+
```
|
|
@@ -3,10 +3,11 @@ import React from "react";
|
|
|
3
3
|
/**
|
|
4
4
|
* Custom hook that controls the sliding function for the carousel wrapper.
|
|
5
5
|
* This returns functions to use for the "previous" and "next" buttons as well
|
|
6
|
-
* as a CSS style object that should be use to transition between slides.
|
|
6
|
+
* as a CSS style object that should be use to transition between slides. There
|
|
7
|
+
* is also a function to programmatically slide to the first slide.
|
|
7
8
|
* Inspired by: https://codesandbox.io/s/fxjeo
|
|
8
9
|
*/
|
|
9
|
-
const useCarouselStyles = (slidesCount = 0, slideWidth = 100) => {
|
|
10
|
+
export const useCarouselStyles = (slidesCount = 0, slideWidth = 100) => {
|
|
10
11
|
const [currentSlide, setCurrentSlide] = React.useState(0);
|
|
11
12
|
// This wraps around to the last slide if this is invoked while the
|
|
12
13
|
// first slide is active.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Meta } from "@storybook/addon-docs";
|
|
2
|
+
import { getCategory } from "../utils/componentCategories";
|
|
3
|
+
|
|
4
|
+
<Meta title={getCategory("useNYPLTheme")} />
|
|
5
|
+
|
|
6
|
+
# useNYPLTheme
|
|
7
|
+
|
|
8
|
+
| Hook Version | DS Version |
|
|
9
|
+
| ------------ | ---------- |
|
|
10
|
+
| Added | `0.25.2` |
|
|
11
|
+
| Latest | `0.25.2` |
|
|
12
|
+
|
|
13
|
+
This custom hook is based on Chakra UI's `useTheme` hook. If your application
|
|
14
|
+
does not use CSS or SCSS files and you want to write CSS-in-JS styles in your
|
|
15
|
+
React components, the `useNYPLTheme` hook will provide you with NYPL-specific
|
|
16
|
+
style values.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
This hook depends on the `DSProvider` component and if the function is used
|
|
21
|
+
outside of this wrapper component, then the theme object will be empty. After
|
|
22
|
+
importing and rendering the `DSProvider` wrapper component, your children
|
|
23
|
+
components can use this hook function.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { useNYPLTheme } from "@nypl/design-system-react-components";
|
|
27
|
+
// ...
|
|
28
|
+
|
|
29
|
+
const theme = useNYPLTheme();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The `theme` variable will be a JS object with design token style values.
|
|
33
|
+
This will allow you to use NYPL-specific styles in your components through CSS-in-JS.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// theme:
|
|
37
|
+
{
|
|
38
|
+
breakpoints: { ... },
|
|
39
|
+
colors: {
|
|
40
|
+
brand: { ... },
|
|
41
|
+
section: { ... },
|
|
42
|
+
transparent: { ... },
|
|
43
|
+
ui: { ... },
|
|
44
|
+
},
|
|
45
|
+
fontSizes: { ... },
|
|
46
|
+
fontWeights: { ... },
|
|
47
|
+
fonts: { ... },
|
|
48
|
+
radii: { ... },
|
|
49
|
+
space: { ... },
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
1. NYPL DS Components
|
|
54
|
+
|
|
55
|
+
All DS components _should_ be used with their current styles. If a DS component
|
|
56
|
+
needs an updated style, first contact the Design System and UX teams about this
|
|
57
|
+
update. If you really _need_ to update a style and there is no available
|
|
58
|
+
variant, then you can add styles directly to the `additionalStyles` prop. At the
|
|
59
|
+
moment, not all DS components have this prop or feature.
|
|
60
|
+
|
|
61
|
+
For example, if the `Heading` component should render the text in NYPL's green
|
|
62
|
+
color used for "success primary" and add a bold font weight, then you can do
|
|
63
|
+
the following:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
const theme = useNYPLTheme();
|
|
67
|
+
|
|
68
|
+
// ...
|
|
69
|
+
return (
|
|
70
|
+
<div>
|
|
71
|
+
<Heading
|
|
72
|
+
level={2}
|
|
73
|
+
additionalStyles={{
|
|
74
|
+
color: theme.colors.ui.sucess.primary,
|
|
75
|
+
fontWeight: theme.fontWeights.bold,
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
Get a Digital Library Card Today in a Few Easy Steps
|
|
79
|
+
</Heading>
|
|
80
|
+
|
|
81
|
+
{/* Other components */}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Of course, you can destructure the `theme` object to only get the object keys
|
|
87
|
+
you need for your component (this is a general example). Log the object to the
|
|
88
|
+
console to see all the available styles.
|
|
89
|
+
|
|
90
|
+
2. HTML Components
|
|
91
|
+
|
|
92
|
+
Use the `style` attribute in HTML components to add inline styles.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<p style={{ color: theme.colors.ui.success.primary }}>
|
|
96
|
+
If you are 13 or older and live, work, attend school, or pay property taxes in
|
|
97
|
+
New York State, you can get a free digital library card right now using this
|
|
98
|
+
online form. Visitors to New York State can also use this form to apply for a
|
|
99
|
+
temporary card.
|
|
100
|
+
</p>
|
|
101
|
+
```
|
|
@@ -9,7 +9,7 @@ function useNYPLTheme() {
|
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
if (!theme || Object.keys(theme).length === 0) {
|
|
11
11
|
console.warn(
|
|
12
|
-
"
|
|
12
|
+
"NYPL Reservoir useNYPLTheme: hook must be used inside of `<DSProvider />`."
|
|
13
13
|
);
|
|
14
14
|
return {};
|
|
15
15
|
}
|
|
@@ -22,8 +22,8 @@ function useNYPLTheme() {
|
|
|
22
22
|
colors: {
|
|
23
23
|
// primary, secondary
|
|
24
24
|
brand: theme.colors.brand,
|
|
25
|
-
// blogs, books-and-more,
|
|
26
|
-
// research-library, whats-on
|
|
25
|
+
// blogs, books-and-more, education, locations,
|
|
26
|
+
// research, research-library, whats-on
|
|
27
27
|
section: theme.colors.section,
|
|
28
28
|
transparent: theme.colors.transparent,
|
|
29
29
|
// black, disabled, error, focus, gray, link,
|
|
@@ -32,19 +32,43 @@ function useNYPLTheme() {
|
|
|
32
32
|
},
|
|
33
33
|
fontSizes: {
|
|
34
34
|
"-3": theme.fontSizes["-3"],
|
|
35
|
-
"-2": theme.fontSizes
|
|
36
|
-
"-1": theme.fontSizes
|
|
37
|
-
"0": theme.fontSizes
|
|
38
|
-
"1": theme.fontSizes
|
|
35
|
+
"-2": theme.fontSizes["-2"],
|
|
36
|
+
"-1": theme.fontSizes["-1"],
|
|
37
|
+
"0": theme.fontSizes["0"],
|
|
38
|
+
"1": theme.fontSizes["1"],
|
|
39
39
|
"2": theme.fontSizes["2"],
|
|
40
40
|
"3": theme.fontSizes["3"],
|
|
41
41
|
"4": theme.fontSizes["4"],
|
|
42
|
+
// default
|
|
43
|
+
breadcrumbs: theme.fontSizes.breadcrumbs,
|
|
44
|
+
// default
|
|
45
|
+
button: theme.fontSizes.button,
|
|
46
|
+
// primary, secondary, tertiary, callout
|
|
47
|
+
heading: theme.fontSizes.heading,
|
|
48
|
+
// default
|
|
49
|
+
helper: theme.fontSizes.helper,
|
|
50
|
+
// default, secondary
|
|
51
|
+
label: theme.fontSizes.label,
|
|
52
|
+
// default, caption, tag, mini
|
|
53
|
+
text: theme.fontSizes.text,
|
|
42
54
|
},
|
|
43
55
|
fontWeights: {
|
|
44
56
|
light: theme.fontWeights.light,
|
|
45
57
|
regular: theme.fontWeights.regular,
|
|
46
58
|
medium: theme.fontWeights.medium,
|
|
47
59
|
bold: theme.fontWeights.bold,
|
|
60
|
+
// default, lastChild
|
|
61
|
+
breadcrumbs: theme.fontWeights.breadcrumbs,
|
|
62
|
+
// default
|
|
63
|
+
button: theme.fontWeights.button,
|
|
64
|
+
// primary, secondary, tertiary, callout
|
|
65
|
+
heading: theme.fontWeights.heading,
|
|
66
|
+
// default
|
|
67
|
+
helper: theme.fontWeights.helper,
|
|
68
|
+
// default
|
|
69
|
+
label: theme.fontWeights.label,
|
|
70
|
+
// default, caption, tag, mini
|
|
71
|
+
text: theme.fontWeights.text,
|
|
48
72
|
},
|
|
49
73
|
fonts: {
|
|
50
74
|
body: theme.fonts.body,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Meta } from "@storybook/addon-docs";
|
|
2
|
+
import { getCategory } from "../utils/componentCategories";
|
|
3
|
+
|
|
4
|
+
<Meta title={getCategory("useWindowSize")} />
|
|
5
|
+
|
|
6
|
+
# useWindowSize
|
|
7
|
+
|
|
8
|
+
| Hook Version | DS Version |
|
|
9
|
+
| ------------ | ---------- |
|
|
10
|
+
| Added | `0.25.2` |
|
|
11
|
+
| Latest | `0.25.2` |
|
|
12
|
+
|
|
13
|
+
This hook is based on [Typescript hooks](https://usehooks-typescript.com/react-hook/use-window-size).
|
|
14
|
+
It returns an object with `width` and `height` properties that can be used to
|
|
15
|
+
update a component's UI based on the size of the browser window.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
For an example implementation, view the [`Tabs` component](https://github.com/NYPL/nypl-design-system/blob/development/src/components/Tabs/Tabs.tsx).
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
const { height, width } = useWindowSize();
|
|
23
|
+
```
|
package/src/index.ts
CHANGED
|
@@ -17,8 +17,9 @@ export {
|
|
|
17
17
|
VStack,
|
|
18
18
|
} from "@chakra-ui/react";
|
|
19
19
|
export { default as Accordion } from "./components/Accordion/Accordion";
|
|
20
|
+
export { AccordionTypes } from "./components/Accordion/AccordionTypes";
|
|
20
21
|
export { default as Breadcrumbs } from "./components/Breadcrumbs/Breadcrumbs";
|
|
21
|
-
export {
|
|
22
|
+
export { BreadcrumbsTypes } from "./components/Breadcrumbs/BreadcrumbsTypes";
|
|
22
23
|
export { default as Button } from "./components/Button/Button";
|
|
23
24
|
export { ButtonTypes } from "./components/Button/ButtonTypes";
|
|
24
25
|
export {
|
|
@@ -27,10 +28,8 @@ export {
|
|
|
27
28
|
CardContent,
|
|
28
29
|
CardHeading,
|
|
29
30
|
} from "./components/Card/Card";
|
|
30
|
-
export { CardLayouts } from "./components/Card/CardTypes";
|
|
31
31
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
32
32
|
export { default as CheckboxGroup } from "./components/CheckboxGroup/CheckboxGroup";
|
|
33
|
-
export { CheckboxGroupLayoutTypes } from "./components/CheckboxGroup/CheckboxGroupLayoutTypes";
|
|
34
33
|
export {
|
|
35
34
|
default as DatePicker,
|
|
36
35
|
FullDateType,
|
|
@@ -42,10 +41,7 @@ export { default as Form, FormField, FormRow } from "./components/Form/Form";
|
|
|
42
41
|
export { FormGaps } from "./components/Form/FormTypes";
|
|
43
42
|
export { GridGaps } from "./components/Grid/GridTypes";
|
|
44
43
|
export { default as Heading } from "./components/Heading/Heading";
|
|
45
|
-
export {
|
|
46
|
-
HeadingDisplaySizes,
|
|
47
|
-
HeadingLevels,
|
|
48
|
-
} from "./components/Heading/HeadingTypes";
|
|
44
|
+
export { HeadingSizes, HeadingLevels } from "./components/Heading/HeadingTypes";
|
|
49
45
|
export { default as HelperErrorText } from "./components/HelperErrorText/HelperErrorText";
|
|
50
46
|
export { default as Hero } from "./components/Hero/Hero";
|
|
51
47
|
export { HeroTypes } from "./components/Hero/HeroTypes";
|
|
@@ -66,6 +62,7 @@ export {
|
|
|
66
62
|
ImageTypes,
|
|
67
63
|
} from "./components/Image/ImageTypes";
|
|
68
64
|
export { default as Label } from "./components/Label/Label";
|
|
65
|
+
export { LayoutTypes } from "./helpers/enums";
|
|
69
66
|
export { default as Link } from "./components/Link/Link";
|
|
70
67
|
export { LinkTypes } from "./components/Link/LinkTypes";
|
|
71
68
|
export { default as List } from "./components/List/List";
|
|
@@ -83,22 +80,19 @@ export {
|
|
|
83
80
|
} from "./components/ProgressIndicator/ProgressIndicatorTypes";
|
|
84
81
|
export { default as Radio } from "./components/Radio/Radio";
|
|
85
82
|
export { default as RadioGroup } from "./components/RadioGroup/RadioGroup";
|
|
86
|
-
export { RadioGroupLayoutTypes } from "./components/RadioGroup/RadioGroupLayoutTypes";
|
|
87
83
|
export { default as SearchBar } from "./components/SearchBar/SearchBar";
|
|
88
84
|
export { default as Select } from "./components/Select/Select";
|
|
85
|
+
export { LabelPositions } from "./components/Select/SelectTypes";
|
|
89
86
|
export { default as SimpleGrid } from "./components/Grid/SimpleGrid";
|
|
90
87
|
export { default as SkeletonLoader } from "./components/SkeletonLoader/SkeletonLoader";
|
|
91
|
-
export {
|
|
92
|
-
SkeletonLoaderImageRatios,
|
|
93
|
-
SkeletonLoaderLayouts,
|
|
94
|
-
} from "./components/SkeletonLoader/SkeletonLoaderTypes";
|
|
88
|
+
export { SkeletonLoaderImageRatios } from "./components/SkeletonLoader/SkeletonLoaderTypes";
|
|
95
89
|
export { default as Slider } from "./components/Slider/Slider";
|
|
96
90
|
export { default as StatusBadge } from "./components/StatusBadge/StatusBadge";
|
|
97
91
|
export { StatusBadgeTypes } from "./components/StatusBadge/StatusBadgeTypes";
|
|
98
92
|
export { default as StructuredContent } from "./components/StructuredContent/StructuredContent";
|
|
99
93
|
export { StructuredContentImagePosition } from "./components/StructuredContent/StructuredContentTypes";
|
|
100
94
|
export {
|
|
101
|
-
Tabs,
|
|
95
|
+
default as Tabs,
|
|
102
96
|
TabList,
|
|
103
97
|
Tab,
|
|
104
98
|
TabPanels,
|
|
@@ -117,15 +111,17 @@ export {
|
|
|
117
111
|
TemplateFooter,
|
|
118
112
|
} from "./components/Template/Template";
|
|
119
113
|
export { default as Text } from "./components/Text/Text";
|
|
120
|
-
export {
|
|
114
|
+
export { TextSizes } from "./components/Text/TextTypes";
|
|
121
115
|
export {
|
|
122
116
|
default as TextInput,
|
|
123
117
|
TextInputRefType,
|
|
124
118
|
} from "./components/TextInput/TextInput";
|
|
125
119
|
export { TextInputTypes } from "./components/TextInput/TextInputTypes";
|
|
126
120
|
export { default as Toggle } from "./components/Toggle/Toggle";
|
|
127
|
-
export { ToggleSizes } from "./components/Toggle/
|
|
121
|
+
export { ToggleSizes } from "./components/Toggle/ToggleTypes";
|
|
122
|
+
export { default as useCarouselStyles } from "./hooks/useCarouselStyles";
|
|
128
123
|
export { default as useNYPLTheme } from "./hooks/useNYPLTheme";
|
|
124
|
+
export { default as useWindowSize } from "./hooks/useWindowSize";
|
|
129
125
|
export { default as VideoPlayer } from "./components/VideoPlayer/VideoPlayer";
|
|
130
126
|
export {
|
|
131
127
|
VideoPlayerAspectRatios,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
// Only used for the `Placeholder` component, not to style
|
|
2
|
+
// an `input`'s placeholder.
|
|
1
3
|
.placeholder {
|
|
2
4
|
--color-place-holder: var(--nypl-colors-ui-gray-dark);
|
|
3
5
|
|
|
4
6
|
margin-bottom: var(--nypl-space-l);
|
|
5
7
|
@include breakpoint($nypl-breakpoint-large) {
|
|
6
|
-
margin-bottom: var(--nypl-space-
|
|
8
|
+
margin-bottom: var(--nypl-space-l);
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
padding: var(--nypl-space-s);
|
package/src/styles.scss
CHANGED
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
// Order important
|
|
14
14
|
@import "./styles/base/_01-breakpoints";
|
|
15
15
|
@import "./styles/base/_02-mixins";
|
|
16
|
-
@import "./styles/base/_03-base";
|
|
17
|
-
@import "./styles/base/_04-focus";
|
|
18
16
|
@import "./styles/base/_place-holder";
|
|
19
17
|
@import "./styles/space/_space-inline";
|
|
20
18
|
@import "./styles/space/_space-inset";
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
const containerStyles = {
|
|
2
|
-
|
|
3
|
-
borderRightWidth: "1px",
|
|
4
|
-
borderColor: "ui.gray.medium",
|
|
2
|
+
border: "none",
|
|
5
3
|
width: "100%",
|
|
6
4
|
};
|
|
7
5
|
const buttonStyles = {
|
|
8
|
-
|
|
9
|
-
fontWeight:
|
|
10
|
-
_hover: {
|
|
11
|
-
bg: "ui.gray.light-cool",
|
|
12
|
-
},
|
|
6
|
+
borderWidth: "1px",
|
|
7
|
+
fontWeight: "medium",
|
|
13
8
|
};
|
|
14
9
|
const panelStyles = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
padding: "s",
|
|
11
|
+
borderLeftWidth: "1px",
|
|
12
|
+
borderRightWidth: "1px",
|
|
13
|
+
borderBottomWidth: "1px",
|
|
19
14
|
};
|
|
20
15
|
|
|
21
16
|
const Accordion = {
|