@nypl/design-system-react-components 0.25.13 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.md +10 -10
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +11 -9
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -4
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -6
- package/dist/components/Fieldset/Fieldset.d.ts +5 -6
- package/dist/components/Form/Form.d.ts +6 -6
- package/dist/components/Grid/GridTypes.d.ts +7 -7
- package/dist/components/Grid/SimpleGrid.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
- package/dist/components/Hero/Hero.d.ts +2 -1
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
- package/dist/components/Icons/Icon.d.ts +2 -1
- package/dist/components/Image/Image.d.ts +2 -2
- package/dist/components/Label/Label.d.ts +7 -4
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +11 -11
- package/dist/components/List/ListTypes.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts +2 -1
- package/dist/components/Logo/LogoSvgs.d.ts +2 -0
- package/dist/components/Logo/LogoTypes.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +4 -4
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +4 -6
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -6
- package/dist/components/SearchBar/SearchBar.d.ts +4 -4
- package/dist/components/Select/Select.d.ts +10 -6
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
- package/dist/components/Slider/Slider.d.ts +6 -4
- package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +4 -3
- package/dist/components/Template/Template.d.ts +4 -3
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +5 -5
- package/dist/components/Toggle/Toggle.d.ts +3 -4
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +1767 -1180
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +1774 -1188
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/hooks/useCarouselStyles.d.ts +3 -2
- package/dist/hooks/useNYPLTheme.d.ts +12 -0
- package/dist/index.d.ts +5 -2
- package/dist/styles.css +1 -1
- package/dist/theme/components/button.d.ts +10 -2
- package/dist/theme/components/card.d.ts +42 -22
- package/dist/theme/components/checkbox.d.ts +5 -4
- package/dist/theme/components/checkboxGroup.d.ts +1 -1
- package/dist/theme/components/componentWrapper.d.ts +2 -2
- package/dist/theme/components/customTable.d.ts +84 -1
- package/dist/theme/components/fieldset.d.ts +4 -14
- package/dist/theme/components/global.d.ts +23 -17
- package/dist/theme/components/heading.d.ts +53 -0
- package/dist/theme/components/helperErrorText.d.ts +1 -0
- package/dist/theme/components/hero.d.ts +20 -14
- package/dist/theme/components/label.d.ts +9 -10
- package/dist/theme/components/list.d.ts +99 -9
- package/dist/theme/components/radio.d.ts +6 -4
- package/dist/theme/components/radioGroup.d.ts +1 -1
- package/dist/theme/components/select.d.ts +28 -5
- package/dist/theme/components/skeletonLoader.d.ts +2 -2
- package/dist/theme/components/slider.d.ts +6 -3
- package/dist/theme/components/structuredContent.d.ts +197 -0
- package/dist/theme/components/textInput.d.ts +18 -6
- package/dist/theme/components/toggle.d.ts +7 -4
- package/dist/theme/foundations/global.d.ts +2 -0
- package/dist/theme/foundations/radii.d.ts +1 -0
- package/dist/theme/foundations/spacing.d.ts +46 -43
- package/package.json +17 -19
- package/src/components/Accordion/Accordion.stories.mdx +9 -9
- package/src/components/Accordion/Accordion.test.tsx +21 -0
- package/src/components/Accordion/Accordion.tsx +13 -9
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +276 -27
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -5
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +52 -31
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +8 -7
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
- package/src/components/Button/Button.stories.mdx +87 -23
- package/src/components/Button/Button.test.tsx +25 -0
- package/src/components/Button/Button.tsx +18 -7
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
- package/src/components/Card/Card.stories.mdx +287 -194
- package/src/components/Card/Card.test.tsx +102 -0
- package/src/components/Card/Card.tsx +73 -32
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +196 -36
- package/src/components/Chakra/Grid.stories.mdx +4 -4
- package/src/components/Checkbox/Checkbox.stories.mdx +62 -10
- package/src/components/Checkbox/Checkbox.test.tsx +32 -9
- package/src/components/Checkbox/Checkbox.tsx +20 -15
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +134 -7
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +65 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +137 -81
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +31 -21
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +332 -97
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
- package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
- package/src/components/DatePicker/DatePicker.test.tsx +89 -13
- package/src/components/DatePicker/DatePicker.tsx +62 -56
- package/src/components/DatePicker/_DatePicker.scss +71 -13
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
- package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
- package/src/components/Fieldset/Fieldset.test.tsx +58 -28
- package/src/components/Fieldset/Fieldset.tsx +35 -30
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
- package/src/components/Form/Form.stories.mdx +72 -39
- package/src/components/Form/Form.test.tsx +58 -15
- package/src/components/Form/Form.tsx +89 -67
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
- package/src/components/Grid/GridTypes.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +34 -6
- package/src/components/Grid/SimpleGrid.test.tsx +9 -0
- package/src/components/Grid/SimpleGrid.tsx +29 -20
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
- package/src/components/Heading/Heading.stories.mdx +36 -3
- package/src/components/Heading/Heading.test.tsx +10 -0
- package/src/components/Heading/Heading.tsx +56 -50
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +26 -7
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
- package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
- package/src/components/Hero/Hero.stories.mdx +125 -95
- package/src/components/Hero/Hero.test.tsx +33 -0
- package/src/components/Hero/Hero.tsx +135 -126
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -19
- package/src/components/HorizontalRule/HorizontalRule.tsx +9 -26
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
- package/src/components/Icons/Icon.stories.mdx +31 -6
- package/src/components/Icons/Icon.test.tsx +38 -0
- package/src/components/Icons/Icon.tsx +93 -76
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
- package/src/components/Image/Image.stories.mdx +29 -5
- package/src/components/Image/Image.test.tsx +8 -0
- package/src/components/Image/Image.tsx +38 -26
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
- package/src/components/Label/Label.stories.mdx +42 -20
- package/src/components/Label/Label.test.tsx +42 -17
- package/src/components/Label/Label.tsx +22 -13
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
- package/src/components/Link/Link.stories.mdx +25 -15
- package/src/components/Link/Link.test.tsx +21 -22
- package/src/components/Link/Link.tsx +8 -8
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
- package/src/components/List/List.stories.mdx +75 -40
- package/src/components/List/List.test.tsx +67 -19
- package/src/components/List/List.tsx +38 -25
- package/src/components/List/ListTypes.tsx +1 -1
- package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
- package/src/components/Logo/Logo.stories.mdx +30 -6
- package/src/components/Logo/Logo.test.tsx +17 -0
- package/src/components/Logo/Logo.tsx +18 -6
- package/src/components/Logo/LogoSvgs.tsx +4 -0
- package/src/components/Logo/LogoTypes.tsx +2 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
- package/src/components/Modal/Modal.stories.mdx +256 -136
- package/src/components/Modal/Modal.test.tsx +151 -9
- package/src/components/Modal/Modal.tsx +140 -20
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
- package/src/components/Notification/Notification.stories.mdx +25 -1
- package/src/components/Notification/Notification.test.tsx +23 -0
- package/src/components/Notification/Notification.tsx +46 -44
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
- package/src/components/Pagination/Pagination.stories.mdx +25 -6
- package/src/components/Pagination/Pagination.test.tsx +25 -0
- package/src/components/Pagination/Pagination.tsx +6 -6
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
- package/src/components/Placeholder/Placeholder.tsx +3 -1
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +81 -11
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -9
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
- package/src/components/Radio/Radio.stories.mdx +64 -12
- package/src/components/Radio/Radio.test.tsx +28 -8
- package/src/components/Radio/Radio.tsx +66 -63
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +103 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +224 -89
- package/src/components/RadioGroup/RadioGroup.test.tsx +122 -62
- package/src/components/RadioGroup/RadioGroup.tsx +106 -100
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1020
- package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
- package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
- package/src/components/SearchBar/SearchBar.tsx +17 -8
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
- package/src/components/Select/Select.stories.mdx +128 -49
- package/src/components/Select/Select.test.tsx +63 -16
- package/src/components/Select/Select.tsx +131 -92
- package/src/components/Select/SelectTypes.tsx +5 -0
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +765 -425
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +42 -10
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +8 -0
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +76 -72
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
- package/src/components/Slider/Slider.stories.mdx +91 -42
- package/src/components/Slider/Slider.test.tsx +65 -17
- package/src/components/Slider/Slider.tsx +26 -19
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
- package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
- package/src/components/StatusBadge/StatusBadge.test.tsx +16 -0
- package/src/components/StatusBadge/StatusBadge.tsx +25 -20
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
- package/src/components/StructuredContent/StructuredContent.stories.mdx +131 -12
- package/src/components/StructuredContent/StructuredContent.test.tsx +34 -0
- package/src/components/StructuredContent/StructuredContent.tsx +80 -75
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
- package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
- package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
- package/src/components/StyleGuide/ColorCard.tsx +1 -1
- package/src/components/StyleGuide/Colors.stories.mdx +1 -2
- package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
- package/src/components/StyleGuide/Forms.stories.mdx +27 -12
- package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
- package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
- package/src/components/StyleGuide/Typography.stories.mdx +30 -21
- package/src/components/Table/Table.stories.mdx +38 -11
- package/src/components/Table/Table.test.tsx +15 -0
- package/src/components/Table/Table.tsx +7 -7
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
- package/src/components/Tabs/Tabs.stories.mdx +52 -3
- package/src/components/Tabs/Tabs.test.tsx +16 -0
- package/src/components/Tabs/Tabs.tsx +10 -6
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
- package/src/components/Template/Template.stories.mdx +47 -43
- package/src/components/Template/Template.test.tsx +33 -0
- package/src/components/Template/Template.tsx +65 -60
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +191 -20
- package/src/components/Text/Text.stories.mdx +20 -1
- package/src/components/Text/Text.test.tsx +12 -0
- package/src/components/Text/Text.tsx +6 -4
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
- package/src/components/TextInput/TextInput.stories.mdx +65 -19
- package/src/components/TextInput/TextInput.test.tsx +42 -28
- package/src/components/TextInput/TextInput.tsx +121 -113
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
- package/src/components/Toggle/Toggle.stories.mdx +80 -22
- package/src/components/Toggle/Toggle.test.tsx +27 -9
- package/src/components/Toggle/Toggle.tsx +22 -18
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +128 -5
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +23 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +133 -126
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
- package/src/docs/Chakra.stories.mdx +50 -9
- package/src/docs/Welcome.stories.mdx +160 -41
- package/src/hooks/useCarouselStyles.stories.mdx +22 -2
- package/src/hooks/useCarouselStyles.ts +3 -2
- package/src/hooks/useNYPLTheme.stories.mdx +101 -0
- package/src/hooks/useNYPLTheme.ts +30 -6
- package/src/hooks/useWindowSize.stories.mdx +23 -0
- package/src/index.ts +5 -2
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles.scss +0 -1
- package/src/theme/components/button.ts +15 -7
- package/src/theme/components/card.ts +30 -19
- package/src/theme/components/checkbox.ts +10 -8
- package/src/theme/components/checkboxGroup.ts +1 -1
- package/src/theme/components/componentWrapper.ts +2 -2
- package/src/theme/components/customTable.ts +39 -31
- package/src/theme/components/fieldset.ts +1 -2
- package/src/theme/components/global.ts +25 -20
- package/src/theme/components/heading.ts +1 -1
- package/src/theme/components/helperErrorText.ts +1 -0
- package/src/theme/components/hero.ts +13 -15
- package/src/theme/components/label.ts +4 -3
- package/src/theme/components/list.ts +73 -66
- package/src/theme/components/notification.ts +2 -2
- package/src/theme/components/radio.ts +9 -9
- package/src/theme/components/radioGroup.ts +1 -1
- package/src/theme/components/select.ts +31 -22
- package/src/theme/components/skeletonLoader.ts +3 -3
- package/src/theme/components/slider.ts +8 -7
- package/src/theme/components/statusBadge.ts +2 -2
- package/src/theme/components/structuredContent.ts +66 -1
- package/src/theme/components/tabs.ts +2 -2
- package/src/theme/components/template.ts +9 -9
- package/src/theme/components/textInput.ts +13 -12
- package/src/theme/components/toggle.ts +17 -10
- package/src/theme/components/videoPlayer.ts +1 -1
- package/src/theme/foundations/colors.ts +1 -1
- package/src/theme/foundations/radii.ts +1 -0
- package/src/theme/foundations/spacing.ts +70 -22
- package/src/theme/foundations/typography.ts +2 -2
- package/src/utils/componentCategories.ts +1 -2
- package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
- package/dist/helpers/generateUUID.d.ts +0 -1
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/helpers/generateUUID.tsx +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Box, chakra, useStyleConfig } from "@chakra-ui/react";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import { Box, useStyleConfig } from "@chakra-ui/react";
|
|
3
3
|
|
|
4
4
|
export interface TemplateProps {}
|
|
5
5
|
export interface TemplateHeaderProps {
|
|
@@ -49,10 +49,14 @@ export interface TemplateAppContainerProps
|
|
|
49
49
|
* The main top-level parent component that wraps all template-related
|
|
50
50
|
* components.
|
|
51
51
|
*/
|
|
52
|
-
const Template = (props: React.PropsWithChildren<TemplateProps>) => {
|
|
52
|
+
const Template = chakra((props: React.PropsWithChildren<TemplateProps>) => {
|
|
53
53
|
const styles = useStyleConfig("Template", {});
|
|
54
|
-
return
|
|
55
|
-
}
|
|
54
|
+
return (
|
|
55
|
+
<Box __css={styles} {...props}>
|
|
56
|
+
{props.children}
|
|
57
|
+
</Box>
|
|
58
|
+
);
|
|
59
|
+
});
|
|
56
60
|
|
|
57
61
|
/**
|
|
58
62
|
* This optional component renders its children from edge-to-edge and should
|
|
@@ -241,68 +245,68 @@ const TemplateFooter = ({
|
|
|
241
245
|
* be rendered. For example, if you want to render content in the
|
|
242
246
|
* `TemplateContentPrimary` section, then pass it as a prop to `contentPrimary`.
|
|
243
247
|
*/
|
|
244
|
-
const TemplateAppContainer = (
|
|
245
|
-
props: React.PropsWithChildren<TemplateAppContainerProps>
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
248
|
+
export const TemplateAppContainer = chakra(
|
|
249
|
+
(props: React.PropsWithChildren<TemplateAppContainerProps>) => {
|
|
250
|
+
const {
|
|
251
|
+
aboveHeader,
|
|
252
|
+
breakout,
|
|
253
|
+
contentId = "mainContent",
|
|
254
|
+
contentPrimary,
|
|
255
|
+
contentSidebar,
|
|
256
|
+
contentTop,
|
|
257
|
+
footer,
|
|
258
|
+
header,
|
|
259
|
+
sidebar = "none",
|
|
260
|
+
renderFooterElement = true,
|
|
261
|
+
renderHeaderElement = true,
|
|
262
|
+
...rest
|
|
263
|
+
} = props;
|
|
264
|
+
const aboveHeaderElem = aboveHeader && (
|
|
265
|
+
<TemplateAboveHeader>{aboveHeader}</TemplateAboveHeader>
|
|
266
|
+
);
|
|
267
|
+
const breakoutElem = breakout && (
|
|
268
|
+
<TemplateBreakout>{breakout}</TemplateBreakout>
|
|
269
|
+
);
|
|
270
|
+
const contentTopElem = contentTop && (
|
|
271
|
+
<TemplateContentTop>{contentTop}</TemplateContentTop>
|
|
272
|
+
);
|
|
273
|
+
const contentPrimaryElem = contentPrimary && (
|
|
274
|
+
<TemplateContentPrimary>{contentPrimary}</TemplateContentPrimary>
|
|
275
|
+
);
|
|
276
|
+
const contentSidebarElem = contentSidebar && (
|
|
277
|
+
<TemplateContentSidebar>{contentSidebar}</TemplateContentSidebar>
|
|
278
|
+
);
|
|
279
|
+
return (
|
|
280
|
+
<Template {...rest}>
|
|
281
|
+
{aboveHeaderElem}
|
|
282
|
+
{(header || breakoutElem) && (
|
|
283
|
+
<TemplateHeader renderHeaderElement={renderHeaderElement}>
|
|
284
|
+
{header}
|
|
285
|
+
{breakoutElem}
|
|
286
|
+
</TemplateHeader>
|
|
287
|
+
)}
|
|
288
|
+
{/* Note that setting `sidebar` as a prop here affects the
|
|
285
289
|
TemplateContentSidebar and TemplateContentPrimary components. */}
|
|
286
|
-
|
|
287
|
-
|
|
290
|
+
<TemplateContent id={contentId} sidebar={sidebar}>
|
|
291
|
+
{contentTopElem}
|
|
288
292
|
|
|
289
|
-
|
|
293
|
+
{sidebar === "left" && contentSidebarElem}
|
|
290
294
|
|
|
291
|
-
|
|
295
|
+
{contentPrimaryElem}
|
|
292
296
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
297
|
+
{sidebar === "right" && contentSidebarElem}
|
|
298
|
+
</TemplateContent>
|
|
299
|
+
{footer && (
|
|
300
|
+
<TemplateFooter renderFooterElement={renderFooterElement}>
|
|
301
|
+
{footer}
|
|
302
|
+
</TemplateFooter>
|
|
303
|
+
)}
|
|
304
|
+
</Template>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
);
|
|
303
308
|
|
|
304
309
|
export {
|
|
305
|
-
TemplateAppContainer,
|
|
306
310
|
Template,
|
|
307
311
|
TemplateAboveHeader,
|
|
308
312
|
TemplateHeader,
|
|
@@ -313,3 +317,4 @@ export {
|
|
|
313
317
|
TemplateContentSidebar,
|
|
314
318
|
TemplateFooter,
|
|
315
319
|
};
|
|
320
|
+
export default TemplateAppContainer;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
className="css-
|
|
5
|
+
className="css-1xdhyk6"
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
8
8
|
className="css-0"
|
|
9
9
|
>
|
|
10
10
|
<div
|
|
11
|
-
className="placeholder placeholder
|
|
11
|
+
className="placeholder placeholder--short"
|
|
12
12
|
>
|
|
13
13
|
Above Header
|
|
14
14
|
</div>
|
|
@@ -17,7 +17,7 @@ exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
|
17
17
|
className="css-0"
|
|
18
18
|
>
|
|
19
19
|
<div
|
|
20
|
-
className="placeholder placeholder
|
|
20
|
+
className="placeholder placeholder--short"
|
|
21
21
|
>
|
|
22
22
|
NYPL Header
|
|
23
23
|
</div>
|
|
@@ -25,12 +25,12 @@ exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
|
25
25
|
className="css-0"
|
|
26
26
|
>
|
|
27
27
|
<div
|
|
28
|
-
className="placeholder placeholder
|
|
28
|
+
className="placeholder placeholder--short"
|
|
29
29
|
>
|
|
30
30
|
Breadcrumbs
|
|
31
31
|
</div>
|
|
32
32
|
<div
|
|
33
|
-
className="placeholder placeholder
|
|
33
|
+
className="placeholder placeholder--short"
|
|
34
34
|
>
|
|
35
35
|
Hero
|
|
36
36
|
</div>
|
|
@@ -44,7 +44,7 @@ exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
|
44
44
|
className="css-0"
|
|
45
45
|
>
|
|
46
46
|
<div
|
|
47
|
-
className="placeholder placeholder
|
|
47
|
+
className="placeholder placeholder--undefined"
|
|
48
48
|
>
|
|
49
49
|
Content Top
|
|
50
50
|
</div>
|
|
@@ -53,7 +53,7 @@ exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
|
53
53
|
className="css-0"
|
|
54
54
|
>
|
|
55
55
|
<div
|
|
56
|
-
className="placeholder placeholder
|
|
56
|
+
className="placeholder placeholder--undefined"
|
|
57
57
|
>
|
|
58
58
|
Left Sidebar
|
|
59
59
|
</div>
|
|
@@ -62,12 +62,12 @@ exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
|
62
62
|
className="css-0"
|
|
63
63
|
>
|
|
64
64
|
<div
|
|
65
|
-
className="placeholder placeholder
|
|
65
|
+
className="placeholder placeholder--undefined"
|
|
66
66
|
>
|
|
67
67
|
Main Content
|
|
68
68
|
</div>
|
|
69
69
|
<div
|
|
70
|
-
className="placeholder placeholder
|
|
70
|
+
className="placeholder placeholder--short"
|
|
71
71
|
>
|
|
72
72
|
More Content
|
|
73
73
|
</div>
|
|
@@ -77,7 +77,7 @@ exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
|
77
77
|
className="css-0"
|
|
78
78
|
>
|
|
79
79
|
<div
|
|
80
|
-
className="placeholder placeholder
|
|
80
|
+
className="placeholder placeholder--short"
|
|
81
81
|
>
|
|
82
82
|
Footer
|
|
83
83
|
</div>
|
|
@@ -87,13 +87,13 @@ exports[`Template components renders the UI snapshot correctly 1`] = `
|
|
|
87
87
|
|
|
88
88
|
exports[`Template components renders the UI snapshot correctly 2`] = `
|
|
89
89
|
<div
|
|
90
|
-
className="css-
|
|
90
|
+
className="css-1u8qly9"
|
|
91
91
|
>
|
|
92
92
|
<div
|
|
93
93
|
className="css-0"
|
|
94
94
|
>
|
|
95
95
|
<div
|
|
96
|
-
className="placeholder placeholder
|
|
96
|
+
className="placeholder placeholder--short"
|
|
97
97
|
>
|
|
98
98
|
Above Header
|
|
99
99
|
</div>
|
|
@@ -102,7 +102,7 @@ exports[`Template components renders the UI snapshot correctly 2`] = `
|
|
|
102
102
|
className="css-0"
|
|
103
103
|
>
|
|
104
104
|
<div
|
|
105
|
-
className="placeholder placeholder
|
|
105
|
+
className="placeholder placeholder--short"
|
|
106
106
|
>
|
|
107
107
|
NYPL Header
|
|
108
108
|
</div>
|
|
@@ -110,12 +110,12 @@ exports[`Template components renders the UI snapshot correctly 2`] = `
|
|
|
110
110
|
className="css-0"
|
|
111
111
|
>
|
|
112
112
|
<div
|
|
113
|
-
className="placeholder placeholder
|
|
113
|
+
className="placeholder placeholder--short"
|
|
114
114
|
>
|
|
115
115
|
Breadcrumbs
|
|
116
116
|
</div>
|
|
117
117
|
<div
|
|
118
|
-
className="placeholder placeholder
|
|
118
|
+
className="placeholder placeholder--short"
|
|
119
119
|
>
|
|
120
120
|
Hero
|
|
121
121
|
</div>
|
|
@@ -129,7 +129,7 @@ exports[`Template components renders the UI snapshot correctly 2`] = `
|
|
|
129
129
|
className="css-0"
|
|
130
130
|
>
|
|
131
131
|
<div
|
|
132
|
-
className="placeholder placeholder
|
|
132
|
+
className="placeholder placeholder--undefined"
|
|
133
133
|
>
|
|
134
134
|
Content Top
|
|
135
135
|
</div>
|
|
@@ -138,7 +138,7 @@ exports[`Template components renders the UI snapshot correctly 2`] = `
|
|
|
138
138
|
className="css-0"
|
|
139
139
|
>
|
|
140
140
|
<div
|
|
141
|
-
className="placeholder placeholder
|
|
141
|
+
className="placeholder placeholder--undefined"
|
|
142
142
|
>
|
|
143
143
|
Left Sidebar
|
|
144
144
|
</div>
|
|
@@ -147,12 +147,12 @@ exports[`Template components renders the UI snapshot correctly 2`] = `
|
|
|
147
147
|
className="css-0"
|
|
148
148
|
>
|
|
149
149
|
<div
|
|
150
|
-
className="placeholder placeholder
|
|
150
|
+
className="placeholder placeholder--undefined"
|
|
151
151
|
>
|
|
152
152
|
Main Content
|
|
153
153
|
</div>
|
|
154
154
|
<div
|
|
155
|
-
className="placeholder placeholder
|
|
155
|
+
className="placeholder placeholder--short"
|
|
156
156
|
>
|
|
157
157
|
More Content
|
|
158
158
|
</div>
|
|
@@ -162,7 +162,178 @@ exports[`Template components renders the UI snapshot correctly 2`] = `
|
|
|
162
162
|
className="css-0"
|
|
163
163
|
>
|
|
164
164
|
<div
|
|
165
|
-
className="placeholder placeholder
|
|
165
|
+
className="placeholder placeholder--short"
|
|
166
|
+
>
|
|
167
|
+
Footer
|
|
168
|
+
</div>
|
|
169
|
+
</footer>
|
|
170
|
+
</div>
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
exports[`Template components renders the UI snapshot correctly 3`] = `
|
|
174
|
+
<div
|
|
175
|
+
className="css-1y4kn3e"
|
|
176
|
+
>
|
|
177
|
+
<div
|
|
178
|
+
className="css-0"
|
|
179
|
+
>
|
|
180
|
+
<div
|
|
181
|
+
className="placeholder placeholder--short"
|
|
182
|
+
>
|
|
183
|
+
Above Header
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
<header
|
|
187
|
+
className="css-0"
|
|
188
|
+
>
|
|
189
|
+
<div
|
|
190
|
+
className="placeholder placeholder--short"
|
|
191
|
+
>
|
|
192
|
+
NYPL Header
|
|
193
|
+
</div>
|
|
194
|
+
<div
|
|
195
|
+
className="css-0"
|
|
196
|
+
>
|
|
197
|
+
<div
|
|
198
|
+
className="placeholder placeholder--short"
|
|
199
|
+
>
|
|
200
|
+
Breadcrumbs
|
|
201
|
+
</div>
|
|
202
|
+
<div
|
|
203
|
+
className="placeholder placeholder--short"
|
|
204
|
+
>
|
|
205
|
+
Hero
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</header>
|
|
209
|
+
<main
|
|
210
|
+
className="css-0"
|
|
211
|
+
id="mainContent"
|
|
212
|
+
>
|
|
213
|
+
<div
|
|
214
|
+
className="css-0"
|
|
215
|
+
>
|
|
216
|
+
<div
|
|
217
|
+
className="placeholder placeholder--undefined"
|
|
218
|
+
>
|
|
219
|
+
Content Top
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
<div
|
|
223
|
+
className="css-0"
|
|
224
|
+
>
|
|
225
|
+
<div
|
|
226
|
+
className="placeholder placeholder--undefined"
|
|
227
|
+
>
|
|
228
|
+
Left Sidebar
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
<div
|
|
232
|
+
className="css-0"
|
|
233
|
+
>
|
|
234
|
+
<div
|
|
235
|
+
className="placeholder placeholder--undefined"
|
|
236
|
+
>
|
|
237
|
+
Main Content
|
|
238
|
+
</div>
|
|
239
|
+
<div
|
|
240
|
+
className="placeholder placeholder--short"
|
|
241
|
+
>
|
|
242
|
+
More Content
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
</main>
|
|
246
|
+
<footer
|
|
247
|
+
className="css-0"
|
|
248
|
+
>
|
|
249
|
+
<div
|
|
250
|
+
className="placeholder placeholder--short"
|
|
251
|
+
>
|
|
252
|
+
Footer
|
|
253
|
+
</div>
|
|
254
|
+
</footer>
|
|
255
|
+
</div>
|
|
256
|
+
`;
|
|
257
|
+
|
|
258
|
+
exports[`Template components renders the UI snapshot correctly 4`] = `
|
|
259
|
+
<div
|
|
260
|
+
className="css-1u8qly9"
|
|
261
|
+
data-testid="props"
|
|
262
|
+
>
|
|
263
|
+
<div
|
|
264
|
+
className="css-0"
|
|
265
|
+
>
|
|
266
|
+
<div
|
|
267
|
+
className="placeholder placeholder--short"
|
|
268
|
+
>
|
|
269
|
+
Above Header
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
<header
|
|
273
|
+
className="css-0"
|
|
274
|
+
>
|
|
275
|
+
<div
|
|
276
|
+
className="placeholder placeholder--short"
|
|
277
|
+
>
|
|
278
|
+
NYPL Header
|
|
279
|
+
</div>
|
|
280
|
+
<div
|
|
281
|
+
className="css-0"
|
|
282
|
+
>
|
|
283
|
+
<div
|
|
284
|
+
className="placeholder placeholder--short"
|
|
285
|
+
>
|
|
286
|
+
Breadcrumbs
|
|
287
|
+
</div>
|
|
288
|
+
<div
|
|
289
|
+
className="placeholder placeholder--short"
|
|
290
|
+
>
|
|
291
|
+
Hero
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</header>
|
|
295
|
+
<main
|
|
296
|
+
className="css-0"
|
|
297
|
+
id="mainContent"
|
|
298
|
+
>
|
|
299
|
+
<div
|
|
300
|
+
className="css-0"
|
|
301
|
+
>
|
|
302
|
+
<div
|
|
303
|
+
className="placeholder placeholder--undefined"
|
|
304
|
+
>
|
|
305
|
+
Content Top
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
<div
|
|
309
|
+
className="css-0"
|
|
310
|
+
>
|
|
311
|
+
<div
|
|
312
|
+
className="placeholder placeholder--undefined"
|
|
313
|
+
>
|
|
314
|
+
Left Sidebar
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
<div
|
|
318
|
+
className="css-0"
|
|
319
|
+
>
|
|
320
|
+
<div
|
|
321
|
+
className="placeholder placeholder--undefined"
|
|
322
|
+
>
|
|
323
|
+
Main Content
|
|
324
|
+
</div>
|
|
325
|
+
<div
|
|
326
|
+
className="placeholder placeholder--short"
|
|
327
|
+
>
|
|
328
|
+
More Content
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</main>
|
|
332
|
+
<footer
|
|
333
|
+
className="css-0"
|
|
334
|
+
>
|
|
335
|
+
<div
|
|
336
|
+
className="placeholder placeholder--short"
|
|
166
337
|
>
|
|
167
338
|
Footer
|
|
168
339
|
</div>
|
|
@@ -42,13 +42,23 @@ export const enumValues = getStorybookEnumValues(TextSizes, "TextSizes");
|
|
|
42
42
|
| Component Version | DS Version |
|
|
43
43
|
| ----------------- | ---------- |
|
|
44
44
|
| Added | `0.25.1` |
|
|
45
|
-
| Latest | `0.
|
|
45
|
+
| Latest | `0.26.0` |
|
|
46
|
+
|
|
47
|
+
## Table of Contents
|
|
48
|
+
|
|
49
|
+
- [Overview](#overview)
|
|
50
|
+
- [Component Props](#component-props)
|
|
51
|
+
- [Accessibility](#accessibility)
|
|
52
|
+
|
|
53
|
+
## Overview
|
|
46
54
|
|
|
47
55
|
<Description of={Text} />
|
|
48
56
|
|
|
49
57
|
The `Text` component renders a basic `<p>` element. As its name indicates, the
|
|
50
58
|
`size` prop controls the size of the text rendered in the component.
|
|
51
59
|
|
|
60
|
+
## Component Props
|
|
61
|
+
|
|
52
62
|
<Canvas withToolbar>
|
|
53
63
|
<Story
|
|
54
64
|
name="Text"
|
|
@@ -88,3 +98,12 @@ The `Text` component renders a basic `<p>` element. As its name indicates, the
|
|
|
88
98
|
</Canvas>
|
|
89
99
|
|
|
90
100
|
<ArgsTable story="Text" />
|
|
101
|
+
|
|
102
|
+
## Accessibility
|
|
103
|
+
|
|
104
|
+
The `Text` component renders paragraph `p` HTML elements which are inherently
|
|
105
|
+
accessible and will be read by screen readers.
|
|
106
|
+
|
|
107
|
+
Resources:
|
|
108
|
+
|
|
109
|
+
- [Chakra UI Text](https://chakra-ui.com/docs/components/typography/text)
|
|
@@ -45,10 +45,22 @@ describe("Text", () => {
|
|
|
45
45
|
const mini = renderer
|
|
46
46
|
.create(<Text size={TextSizes.Mini}>Animal Crossing is all that!</Text>)
|
|
47
47
|
.toJSON();
|
|
48
|
+
const withChakraProps = renderer
|
|
49
|
+
.create(
|
|
50
|
+
<Text p="20px" color="ui.error.primary">
|
|
51
|
+
Animal Crossing is all that!
|
|
52
|
+
</Text>
|
|
53
|
+
)
|
|
54
|
+
.toJSON();
|
|
55
|
+
const withOtherProps = renderer
|
|
56
|
+
.create(<Text data-testid="props">Animal Crossing is all that!</Text>)
|
|
57
|
+
.toJSON();
|
|
48
58
|
|
|
49
59
|
expect(defaultText).toMatchSnapshot();
|
|
50
60
|
expect(caption).toMatchSnapshot();
|
|
51
61
|
expect(tag).toMatchSnapshot();
|
|
52
62
|
expect(mini).toMatchSnapshot();
|
|
63
|
+
expect(withChakraProps).toMatchSnapshot();
|
|
64
|
+
expect(withOtherProps).toMatchSnapshot();
|
|
53
65
|
});
|
|
54
66
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Text as ChakraText, chakra, useStyleConfig } from "@chakra-ui/react";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
+
|
|
3
4
|
import { TextSizes } from "./TextTypes";
|
|
4
5
|
import { getVariant } from "../../utils/utils";
|
|
5
6
|
|
|
@@ -16,7 +17,7 @@ export interface TextProps {
|
|
|
16
17
|
size?: TextSizes;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
export const Text = chakra((props: React.PropsWithChildren<TextProps>) => {
|
|
20
21
|
const {
|
|
21
22
|
children,
|
|
22
23
|
className = "",
|
|
@@ -24,6 +25,7 @@ function Text(props: React.PropsWithChildren<TextProps>) {
|
|
|
24
25
|
isItalic,
|
|
25
26
|
noSpace,
|
|
26
27
|
size = TextSizes.Default,
|
|
28
|
+
...rest
|
|
27
29
|
} = props;
|
|
28
30
|
const variant = getVariant(size, TextSizes, TextSizes.Default);
|
|
29
31
|
const styles = useStyleConfig("Text", {
|
|
@@ -41,10 +43,10 @@ function Text(props: React.PropsWithChildren<TextProps>) {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
return (
|
|
44
|
-
<ChakraText className={className} sx={styles}>
|
|
46
|
+
<ChakraText className={className} sx={styles} {...rest}>
|
|
45
47
|
{children}
|
|
46
48
|
</ChakraText>
|
|
47
49
|
);
|
|
48
|
-
}
|
|
50
|
+
});
|
|
49
51
|
|
|
50
52
|
export default Text;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Text renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<p
|
|
5
|
-
className="chakra-text css-
|
|
5
|
+
className="chakra-text css-1xdhyk6"
|
|
6
6
|
>
|
|
7
7
|
Animal Crossing is all that!
|
|
8
8
|
</p>
|
|
@@ -10,7 +10,7 @@ exports[`Text renders the UI snapshot correctly 1`] = `
|
|
|
10
10
|
|
|
11
11
|
exports[`Text renders the UI snapshot correctly 2`] = `
|
|
12
12
|
<p
|
|
13
|
-
className="chakra-text css-
|
|
13
|
+
className="chakra-text css-1xdhyk6"
|
|
14
14
|
>
|
|
15
15
|
Animal Crossing is all that!
|
|
16
16
|
</p>
|
|
@@ -18,7 +18,7 @@ exports[`Text renders the UI snapshot correctly 2`] = `
|
|
|
18
18
|
|
|
19
19
|
exports[`Text renders the UI snapshot correctly 3`] = `
|
|
20
20
|
<p
|
|
21
|
-
className="chakra-text css-
|
|
21
|
+
className="chakra-text css-1xdhyk6"
|
|
22
22
|
>
|
|
23
23
|
Animal Crossing is all that!
|
|
24
24
|
</p>
|
|
@@ -26,7 +26,24 @@ exports[`Text renders the UI snapshot correctly 3`] = `
|
|
|
26
26
|
|
|
27
27
|
exports[`Text renders the UI snapshot correctly 4`] = `
|
|
28
28
|
<p
|
|
29
|
-
className="chakra-text css-
|
|
29
|
+
className="chakra-text css-1xdhyk6"
|
|
30
|
+
>
|
|
31
|
+
Animal Crossing is all that!
|
|
32
|
+
</p>
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
exports[`Text renders the UI snapshot correctly 5`] = `
|
|
36
|
+
<p
|
|
37
|
+
className="chakra-text css-kle7zy"
|
|
38
|
+
>
|
|
39
|
+
Animal Crossing is all that!
|
|
40
|
+
</p>
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
exports[`Text renders the UI snapshot correctly 6`] = `
|
|
44
|
+
<p
|
|
45
|
+
className="chakra-text css-1xdhyk6"
|
|
46
|
+
data-testid="props"
|
|
30
47
|
>
|
|
31
48
|
Animal Crossing is all that!
|
|
32
49
|
</p>
|