@nypl/design-system-react-components 0.23.4 → 0.25.1
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 +98 -1
- package/README.md +46 -11
- package/dist/components/Accordion/Accordion.d.ts +14 -14
- package/dist/components/Autosuggest/Autosuggest.stories.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
- package/dist/components/Button/Button.d.ts +6 -13
- package/dist/components/Button/ButtonTypes.d.ts +5 -3
- package/dist/components/Card/Card.d.ts +59 -10
- package/dist/components/Card/CardTypes.d.ts +19 -0
- package/dist/components/CardEdition/CardEdition.d.ts +21 -0
- package/dist/components/{StyleGuide/Colors.stories.d.ts → CardEdition/CardEdition.stories.d.ts} +5 -2
- package/dist/components/Checkbox/Checkbox.d.ts +21 -16
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +43 -0
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts +79 -0
- package/dist/components/DatePicker/DatePickerTypes.d.ts +5 -0
- package/dist/components/Form/Form.d.ts +16 -8
- package/dist/components/Form/FormTypes.d.ts +2 -0
- package/dist/components/Grid/GridTypes.d.ts +9 -0
- package/dist/components/Grid/SimpleGrid.d.ts +14 -0
- package/dist/components/Heading/Heading.d.ts +9 -11
- package/dist/components/Heading/{HeadingDisplaySizes.d.ts → HeadingTypes.d.ts} +8 -0
- package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +2 -1
- package/dist/components/Hero/Hero.d.ts +19 -14
- package/dist/components/Hero/HeroTypes.d.ts +10 -5
- package/dist/components/Icons/Icon.d.ts +13 -16
- package/dist/components/Icons/IconSvgs.d.ts +4 -0
- package/dist/components/Icons/IconTypes.d.ts +78 -60
- package/dist/components/Image/Image.stories.d.ts +2 -1
- package/dist/components/Label/Label.d.ts +10 -26
- package/dist/components/Link/Link.d.ts +8 -12
- package/dist/components/List/List.stories.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +30 -24
- package/dist/components/RadioGroup/RadioGroup.d.ts +40 -0
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +4 -0
- package/dist/components/SearchBar/SearchBar.d.ts +45 -27
- package/dist/components/Select/Select.d.ts +34 -35
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +1 -1
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
- package/dist/components/Tabs/Tabs.d.ts +25 -0
- package/dist/components/Template/Template.d.ts +91 -0
- package/dist/components/Text/Text.d.ts +16 -0
- package/dist/components/Text/TextTypes.d.ts +6 -0
- package/dist/components/TextInput/TextInput.d.ts +37 -30
- package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
- package/dist/design-system-react-components.cjs.development.js +4102 -917
- 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 +4023 -920
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/resources.scss +133 -24
- package/dist/styles.css +1 -1
- package/dist/theme/components/accordion.d.ts +25 -0
- package/dist/theme/components/breadcrumb.d.ts +90 -0
- package/dist/theme/components/button.d.ts +109 -0
- package/dist/theme/components/checkbox.d.ts +91 -0
- package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
- package/dist/theme/components/customRadioGroup.d.ts +18 -0
- package/dist/theme/components/global.d.ts +55 -0
- package/dist/theme/components/globalMixins.d.ts +15 -0
- package/dist/theme/components/heading.d.ts +110 -0
- package/dist/theme/components/hero.d.ts +492 -0
- package/dist/theme/components/icon.d.ts +13 -0
- package/dist/theme/components/label.d.ts +16 -0
- package/dist/theme/components/link.d.ts +45 -0
- package/dist/theme/components/radio.d.ts +95 -0
- package/dist/theme/components/searchBar.d.ts +20 -0
- package/dist/theme/components/select.d.ts +58 -0
- package/dist/theme/components/statusBadge.d.ts +25 -0
- package/dist/theme/components/tabs.d.ts +85 -0
- package/dist/theme/components/template.d.ts +105 -0
- package/dist/theme/components/text.d.ts +20 -0
- package/dist/theme/components/textInput.d.ts +105 -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 +23 -0
- package/dist/theme/foundations/shadows.d.ts +4 -0
- package/dist/theme/foundations/spacing.d.ts +77 -0
- package/dist/theme/foundations/typography.d.ts +8 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/provider.d.ts +5 -0
- package/dist/theme/types.d.ts +1 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +9 -2
- package/src/components/Accordion/Accordion.stories.mdx +233 -33
- package/src/components/Accordion/Accordion.test.tsx +135 -19
- package/src/components/Accordion/Accordion.tsx +81 -56
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
- package/src/components/Autosuggest/_Autosuggest.scss +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +57 -56
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +31 -25
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -73
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +100 -0
- package/src/components/Button/Button.stories.mdx +125 -138
- package/src/components/Button/Button.test.tsx +65 -11
- package/src/components/Button/Button.tsx +72 -68
- package/src/components/Button/ButtonTypes.tsx +4 -2
- package/src/components/Button/_Button.scss +7 -92
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +58 -3
- package/src/components/Card/Card.stories.mdx +694 -0
- package/src/components/Card/Card.test.tsx +97 -102
- package/src/components/Card/Card.tsx +182 -31
- package/src/components/Card/CardTypes.tsx +21 -0
- package/src/components/Card/_Card.scss +234 -49
- package/src/components/{Card/Card.stories.tsx → CardEdition/CardEdition.stories.tsx} +32 -22
- package/src/components/CardEdition/CardEdition.test.tsx +395 -0
- package/src/components/CardEdition/CardEdition.tsx +60 -0
- package/src/components/CardEdition/_CardEdition.scss +138 -0
- package/src/components/Chakra/Box.stories.mdx +57 -0
- package/src/components/Chakra/Center.stories.mdx +99 -0
- package/src/components/Chakra/Grid.stories.mdx +79 -0
- package/src/components/Chakra/Stack.stories.mdx +93 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +57 -35
- package/src/components/Checkbox/Checkbox.test.tsx +117 -147
- package/src/components/Checkbox/Checkbox.tsx +76 -50
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +325 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +249 -0
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +345 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +148 -0
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1360 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +284 -0
- package/src/components/DatePicker/DatePicker.test.tsx +657 -0
- package/src/components/DatePicker/DatePicker.tsx +396 -0
- package/src/components/DatePicker/DatePickerTypes.tsx +5 -0
- package/src/components/DatePicker/_DatePicker.scss +76 -0
- package/src/components/Form/Form.stories.mdx +130 -27
- package/src/components/Form/Form.test.tsx +78 -36
- package/src/components/Form/Form.tsx +53 -19
- package/src/components/Form/FormTypes.tsx +3 -0
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +38 -0
- package/src/components/Grid/GridTypes.tsx +9 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +275 -0
- package/src/components/Grid/SimpleGrid.test.tsx +66 -0
- package/src/components/Grid/SimpleGrid.tsx +37 -0
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
- package/src/components/Heading/Heading.stories.mdx +63 -33
- package/src/components/Heading/Heading.test.tsx +24 -16
- package/src/components/Heading/Heading.tsx +54 -38
- package/src/components/Heading/{HeadingDisplaySizes.tsx → HeadingTypes.tsx} +9 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.tsx +2 -1
- package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
- package/src/components/Hero/Hero.stories.mdx +195 -85
- package/src/components/Hero/Hero.test.tsx +544 -113
- package/src/components/Hero/Hero.tsx +80 -93
- package/src/components/Hero/HeroTypes.tsx +17 -5
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -1
- package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
- package/src/components/Icons/Icon.stories.mdx +89 -74
- package/src/components/Icons/Icon.test.tsx +30 -22
- package/src/components/Icons/Icon.tsx +63 -61
- package/src/components/Icons/IconSvgs.tsx +8 -0
- package/src/components/Icons/IconTypes.tsx +80 -60
- package/src/components/Image/Image.stories.tsx +2 -1
- package/src/components/Input/_Input.scss +2 -2
- package/src/components/Label/Label.stories.mdx +77 -0
- package/src/components/Label/Label.test.tsx +43 -12
- package/src/components/Label/Label.tsx +28 -45
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
- package/src/components/Link/Link.stories.mdx +47 -41
- package/src/components/Link/Link.test.tsx +33 -44
- package/src/components/Link/Link.tsx +114 -100
- package/src/components/List/List.stories.mdx +7 -3
- package/src/components/List/List.stories.tsx +14 -9
- package/src/components/List/List.test.tsx +12 -8
- package/src/components/List/List.tsx +9 -7
- package/src/components/List/_List.scss +3 -3
- package/src/components/Modal/Modal.stories.mdx +7 -3
- package/src/components/Modal/_Modal.scss +1 -1
- package/src/components/Notification/Notification.stories.mdx +99 -65
- package/src/components/Notification/Notification.test.tsx +3 -16
- package/src/components/Notification/Notification.tsx +12 -12
- package/src/components/Notification/_Notification.scss +5 -4
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +1 -1
- package/src/components/Pagination/Pagination.stories.mdx +7 -1
- package/src/components/Pagination/Pagination.test.tsx +16 -10
- package/src/components/Radio/Radio.stories.mdx +57 -46
- package/src/components/Radio/Radio.test.tsx +92 -138
- package/src/components/Radio/Radio.tsx +70 -69
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +250 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +247 -0
- package/src/components/RadioGroup/RadioGroup.test.tsx +327 -0
- package/src/components/RadioGroup/RadioGroup.tsx +154 -0
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +4 -0
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1101 -0
- package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
- package/src/components/SearchBar/SearchBar.stories.mdx +196 -224
- package/src/components/SearchBar/SearchBar.tsx +151 -46
- package/src/components/Select/Select.stories.mdx +193 -168
- package/src/components/Select/Select.test.tsx +129 -324
- package/src/components/Select/Select.tsx +120 -160
- package/src/components/Select/SelectTypes.tsx +4 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +18 -29
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -7
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +4 -2
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +3 -3
- package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
- package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
- package/src/components/StatusBadge/StatusBadge.tsx +24 -25
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +112 -90
- package/src/components/StyleGuide/Buttons.stories.mdx +98 -100
- package/src/components/StyleGuide/Colors.stories.mdx +336 -0
- package/src/components/StyleGuide/Forms.stories.mdx +85 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +86 -93
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +164 -166
- package/src/components/StyleGuide/UIDocCard.tsx +4 -4
- package/src/components/Tabs/Tabs.stories.mdx +221 -0
- package/src/components/Tabs/Tabs.test.tsx +264 -0
- package/src/components/Tabs/Tabs.tsx +220 -0
- package/src/components/Template/Template.stories.mdx +574 -0
- package/src/components/Template/Template.test.tsx +124 -0
- package/src/components/Template/Template.tsx +226 -0
- package/src/components/Text/Text.stories.mdx +70 -0
- package/src/components/Text/Text.test.tsx +63 -0
- package/src/components/Text/Text.tsx +55 -0
- package/src/components/Text/TextTypes.tsx +6 -0
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
- package/src/components/TextInput/TextInput.stories.mdx +90 -90
- package/src/components/TextInput/TextInput.test.tsx +103 -83
- package/src/components/TextInput/TextInput.tsx +108 -91
- package/src/components/TextInput/TextInputTypes.tsx +6 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
- package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
- package/src/docs/Chakra.stories.mdx +341 -0
- package/src/docs/Intro.stories.mdx +31 -24
- package/src/index.ts +70 -5
- package/src/styles/01-colors/_colors-brand.scss +6 -4
- package/src/styles/01-colors/_colors-utility.scss +14 -15
- package/src/styles/03-space/_space-inline.scss +47 -7
- package/src/styles/03-space/_space-inset.scss +33 -5
- package/src/styles/03-space/_space-stack.scss +48 -8
- package/src/styles/base/_02-breakpoints.scss +5 -4
- package/src/styles/base/_04-base.scss +2 -1
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles/base/_typography.scss +1 -29
- package/src/styles.scss +22 -25
- package/src/theme/components/accordion.ts +30 -0
- package/src/theme/components/breadcrumb.ts +77 -0
- package/src/theme/components/button.ts +125 -0
- package/src/theme/components/checkbox.ts +107 -0
- package/src/theme/components/customCheckboxGroup.ts +12 -0
- package/src/theme/components/customRadioGroup.ts +12 -0
- package/src/theme/components/global.ts +71 -0
- package/src/theme/components/globalMixins.ts +16 -0
- package/src/theme/components/heading.ts +72 -0
- package/src/theme/components/hero.ts +239 -0
- package/src/theme/components/icon.ts +79 -0
- package/src/theme/components/label.ts +17 -0
- package/src/theme/components/link.ts +47 -0
- package/src/theme/components/radio.ts +106 -0
- package/src/theme/components/searchBar.ts +21 -0
- package/src/theme/components/select.ts +50 -0
- package/src/theme/components/statusBadge.ts +27 -0
- package/src/theme/components/tabs.ts +79 -0
- package/src/theme/components/template.ts +114 -0
- package/src/theme/components/text.ts +31 -0
- package/src/theme/components/textInput.ts +61 -0
- package/src/theme/foundations/breakpoints.ts +24 -0
- package/src/theme/foundations/colors.ts +208 -0
- package/src/theme/foundations/global.ts +26 -0
- package/src/theme/foundations/shadows.ts +5 -0
- package/src/theme/foundations/spacing.ts +85 -0
- package/src/theme/foundations/typography.ts +35 -0
- package/src/theme/index.ts +88 -0
- package/src/theme/provider.tsx +9 -0
- package/src/theme/types.ts +1 -0
- package/src/utils/componentCategories.ts +56 -21
- package/src/utils/utils.ts +13 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -5
- package/dist/components/Card/Card.stories.d.ts +0 -27
- package/dist/components/Label/Label.stories.d.ts +0 -12
- package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
- package/dist/components/Template/Template.stories.d.ts +0 -29
- package/src/components/Accordion/Accordion.stories.tsx +0 -65
- package/src/components/Accordion/_Accordion.scss +0 -81
- package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
- package/src/components/Checkbox/_Checkbox.scss +0 -97
- package/src/components/Form/_Form.scss +0 -28
- package/src/components/Heading/_Heading.scss +0 -163
- package/src/components/Hero/_Hero.scss +0 -256
- package/src/components/Icons/_Icons.scss +0 -116
- package/src/components/Label/Label.stories.tsx +0 -30
- package/src/components/Label/_Label.scss +0 -22
- package/src/components/Link/_Link.scss +0 -73
- package/src/components/Radio/_Radio.scss +0 -84
- package/src/components/SearchBar/_SearchBar.scss +0 -16
- package/src/components/Select/_Select.scss +0 -82
- package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -33
- package/src/components/StatusBadge/_StatusBadge.scss +0 -23
- package/src/components/StyleGuide/Colors.stories.tsx +0 -288
- package/src/components/Template/Template.stories.tsx +0 -85
- package/src/components/Template/_Template.scss +0 -63
- package/src/components/TextInput/_TextInput.scss +0 -59
|
@@ -10,7 +10,7 @@ import { withDesign } from "storybook-addon-designs";
|
|
|
10
10
|
|
|
11
11
|
import { getCategory } from "../../utils/componentCategories";
|
|
12
12
|
import Heading from "../Heading/Heading";
|
|
13
|
-
import { HeadingDisplaySizes } from "../Heading/
|
|
13
|
+
import { HeadingDisplaySizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
14
14
|
import List from "../List/List";
|
|
15
15
|
|
|
16
16
|
<Meta
|
|
@@ -31,6 +31,16 @@ Consuming applications should utilize the DS standard text components as much as
|
|
|
31
31
|
|
|
32
32
|
The sizing of all text elements in the Design System is based on `1rem` being equal to `16px`.
|
|
33
33
|
|
|
34
|
+
## Style Guide Topics
|
|
35
|
+
|
|
36
|
+
- [Standard Text Component](#standard-text-components)
|
|
37
|
+
- [Font Family](#font-family)
|
|
38
|
+
- [Font Color](#font-color)
|
|
39
|
+
- [Font Weight](#font-weight)
|
|
40
|
+
- [Font Sizes](#font-sizes)
|
|
41
|
+
- [Text Case](#text-case)
|
|
42
|
+
- [Character Count](#character-count)
|
|
43
|
+
|
|
34
44
|
## Standard Text Components
|
|
35
45
|
|
|
36
46
|
### Headings
|
|
@@ -38,19 +48,19 @@ The sizing of all text elements in the Design System is based on `1rem` being eq
|
|
|
38
48
|
Use the NYPL Design System [Heading](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/heading--basic) component to render a standard HTML `<h>` tag. The `level` prop can be used to set the specific `<h>` tag that you require.
|
|
39
49
|
|
|
40
50
|
<Preview>
|
|
41
|
-
|
|
42
|
-
<Heading level={
|
|
43
|
-
<Heading level={
|
|
44
|
-
<Heading level={
|
|
45
|
-
<Heading level={
|
|
46
|
-
|
|
51
|
+
<>
|
|
52
|
+
<Heading level={HeadingLevels.One}>Heading Level 1</Heading>
|
|
53
|
+
<Heading level={HeadingLevels.Two}>Heading Level 2</Heading>
|
|
54
|
+
<Heading level={HeadingLevels.Three}>Heading Level 3</Heading>
|
|
55
|
+
<Heading level={HeadingLevels.Four}>Heading Level 4</Heading>
|
|
56
|
+
</>
|
|
47
57
|
</Preview>
|
|
48
58
|
|
|
49
59
|
#### Heading Display Sizes
|
|
50
60
|
|
|
51
61
|
Each heading level has a default style and size, but those styles can be overridden using the `displaySize` prop. The display sizes are separate from semantic elements and may be used to override the default size and styling of the semantic HTML heading elements. For example, the `h1` element has the `Primary` style applied by default, but a new style can be applied through the `displaySize` prop. Any `displaySize` style can be applied to any `Heading` element.
|
|
52
62
|
|
|
53
|
-
<Heading level={
|
|
63
|
+
<Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Primary}>
|
|
54
64
|
Primary Heading
|
|
55
65
|
</Heading>
|
|
56
66
|
|
|
@@ -60,7 +70,7 @@ Each heading level has a default style and size, but those styles can be overrid
|
|
|
60
70
|
| `font-weight` | `300` | `--font-weight-light` |
|
|
61
71
|
| `line-height` | `1.1` | n/a |
|
|
62
72
|
|
|
63
|
-
<Heading level={
|
|
73
|
+
<Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Secondary}>
|
|
64
74
|
Secondary Heading
|
|
65
75
|
</Heading>
|
|
66
76
|
|
|
@@ -70,7 +80,7 @@ Each heading level has a default style and size, but those styles can be overrid
|
|
|
70
80
|
| `font-weight` | `500` | `--font-weight-medium` |
|
|
71
81
|
| `line-height` | `1.25` | n/a |
|
|
72
82
|
|
|
73
|
-
<Heading level={
|
|
83
|
+
<Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Tertiary}>
|
|
74
84
|
Tertiary Heading
|
|
75
85
|
</Heading>
|
|
76
86
|
|
|
@@ -80,7 +90,7 @@ Each heading level has a default style and size, but those styles can be overrid
|
|
|
80
90
|
| `font-weight` | `500` | `--font-weight-medium` |
|
|
81
91
|
| `line-height` | `1.25` | n/a |
|
|
82
92
|
|
|
83
|
-
<Heading level={
|
|
93
|
+
<Heading level={HeadingLevels.One} displaySize={HeadingDisplaySizes.Callout}>
|
|
84
94
|
Callout Heading
|
|
85
95
|
</Heading>
|
|
86
96
|
|
|
@@ -158,17 +168,15 @@ The `displaySize` prop can be used to render a specific style from the DS defaul
|
|
|
158
168
|
With website accessibility in mind, font choices for the DS were made with an eye toward clarity and readability. Headings and body content use the following font family assignment:
|
|
159
169
|
|
|
160
170
|
<Preview>
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
</p>
|
|
171
|
-
</Story>
|
|
171
|
+
<p
|
|
172
|
+
style={{
|
|
173
|
+
fontSize: "var(--font-size--0)",
|
|
174
|
+
fontWeight: "var(--font-weight-light)",
|
|
175
|
+
fontFamily: "var(--typeface-body)",
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
system-ui, sans-serif
|
|
179
|
+
</p>
|
|
172
180
|
</Preview>
|
|
173
181
|
|
|
174
182
|
The following CSS variables are available through the DS.
|
|
@@ -181,23 +189,21 @@ The following CSS variables are available through the DS.
|
|
|
181
189
|
> **RECOMMENDATIONS**
|
|
182
190
|
> When making font selections for project based components outside the DS, sans serif fonts display better on computers and mobile devices. Avoid decorative or overly stylized fonts, as they are often difficult to read even for users without visual impairments or reading Standard Text Default
|
|
183
191
|
|
|
184
|
-
## Font
|
|
192
|
+
## Font Color
|
|
185
193
|
|
|
186
194
|
All text within a project, unless specifically noted in mockups, should be black on a white background.
|
|
187
195
|
|
|
188
196
|
<Preview>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
</>
|
|
200
|
-
</Story>
|
|
197
|
+
<>
|
|
198
|
+
<Heading level={HeadingLevels.Three}>Default Heading Color</Heading>
|
|
199
|
+
<p>
|
|
200
|
+
This paragraph shows the default body text color. Curabitur blandit tempus
|
|
201
|
+
porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur
|
|
202
|
+
et. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
|
|
203
|
+
Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget
|
|
204
|
+
lacinia odio sem nec elit.
|
|
205
|
+
</p>
|
|
206
|
+
</>
|
|
201
207
|
</Preview>
|
|
202
208
|
|
|
203
209
|
In cases where specific colors must be applied to text elements, the DS provides CSS variables for the full NYPL color palette. Refer to the [Colors](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/style-guide-colors--colors-brand) section of the Style Guide for details.
|
|
@@ -207,46 +213,44 @@ In cases where specific colors must be applied to text elements, the DS provides
|
|
|
207
213
|
The DS uses four font weights to render text. The default font-weight is 300.
|
|
208
214
|
|
|
209
215
|
<Preview>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
</>
|
|
249
|
-
</Story>
|
|
216
|
+
<>
|
|
217
|
+
<p
|
|
218
|
+
style={{
|
|
219
|
+
fontSize: "1rem",
|
|
220
|
+
fontWeight: "var(--font-weight-light)",
|
|
221
|
+
fontFamily: "system-ui, sans-serif",
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
Light / 300
|
|
225
|
+
</p>
|
|
226
|
+
<p
|
|
227
|
+
style={{
|
|
228
|
+
fontSize: "1rem",
|
|
229
|
+
fontWeight: "var(--font-weight-regular)",
|
|
230
|
+
fontFamily: "system-ui, sans-serif",
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
Regular / 400
|
|
234
|
+
</p>
|
|
235
|
+
<p
|
|
236
|
+
style={{
|
|
237
|
+
fontSize: "1rem",
|
|
238
|
+
fontWeight: "var(--font-weight-medium)",
|
|
239
|
+
fontFamily: "system-ui, sans-serif",
|
|
240
|
+
}}
|
|
241
|
+
>
|
|
242
|
+
Medium / 500
|
|
243
|
+
</p>
|
|
244
|
+
<p
|
|
245
|
+
style={{
|
|
246
|
+
fontSize: "1rem",
|
|
247
|
+
fontWeight: "var(--font-weight-bold)",
|
|
248
|
+
fontFamily: "system-ui, sans-serif",
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
Bold / 700
|
|
252
|
+
</p>
|
|
253
|
+
</>
|
|
250
254
|
</Preview>
|
|
251
255
|
|
|
252
256
|
The following CSS variables are available through the DS.
|
|
@@ -258,87 +262,85 @@ The following CSS variables are available through the DS.
|
|
|
258
262
|
--font-weight-bold: 700;
|
|
259
263
|
```
|
|
260
264
|
|
|
261
|
-
## Font
|
|
265
|
+
## Font Sizes
|
|
262
266
|
|
|
263
267
|
Font sizing is based on a root font size of 16px (1rem = 16px).
|
|
264
268
|
|
|
265
269
|
<Preview>
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
</>
|
|
341
|
-
</Story>
|
|
270
|
+
<>
|
|
271
|
+
<p
|
|
272
|
+
style={{
|
|
273
|
+
fontSize: "var(--font-size--3)",
|
|
274
|
+
fontWeight: "var(--font-weight-light)",
|
|
275
|
+
fontFamily: "var(--typeface-body)",
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
Font size -3
|
|
279
|
+
</p>
|
|
280
|
+
<p
|
|
281
|
+
style={{
|
|
282
|
+
fontSize: "var(--font-size--2)",
|
|
283
|
+
fontWeight: "var(--font-weight-light)",
|
|
284
|
+
fontFamily: "var(--typeface-body)",
|
|
285
|
+
}}
|
|
286
|
+
>
|
|
287
|
+
Font size -2
|
|
288
|
+
</p>
|
|
289
|
+
<p
|
|
290
|
+
style={{
|
|
291
|
+
fontSize: "var(--font-size--1)",
|
|
292
|
+
fontWeight: "var(--font-weight-light)",
|
|
293
|
+
fontFamily: "var(--typeface-body)",
|
|
294
|
+
}}
|
|
295
|
+
>
|
|
296
|
+
Font size -1
|
|
297
|
+
</p>
|
|
298
|
+
<p
|
|
299
|
+
style={{
|
|
300
|
+
fontSize: "var(--font-size--0)",
|
|
301
|
+
fontWeight: "var(--font-weight-light)",
|
|
302
|
+
fontFamily: "var(--typeface-body)",
|
|
303
|
+
}}
|
|
304
|
+
>
|
|
305
|
+
Font size 0
|
|
306
|
+
</p>
|
|
307
|
+
<p
|
|
308
|
+
style={{
|
|
309
|
+
fontSize: "var(--font-size-1)",
|
|
310
|
+
fontWeight: "var(--font-weight-light)",
|
|
311
|
+
fontFamily: "var(--typeface-body)",
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
Font size 1
|
|
315
|
+
</p>
|
|
316
|
+
<p
|
|
317
|
+
style={{
|
|
318
|
+
fontSize: "var(--font-size-2)",
|
|
319
|
+
fontWeight: "var(--font-weight-light)",
|
|
320
|
+
fontFamily: "var(--typeface-body)",
|
|
321
|
+
}}
|
|
322
|
+
>
|
|
323
|
+
Font size 2
|
|
324
|
+
</p>
|
|
325
|
+
<p
|
|
326
|
+
style={{
|
|
327
|
+
fontSize: "var(--font-size-3)",
|
|
328
|
+
fontWeight: "var(--font-weight-light)",
|
|
329
|
+
fontFamily: "var(--typeface-body)",
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
Font size 3
|
|
333
|
+
</p>
|
|
334
|
+
<p
|
|
335
|
+
style={{
|
|
336
|
+
fontSize: "var(--font-size-4)",
|
|
337
|
+
fontWeight: "var(--font-weight-light)",
|
|
338
|
+
fontFamily: "var(--typeface-body)",
|
|
339
|
+
}}
|
|
340
|
+
>
|
|
341
|
+
Font size 4
|
|
342
|
+
</p>
|
|
343
|
+
</>
|
|
342
344
|
</Preview>
|
|
343
345
|
|
|
344
346
|
The following CSS variables are available through the DS.
|
|
@@ -359,15 +361,13 @@ The following CSS variables are available through the DS.
|
|
|
359
361
|
In general, the New York Public Library uses Title Case for titles. This means only using capital letters for the principal words. Articles, conjunctions, and prepositions do not get capital letters unless they start the title. For example:
|
|
360
362
|
|
|
361
363
|
<Preview>
|
|
362
|
-
<
|
|
363
|
-
<
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
</ul>
|
|
370
|
-
</Story>
|
|
364
|
+
<ul>
|
|
365
|
+
<li>Snow White and the Seven Dwarfs</li>
|
|
366
|
+
<li>The Last of the Mohicans</li>
|
|
367
|
+
<li>Spooky Books for Kids: The Ultimate Creepy Guide</li>
|
|
368
|
+
<li>The Future Teen Stars of America Live on TikTok</li>
|
|
369
|
+
<li>How Jacqueline Woodson Captures Every Side of Brooklyn</li>
|
|
370
|
+
</ul>
|
|
371
371
|
</Preview>
|
|
372
372
|
|
|
373
373
|
## Character Count
|
|
@@ -377,11 +377,9 @@ In general, the New York Public Library uses Title Case for titles. This means o
|
|
|
377
377
|
80 characters max, 60 characters recommended
|
|
378
378
|
|
|
379
379
|
<Preview>
|
|
380
|
-
<
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
</Heading>
|
|
384
|
-
</Story>
|
|
380
|
+
<Heading level={HeadingLevels.Four}>
|
|
381
|
+
This is a Long Title to Show What 58 Characters Looks Like
|
|
382
|
+
</Heading>
|
|
385
383
|
</Preview>
|
|
386
384
|
|
|
387
385
|
### Summaries
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import CardEdition from "../CardEdition/CardEdition";
|
|
3
3
|
|
|
4
4
|
interface UIDocCardProps {
|
|
5
5
|
/** backgroundColor of the doc card */
|
|
@@ -16,12 +16,12 @@ export default function UIDocCard(
|
|
|
16
16
|
const { backgroundColor, children } = props;
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
|
-
<
|
|
19
|
+
<CardEdition className="var-docs">
|
|
20
20
|
<div
|
|
21
21
|
style={{
|
|
22
22
|
alignItems: "center",
|
|
23
23
|
backgroundColor: backgroundColor,
|
|
24
|
-
borderBottom: "1px solid var(--ui-gray-light)",
|
|
24
|
+
borderBottom: "1px solid var(--ui-gray-light-cool)",
|
|
25
25
|
color: "white",
|
|
26
26
|
display: "flex",
|
|
27
27
|
height: "100px",
|
|
@@ -31,6 +31,6 @@ export default function UIDocCard(
|
|
|
31
31
|
}}
|
|
32
32
|
></div>
|
|
33
33
|
{children}
|
|
34
|
-
</
|
|
34
|
+
</CardEdition>
|
|
35
35
|
);
|
|
36
36
|
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Meta,
|
|
3
|
+
Story,
|
|
4
|
+
Canvas,
|
|
5
|
+
ArgsTable,
|
|
6
|
+
Description,
|
|
7
|
+
} from "@storybook/addon-docs/blocks";
|
|
8
|
+
import { withDesign } from "storybook-addon-designs";
|
|
9
|
+
|
|
10
|
+
import { Tabs, TabList, Tab, TabPanels, TabPanel } from "./Tabs";
|
|
11
|
+
import { getCategory } from "../../utils/componentCategories";
|
|
12
|
+
import DSProvider from "../../theme/provider";
|
|
13
|
+
|
|
14
|
+
<Meta
|
|
15
|
+
title={getCategory("Tabs")}
|
|
16
|
+
component={Tabs}
|
|
17
|
+
decorators={[withDesign]}
|
|
18
|
+
parameters={{
|
|
19
|
+
design: {
|
|
20
|
+
type: "figma",
|
|
21
|
+
url:
|
|
22
|
+
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A26464",
|
|
23
|
+
},
|
|
24
|
+
jest: ["Tabs.test.tsx"],
|
|
25
|
+
}}
|
|
26
|
+
argTypes={{
|
|
27
|
+
children: { table: { disable: true } },
|
|
28
|
+
id: { table: { disable: true } },
|
|
29
|
+
className: { table: { disable: true } },
|
|
30
|
+
data: { table: { disable: true } },
|
|
31
|
+
onChange: { table: { disable: true } },
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
# Tabs
|
|
36
|
+
|
|
37
|
+
| Component Version | DS Version |
|
|
38
|
+
| ----------------- | ---------- |
|
|
39
|
+
| Added | `0.24.0` |
|
|
40
|
+
| Latest | `0.25.0` |
|
|
41
|
+
|
|
42
|
+
<Description of={Tabs} />
|
|
43
|
+
|
|
44
|
+
export const animalCrossing = [
|
|
45
|
+
{
|
|
46
|
+
label: "Tom Nook",
|
|
47
|
+
content: (
|
|
48
|
+
<p>
|
|
49
|
+
Tom Nook, <b>known in Japan as Tanukichi</b>, is a fictional character
|
|
50
|
+
in the Animal Crossing series who operates the village store.
|
|
51
|
+
</p>
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "Isabelle",
|
|
56
|
+
content:
|
|
57
|
+
"Isabelle, known as Shizue in Japan, is a fictional character " +
|
|
58
|
+
"from the Animal Crossing series of video games. She is a kindly Shih " +
|
|
59
|
+
"Tzu that debuted in the 2012 release Animal Crossing: New Leaf, where " +
|
|
60
|
+
"she serves as the secretary to the player character.",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "K.K. Slider",
|
|
64
|
+
content:
|
|
65
|
+
"<p>Totakeke, more commonly known as <b>K.K. Slider or K.K.</b>, is a " +
|
|
66
|
+
"fictional character within the Animal Crossing franchise. One of the " +
|
|
67
|
+
"franchise's most popular characters, he debuted in the title Animal " +
|
|
68
|
+
"Crossing, and has appeared in every installment since.</p>",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: "Mr. Resetti",
|
|
72
|
+
content:
|
|
73
|
+
"<strong>Mr. Resetti</strong>, full name Sonny Resetti, is a fictional character from the Animal Crossing series of video games by Nintendo. His first appearance was in the Nintendo 64 game Dōbutsu no Mori, released in Europe and North America on the GameCube as Animal Crossing.",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "Zucker",
|
|
77
|
+
content:
|
|
78
|
+
"<strong>Zucker</strong> is a lazy octopus villager who first appeared in New Leaf. His Japanese name and general appearance refers to the Japanese snack takoyaki, which is a fried ball of dough commonly filled with minced octopus. His catchphrase is a reference to how he is an underwater animal. He has the same initial phrase as Bertha. He has the nature hobby.",
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
<Canvas withToolbar>
|
|
83
|
+
<Story
|
|
84
|
+
name="Basic with props"
|
|
85
|
+
args={{
|
|
86
|
+
defaultIndex: 0,
|
|
87
|
+
useHash: false,
|
|
88
|
+
contentData: animalCrossing,
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
{(args) => <Tabs {...args} />}
|
|
92
|
+
</Story>
|
|
93
|
+
</Canvas>
|
|
94
|
+
|
|
95
|
+
<ArgsTable story="Basic with props" />
|
|
96
|
+
|
|
97
|
+
## Composing with a Data Object
|
|
98
|
+
|
|
99
|
+
_Note: this is the recommended approach._
|
|
100
|
+
|
|
101
|
+
We recommended passing in the data for the `Tabs` component through the `data`
|
|
102
|
+
prop. This allows the consumer to pass in well-formed data and always generate
|
|
103
|
+
the correct DOM. Internally in the DS `Tabs` component, we map through the data
|
|
104
|
+
array and generate the appropriate components needed for the layout.
|
|
105
|
+
|
|
106
|
+
Note that HTML is allowed in the `content` property in each object as part of the
|
|
107
|
+
string or as straight HTML.
|
|
108
|
+
|
|
109
|
+
```jsx
|
|
110
|
+
import { Tabs } from "@nypl/design-system-react-components";
|
|
111
|
+
|
|
112
|
+
const animalCrossing = [
|
|
113
|
+
{
|
|
114
|
+
label: "Tom Nook",
|
|
115
|
+
content: <p>Tom Nook, <b>known in Japan as Tanukichi</b>, is a ...,
|
|
116
|
+
{
|
|
117
|
+
label: "Isabelle",
|
|
118
|
+
content: "Isabelle, known as Shizue in Japan, is a fictional ...",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: "K.K. Slider",
|
|
122
|
+
content:
|
|
123
|
+
"<p>Totakeke, more commonly known as <b>K.K. Slider or K.K.</b>, is ...",
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
// ...
|
|
128
|
+
<Tabs contentData={animalCrossing} />;
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## With Callback Event Function
|
|
132
|
+
|
|
133
|
+
If you need to keep track of the index of current tab that was selected, pass
|
|
134
|
+
an `onChange` event handler to the `onChange` prop. This will return the index
|
|
135
|
+
(0-based) of the tab selected.
|
|
136
|
+
|
|
137
|
+
```jsx
|
|
138
|
+
export const onChange = (value) => {
|
|
139
|
+
window.alert(`Tab index selected was ${value}`);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// ...
|
|
143
|
+
<Tabs contentData={animalCrossing} onChange={onChange} />;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
export const onChange = (value) => {
|
|
147
|
+
window.alert(`Tab index selected was ${value}`);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
<Canvas>
|
|
151
|
+
<Story name="With Callback Event Function">
|
|
152
|
+
<Tabs contentData={animalCrossing} onChange={onChange} />
|
|
153
|
+
</Story>
|
|
154
|
+
</Canvas>
|
|
155
|
+
|
|
156
|
+
## With URL Hash Option
|
|
157
|
+
|
|
158
|
+
In some situations, each selected tab should update the URL with a hash value.
|
|
159
|
+
To enable this, set the `useHash` prop to true.
|
|
160
|
+
|
|
161
|
+
<Canvas>
|
|
162
|
+
<Story name="With URL Hash Option">
|
|
163
|
+
<Tabs contentData={animalCrossing} useHash={true} />
|
|
164
|
+
</Story>
|
|
165
|
+
</Canvas>
|
|
166
|
+
|
|
167
|
+
## With Children Components
|
|
168
|
+
|
|
169
|
+
_Note: not recommended but available._
|
|
170
|
+
|
|
171
|
+
There are five components that make up the Design System `Tabs` component:
|
|
172
|
+
`Tabs`, `TabList`, `Tab`, `TabPanels`, `TabPanel`. The general layout is always
|
|
173
|
+
the same such that the `Tabs` component has `TabList` and `TabPanels` as children.
|
|
174
|
+
|
|
175
|
+
`TabList` only takes `Tab` components as children and `TabPanels` only take
|
|
176
|
+
`TabPanel` as children. While you can compose the DS `Tabs` components with these
|
|
177
|
+
available components, you will probably have to iterate or map through an array
|
|
178
|
+
to get the desired outcome. The DS `Tabs` component does this internally for
|
|
179
|
+
you so this should be a last resort option.
|
|
180
|
+
|
|
181
|
+
Make sure all five components are imported to use this approach.
|
|
182
|
+
|
|
183
|
+
```jsx
|
|
184
|
+
import {
|
|
185
|
+
Tabs,
|
|
186
|
+
TabList,
|
|
187
|
+
Tab,
|
|
188
|
+
TabPanels,
|
|
189
|
+
TabPanel,
|
|
190
|
+
} from "@nypl/design-system-react-components";
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
<Canvas>
|
|
194
|
+
<Story name="With Children Components">
|
|
195
|
+
<Tabs>
|
|
196
|
+
<TabList>
|
|
197
|
+
<Tab>Tom Nook</Tab>
|
|
198
|
+
<Tab>Isabelle</Tab>
|
|
199
|
+
<Tab>K.K. Slider</Tab>
|
|
200
|
+
</TabList>
|
|
201
|
+
<TabPanels>
|
|
202
|
+
<TabPanel>
|
|
203
|
+
Tom Nook, known in Japan as Tanukichi, is a fictional character in the
|
|
204
|
+
Animal Crossing series who operates the village store.
|
|
205
|
+
</TabPanel>
|
|
206
|
+
<TabPanel>
|
|
207
|
+
Isabelle, known as Shizue in Japan, is a fictional character from the
|
|
208
|
+
Animal Crossing series of video games. She is a kindly Shih Tzu that
|
|
209
|
+
debuted in the 2012 release Animal Crossing: New Leaf, where she
|
|
210
|
+
serves as the secretary to the player character.
|
|
211
|
+
</TabPanel>
|
|
212
|
+
<TabPanel>
|
|
213
|
+
Totakeke, more commonly known as K.K. Slider or K.K., is a fictional
|
|
214
|
+
character within the Animal Crossing franchise. One of the franchise's
|
|
215
|
+
most popular characters, he debuted in the title Animal Crossing, and
|
|
216
|
+
has appeared in every installment since.
|
|
217
|
+
</TabPanel>
|
|
218
|
+
</TabPanels>
|
|
219
|
+
</Tabs>
|
|
220
|
+
</Story>
|
|
221
|
+
</Canvas>
|