@nypl/design-system-react-components 1.0.1 → 1.0.2
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 +1428 -3
- package/README.md +391 -3
- package/dist/__tests__/fileMock.d.ts +4 -0
- package/dist/__tests__/setup.d.ts +2 -0
- package/{lib/stories/0-Welcome.stories.d.ts → dist/__tests__/utils/utils.test.d.ts} +1 -1
- package/dist/components/Accordion/Accordion.d.ts +21 -0
- package/dist/components/Autosuggest/Autosuggest.stories.d.ts +4 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +18 -0
- package/dist/components/Button/Button.d.ts +25 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +49 -0
- package/dist/components/Checkbox/Checkbox.d.ts +47 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +49 -0
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +29 -0
- package/dist/components/DatePicker/DatePicker.d.ts +81 -0
- package/dist/components/Fieldset/Fieldset.d.ts +22 -0
- package/dist/components/Form/Form.d.ts +29 -0
- package/dist/components/Grid/SimpleGrid.d.ts +17 -0
- package/dist/components/Heading/Heading.d.ts +27 -0
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +29 -0
- package/dist/components/Hero/Hero.d.ts +40 -0
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +11 -0
- package/dist/components/Icons/Icon.d.ts +37 -0
- package/dist/components/Icons/IconSvgs.d.ts +33 -0
- package/dist/components/Image/Image.d.ts +61 -0
- package/dist/components/Label/Label.d.ts +20 -0
- package/dist/components/Link/Link.d.ts +20 -0
- package/dist/components/List/List.d.ts +35 -0
- package/dist/components/Logo/Logo.d.ts +26 -0
- package/dist/components/Logo/LogoSvgs.d.ts +46 -0
- package/dist/components/Modal/Modal.d.ts +33 -0
- package/dist/components/Notification/Notification.d.ts +50 -0
- package/dist/components/Pagination/Pagination.d.ts +27 -0
- package/dist/components/Placeholder/Placeholder.d.ts +10 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +30 -0
- package/dist/components/Radio/Radio.d.ts +43 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +51 -0
- package/dist/components/SearchBar/SearchBar.d.ts +61 -0
- package/dist/components/Select/Select.d.ts +57 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +39 -0
- package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
- package/dist/components/Slider/Slider.d.ts +60 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +16 -0
- package/dist/components/StructuredContent/StructuredContent.d.ts +28 -0
- package/dist/components/StyleGuide/ColorCard.d.ts +12 -0
- package/dist/components/Table/Table.d.ts +29 -0
- package/dist/components/Tabs/Tabs.d.ts +26 -0
- package/dist/components/Template/Template.d.ts +126 -0
- package/dist/components/Text/Text.d.ts +16 -0
- package/dist/components/TextInput/TextInput.d.ts +78 -0
- package/dist/components/Toggle/Toggle.d.ts +42 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +38 -0
- package/dist/design-system-react-components.cjs.development.js +11305 -0
- package/dist/design-system-react-components.cjs.development.js.map +1 -0
- package/dist/design-system-react-components.cjs.production.min.js +2 -0
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -0
- package/dist/design-system-react-components.esm.js +11150 -0
- package/dist/design-system-react-components.esm.js.map +1 -0
- package/dist/helpers/types.d.ts +1 -0
- package/dist/hooks/tests/useCarouselStyles.test.d.ts +1 -0
- package/dist/hooks/useCarouselStyles.d.ts +17 -0
- package/dist/hooks/useNYPLTheme.d.ts +66 -0
- package/dist/hooks/useWindowSize.d.ts +10 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +8 -0
- package/dist/resources.scss +386 -0
- package/dist/styles.css +3 -0
- package/dist/theme/components/accordion.d.ts +20 -0
- package/dist/theme/components/breadcrumb.d.ts +105 -0
- package/dist/theme/components/button.d.ts +120 -0
- package/dist/theme/components/buttonGroup.d.ts +11 -0
- package/dist/theme/components/card.d.ts +381 -0
- package/dist/theme/components/checkbox.d.ts +95 -0
- package/dist/theme/components/checkboxGroup.d.ts +14 -0
- package/dist/theme/components/componentWrapper.d.ts +12 -0
- package/dist/theme/components/customTable.d.ts +136 -0
- package/dist/theme/components/datePicker.d.ts +16 -0
- package/dist/theme/components/fieldset.d.ts +20 -0
- package/dist/theme/components/global.d.ts +73 -0
- package/dist/theme/components/globalMixins.d.ts +23 -0
- package/dist/theme/components/heading.d.ts +160 -0
- package/dist/theme/components/helperErrorText.d.ts +12 -0
- package/dist/theme/components/hero.d.ts +499 -0
- package/dist/theme/components/horizontalRule.d.ts +15 -0
- package/dist/theme/components/icon.d.ts +47755 -0
- package/dist/theme/components/image.d.ts +590 -0
- package/dist/theme/components/label.d.ts +18 -0
- package/dist/theme/components/link.d.ts +62 -0
- package/dist/theme/components/list.d.ts +182 -0
- package/dist/theme/components/logo.d.ts +477 -0
- package/dist/theme/components/notification.d.ts +95 -0
- package/dist/theme/components/pagination.d.ts +16 -0
- package/dist/theme/components/progressIndicator.d.ts +52 -0
- package/dist/theme/components/radio.d.ts +99 -0
- package/dist/theme/components/radioGroup.d.ts +14 -0
- package/dist/theme/components/searchBar.d.ts +18 -0
- package/dist/theme/components/select.d.ts +87 -0
- package/dist/theme/components/skeletonLoader.d.ts +102 -0
- package/dist/theme/components/skipNavigation.d.ts +25 -0
- package/dist/theme/components/slider.d.ts +59 -0
- package/dist/theme/components/statusBadge.d.ts +25 -0
- package/dist/theme/components/structuredContent.d.ts +226 -0
- package/dist/theme/components/tabs.d.ts +136 -0
- package/dist/theme/components/template.d.ts +105 -0
- package/dist/theme/components/text.d.ts +26 -0
- package/dist/theme/components/textInput.d.ts +124 -0
- package/dist/theme/components/toggle.d.ts +92 -0
- package/dist/theme/components/videoPlayer.d.ts +40 -0
- package/dist/theme/foundations/breakpoints.d.ts +23 -0
- package/dist/theme/foundations/colors.d.ts +3 -0
- package/dist/theme/foundations/global.d.ts +58 -0
- package/dist/theme/foundations/radii.d.ts +6 -0
- package/dist/theme/foundations/shadows.d.ts +4 -0
- package/dist/theme/foundations/spacing.d.ts +82 -0
- package/dist/theme/foundations/typography.d.ts +8 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/provider.d.ts +3 -0
- package/dist/theme/types.d.ts +1 -0
- package/dist/utils/componentCategories.d.ts +1 -0
- package/dist/utils/interfaces.d.ts +5 -0
- package/dist/utils/utils.d.ts +31 -0
- package/package.json +133 -20
- package/src/__tests__/fileMock.ts +6 -0
- package/src/__tests__/setup.ts +27 -0
- package/src/__tests__/utils/utils.test.ts +18 -0
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +42 -0
- package/src/components/Accordion/Accordion.stories.mdx +333 -0
- package/src/components/Accordion/Accordion.test.tsx +237 -0
- package/src/components/Accordion/Accordion.tsx +137 -0
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +734 -0
- package/src/components/Autosuggest/Autosuggest.stories.mdx +75 -0
- package/src/components/Autosuggest/Autosuggest.stories.tsx +211 -0
- package/src/components/Autosuggest/_Autosuggest.scss +51 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +231 -0
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +144 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +98 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +695 -0
- package/src/components/Button/Button.stories.mdx +320 -0
- package/src/components/Button/Button.test.tsx +184 -0
- package/src/components/Button/Button.tsx +95 -0
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +106 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +178 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +100 -0
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
- package/src/components/Card/Card.stories.mdx +1041 -0
- package/src/components/Card/Card.test.tsx +388 -0
- package/src/components/Card/Card.tsx +346 -0
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +568 -0
- package/src/components/Chakra/Box.stories.mdx +52 -0
- package/src/components/Chakra/Center.stories.mdx +96 -0
- package/src/components/Chakra/Flex.stories.mdx +111 -0
- package/src/components/Chakra/Grid.stories.mdx +89 -0
- package/src/components/Chakra/Stack.stories.mdx +109 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +243 -0
- package/src/components/Checkbox/Checkbox.test.tsx +350 -0
- package/src/components/Checkbox/Checkbox.tsx +152 -0
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +661 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +462 -0
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +492 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +173 -0
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1842 -0
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +163 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +76 -0
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +103 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +452 -0
- package/src/components/DatePicker/DatePicker.test.tsx +940 -0
- package/src/components/DatePicker/DatePicker.tsx +450 -0
- package/src/components/DatePicker/_DatePicker.scss +100 -0
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +908 -0
- package/src/components/Fieldset/Fieldset.stories.mdx +96 -0
- package/src/components/Fieldset/Fieldset.test.tsx +155 -0
- package/src/components/Fieldset/Fieldset.tsx +55 -0
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +89 -0
- package/src/components/Form/Form.stories.mdx +426 -0
- package/src/components/Form/Form.test.tsx +234 -0
- package/src/components/Form/Form.tsx +124 -0
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +115 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +336 -0
- package/src/components/Grid/SimpleGrid.test.tsx +79 -0
- package/src/components/Grid/SimpleGrid.tsx +49 -0
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +23 -0
- package/src/components/Heading/Heading.stories.mdx +187 -0
- package/src/components/Heading/Heading.test.tsx +171 -0
- package/src/components/Heading/Heading.tsx +104 -0
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +90 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +172 -0
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +114 -0
- package/src/components/HelperErrorText/HelperErrorText.tsx +62 -0
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +93 -0
- package/src/components/Hero/Hero.stories.mdx +378 -0
- package/src/components/Hero/Hero.test.tsx +611 -0
- package/src/components/Hero/Hero.tsx +203 -0
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +379 -0
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +73 -0
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +54 -0
- package/src/components/HorizontalRule/HorizontalRule.tsx +27 -0
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +44 -0
- package/src/components/Icons/Icon.stories.mdx +413 -0
- package/src/components/Icons/Icon.test.tsx +120 -0
- package/src/components/Icons/Icon.tsx +187 -0
- package/src/components/Icons/IconSvgs.tsx +64 -0
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
- package/src/components/Image/Image.stories.mdx +332 -0
- package/src/components/Image/Image.test.tsx +155 -0
- package/src/components/Image/Image.tsx +171 -0
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +269 -0
- package/src/components/Label/Label.stories.mdx +100 -0
- package/src/components/Label/Label.test.tsx +116 -0
- package/src/components/Label/Label.tsx +55 -0
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +45 -0
- package/src/components/Link/Link.stories.mdx +249 -0
- package/src/components/Link/Link.test.tsx +224 -0
- package/src/components/Link/Link.tsx +178 -0
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +286 -0
- package/src/components/List/List.stories.mdx +393 -0
- package/src/components/List/List.test.tsx +265 -0
- package/src/components/List/List.tsx +156 -0
- package/src/components/List/__snapshots__/List.test.tsx.snap +213 -0
- package/src/components/Logo/Logo.stories.mdx +295 -0
- package/src/components/Logo/Logo.test.tsx +116 -0
- package/src/components/Logo/Logo.tsx +151 -0
- package/src/components/Logo/LogoSvgs.tsx +90 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +142 -0
- package/src/components/Modal/Modal.stories.mdx +294 -0
- package/src/components/Modal/Modal.test.tsx +157 -0
- package/src/components/Modal/Modal.tsx +154 -0
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
- package/src/components/Notification/Notification.stories.mdx +358 -0
- package/src/components/Notification/Notification.test.tsx +279 -0
- package/src/components/Notification/Notification.tsx +224 -0
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +525 -0
- package/src/components/Pagination/Pagination.stories.mdx +184 -0
- package/src/components/Pagination/Pagination.test.tsx +419 -0
- package/src/components/Pagination/Pagination.tsx +269 -0
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +544 -0
- package/src/components/Placeholder/Placeholder.tsx +19 -0
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +360 -0
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +298 -0
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +132 -0
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +434 -0
- package/src/components/Radio/Radio.stories.mdx +216 -0
- package/src/components/Radio/Radio.test.tsx +247 -0
- package/src/components/Radio/Radio.tsx +119 -0
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +451 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +479 -0
- package/src/components/RadioGroup/RadioGroup.test.tsx +471 -0
- package/src/components/RadioGroup/RadioGroup.tsx +171 -0
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1550 -0
- package/src/components/SearchBar/SearchBar.stories.mdx +518 -0
- package/src/components/SearchBar/SearchBar.test.tsx +435 -0
- package/src/components/SearchBar/SearchBar.tsx +210 -0
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1049 -0
- package/src/components/Select/Select.stories.mdx +439 -0
- package/src/components/Select/Select.test.tsx +358 -0
- package/src/components/Select/Select.tsx +183 -0
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +895 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +142 -0
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +116 -0
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +123 -0
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +898 -0
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
- package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
- package/src/components/Slider/Slider.stories.mdx +628 -0
- package/src/components/Slider/Slider.test.tsx +736 -0
- package/src/components/Slider/Slider.tsx +322 -0
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2186 -0
- package/src/components/StatusBadge/StatusBadge.stories.mdx +109 -0
- package/src/components/StatusBadge/StatusBadge.test.tsx +70 -0
- package/src/components/StatusBadge/StatusBadge.tsx +35 -0
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +47 -0
- package/src/components/StructuredContent/StructuredContent.stories.mdx +567 -0
- package/src/components/StructuredContent/StructuredContent.test.tsx +435 -0
- package/src/components/StructuredContent/StructuredContent.tsx +139 -0
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +368 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +206 -0
- package/src/components/StyleGuide/Breakpoints.stories.mdx +55 -0
- package/src/components/StyleGuide/Buttons.stories.mdx +194 -0
- package/src/components/StyleGuide/ColorCard.tsx +43 -0
- package/src/components/StyleGuide/Colors.stories.mdx +201 -0
- package/src/components/StyleGuide/DesignTokens.stories.mdx +193 -0
- package/src/components/StyleGuide/Forms.stories.mdx +94 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +142 -0
- package/src/components/StyleGuide/Spacing.stories.mdx +116 -0
- package/src/components/StyleGuide/Typography.stories.mdx +419 -0
- package/src/components/Table/Table.stories.mdx +272 -0
- package/src/components/Table/Table.test.tsx +241 -0
- package/src/components/Table/Table.tsx +152 -0
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +1703 -0
- package/src/components/Tabs/Tabs.stories.mdx +338 -0
- package/src/components/Tabs/Tabs.test.tsx +298 -0
- package/src/components/Tabs/Tabs.tsx +264 -0
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +584 -0
- package/src/components/Template/Template.stories.mdx +695 -0
- package/src/components/Template/Template.test.tsx +309 -0
- package/src/components/Template/Template.tsx +326 -0
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +342 -0
- package/src/components/Text/Text.stories.mdx +103 -0
- package/src/components/Text/Text.test.tsx +63 -0
- package/src/components/Text/Text.tsx +50 -0
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +50 -0
- package/src/components/TextInput/TextInput.stories.mdx +268 -0
- package/src/components/TextInput/TextInput.test.tsx +451 -0
- package/src/components/TextInput/TextInput.tsx +240 -0
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +274 -0
- package/src/components/Toggle/Toggle.stories.mdx +237 -0
- package/src/components/Toggle/Toggle.test.tsx +170 -0
- package/src/components/Toggle/Toggle.tsx +128 -0
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +470 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +212 -0
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +308 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +188 -0
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +192 -0
- package/src/docs/Chakra.stories.mdx +563 -0
- package/src/docs/Welcome.stories.mdx +148 -0
- package/src/helpers/types.ts +1 -0
- package/src/hooks/tests/useCarouselStyles.test.ts +140 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +36 -0
- package/src/hooks/useCarouselStyles.stories.mdx +30 -0
- package/src/hooks/useCarouselStyles.ts +35 -0
- package/src/hooks/useNYPLTheme.stories.mdx +98 -0
- package/src/hooks/useNYPLTheme.ts +91 -0
- package/src/hooks/useWindowSize.stories.mdx +23 -0
- package/src/hooks/useWindowSize.ts +40 -0
- package/src/index.ts +136 -0
- package/src/resources.scss +6 -0
- package/src/styles/base/_01-breakpoints.scss +27 -0
- package/src/styles/base/_02-mixins.scss +103 -0
- package/src/styles/base/_place-holder.scss +33 -0
- package/src/styles/space/_space-inline.scss +79 -0
- package/src/styles/space/_space-inset.scss +57 -0
- package/src/styles/space/_space-stack.scss +116 -0
- package/src/styles.scss +23 -0
- package/src/theme/components/accordion.ts +25 -0
- package/src/theme/components/breadcrumb.ts +94 -0
- package/src/theme/components/button.ts +133 -0
- package/src/theme/components/buttonGroup.ts +10 -0
- package/src/theme/components/card.ts +237 -0
- package/src/theme/components/checkbox.ts +110 -0
- package/src/theme/components/checkboxGroup.ts +10 -0
- package/src/theme/components/componentWrapper.ts +14 -0
- package/src/theme/components/customTable.ts +77 -0
- package/src/theme/components/datePicker.ts +17 -0
- package/src/theme/components/fieldset.ts +23 -0
- package/src/theme/components/global.ts +91 -0
- package/src/theme/components/globalMixins.ts +24 -0
- package/src/theme/components/heading.ts +79 -0
- package/src/theme/components/helperErrorText.ts +14 -0
- package/src/theme/components/hero.ts +238 -0
- package/src/theme/components/horizontalRule.ts +17 -0
- package/src/theme/components/icon.ts +88 -0
- package/src/theme/components/image.ts +136 -0
- package/src/theme/components/label.ts +15 -0
- package/src/theme/components/link.ts +63 -0
- package/src/theme/components/list.ts +88 -0
- package/src/theme/components/logo.ts +58 -0
- package/src/theme/components/notification.ts +132 -0
- package/src/theme/components/pagination.ts +17 -0
- package/src/theme/components/progressIndicator.ts +67 -0
- package/src/theme/components/radio.ts +103 -0
- package/src/theme/components/radioGroup.ts +10 -0
- package/src/theme/components/searchBar.ts +19 -0
- package/src/theme/components/select.ts +72 -0
- package/src/theme/components/skeletonLoader.ts +113 -0
- package/src/theme/components/skipNavigation.ts +29 -0
- package/src/theme/components/slider.ts +95 -0
- package/src/theme/components/statusBadge.ts +26 -0
- package/src/theme/components/structuredContent.ts +149 -0
- package/src/theme/components/tabs.ts +109 -0
- package/src/theme/components/template.ts +114 -0
- package/src/theme/components/text.ts +38 -0
- package/src/theme/components/textInput.ts +65 -0
- package/src/theme/components/toggle.ts +109 -0
- package/src/theme/components/videoPlayer.ts +47 -0
- package/src/theme/foundations/breakpoints.ts +24 -0
- package/src/theme/foundations/colors.ts +212 -0
- package/src/theme/foundations/global.ts +43 -0
- package/src/theme/foundations/radii.ts +7 -0
- package/src/theme/foundations/shadows.ts +5 -0
- package/src/theme/foundations/spacing.ts +136 -0
- package/src/theme/foundations/typography.ts +107 -0
- package/src/theme/index.ts +131 -0
- package/src/theme/provider.tsx +9 -0
- package/src/theme/types.ts +1 -0
- package/src/utils/componentCategories.ts +152 -0
- package/src/utils/interfaces.ts +5 -0
- package/src/utils/utils.ts +84 -0
- package/lib/components/Button/Button.d.ts +0 -17
- package/lib/components/Button/Button.js +0 -42
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -6
- package/lib/stories/0-Welcome.stories.js +0 -19
- package/lib/stories/1-Button.stories.d.ts +0 -6
- package/lib/stories/1-Button.stories.js +0 -20
package/README.md
CHANGED
|
@@ -1,4 +1,392 @@
|
|
|
1
|
-
#
|
|
2
|
-
## How to use
|
|
3
|
-
This is intended to be used with [NYPL Design System Styles](https://github.com/NYPL/nypl-design-system/tree/master/src/styles)
|
|
1
|
+
# Reservoir Design System
|
|
4
2
|
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/js/%40nypl%2Fdesign-system-react-components)
|
|
6
|
+
|
|
7
|
+
The Reservoir Design System (DS) is NYPL’s open-source extensible React library for products and experiences with the accessibility as its foundation. It ships functional, stateless components with consistent NYPL styling. You can learn more about the project and its goals [on the project's wiki](https://github.com/NYPL/nypl-design-system/wiki).
|
|
8
|
+
|
|
9
|
+
_Note: This library is still in beta. Until we release the stable `1.0.0` version, we are loosely using semantic versioning._
|
|
10
|
+
|
|
11
|
+
Storybook documentation
|
|
12
|
+
|
|
13
|
+
- [Production - deployed to Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page)
|
|
14
|
+
- [Development/QA - deployed to Vercel](https://nypl-design-system.vercel.app/?path=/story/welcome--page)
|
|
15
|
+
|
|
16
|
+
| Table of Contents | |
|
|
17
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
18
|
+
| 1. | [Contributing Quickstart](#contributing-quickstart) |
|
|
19
|
+
| 2. | [Developing with NPM Link](#developing-with-npm-link) |
|
|
20
|
+
| 3. | [Using the Design System in Your Product](#using-the-design-system-in-your-product) |
|
|
21
|
+
| 4. | [Using Chakra UI Components](#using-chakra-ui-components) |
|
|
22
|
+
| 5. | [Storybook](#storybook) |
|
|
23
|
+
| 6. | [Typescript Usage](#typescript-usage) |
|
|
24
|
+
| 7. | [Unit Testing](#unit-testing) |
|
|
25
|
+
| 8. | [Accessibility](#accessibility) |
|
|
26
|
+
| 9. | [CDN](#cdn) |
|
|
27
|
+
|
|
28
|
+
## Contributing Quickstart
|
|
29
|
+
|
|
30
|
+
Follow these steps to setup a local installation of the project:
|
|
31
|
+
|
|
32
|
+
1. Clone the repo
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
$ git clone https://github.com/NYPL/nypl-design-system.git
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Install all the dependencies
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
$ npm install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. Run the Storybook instance and view it at `http://localhost:6006`
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
$ npm run storybook
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can now edit styles or templates in the `src` directory, and they will automatically re-build and update in the Storybook instance. Adding new stories or changing story names will require a page refresh.
|
|
51
|
+
|
|
52
|
+
Information about active maintainers, how we run reviews, and more can be found in our wiki page for [Contributing to the Design System](https://github.com/NYPL/nypl-design-system/wiki/Contributing-to-the-React-Library).
|
|
53
|
+
|
|
54
|
+
Follow the [contribution document](/.github/CONTRIBUTING.md) to follow git branching convetions, component creation and update guidelines, testing methodoly, and documentation guidelines.
|
|
55
|
+
|
|
56
|
+
### Node Version
|
|
57
|
+
|
|
58
|
+
We recommend using Node version 12.22.x since the DS has some issues with versions higher than 12.x. The Github Actions for linting, automated testing, deploying to Github Pages, and releasing to npm are all running on Node 12.x.
|
|
59
|
+
|
|
60
|
+
If you are using `nvm`, the local `.nvmrc` file can be use to set your local Node version with the `nvm use` command (will be set to `12.22.x`).
|
|
61
|
+
|
|
62
|
+
## Developing with NPM Link
|
|
63
|
+
|
|
64
|
+
To develop with a local version of the Design System:
|
|
65
|
+
|
|
66
|
+
1. In the Design System directory, run:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
$ npm link
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. Go to the consuming application directory and run:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
$ npm link @nypl/design-system-react-components
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. Go back to the Design System directory and run the following command. It allos the local Design System to be rebuilt and exported automatically:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
$ npm start
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Error Troubleshooting
|
|
85
|
+
|
|
86
|
+
It's possible when running `npm link` that you'll get an `Invalid Hook` issue. If this occurs, it's most likely caused by having two versions of React when trying to run the application while the NYPL DS package is linked. This [Duplicate React](https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react) issue is covered by the React team.
|
|
87
|
+
|
|
88
|
+
To be more specific, you should run the following in your local DS directory, where `[../path/to/application]` is the local directory of the consuming application.
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
$ npm link [../path/to/application]/node_modules/react
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Now you should be able to run `npm start` in the DS directory and `npm run dev` (or whatever your application uses) in the application directory and not get an `Invalid Hook` error.
|
|
95
|
+
|
|
96
|
+
### npm Unlink
|
|
97
|
+
|
|
98
|
+
To unlink the DS codebase:
|
|
99
|
+
|
|
100
|
+
1. Run `npm unlink` in the Design System directory.
|
|
101
|
+
2. Run `npm unlink --no-save @nypl/design-system-react-components` in the consuming application.
|
|
102
|
+
|
|
103
|
+
## Using the Design System in Your Product
|
|
104
|
+
|
|
105
|
+
To use the Design System in your project:
|
|
106
|
+
|
|
107
|
+
1. Install the DS:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
$ npm install @nypl/design-system-react-components
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
2. Import the styles in your main css file
|
|
114
|
+
|
|
115
|
+
```css
|
|
116
|
+
@import "~@nypl/design-system-react-components/dist/styles.css";
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. Import the `DSProvider` component
|
|
120
|
+
|
|
121
|
+
In order to use DS components in a consuming application, there is a necessary step that must be done for component styles to properly render. Consuming applications need to wrap all the DS components with a simple provider component. Fortunately, this only needs to be done once at the top level of the consuming application.
|
|
122
|
+
|
|
123
|
+
Once the following is completed, DS components that internally use Chakra UI will render styles properly.
|
|
124
|
+
|
|
125
|
+
```jsx
|
|
126
|
+
// your main application file
|
|
127
|
+
import { DSProvider } from "@nypl/design-system-react-components";
|
|
128
|
+
|
|
129
|
+
// ...
|
|
130
|
+
const ApplicationContainer = (props) => {
|
|
131
|
+
// ...
|
|
132
|
+
return (
|
|
133
|
+
<DSProvider>
|
|
134
|
+
<div className="my-app">
|
|
135
|
+
// ...
|
|
136
|
+
{children}
|
|
137
|
+
</div>
|
|
138
|
+
</DSProvider>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
4. Use DS components!
|
|
144
|
+
|
|
145
|
+
Consult Storybook for the list of available components and props that they require.
|
|
146
|
+
|
|
147
|
+
Here's an example with the `Link` component:
|
|
148
|
+
|
|
149
|
+
```jsx
|
|
150
|
+
import { Link } from "@nypl/design-system-react-components";
|
|
151
|
+
|
|
152
|
+
function NewComponent(props) {
|
|
153
|
+
return <Link href="https://www.hathitrust.org/">HathiTrust</Link>;
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Sometimes you may have conflicts, perhaps with `React-Router`. In that case, you can alias your imports:
|
|
158
|
+
|
|
159
|
+
```jsx
|
|
160
|
+
import * as DS from "@nypl/design-system-react-components";
|
|
161
|
+
import { Link } from "react-router";
|
|
162
|
+
|
|
163
|
+
function NewComponent(props) {
|
|
164
|
+
return (
|
|
165
|
+
<DS.Link>
|
|
166
|
+
<Link to="/license">public domain</Link>
|
|
167
|
+
</DS.Link>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### NYPL DS, NYPL Header, and NYPL Footer
|
|
173
|
+
|
|
174
|
+
```jsx
|
|
175
|
+
<body>
|
|
176
|
+
<NYPLHeader />
|
|
177
|
+
|
|
178
|
+
<div class="app">
|
|
179
|
+
<!-- your code here -->
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<NYPLFooter />
|
|
183
|
+
</body>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Using Chakra UI Components
|
|
187
|
+
|
|
188
|
+
The Chakra UI component library has been integrated into the Reservoir Design System. We are still progressing towards using Chakra components and patterns to build DS components, and therefore documentation and features are expected to change. While the implementation details of DS components will use Chakra, the DS package itself will export _some_ Chakra components.
|
|
189
|
+
|
|
190
|
+
The list of re-exported Chakra components can be found in the main [index.ts](/src/index.ts) file. They include:
|
|
191
|
+
|
|
192
|
+
- `Box`, `Center`, `Circle`, `Grid`, `GridItem`, `HStack`, `Square`, `Stack`, `VStack`
|
|
193
|
+
|
|
194
|
+
Find more information about the Design System's internal use of Chakra to create and refactor components in the Storybook documentation page. The following two links have the same information but in different formats for your reading preference:
|
|
195
|
+
|
|
196
|
+
- [MDX format](/src/docs/Chakra.stories.mdx)
|
|
197
|
+
- [Storybook page](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/chakra-ui--page)
|
|
198
|
+
|
|
199
|
+
Chakra was integrated into the Design System in version `0.25.0`. For those looking to update to a version greater than or equal `0.25.0`, check out our [Chakra Migration Guide](/CHAKRA_MIGRATION_GUIDE.md).
|
|
200
|
+
|
|
201
|
+
## CDN
|
|
202
|
+
|
|
203
|
+
You can also use the Design System styles in your project through the `unpkg` CDN:
|
|
204
|
+
|
|
205
|
+
```jsx
|
|
206
|
+
<link href="https://unpkg.com/@nypl/design-system-react-components/dist/styles.css">
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
If you need to reference a particular version you can do do by including the version number in the URL:
|
|
210
|
+
|
|
211
|
+
```jsx
|
|
212
|
+
<link href="https://unpkg.com/@nypl/design-system-react-components@0.9.1/dist/styles.css">
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
You can check out a working Codepen with unpkg [here](https://codepen.io/edwinguzman/pen/ExmXGKx).
|
|
216
|
+
|
|
217
|
+
## Storybook
|
|
218
|
+
|
|
219
|
+
The Reservoir Design System leverages Storybook to document all the React components and style guidelines. The Storybook documentation can be found [here](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page). For your convenience, the Reservoir Design System components have been organized into logical categories based on both form and function. Please refer to the COMPONENTS section in the Storybook sidebar.
|
|
220
|
+
|
|
221
|
+
### Documentation Instances
|
|
222
|
+
|
|
223
|
+
There are currently two main instances of the Reservoir Design System Storybook documentation. There are also "preview" sites that are used to quickly and easily view pull request changes.
|
|
224
|
+
|
|
225
|
+
**Production**
|
|
226
|
+
|
|
227
|
+
The production Storybook documentation is deployed to [Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page). This is the main instance we use to share the latest stable release of the Reservoir Design System. This documentation site is deployed through [Github Actions](/.github/workflows/gh-pages.yml) only on merges to the `release` branch.
|
|
228
|
+
|
|
229
|
+
As of July, 2021, the Github Pages production site gets deployed every two weeks on the same schedule as npm releases.
|
|
230
|
+
|
|
231
|
+
**Development**
|
|
232
|
+
|
|
233
|
+
The development Storybook documentation is deployed to [Vercel](https://nypl-design-system.vercel.app/?path=/story/welcome--page). This development site has all the working updates that get merged to the `development` branch. This means that this site is constantly being updated as pull requests are being merged in. This site is used to see the lastest changes during a working sprint before a production release is made.
|
|
234
|
+
|
|
235
|
+
**Preview Sites**
|
|
236
|
+
|
|
237
|
+
Preview Storybook documentation sites are deployed to Vercel on every commit push to every branch in this repository. They follow a pattern such as `nypl-design-system-[hash]-nypl.vercel.app` where `[hash]` is a random hash created by Vercel. This means that the URL varies and that those instances are eventually shut off. They are not meant to be used as long-term sites but rather for reviewing working changes within the team.
|
|
238
|
+
|
|
239
|
+
### React Component Documentation
|
|
240
|
+
|
|
241
|
+
When actively developing components or fixing bugs, make sure that the related stories are created or updated. This means updating the respective `[component-name].stories.mdx` file. For information on how to write stories, check out the [Anatomy of a Story](https://github.com/NYPL/nypl-design-system/wiki/Anatomy-of-a-Story) wiki page.
|
|
242
|
+
|
|
243
|
+
For stand-alone document pages in Storybook, you need to:
|
|
244
|
+
|
|
245
|
+
1. create the `[page-name].stories.mdx` file in `src/docs/`
|
|
246
|
+
2. add the file reference to the `.storybook/main.js` file in the `stories` array
|
|
247
|
+
|
|
248
|
+
### React Component Versions
|
|
249
|
+
|
|
250
|
+
To help consuming application developers understand which version of the DS is required for a specific component, each component story page includes the following:
|
|
251
|
+
|
|
252
|
+
- when a component was added to the DS
|
|
253
|
+
- minimum version of the DS required for the latest version of a component
|
|
254
|
+
|
|
255
|
+
**Example Component Version Table**
|
|
256
|
+
|
|
257
|
+
| Component Version | DS Version |
|
|
258
|
+
| ----------------- | ---------- |
|
|
259
|
+
| Added | `0.20.1` |
|
|
260
|
+
| Latest | `0.23.2` |
|
|
261
|
+
|
|
262
|
+
### Static Build
|
|
263
|
+
|
|
264
|
+
There should be no need to run the static Storybook instance while actively developing -- it's used exclusively for building out the `gh-pages` environment and deploying it to [Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page). In the event that you do run the static Storybook npm script, run:
|
|
265
|
+
|
|
266
|
+
```sh
|
|
267
|
+
$ npm run build-storybook:v1
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
You can then view `/reservoir/v1/index.html` in your browser. _Make sure not to commit this directory_.
|
|
271
|
+
|
|
272
|
+
## Typescript Usage
|
|
273
|
+
|
|
274
|
+
The Reservoir Design System is built with Typescript. Check out the Design System's [Typescript documentation](/TYPESCRIPT.md) for more information on why we chose to build React components in Typescript and the benefits and the gotchas we encountered.
|
|
275
|
+
|
|
276
|
+
## Unit Testing
|
|
277
|
+
|
|
278
|
+
The Reservoir Design System runs unit tests with Jest and React Testing Library.
|
|
279
|
+
|
|
280
|
+
To run all tests once:
|
|
281
|
+
|
|
282
|
+
```sh
|
|
283
|
+
$ npm test
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
If you're actively writing or updating tests, you can run the tests in watch mode. This will wait for any changes and run when a file is saved:
|
|
287
|
+
|
|
288
|
+
```sh
|
|
289
|
+
$ npm run test:watch
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
If you want to run tests on only one specific file, run:
|
|
293
|
+
|
|
294
|
+
```sh
|
|
295
|
+
$ npm test -- src/[path/to/file]
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
For example, to test the `Link` component, run:
|
|
299
|
+
|
|
300
|
+
```sh
|
|
301
|
+
$ npm test -- src/components/Link/Link.test.tsx
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Snapshot Testing
|
|
305
|
+
|
|
306
|
+
The NYPL DS implements snapshot testing with `react-test-renderer` and `jest`. Using React Testing Library to test our components works well to make sure that what the user sees is what the component should be rendering. There are also some behavioral tests that test user interactions. If, however, a component's DOM or SCSS styling was unintentionally updated, we can catch those bugs through snapshot testing.
|
|
307
|
+
|
|
308
|
+
The `react-test-renderer` package, will create a directory and a file to hold `.snap` files after a unit test is created. Using the `Notification` component as an example, this is the basic layout for a snapshot test:
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
import renderer from "react-test-renderer";
|
|
312
|
+
|
|
313
|
+
// ...
|
|
314
|
+
|
|
315
|
+
it("Renders the UI snapshot correctly", () => {
|
|
316
|
+
const tree = renderer
|
|
317
|
+
.create(
|
|
318
|
+
<Notification
|
|
319
|
+
id="notificationID"
|
|
320
|
+
notificationHeading="Notification Heading"
|
|
321
|
+
notificationContent={<>Notification content.</>}
|
|
322
|
+
/>
|
|
323
|
+
)
|
|
324
|
+
.toJSON();
|
|
325
|
+
expect(tree).toMatchSnapshot();
|
|
326
|
+
});
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
If this is a new test and we run `npm test`, a [`/__snapshots__/Notification.test.tsx.snap`](/src/components/Notification/__snapshots__/Notification.test.tsx.snap) file is created. This holds the DOM structure as well as any inline CSS that was added.
|
|
330
|
+
|
|
331
|
+
```tsx
|
|
332
|
+
exports[`Notification Snapshot Renders the UI snapshot correctly 1`] = `
|
|
333
|
+
<aside
|
|
334
|
+
className="notification notification--standard "
|
|
335
|
+
id="notificationID"
|
|
336
|
+
>
|
|
337
|
+
// Removed for brevity...
|
|
338
|
+
</aside>
|
|
339
|
+
`;
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Now, if we unintentionally update the `Notification.tsx` component to render a `div` instead of an `aside` element, this test will fail.
|
|
343
|
+
|
|
344
|
+
If you want to update any existing snapshots, re-run the test script as:
|
|
345
|
+
|
|
346
|
+
```sh
|
|
347
|
+
$ npm test -- --updateSnapshot
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Each snapshot file also includes a link to its [Jest Snapshot documentation](https://jestjs.io/docs/snapshot-testing) which is recommended to read!
|
|
351
|
+
|
|
352
|
+
### Storybook Jest Addon
|
|
353
|
+
|
|
354
|
+
Through the [`@storybook/addon-jest`](https://www.npmjs.com/package/@storybook/addon-jest) plugin, we can see a component's suite of unit tests right Storybook. In the "Addons" panel, a "Test" tab will display all the tests for the current component and whether they pass or fail.
|
|
355
|
+
|
|
356
|
+
After writing new tests, run `npm run test:generate-output` to create a new JSON file that is used by Storybook. This JSON file contains all the test suites for all the components and Storybook picks this up and automatically combines a component with its relevant unit tests. Make sure to commit this file although new builds on Github Pages will recreate this file for the production Storybook instance.
|
|
357
|
+
|
|
358
|
+
## Accessibility
|
|
359
|
+
|
|
360
|
+
### Development and Storybook
|
|
361
|
+
|
|
362
|
+
The Reservoir Design System is built with accessibility in mind. By using Chakra UI as our foundational base, the custom DS components built with Chakra have accessibility concerns already implemented. On top of built-in accessible elements, DS components internally work to link labels with input elements, to add correct `aria-*` attributes, to visually hide text but still associate it with the correct element for titles and descriptions, to auto-generate a random `id` attribute if none was passed, and much more.
|
|
363
|
+
|
|
364
|
+
We make use of:
|
|
365
|
+
|
|
366
|
+
- `eslint-plugin-jsx-a11y` for finding accessibility errors through linting and through IDE environments.
|
|
367
|
+
- `jest-axe` for running [`axe-core`](https://github.com/dequelabs/axe-core) on _every_ component's unit test file. This is part of the automated tests that run in Github Actions through the `npm test` command.
|
|
368
|
+
- `@storybook/addon-a11y` for real-time accessibility testing in the browser through Storybook. _Every_ component has a tab that displays violations, passes, and incomplete checks performed by `axe-core`.
|
|
369
|
+
|
|
370
|
+
If applicable, DS components have section(s) on accessibility in their Storybook documentation. For example, in the `Slider`'s [Storybook file](/src/components/Slider/Slider.stories.mdx), there are two "Accessibility" sections for each of the two `Slider` types, "single" and "range". This gives an explanation on additional changes we made to make the combination of elements in the `Slider` component accessible.
|
|
371
|
+
|
|
372
|
+
### Product Requirements
|
|
373
|
+
|
|
374
|
+
The Reservoir Design System provides accessible stories, but real live data can necessitate additional accessibility requirements beyond what we're committed to in our generic, extensible components. To ensure your products' final result is accessible, please adhere to the accessibility requirements put together by NYPL's accessibility coordinator on [Metronome](http://themetronome.co/).
|
|
375
|
+
|
|
376
|
+
NYPL's Metronome instance is currently password protected. For access to Metronome, please contact NYPL's UX team or Design System team.
|
|
377
|
+
|
|
378
|
+
## CDN
|
|
379
|
+
|
|
380
|
+
You can also use the Design System styles in your project through the `unpkg` CDN:
|
|
381
|
+
|
|
382
|
+
```jsx
|
|
383
|
+
<link href="https://unpkg.com/@nypl/design-system-react-components/dist/styles.css">
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
If you need to reference a particular version you can do do by including the version number in the URL:
|
|
387
|
+
|
|
388
|
+
```jsx
|
|
389
|
+
<link href="https://unpkg.com/@nypl/design-system-react-components@0.9.1/dist/styles.css">
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
You can check out a working Codepen with unpkg [here](https://codepen.io/edwinguzman/pen/ExmXGKx).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare type AccordionTypes = "default" | "warning" | "error";
|
|
3
|
+
export interface AccordionDataProps {
|
|
4
|
+
accordionType?: AccordionTypes;
|
|
5
|
+
label: string;
|
|
6
|
+
panel: string | React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionProps {
|
|
9
|
+
/** Array of data to display, and an optional accordionType */
|
|
10
|
+
accordionData: AccordionDataProps[];
|
|
11
|
+
/** ID that other components can cross reference for accessibility purposes */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** Whether the accordion is open by default only on its initial rendering */
|
|
14
|
+
isDefaultOpen?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Accordion component that shows content on toggle. Can be used to display
|
|
18
|
+
* multiple accordion items together.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Accordion: import("@chakra-ui/react").ChakraComponent<(props: AccordionProps) => JSX.Element, {}>;
|
|
21
|
+
export default Accordion;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare type BreadcrumbsTypes = "blogs" | "booksAndMore" | "education" | "locations" | "research" | "whatsOn";
|
|
3
|
+
export interface BreadcrumbsDataProps {
|
|
4
|
+
url: string;
|
|
5
|
+
text: string | React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface BreadcrumbProps {
|
|
8
|
+
/** Breadcrumb links as an array */
|
|
9
|
+
breadcrumbsData: BreadcrumbsDataProps[];
|
|
10
|
+
/** Used to control how the `Hero` component will be rendered. */
|
|
11
|
+
breadcrumbsType?: BreadcrumbsTypes;
|
|
12
|
+
/** className you can add in addition to 'input' */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** ID that other components can cross reference for accessibility purposes */
|
|
15
|
+
id?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const Breadcrumbs: import("@chakra-ui/react").ChakraComponent<(props: BreadcrumbProps) => JSX.Element, {}>;
|
|
18
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare type ButtonElementType = "submit" | "button" | "reset";
|
|
3
|
+
export declare type ButtonTypes = "primary" | "secondary" | "callout" | "pill" | "link" | "noBrand";
|
|
4
|
+
interface ButtonProps {
|
|
5
|
+
/** The button variation to render based on the `ButtonTypes` type.*/
|
|
6
|
+
buttonType?: ButtonTypes;
|
|
7
|
+
/** Additional className to use. */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Adds 'disabled' property to the button. */
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
/** Trigger the Button's action through the `mouseDown` event handler instead
|
|
14
|
+
* of `onClick`. `false` by default. */
|
|
15
|
+
mouseDown?: boolean;
|
|
16
|
+
/** The action to perform on the `<button>`'s onClick function. */
|
|
17
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
18
|
+
/** The HTML button type attribute. */
|
|
19
|
+
type?: ButtonElementType;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Renders a simple `button` element with custom variant styles.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Button: import("@chakra-ui/react").ChakraComponent<(props: React.PropsWithChildren<ButtonProps>) => JSX.Element, {}>;
|
|
25
|
+
export default Button;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { LayoutTypes } from "../../helpers/types";
|
|
3
|
+
export declare type ButtonGroupWidths = "default" | "full";
|
|
4
|
+
interface ButtonGroupProps {
|
|
5
|
+
/** Sets the width to "default" (for "fit-content") or "full". */
|
|
6
|
+
buttonWidth?: ButtonGroupWidths;
|
|
7
|
+
/** Additional className to use. */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
10
|
+
id?: string;
|
|
11
|
+
/** Set's the disabled state to all the internal `Button` components. */
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
/** Renders the layout of `Button` components in a row or column. */
|
|
14
|
+
layout?: LayoutTypes;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A simple wrapper to group `Button` components together. The layout can be set
|
|
18
|
+
* to row or column and the width of internal `Button` components can be set to
|
|
19
|
+
* the parent's full width or the `Button`'s content width
|
|
20
|
+
*/
|
|
21
|
+
export declare const ButtonGroup: import("@chakra-ui/react").ChakraComponent<(props: React.PropsWithChildren<ButtonGroupProps>) => JSX.Element, {}>;
|
|
22
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { LayoutTypes } from "../../helpers/types";
|
|
3
|
+
import { ComponentImageProps } from "../Image/Image";
|
|
4
|
+
interface CardBaseProps {
|
|
5
|
+
/** Optional value to control the alignment of the text and elements. */
|
|
6
|
+
isCentered?: boolean;
|
|
7
|
+
/** Optional value to render the layout in a row or column.
|
|
8
|
+
* Default is `"column"`. */
|
|
9
|
+
layout?: LayoutTypes;
|
|
10
|
+
}
|
|
11
|
+
interface CardLinkBoxProps {
|
|
12
|
+
/** Main link to use when the full `Card` component should be clickable. */
|
|
13
|
+
mainActionLink?: string;
|
|
14
|
+
}
|
|
15
|
+
interface CardImageProps extends ComponentImageProps {
|
|
16
|
+
/** Optional boolean value to control the position of the `CardImage`. */
|
|
17
|
+
isAtEnd?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface CardActionsProps extends CardBaseProps {
|
|
20
|
+
/** Optional boolean value to control visibility of border on the bottom edge
|
|
21
|
+
* of the card actions element */
|
|
22
|
+
bottomBorder?: boolean;
|
|
23
|
+
/** Optional boolean value to control visibility of border on the top edge of
|
|
24
|
+
* the card actions element */
|
|
25
|
+
topBorder?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface CardProps extends CardBaseProps, CardLinkBoxProps {
|
|
28
|
+
/** Optional hex color value used to set the card background color. */
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
/** Optional CSS class name to add. */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Optional hex color value used to override the default text color. */
|
|
33
|
+
foregroundColor?: string;
|
|
34
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
35
|
+
id?: string;
|
|
36
|
+
/** Optional boolean value to control the visibility of a border around
|
|
37
|
+
* the card. */
|
|
38
|
+
isBordered?: boolean;
|
|
39
|
+
/** Object used to create and render the `Image` component. */
|
|
40
|
+
imageProps?: CardImageProps;
|
|
41
|
+
/** Set CardActions to the right content side. This only works in
|
|
42
|
+
* the row layout. */
|
|
43
|
+
isAlignedRightActions?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare const CardHeading: import("@chakra-ui/react").ChakraComponent<import("@chakra-ui/react").ChakraComponent<(props: React.PropsWithChildren<import("../Heading/Heading").HeadingProps>) => JSX.Element, {}>, {}>;
|
|
46
|
+
export declare const CardContent: import("@chakra-ui/react").ChakraComponent<(props: React.PropsWithChildren<{}>) => JSX.Element, {}>;
|
|
47
|
+
export declare const CardActions: import("@chakra-ui/react").ChakraComponent<(props: React.PropsWithChildren<CardActionsProps>) => JSX.Element, {}>;
|
|
48
|
+
export declare const Card: import("@chakra-ui/react").ChakraComponent<(props: React.PropsWithChildren<CardProps>) => JSX.Element, {}>;
|
|
49
|
+
export default Card;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
|
|
3
|
+
interface CheckboxIconProps {
|
|
4
|
+
/** When using the Checkbox as a "controlled" form element, you can specify
|
|
5
|
+
* the Checkbox's checked state using this prop.
|
|
6
|
+
* Learn more about controlled and uncontrolled form fields:
|
|
7
|
+
* https://goshakkk.name/controlled-vs-uncontrolled-inputs-react/ */
|
|
8
|
+
isChecked?: boolean;
|
|
9
|
+
/** Adds the indeterminate state to the `Checkbox`. */
|
|
10
|
+
isIndeterminate?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface CheckboxProps extends CheckboxIconProps {
|
|
13
|
+
/** className you can add in addition to 'input' */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Optional string to populate the HelperErrorText for standard state */
|
|
16
|
+
helperText?: HelperErrorTextType;
|
|
17
|
+
/** ID that other components can cross reference for accessibility purposes */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Optional string to populate the HelperErrorText for the error state
|
|
20
|
+
* when `isInvalid` is true. */
|
|
21
|
+
invalidText?: HelperErrorTextType;
|
|
22
|
+
/** Adds the 'disabled' and `aria-disabled` attributes to the input when true.
|
|
23
|
+
* This also makes the text italic and color scheme gray. */
|
|
24
|
+
isDisabled?: boolean;
|
|
25
|
+
/** Adds the 'aria-invalid' attribute to the input when true. This also makes
|
|
26
|
+
* the color theme "NYPL error" red for the button and text. */
|
|
27
|
+
isInvalid?: boolean;
|
|
28
|
+
/** Adds the 'required' attribute to the input when true. */
|
|
29
|
+
isRequired?: boolean;
|
|
30
|
+
/** The checkbox's label. This will serve as the text content for a `<label>`
|
|
31
|
+
* element if `showlabel` is true, or an "aria-label" if `showLabel` is false. */
|
|
32
|
+
labelText: string | JSX.Element;
|
|
33
|
+
/** The name prop indicates into which group of checkboxes this checkbox
|
|
34
|
+
* belongs. If none is specified, 'default' will be used */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** The action to perform on the `<input>`'s onChange function */
|
|
37
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
38
|
+
/** Offers the ability to hide the helper/invalid text. */
|
|
39
|
+
showHelperInvalidText?: boolean;
|
|
40
|
+
/** Offers the ability to show the checkbox's label onscreen or hide it.
|
|
41
|
+
* Refer to the `labelText` property for more information. */
|
|
42
|
+
showLabel?: boolean;
|
|
43
|
+
/** Populates the value of the input */
|
|
44
|
+
value?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare const Checkbox: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>, {}>;
|
|
47
|
+
export default Checkbox;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
|
|
3
|
+
import { LayoutTypes } from "../../helpers/types";
|
|
4
|
+
export interface CheckboxGroupProps {
|
|
5
|
+
/** Any child node passed to the component. */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Populates the initial value of the input */
|
|
8
|
+
defaultValue?: string[];
|
|
9
|
+
/** Optional string to populate the HelperErrorText for standard state */
|
|
10
|
+
helperText?: HelperErrorTextType;
|
|
11
|
+
/** ID that other components can cross reference for accessibility purposes */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Optional string to populate the HelperErrorText for error state */
|
|
14
|
+
invalidText?: HelperErrorTextType;
|
|
15
|
+
/** Adds the 'disabled' prop to the input when true. */
|
|
16
|
+
isDisabled?: boolean;
|
|
17
|
+
/** Set's the `Checkbox`s' wrapper to be full width. */
|
|
18
|
+
isFullWidth?: boolean;
|
|
19
|
+
/** A`dds the 'aria-invalid' attribute to the input and
|
|
20
|
+
* sets the error state when true. */
|
|
21
|
+
isInvalid?: boolean;
|
|
22
|
+
/** Adds the 'required' attribute to the input when true. */
|
|
23
|
+
isRequired?: boolean;
|
|
24
|
+
/** The checkbox group label displayed in a `legend` element if `showlabel` is
|
|
25
|
+
* true, or an "aria-label" if `showLabel` is false. */
|
|
26
|
+
labelText: string;
|
|
27
|
+
/** Renders the checkbox buttons in a row or column (default). */
|
|
28
|
+
layout?: LayoutTypes;
|
|
29
|
+
/** The `name` prop indicates the form group for all the `Checkbox` children. */
|
|
30
|
+
name: string;
|
|
31
|
+
/** The action to perform on the `<input>`'s onChange function */
|
|
32
|
+
onChange?: (value: string[]) => void;
|
|
33
|
+
/** Offers the ability to hide the helper/invalid text. */
|
|
34
|
+
showHelperInvalidText?: boolean;
|
|
35
|
+
/** Offers the ability to show the group's legend onscreen or hide it. Refer
|
|
36
|
+
* to the `labelText` property for more information. */
|
|
37
|
+
showLabel?: boolean;
|
|
38
|
+
/** Whether or not to display the "(Required)" text in the label text.
|
|
39
|
+
* True by default. */
|
|
40
|
+
showRequiredLabel?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Wrapper component to wrap `Checkbox` components. Can be displayed in a
|
|
44
|
+
* column or in a row. The `CheckboxGroup` component renders all the necessary
|
|
45
|
+
* wrapping and associated text elements, but the checkbox input elements
|
|
46
|
+
* _need_ to be child `Checkbox` components from the NYPL Design System.
|
|
47
|
+
*/
|
|
48
|
+
export declare const CheckboxGroup: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLInputElement>>, {}>;
|
|
49
|
+
export default CheckboxGroup;
|