@nypl/design-system-react-components 0.25.2 → 0.25.6
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 +101 -0
- package/README.md +47 -11
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +9 -8
- package/dist/components/Button/ButtonTypes.d.ts +2 -1
- package/dist/components/Card/Card.d.ts +36 -52
- package/dist/components/Card/CardTypes.d.ts +0 -15
- package/dist/components/Checkbox/Checkbox.d.ts +8 -9
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts +36 -36
- package/dist/components/Fieldset/Fieldset.d.ts +25 -0
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +4 -0
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -3
- package/dist/components/Icons/Icon.d.ts +4 -0
- package/dist/components/Icons/IconSvgs.d.ts +11 -0
- package/dist/components/Icons/IconTypes.d.ts +11 -0
- package/dist/components/Image/Image.d.ts +19 -9
- package/dist/components/Image/ImageTypes.d.ts +20 -0
- package/dist/components/Link/Link.d.ts +4 -0
- package/dist/components/List/List.d.ts +7 -1
- package/dist/components/Notification/Notification.d.ts +6 -4
- package/dist/components/Pagination/Pagination.d.ts +16 -13
- package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/components/SearchBar/SearchBar.d.ts +3 -3
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
- package/dist/components/Slider/Slider.d.ts +57 -0
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +10 -0
- package/dist/design-system-react-components.cjs.development.js +3058 -936
- 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 +3049 -921
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/resources.scss +180 -170
- package/dist/styles.css +1 -1
- package/dist/theme/components/breadcrumb.d.ts +9 -0
- package/dist/theme/components/button.d.ts +22 -8
- package/dist/theme/components/card.d.ts +168 -0
- package/dist/theme/components/checkbox.d.ts +5 -1
- package/dist/theme/components/checkboxGroup.d.ts +12 -0
- package/dist/theme/components/datePicker.d.ts +16 -0
- package/dist/theme/components/fieldset.d.ts +27 -0
- package/dist/theme/components/global.d.ts +23 -13
- package/dist/theme/components/globalMixins.d.ts +9 -1
- package/dist/theme/components/heading.d.ts +5 -0
- package/dist/theme/components/image.d.ts +31 -0
- package/dist/theme/components/label.d.ts +5 -3
- package/dist/theme/components/link.d.ts +4 -0
- package/dist/theme/components/list.d.ts +5 -1
- package/dist/theme/components/notification.d.ts +4 -14
- package/dist/theme/components/pagination.d.ts +19 -0
- package/dist/theme/components/progressIndicator.d.ts +50 -0
- package/dist/theme/components/radioGroup.d.ts +12 -0
- package/dist/theme/components/select.d.ts +11 -2
- package/dist/theme/components/skeletonLoader.d.ts +98 -0
- package/dist/theme/components/slider.d.ts +51 -0
- package/dist/theme/components/textInput.d.ts +8 -0
- package/dist/theme/foundations/breakpoints.d.ts +8 -8
- package/dist/theme/foundations/global.d.ts +6 -1
- package/package.json +72 -84
- package/src/__tests__/setup.ts +2 -2
- package/src/components/Accordion/Accordion.stories.mdx +39 -42
- package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -0
- package/src/components/Autosuggest/_Autosuggest.scss +5 -5
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +24 -8
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +33 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +298 -1
- package/src/components/Button/Button.stories.mdx +15 -10
- package/src/components/Button/Button.test.tsx +21 -7
- package/src/components/Button/Button.tsx +18 -33
- package/src/components/Button/ButtonTypes.tsx +1 -0
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +41 -10
- package/src/components/Card/Card.stories.mdx +296 -259
- package/src/components/Card/Card.test.tsx +156 -84
- package/src/components/Card/Card.tsx +195 -145
- package/src/components/Card/CardTypes.tsx +0 -17
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
- package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
- package/src/components/CardEdition/_CardEdition.scss +22 -23
- package/src/components/Chakra/Box.stories.mdx +14 -15
- package/src/components/Chakra/Center.stories.mdx +15 -8
- package/src/components/Chakra/Grid.stories.mdx +16 -7
- package/src/components/Chakra/Stack.stories.mdx +35 -18
- package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
- package/src/components/Checkbox/Checkbox.test.tsx +30 -3
- package/src/components/Checkbox/Checkbox.tsx +27 -27
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +90 -2
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +82 -2
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -1
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -15
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +44 -80
- package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
- package/src/components/DatePicker/DatePicker.test.tsx +248 -65
- package/src/components/DatePicker/DatePicker.tsx +158 -130
- package/src/components/DatePicker/_DatePicker.scss +33 -67
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
- package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
- package/src/components/Fieldset/Fieldset.test.tsx +125 -0
- package/src/components/Fieldset/Fieldset.tsx +52 -0
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
- package/src/components/Form/Form.stories.mdx +4 -5
- package/src/components/Form/Form.tsx +1 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +32 -39
- package/src/components/Grid/SimpleGrid.test.tsx +4 -4
- package/src/components/Heading/Heading.stories.mdx +3 -4
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -1
- package/src/components/HelperErrorText/HelperErrorText.tsx +5 -1
- package/src/components/Hero/HeroTypes.tsx +1 -0
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +7 -7
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -5
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +17 -0
- package/src/components/HorizontalRule/HorizontalRule.tsx +21 -4
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +5 -5
- package/src/components/Icons/Icon.stories.mdx +11 -3
- package/src/components/Icons/Icon.test.tsx +18 -0
- package/src/components/Icons/Icon.tsx +6 -0
- package/src/components/Icons/IconSvgs.tsx +22 -0
- package/src/components/Icons/IconTypes.tsx +11 -0
- package/src/components/Image/Image.stories.mdx +220 -0
- package/src/components/Image/Image.test.tsx +131 -29
- package/src/components/Image/Image.tsx +84 -56
- package/src/components/Image/ImageTypes.ts +22 -0
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
- package/src/components/Input/Input.stories.tsx +20 -64
- package/src/components/Input/_Input.scss +23 -14
- package/src/components/Link/Link.tsx +4 -1
- package/src/components/List/List.stories.mdx +1 -1
- package/src/components/List/List.tsx +11 -4
- package/src/components/Modal/Modal.stories.mdx +3 -3
- package/src/components/Modal/_Modal.scss +2 -2
- package/src/components/Notification/Notification.stories.mdx +1 -3
- package/src/components/Notification/Notification.tsx +24 -9
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +2 -0
- package/src/components/Pagination/Pagination.stories.mdx +26 -27
- package/src/components/Pagination/Pagination.stories.tsx +11 -16
- package/src/components/Pagination/Pagination.test.tsx +276 -146
- package/src/components/Pagination/Pagination.tsx +174 -154
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +3 -4
- package/src/components/RadioGroup/RadioGroup.tsx +11 -16
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +39 -71
- package/src/components/SearchBar/SearchBar.Test.tsx +66 -21
- package/src/components/SearchBar/SearchBar.stories.mdx +114 -10
- package/src/components/SearchBar/SearchBar.tsx +15 -5
- package/src/components/Select/SelectTypes.tsx +1 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +28 -59
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +74 -71
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
- package/src/components/Slider/Slider.stories.mdx +529 -0
- package/src/components/Slider/Slider.test.tsx +653 -0
- package/src/components/Slider/Slider.tsx +303 -0
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
- package/src/components/StyleGuide/Breakpoints.stories.mdx +21 -7
- package/src/components/StyleGuide/Buttons.stories.mdx +69 -15
- package/src/components/StyleGuide/ColorCard.tsx +0 -1
- package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +51 -62
- package/src/components/Tabs/Tabs.tsx +5 -5
- package/src/components/Template/Template.stories.mdx +11 -16
- package/src/components/TextInput/TextInput.stories.mdx +1 -1
- package/src/components/TextInput/TextInput.tsx +23 -6
- package/src/components/TextInput/TextInputTypes.tsx +2 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -3
- package/src/docs/Chakra.stories.mdx +2 -2
- package/src/index.ts +20 -12
- package/src/resources.scss +5 -5
- package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
- package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
- package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
- package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
- package/src/styles/base/_place-holder.scss +14 -3
- package/src/styles/{03-space → space}/_space-inline.scss +14 -14
- package/src/styles/{03-space → space}/_space-inset.scss +10 -10
- package/src/styles/space/_space-stack.scss +116 -0
- package/src/styles.scss +13 -55
- package/src/theme/components/breadcrumb.ts +10 -0
- package/src/theme/components/button.ts +18 -12
- package/src/theme/components/card.ts +174 -0
- package/src/theme/components/checkbox.ts +7 -2
- package/src/theme/components/checkboxGroup.ts +8 -0
- package/src/theme/components/datePicker.ts +17 -0
- package/src/theme/components/fieldset.ts +18 -0
- package/src/theme/components/global.ts +26 -15
- package/src/theme/components/globalMixins.ts +9 -1
- package/src/theme/components/heading.ts +5 -0
- package/src/theme/components/image.ts +116 -0
- package/src/theme/components/label.ts +3 -10
- package/src/theme/components/link.ts +4 -0
- package/src/theme/components/list.ts +6 -3
- package/src/theme/components/notification.ts +12 -14
- package/src/theme/components/pagination.ts +20 -0
- package/src/theme/components/progressIndicator.ts +62 -0
- package/src/theme/components/radioGroup.ts +8 -0
- package/src/theme/components/select.ts +5 -2
- package/src/theme/components/skeletonLoader.ts +107 -0
- package/src/theme/components/slider.ts +79 -0
- package/src/theme/components/textInput.ts +2 -0
- package/src/theme/foundations/breakpoints.ts +8 -8
- package/src/theme/foundations/global.ts +6 -1
- package/src/theme/index.ts +22 -4
- package/src/utils/componentCategories.ts +4 -3
- package/dist/components/Image/Image.stories.d.ts +0 -18
- package/dist/theme/components/customCheckboxGroup.d.ts +0 -18
- package/dist/theme/components/customRadioGroup.d.ts +0 -18
- package/src/components/Button/_Button.scss +0 -32
- package/src/components/Card/_Card.scss +0 -308
- package/src/components/Image/Image.stories.tsx +0 -54
- package/src/components/Image/_Image.scss +0 -38
- package/src/components/Pagination/_Pagination.scss +0 -40
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
- package/src/styles/01-colors/_colors-brand.scss +0 -62
- package/src/styles/01-colors/_colors-utility.scss +0 -67
- package/src/styles/02-typography/_type-scale.css +0 -11
- package/src/styles/02-typography/_type-weight.css +0 -7
- package/src/styles/02-typography/_typefaces.css +0 -4
- package/src/styles/03-space/_space-stack.scss +0 -116
- package/src/styles/03-space/_space.css +0 -30
- package/src/styles/base/_card-grid.scss +0 -77
- package/src/styles/base/_typography.scss +0 -11
- package/src/theme/components/customCheckboxGroup.ts +0 -12
- package/src/theme/components/customRadioGroup.ts +0 -12
|
@@ -237,7 +237,7 @@ help reduce any visual mistakes.
|
|
|
237
237
|
|
|
238
238
|
<Canvas>
|
|
239
239
|
<DSProvider>
|
|
240
|
-
<div style={{ display: "flex",
|
|
240
|
+
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
241
241
|
<div style={{ width: "300px" }}>
|
|
242
242
|
A regular button:
|
|
243
243
|
<Button buttonType={ButtonTypes.Primary} id="button-ex4" type="submit">
|
|
@@ -28,20 +28,34 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
28
28
|
|
|
29
29
|
The DS adheres to four global breakpoints for responsive layouts and typography.
|
|
30
30
|
|
|
31
|
-
- Desktop: 1280px
|
|
32
|
-
- Tablet Landscape: 960px
|
|
33
|
-
- Tablet Portrait: 600px
|
|
34
31
|
- Mobile: 320px
|
|
32
|
+
- Tablet Portrait: 600px
|
|
33
|
+
- Tablet Landscape: 960px
|
|
34
|
+
- Desktop: 1280px
|
|
35
35
|
|
|
36
36
|
## CSS Variables
|
|
37
37
|
|
|
38
38
|
The following CSS variables are available through the DS.
|
|
39
39
|
|
|
40
|
+
```scss
|
|
41
|
+
--nypl-breakpoint-small: 320px;
|
|
42
|
+
--nypl-breakpoint-medium: 600px;
|
|
43
|
+
--nypl-breakpoint-large: 960px;
|
|
44
|
+
--nypl-breakpoint-xl: 1280px;
|
|
40
45
|
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
|
|
47
|
+
## SCSS Variables
|
|
48
|
+
|
|
49
|
+
If you are using SCSS and imported the NYPL Design System `/dist/resources.scss`
|
|
50
|
+
file, then you can use the following SCSS variables in your media queries or
|
|
51
|
+
SCSS `breakpoint` function (if used).
|
|
52
|
+
|
|
53
|
+
```scss
|
|
54
|
+
$nypl-breakpoint-small: 320px;
|
|
55
|
+
$nypl-breakpoint-medium: 600px;
|
|
56
|
+
$nypl-breakpoint-large: 960px;
|
|
57
|
+
$nypl-breakpoint-xl: 1280px;
|
|
58
|
+
$nypl-max-width: $nypl-breakpoint-xl;
|
|
45
59
|
```
|
|
46
60
|
|
|
47
61
|
## Figma Reference
|
|
@@ -6,18 +6,19 @@ import {
|
|
|
6
6
|
Description,
|
|
7
7
|
} from "@storybook/addon-docs/blocks";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
|
+
import { ButtonGroup } from "@chakra-ui/react";
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
-
import Button, { ButtonGroup } from "../Button/Button";
|
|
11
|
+
import Button from "../Button/Button";
|
|
12
12
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
13
13
|
import Icon from "../Icons/Icon";
|
|
14
14
|
import {
|
|
15
|
+
IconAlign,
|
|
15
16
|
IconNames,
|
|
16
17
|
IconRotationTypes,
|
|
17
18
|
IconSizes,
|
|
18
|
-
IconAlign,
|
|
19
19
|
} from "../Icons/IconTypes";
|
|
20
20
|
import getCSSVariable from "../../helpers/getCSSVariable";
|
|
21
|
+
import { getCategory } from "../../utils/componentCategories";
|
|
21
22
|
import DSProvider from "../../theme/provider";
|
|
22
23
|
|
|
23
24
|
<Meta
|
|
@@ -26,8 +27,7 @@ import DSProvider from "../../theme/provider";
|
|
|
26
27
|
parameters={{
|
|
27
28
|
design: {
|
|
28
29
|
type: "figma",
|
|
29
|
-
url:
|
|
30
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11477%3A2298",
|
|
30
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11477%3A2298",
|
|
31
31
|
},
|
|
32
32
|
}}
|
|
33
33
|
/>
|
|
@@ -45,7 +45,8 @@ import DSProvider from "../../theme/provider";
|
|
|
45
45
|
|
|
46
46
|
## General Information
|
|
47
47
|
|
|
48
|
-
Use the NYPL Design System [Button](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/form-elements-button--basic)
|
|
48
|
+
Use the NYPL Design System [Button](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/form-elements-button--basic)
|
|
49
|
+
component to render form buttons.
|
|
49
50
|
|
|
50
51
|
```jsx
|
|
51
52
|
import { Button, ButtonTypes } from "@nypl/design-system-react-components";
|
|
@@ -59,15 +60,23 @@ import { Button, ButtonTypes } from "@nypl/design-system-react-components";
|
|
|
59
60
|
- Button text should be title case.
|
|
60
61
|
- Button icon is optional.
|
|
61
62
|
- Buttons may have an icon on either the left or the right.
|
|
62
|
-
- Buttons by default are blue. However, Donation buttons are red.
|
|
63
|
-
- Buttons used for Back to Top actions have a Secondary button style with an
|
|
64
|
-
|
|
63
|
+
- Buttons by default are blue. However, Donation callout buttons are red.
|
|
64
|
+
- Buttons used for Back to Top actions have a Secondary button style with an
|
|
65
|
+
arrow icon pointing up.
|
|
66
|
+
- When buttons are used in a group, they should be wrapped in a `ButtonGroup`.
|
|
67
|
+
- When buttons are used in a group where the user can move forward or backward,
|
|
68
|
+
the `Primary` button is on the right and the `Secondary` button on the left
|
|
69
|
+
(i.e. cancel = secondary, submit = primary).
|
|
65
70
|
|
|
66
71
|
## Button Groups
|
|
67
72
|
|
|
68
|
-
When `Button` components are displayed in a group, use the `ButtonGroup`
|
|
73
|
+
When `Button` components are displayed in a group, use the `ButtonGroup`
|
|
74
|
+
component to handle the spacing and layout. The `ButtonGroup` component will use
|
|
75
|
+
`--nypl-space-xs` (0.5rem) for spacing in horizontal group layouts.
|
|
69
76
|
|
|
70
|
-
Standalone `Button` components and the `ButtonGroup` component should use
|
|
77
|
+
Standalone `Button` components and the `ButtonGroup` component should use
|
|
78
|
+
`--nypl-space-l` (2rem) for spacing between all other UI elements. This spacing
|
|
79
|
+
can be achieved by using the `Form` component to wrap the `Button`s.
|
|
71
80
|
|
|
72
81
|
<Canvas>
|
|
73
82
|
<DSProvider>
|
|
@@ -84,7 +93,7 @@ Standalone `Button` components and the `ButtonGroup` component should use `--nyp
|
|
|
84
93
|
<Button buttonType={ButtonTypes.Primary}>
|
|
85
94
|
<Icon name={IconNames.Close} size={IconSizes.Medium} />
|
|
86
95
|
</Button>
|
|
87
|
-
<Button buttonType={ButtonTypes.Callout}>
|
|
96
|
+
<Button buttonType={ButtonTypes.Callout}>Donate</Button>
|
|
88
97
|
<Button buttonType={ButtonTypes.Secondary}>
|
|
89
98
|
Back to Top
|
|
90
99
|
<Icon
|
|
@@ -100,15 +109,20 @@ Standalone `Button` components and the `ButtonGroup` component should use `--nyp
|
|
|
100
109
|
|
|
101
110
|
## Button Types
|
|
102
111
|
|
|
103
|
-
The `buttonType` prop should be used to render various forms of the button
|
|
112
|
+
The `buttonType` prop should be used to render various forms of the button
|
|
113
|
+
component. Note that the `SearchBar` type is only used internally in the
|
|
114
|
+
`SearchBar` component.
|
|
104
115
|
|
|
105
116
|
<Canvas>
|
|
106
117
|
<DSProvider>
|
|
107
118
|
<ButtonGroup>
|
|
108
119
|
<Button buttonType={ButtonTypes.Primary}>Primary Button</Button>
|
|
109
120
|
<Button buttonType={ButtonTypes.Secondary}>Secondary Button</Button>
|
|
121
|
+
<Button buttonType={ButtonTypes.Callout}>Callout Button</Button>
|
|
110
122
|
<Button buttonType={ButtonTypes.Pill}>Pill Button</Button>
|
|
111
123
|
<Button buttonType={ButtonTypes.Link}>Link Button</Button>
|
|
124
|
+
<Button buttonType={ButtonTypes.SearchBar}>SearchBar Button</Button>
|
|
125
|
+
<Button buttonType={ButtonTypes.NoBrand}>NoBrand Button</Button>
|
|
112
126
|
</ButtonGroup>
|
|
113
127
|
</DSProvider>
|
|
114
128
|
</Canvas>
|
|
@@ -124,6 +138,11 @@ The `buttonType` prop should be used to render various forms of the button compo
|
|
|
124
138
|
- often paired with a Primary button
|
|
125
139
|
- Visual Treatment: rectangular, outlined
|
|
126
140
|
|
|
141
|
+
### ButtonTypes.Callout
|
|
142
|
+
|
|
143
|
+
- used for call to actions such as donation buttons
|
|
144
|
+
- Visual Treatment: rectangular, NYPL red background
|
|
145
|
+
|
|
127
146
|
### ButtonTypes.Pill
|
|
128
147
|
|
|
129
148
|
- used for equally weighted actions
|
|
@@ -135,11 +154,28 @@ The `buttonType` prop should be used to render various forms of the button compo
|
|
|
135
154
|
- used for equally weighted actions
|
|
136
155
|
- Visual Treatment: text link with underline
|
|
137
156
|
|
|
157
|
+
### ButtonTypes.SearchBar
|
|
158
|
+
|
|
159
|
+
- used internally in the `SearchBar` component for visual flow when it is next
|
|
160
|
+
to the `TextInput` component
|
|
161
|
+
- Visual Treatment: rectangular, filled, no border radius on the left side
|
|
162
|
+
|
|
163
|
+
### ButtonTypes.NoBrand
|
|
164
|
+
|
|
165
|
+
- used in cases where there is no brand color
|
|
166
|
+
- Visual Treatment: rectangular, filled with a black background
|
|
167
|
+
|
|
138
168
|
## Patterns
|
|
139
169
|
|
|
140
170
|
- Buttons are blue by default.
|
|
141
|
-
- Buttons that are intended as a call out (i.e. Donation buttons)
|
|
142
|
-
|
|
171
|
+
- Buttons that are intended as a call out (i.e. Donation buttons) should be set
|
|
172
|
+
as `ButtonTypes.Callout`.
|
|
173
|
+
- The "Back to Top" button must be set as `ButtonTypes.Secondary` and must
|
|
174
|
+
include an up arrow icon.
|
|
175
|
+
- Previous and Next buttons should be set as `ButtonTypes.Secondary` and be
|
|
176
|
+
wrapped in a `ButtonGroup`.
|
|
177
|
+
- Only use the `ButtonTypes.NoBrand` style where there is no brand color. _This
|
|
178
|
+
should be rarely used._
|
|
143
179
|
|
|
144
180
|
<Canvas>
|
|
145
181
|
<DSProvider>
|
|
@@ -154,6 +190,24 @@ The `buttonType` prop should be used to render various forms of the button compo
|
|
|
154
190
|
align={IconAlign.Right}
|
|
155
191
|
/>
|
|
156
192
|
</Button>
|
|
193
|
+
<Button buttonType={ButtonTypes.Secondary}>
|
|
194
|
+
<Icon
|
|
195
|
+
name={IconNames.Arrow}
|
|
196
|
+
iconRotation={IconRotationTypes.Rotate90}
|
|
197
|
+
align={IconAlign.Left}
|
|
198
|
+
size={IconSizes.Small}
|
|
199
|
+
/>
|
|
200
|
+
Previous
|
|
201
|
+
</Button>
|
|
202
|
+
<Button buttonType={ButtonTypes.Secondary}>
|
|
203
|
+
Next
|
|
204
|
+
<Icon
|
|
205
|
+
name={IconNames.Arrow}
|
|
206
|
+
iconRotation={IconRotationTypes.Rotate270}
|
|
207
|
+
align={IconAlign.Right}
|
|
208
|
+
size={IconSizes.Small}
|
|
209
|
+
/>
|
|
210
|
+
</Button>
|
|
157
211
|
</ButtonGroup>
|
|
158
212
|
</DSProvider>
|
|
159
213
|
</Canvas>
|
|
@@ -0,0 +1,170 @@
|
|
|
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
|
+
import { getCategory } from "../../utils/componentCategories";
|
|
10
|
+
|
|
11
|
+
<Meta title={getCategory("Design Tokens")} />
|
|
12
|
+
|
|
13
|
+
# Design Tokens
|
|
14
|
+
|
|
15
|
+
| Table of Contents |
|
|
16
|
+
| ------------------------------------------------------------------------------------ |
|
|
17
|
+
| 1. [What are Design Tokens?](#what-are-design-tokens) |
|
|
18
|
+
| 2. [Why Use Design Tokens?](#why-use-design-tokens) |
|
|
19
|
+
| 3. [How to Use the NYPL Design Tokens](#figma-reference) |
|
|
20
|
+
| 4. [Using NYPL Design Tokens in CSS](#using-nypl-design-tokens-in-css) |
|
|
21
|
+
| 5. [Using NYPL Design Tokens in Javascript](#using-nypl-design-tokens-in-javascript) |
|
|
22
|
+
| 6. [NYPL Design Token Categories](#nypl-design-token-categories) |
|
|
23
|
+
|
|
24
|
+
## What are Design Tokens?
|
|
25
|
+
|
|
26
|
+
Design tokens are the style values that define a design system. These values can include, but may not be limited to, spacing, color, typography, breakpoints and object styles. Ultimately, these values are used to construct and maintain the components that make up our system.
|
|
27
|
+
|
|
28
|
+
## Why Use Design Tokens?
|
|
29
|
+
|
|
30
|
+
_"With design tokens, you can capture low-level values and then use them to create the styles for your product or app. You can maintain a scalable and consistent visual system for UI development."_ – Jina Bolton, Lead Designer for the Salesforce Design System
|
|
31
|
+
|
|
32
|
+
Design tokens are a single source of truth when it comes to styles. They allow an organization to more easily build multiple applications – web and/or native – that feel and look the same without slowing down the development team.
|
|
33
|
+
|
|
34
|
+
## How to Use the NYPL Design Tokens
|
|
35
|
+
|
|
36
|
+
The NYPL design tokens are built into the NYPL Design System (the DS) and are offered in two formats for consumption: CSS variables and javascript data objects. To access either of these formats, the DS v0.25.2 or higher needs to be properly installed in a consuming React application.
|
|
37
|
+
|
|
38
|
+
## Using NYPL Design Tokens in CSS
|
|
39
|
+
|
|
40
|
+
If your app uses CSS or SCSS to handle styles, the DS creates standard CSS custom properties (e.g. variables) for consumption in your stylesheets. If the DS is properly installed, the CSS custom properties will be available for you to use. Nothing more needs to be done to your app.
|
|
41
|
+
|
|
42
|
+
To assist with CSS scope isolation, all of the CSS custom properties created by the DS are prefixed with "nypl." Please see the examples below.
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
--nypl-colors-brand-primary
|
|
46
|
+
--nypl-colors-brand-secondary
|
|
47
|
+
--nypl-fontSizes-sm
|
|
48
|
+
--nypl-fontSizes-md
|
|
49
|
+
--nypl-fontSizes-lg
|
|
50
|
+
--nypl-fontSizes-xl
|
|
51
|
+
--nypl-space-xxs
|
|
52
|
+
--nypl-space-xs
|
|
53
|
+
--nypl-space-s
|
|
54
|
+
--nypl-space-m
|
|
55
|
+
--nypl-space-l
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The CSS custom properties are defined on the :root pseudo-class and should be implemented using standard CSS custom properties conventions.
|
|
59
|
+
|
|
60
|
+
```css
|
|
61
|
+
/* Property Declaration in the DS */
|
|
62
|
+
:root {
|
|
63
|
+
--nypl-colors-brand-primary: #c60917;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Property Usage in Your Application */
|
|
67
|
+
.custom-button {
|
|
68
|
+
background: var(--nypl-colors-brand-primary);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Using NYPL Design Tokens in Javascript
|
|
73
|
+
|
|
74
|
+
If you would like to use CSS-in-JS styles in your React components, the `useNYPLTheme` hook will provide you with NYPL design token values. The hook depends on the `DSProvider` component and will not work properly outside of the `DSProvider` wrapper component.
|
|
75
|
+
|
|
76
|
+
After importing and implementing the `DSProvider` wrapper component, as explained in the `DSProvider` section of the [DS Chakra UI](?path=/story/chakra-ui--page#dsprovider) document, your children components can use this hook function.
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { useNYPLTheme } from "@nypl/design-system-react-components";
|
|
80
|
+
const theme = useNYPLTheme();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The theme variable will be a javascript object containing the NYPL design token style values. This will allow you to use design token values in your components through CSS-in-JS.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// theme
|
|
87
|
+
{
|
|
88
|
+
breakpoints: { ... },
|
|
89
|
+
colors: {
|
|
90
|
+
brand: { ... },
|
|
91
|
+
section: { ... },
|
|
92
|
+
transparent: { ... },
|
|
93
|
+
ui: { ... },
|
|
94
|
+
},
|
|
95
|
+
fontSizes: { ... },
|
|
96
|
+
fontWeights: { ... },
|
|
97
|
+
fonts: { ... },
|
|
98
|
+
radii: { ... },
|
|
99
|
+
space: { ... },
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Using in DS Components
|
|
104
|
+
|
|
105
|
+
The general rule of thumb is that DS components and the available variants should be used with the styles and variants as they are shown in Storybook, but there may be rare times when a component does require a modification. That said, if a DS component does need an updated style, first contact the Design System and UX teams about this update.
|
|
106
|
+
|
|
107
|
+
If you receive approval to make a change in a consuming app, then you can add styles directly to the `additionalStyles` prop. For example, if the `Heading` component needs to render text in NYPL's "success primary" green color and add a bold font weight, then you can do the following:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
const theme = useNYPLTheme();
|
|
111
|
+
|
|
112
|
+
// ...
|
|
113
|
+
return (
|
|
114
|
+
<div>
|
|
115
|
+
<Heading
|
|
116
|
+
level={2}
|
|
117
|
+
additionalStyles={{
|
|
118
|
+
color: theme.colors.ui.success.primary,
|
|
119
|
+
fontWeight: theme.fontWeights.bold,
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
Get a Digital Library Card Today in a Few Easy Steps
|
|
123
|
+
</Heading>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
IMPORTANT: At the moment, not all DS components have this prop or feature.
|
|
129
|
+
|
|
130
|
+
#### Using in HTML Components
|
|
131
|
+
|
|
132
|
+
For styling standard HTML elements, use the `style` attribute to add inline styles.
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<p style={{ color: theme.colors.ui.success.primary }}>
|
|
136
|
+
If you are 13 or older and live, work, attend school, or pay property
|
|
137
|
+
taxes in New York State, you can get a free digital library card right
|
|
138
|
+
now using this online form. Visitors to New York State can also use this
|
|
139
|
+
form to apply for a temporary card.
|
|
140
|
+
</p>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### Using in Styled Components
|
|
144
|
+
|
|
145
|
+
For adding theme styles to styled-objects, use the theme object as a standard javascript variable.
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
const CustomButton = styled.button`
|
|
149
|
+
background: ${theme.colors.brand.primary};
|
|
150
|
+
`;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## NYPL Design Token Categories
|
|
154
|
+
|
|
155
|
+
The DS design tokens are broken into the following categories:
|
|
156
|
+
|
|
157
|
+
- [breakpoints](?path=/story/documentation-style-guide-breakpoints--page)
|
|
158
|
+
- [colors](?path=/story/documentation-style-guide-colors--page)
|
|
159
|
+
- brand
|
|
160
|
+
- section
|
|
161
|
+
- transparent
|
|
162
|
+
- ui
|
|
163
|
+
- radii
|
|
164
|
+
- [spacing](?path=/story/documentation-style-guide-spacing--page)
|
|
165
|
+
- [typography](?path=/story/documentation-style-guide-typography--page)
|
|
166
|
+
- font families
|
|
167
|
+
- font sizes
|
|
168
|
+
- font weights
|
|
169
|
+
|
|
170
|
+
For details related to a specific category, please refer to the corresponding section in the Style Guide available in the DS Storybook.
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Description,
|
|
7
7
|
} from "@storybook/addon-docs/blocks";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
|
+
import { Stack } from "@chakra-ui/react";
|
|
9
10
|
|
|
10
11
|
import { getCategory } from "../../utils/componentCategories";
|
|
11
12
|
import Icon from "../Icons/Icon";
|
|
@@ -42,63 +43,53 @@ import DSProvider from "../../theme/provider";
|
|
|
42
43
|
|
|
43
44
|
## General Information
|
|
44
45
|
|
|
45
|
-
Use the NYPL Design System [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
|
|
46
|
+
Use the NYPL Design System [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
|
|
47
|
+
component to render and control icons and NYPL logos as `<svg>` elements within
|
|
48
|
+
consuming apps.
|
|
46
49
|
|
|
47
50
|
The DS utilizes the `Filled` icons available in the [Material UI Design System](https://material-ui.com/components/material-icons/).
|
|
48
51
|
|
|
49
52
|
## Icon Examples
|
|
50
53
|
|
|
51
|
-
The graphic of the `Icon` component is handled through the `IconNames` and
|
|
54
|
+
The graphic of the `Icon` component is handled through the `IconNames` and
|
|
55
|
+
`LogoNames` enums. To see all graphic options for `Icon`, please refer to the
|
|
56
|
+
[Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
|
|
57
|
+
Storybook page.
|
|
52
58
|
|
|
53
59
|
<Canvas>
|
|
54
60
|
<DSProvider>
|
|
55
|
-
<
|
|
61
|
+
<Stack spacing="s" direction="row">
|
|
56
62
|
<Icon
|
|
57
63
|
decorative
|
|
58
64
|
size={IconSizes.ExtraExtraExtraLarge}
|
|
59
65
|
name={IconNames.Check}
|
|
60
|
-
style={{ marginRight: "1rem" }}
|
|
61
66
|
/>
|
|
62
|
-
</span>
|
|
63
|
-
<span style={{ marginRight: "1rem" }}>
|
|
64
67
|
<Icon
|
|
65
68
|
decorative
|
|
66
69
|
size={IconSizes.ExtraExtraExtraLarge}
|
|
67
70
|
name={IconNames.Close}
|
|
68
|
-
style={{ marginRight: "1rem" }}
|
|
69
71
|
/>
|
|
70
|
-
</span>
|
|
71
|
-
<span style={{ marginRight: "1rem" }}>
|
|
72
72
|
<Icon
|
|
73
73
|
decorative
|
|
74
74
|
size={IconSizes.ExtraExtraExtraLarge}
|
|
75
75
|
name={IconNames.ErrorOutline}
|
|
76
|
-
style={{ marginRight: "1rem" }}
|
|
77
76
|
/>
|
|
78
|
-
</span>
|
|
79
|
-
<span style={{ marginRight: "1rem" }}>
|
|
80
77
|
<Icon
|
|
81
78
|
decorative
|
|
82
79
|
size={IconSizes.ExtraExtraExtraLarge}
|
|
83
80
|
name={IconNames.SpeakerNotes}
|
|
84
|
-
style={{ marginRight: "1rem" }}
|
|
85
81
|
/>
|
|
86
|
-
</span>
|
|
87
|
-
<span style={{ marginRight: "1rem" }}>
|
|
88
82
|
<Icon
|
|
89
83
|
decorative
|
|
90
84
|
size={IconSizes.ExtraExtraExtraLarge}
|
|
91
85
|
name={LogoNames.LogoNypl}
|
|
92
|
-
style={{ marginRight: "1rem" }}
|
|
93
86
|
/>
|
|
94
|
-
</span>
|
|
95
|
-
<span style={{ marginRight: "1rem" }}>
|
|
96
87
|
<Icon
|
|
97
88
|
decorative
|
|
98
89
|
size={IconSizes.ExtraExtraExtraLarge}
|
|
99
90
|
name={LogoNames.LogoBrooklyn}
|
|
100
91
|
/>
|
|
101
|
-
</
|
|
92
|
+
</Stack>
|
|
102
93
|
</DSProvider>
|
|
103
94
|
</Canvas>
|
|
104
95
|
|
|
@@ -117,26 +108,14 @@ The size of the `Icon` component is handled through the `IconSizes` enum.
|
|
|
117
108
|
|
|
118
109
|
<Canvas>
|
|
119
110
|
<DSProvider>
|
|
120
|
-
<
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<Icon size={IconSizes.Large} name={IconNames.Check} />
|
|
129
|
-
</span>
|
|
130
|
-
<span style={{ marginRight: "1rem" }}>
|
|
131
|
-
<Icon size={IconSizes.ExtraLarge} name={IconNames.Check} />
|
|
132
|
-
</span>
|
|
133
|
-
<span style={{ marginRight: "1rem" }}>
|
|
134
|
-
<Icon size={IconSizes.ExtraExtraLarge} name={IconNames.Check} />
|
|
135
|
-
</span>
|
|
136
|
-
<span style={{ marginRight: "1rem" }}>
|
|
137
|
-
<Icon size={IconSizes.ExtraExtraExtraLarge} name={IconNames.Check} />
|
|
138
|
-
</span>
|
|
139
|
-
</div>
|
|
111
|
+
<Stack spacing="s" direction="row" alignItems="center">
|
|
112
|
+
<Icon size={IconSizes.Small} name={IconNames.Check} />
|
|
113
|
+
<Icon size={IconSizes.Medium} name={IconNames.Check} />
|
|
114
|
+
<Icon size={IconSizes.Large} name={IconNames.Check} />
|
|
115
|
+
<Icon size={IconSizes.ExtraLarge} name={IconNames.Check} />
|
|
116
|
+
<Icon size={IconSizes.ExtraExtraLarge} name={IconNames.Check} />
|
|
117
|
+
<Icon size={IconSizes.ExtraExtraExtraLarge} name={IconNames.Check} />
|
|
118
|
+
</Stack>
|
|
140
119
|
</DSProvider>
|
|
141
120
|
</Canvas>
|
|
142
121
|
|
|
@@ -151,31 +130,34 @@ The size of the `Icon` component is handled through the `IconSizes` enum.
|
|
|
151
130
|
|
|
152
131
|
## Icon Colors
|
|
153
132
|
|
|
154
|
-
The color of the `Icon` component is handled through the `IconColors` enum.
|
|
133
|
+
The color of the `Icon` component is handled through the `IconColors` enum.
|
|
134
|
+
Icons in NYPL projects should always be rendered with one color.
|
|
155
135
|
|
|
156
136
|
<Canvas>
|
|
157
137
|
<DSProvider>
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
138
|
+
<Stack spacing="s" direction="row">
|
|
139
|
+
<Icon size={IconSizes.ExtraExtraExtraLarge} name={IconNames.Check} />
|
|
140
|
+
<Icon
|
|
141
|
+
name={IconNames.Check}
|
|
142
|
+
size={IconSizes.ExtraExtraExtraLarge}
|
|
143
|
+
color={IconColors.BrandPrimary}
|
|
144
|
+
/>
|
|
145
|
+
<Icon
|
|
146
|
+
name={IconNames.Check}
|
|
147
|
+
size={IconSizes.ExtraExtraExtraLarge}
|
|
148
|
+
color={IconColors.SectionResearchPrimary}
|
|
149
|
+
/>
|
|
150
|
+
<Icon
|
|
151
|
+
name={IconNames.Check}
|
|
152
|
+
size={IconSizes.ExtraExtraExtraLarge}
|
|
153
|
+
color={IconColors.SectionResearchLibrarySchwartzman}
|
|
154
|
+
/>
|
|
155
|
+
<Icon
|
|
156
|
+
name={IconNames.Check}
|
|
157
|
+
size={IconSizes.ExtraExtraExtraLarge}
|
|
158
|
+
color={IconColors.SectionResearchLibrarySchomburg}
|
|
159
|
+
/>
|
|
160
|
+
</Stack>
|
|
179
161
|
</DSProvider>
|
|
180
162
|
</Canvas>
|
|
181
163
|
|
|
@@ -196,7 +178,14 @@ The color of the `Icon` component is handled through the `IconColors` enum. Icon
|
|
|
196
178
|
|
|
197
179
|
## Development Notes
|
|
198
180
|
|
|
199
|
-
Icons have been added to the Icon component as they have been needed within NYPL
|
|
181
|
+
Icons have been added to the Icon component as they have been needed within NYPL
|
|
182
|
+
development project, so not all of the [NYPL icons](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/?node-id=10734%3A3945)
|
|
183
|
+
and [NYPL Brand](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=15454%3A47007)
|
|
184
|
+
and [NYPL UI](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=14989%3A37)
|
|
185
|
+
colors are currently available through the DS Icon component. If your project
|
|
186
|
+
requires an icon or color that is not currently available in the Icon component,
|
|
187
|
+
please inform your project manager or reach out directly to the NYPL Design
|
|
188
|
+
System team.
|
|
200
189
|
|
|
201
190
|
## Figma Reference
|
|
202
191
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Box,
|
|
4
|
-
Tabs as ChakraTabs,
|
|
5
|
-
TabList,
|
|
6
4
|
Tab,
|
|
5
|
+
TabList,
|
|
7
6
|
TabPanels,
|
|
8
7
|
TabPanel,
|
|
8
|
+
Tabs as ChakraTabs,
|
|
9
9
|
useMultiStyleConfig,
|
|
10
10
|
} from "@chakra-ui/react";
|
|
11
11
|
|
|
@@ -63,7 +63,7 @@ const getElementsFromContentData = (data, useHash) => {
|
|
|
63
63
|
"needed, consider other navigational patterns."
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
-
data.
|
|
66
|
+
data.forEach((tab, index) => {
|
|
67
67
|
let tempPanel;
|
|
68
68
|
// For URL hash enabled tabs, we need to add a custom `onClick` to handle the URL hash.
|
|
69
69
|
const tempTab = (
|
|
@@ -108,7 +108,7 @@ const getElementsFromChildren = (children) => {
|
|
|
108
108
|
return {};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
children.
|
|
111
|
+
children.forEach((child) => {
|
|
112
112
|
if (child.type === TabList || child.props.mdxType === "TabList") {
|
|
113
113
|
tabs.push(child);
|
|
114
114
|
|
|
@@ -170,7 +170,7 @@ function Tabs(props: React.PropsWithChildren<TabsProps>) {
|
|
|
170
170
|
if (windowDimensions.width > 600) {
|
|
171
171
|
goToStart();
|
|
172
172
|
}
|
|
173
|
-
}, [windowDimensions.width]);
|
|
173
|
+
}, [goToStart, windowDimensions.width]);
|
|
174
174
|
const previousButton = (
|
|
175
175
|
<Button
|
|
176
176
|
buttonType={ButtonTypes.Primary}
|