@nypl/design-system-react-components 0.26.1 → 1.0.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 +54 -0
- package/README.md +7 -7
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/dist/components/Button/Button.d.ts +2 -10
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +10 -8
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/SimpleGrid.d.ts +6 -3
- package/dist/components/Heading/Heading.d.ts +2 -5
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
- package/dist/components/Hero/Hero.d.ts +13 -9
- package/dist/components/Icons/Icon.d.ts +6 -5
- package/dist/components/Icons/IconSvgs.d.ts +21 -21
- package/dist/components/Image/Image.d.ts +8 -5
- package/dist/components/Link/Link.d.ts +1 -9
- package/dist/components/List/List.d.ts +7 -11
- package/dist/components/Logo/Logo.d.ts +2 -5
- package/dist/components/Logo/LogoSvgs.d.ts +39 -39
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +2 -5
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
- package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Template/Template.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +21 -9
- package/dist/components/Toggle/Toggle.d.ts +1 -5
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +983 -1222
- 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 +982 -1285
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/types.d.ts +1 -0
- package/dist/index.d.ts +27 -48
- package/dist/styles.css +1 -1
- package/dist/theme/components/buttonGroup.d.ts +11 -0
- package/dist/theme/components/card.d.ts +104 -8
- package/dist/theme/components/componentWrapper.d.ts +4 -3
- package/dist/theme/components/customTable.d.ts +11 -14
- package/dist/theme/components/fieldset.d.ts +4 -3
- package/dist/theme/components/helperErrorText.d.ts +4 -3
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/horizontalRule.d.ts +4 -3
- package/dist/theme/components/icon.d.ts +47743 -1
- package/dist/theme/components/image.d.ts +563 -10
- package/dist/theme/components/label.d.ts +4 -3
- package/dist/theme/components/list.d.ts +6 -7
- package/dist/theme/components/logo.d.ts +474 -1
- package/dist/theme/components/notification.d.ts +20 -16
- package/dist/theme/components/progressIndicator.d.ts +6 -4
- package/dist/theme/components/select.d.ts +4 -10
- package/dist/theme/components/skeletonLoader.d.ts +14 -10
- package/dist/theme/components/skipNavigation.d.ts +22 -0
- package/dist/theme/components/slider.d.ts +7 -6
- package/dist/theme/components/structuredContent.d.ts +10 -9
- package/dist/theme/components/text.d.ts +7 -1
- package/dist/theme/components/toggle.d.ts +6 -4
- package/dist/theme/provider.d.ts +2 -4
- package/dist/utils/componentCategories.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +5 -0
- package/dist/utils/utils.d.ts +2 -18
- package/package.json +15 -16
- package/src/__tests__/setup.ts +3 -3
- package/src/__tests__/utils/utils.test.ts +1 -23
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
- package/src/components/Accordion/Accordion.stories.mdx +43 -44
- package/src/components/Accordion/Accordion.test.tsx +5 -13
- package/src/components/Accordion/Accordion.tsx +14 -18
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
- package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
- package/src/components/Button/Button.stories.mdx +89 -126
- package/src/components/Button/Button.test.tsx +16 -30
- package/src/components/Button/Button.tsx +14 -20
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
- package/src/components/Card/Card.stories.mdx +144 -178
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Chakra/Box.stories.mdx +3 -7
- package/src/components/Chakra/Center.stories.mdx +6 -24
- package/src/components/Chakra/Flex.stories.mdx +5 -7
- package/src/components/Chakra/Grid.stories.mdx +1 -1
- package/src/components/Chakra/Stack.stories.mdx +10 -11
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +20 -13
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
- package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
- package/src/components/DatePicker/DatePicker.test.tsx +21 -19
- package/src/components/DatePicker/DatePicker.tsx +57 -49
- package/src/components/Form/Form.stories.mdx +46 -31
- package/src/components/Form/Form.test.tsx +1 -18
- package/src/components/Form/Form.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
- package/src/components/Grid/SimpleGrid.test.tsx +7 -9
- package/src/components/Grid/SimpleGrid.tsx +14 -11
- package/src/components/Heading/Heading.stories.mdx +27 -72
- package/src/components/Heading/Heading.test.tsx +18 -44
- package/src/components/Heading/Heading.tsx +7 -10
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
- package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
- package/src/components/Hero/Hero.stories.mdx +219 -216
- package/src/components/Hero/Hero.test.tsx +107 -223
- package/src/components/Hero/Hero.tsx +63 -61
- package/src/components/Icons/Icon.stories.mdx +172 -118
- package/src/components/Icons/Icon.test.tsx +8 -16
- package/src/components/Icons/Icon.tsx +75 -29
- package/src/components/Icons/IconSvgs.tsx +42 -42
- package/src/components/Image/Image.stories.mdx +45 -132
- package/src/components/Image/Image.test.tsx +16 -31
- package/src/components/Image/Image.tsx +28 -12
- package/src/components/Link/Link.stories.mdx +30 -94
- package/src/components/Link/Link.test.tsx +25 -75
- package/src/components/Link/Link.tsx +43 -56
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
- package/src/components/List/List.stories.mdx +20 -31
- package/src/components/List/List.test.tsx +24 -43
- package/src/components/List/List.tsx +25 -36
- package/src/components/Logo/Logo.stories.mdx +94 -50
- package/src/components/Logo/Logo.test.tsx +10 -19
- package/src/components/Logo/Logo.tsx +50 -17
- package/src/components/Logo/LogoSvgs.tsx +78 -78
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
- package/src/components/Modal/Modal.stories.mdx +245 -139
- package/src/components/Modal/Modal.test.tsx +147 -10
- 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 +10 -28
- package/src/components/Notification/Notification.test.tsx +9 -12
- package/src/components/Notification/Notification.tsx +34 -37
- package/src/components/Pagination/Pagination.stories.mdx +3 -4
- package/src/components/Pagination/Pagination.tsx +15 -10
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +9 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
- package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
- package/src/components/RadioGroup/RadioGroup.tsx +28 -24
- package/src/components/SearchBar/SearchBar.stories.mdx +4 -4
- package/src/components/SearchBar/SearchBar.test.tsx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +14 -22
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
- package/src/components/Select/Select.stories.mdx +10 -25
- package/src/components/Select/Select.test.tsx +6 -7
- package/src/components/Select/Select.tsx +28 -35
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
- package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
- package/src/components/Slider/Slider.stories.mdx +19 -53
- package/src/components/Slider/Slider.test.tsx +2 -2
- package/src/components/Slider/Slider.tsx +10 -12
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
- package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
- package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
- package/src/components/StatusBadge/StatusBadge.tsx +3 -10
- package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
- package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
- package/src/components/StructuredContent/StructuredContent.tsx +9 -18
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
- package/src/components/StyleGuide/Buttons.stories.mdx +63 -63
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +9 -10
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +2 -2
- package/src/components/StyleGuide/Iconography.stories.mdx +60 -78
- package/src/components/StyleGuide/Spacing.stories.mdx +1 -2
- package/src/components/StyleGuide/Typography.stories.mdx +16 -19
- package/src/components/Table/Table.stories.mdx +85 -1
- package/src/components/Table/Table.test.tsx +57 -1
- package/src/components/Table/Table.tsx +7 -4
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
- package/src/components/Tabs/Tabs.stories.mdx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +26 -27
- package/src/components/Template/Template.stories.mdx +49 -54
- package/src/components/Template/Template.tsx +9 -3
- package/src/components/Text/Text.stories.mdx +5 -11
- package/src/components/Text/Text.test.tsx +3 -6
- package/src/components/Text/Text.tsx +3 -5
- package/src/components/TextInput/TextInput.stories.mdx +10 -22
- package/src/components/TextInput/TextInput.test.tsx +32 -62
- package/src/components/TextInput/TextInput.tsx +61 -30
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
- package/src/components/Toggle/Toggle.stories.mdx +5 -16
- package/src/components/Toggle/Toggle.test.tsx +2 -3
- package/src/components/Toggle/Toggle.tsx +9 -10
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
- package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
- package/src/docs/Chakra.stories.mdx +14 -11
- package/src/docs/Welcome.stories.mdx +23 -43
- package/src/helpers/types.ts +1 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useNYPLTheme.stories.mdx +3 -6
- package/src/index.ts +52 -46
- package/src/styles.scss +0 -1
- package/src/theme/components/buttonGroup.ts +10 -0
- package/src/theme/components/card.ts +50 -15
- package/src/theme/components/componentWrapper.ts +5 -1
- package/src/theme/components/customTable.ts +8 -2
- package/src/theme/components/fieldset.ts +5 -1
- package/src/theme/components/helperErrorText.ts +5 -1
- package/src/theme/components/hero.ts +2 -2
- package/src/theme/components/horizontalRule.ts +5 -1
- package/src/theme/components/icon.ts +7 -1
- package/src/theme/components/image.ts +14 -3
- package/src/theme/components/label.ts +5 -1
- package/src/theme/components/list.ts +8 -2
- package/src/theme/components/logo.ts +5 -1
- package/src/theme/components/notification.ts +38 -14
- package/src/theme/components/progressIndicator.ts +10 -5
- package/src/theme/components/select.ts +5 -6
- package/src/theme/components/skeletonLoader.ts +8 -2
- package/src/theme/components/skipNavigation.ts +26 -0
- package/src/theme/components/slider.ts +13 -1
- package/src/theme/components/structuredContent.ts +11 -1
- package/src/theme/components/text.ts +12 -5
- package/src/theme/components/toggle.ts +9 -3
- package/src/theme/foundations/colors.ts +6 -9
- package/src/theme/index.ts +4 -0
- package/src/theme/provider.tsx +1 -1
- package/src/utils/componentCategories.ts +13 -5
- package/src/utils/interfaces.ts +5 -0
- package/src/utils/utils.ts +2 -32
- package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
- package/dist/components/Button/ButtonTypes.d.ts +0 -8
- package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
- package/dist/components/Form/FormTypes.d.ts +0 -2
- package/dist/components/Grid/GridTypes.d.ts +0 -9
- package/dist/components/Heading/HeadingTypes.d.ts +0 -14
- package/dist/components/Hero/HeroTypes.d.ts +0 -12
- package/dist/components/Icons/IconTypes.d.ts +0 -77
- package/dist/components/Image/ImageTypes.d.ts +0 -22
- package/dist/components/Link/LinkTypes.d.ts +0 -8
- package/dist/components/List/ListTypes.d.ts +0 -5
- package/dist/components/Logo/LogoTypes.d.ts +0 -54
- package/dist/components/Notification/NotificationTypes.d.ts +0 -5
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
- package/dist/components/Select/SelectTypes.d.ts +0 -8
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
- package/dist/components/Text/TextTypes.d.ts +0 -6
- package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
- package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
- package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
- package/dist/helpers/enums.d.ts +0 -4
- package/dist/utils/siteSections.d.ts +0 -2
- package/src/components/Accordion/AccordionTypes.tsx +0 -5
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
- package/src/components/Button/ButtonTypes.tsx +0 -8
- package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
- package/src/components/Form/FormTypes.tsx +0 -3
- package/src/components/Grid/GridTypes.tsx +0 -9
- package/src/components/Heading/HeadingTypes.tsx +0 -15
- package/src/components/Hero/HeroTypes.tsx +0 -20
- package/src/components/Icons/IconTypes.tsx +0 -83
- package/src/components/Image/ImageTypes.ts +0 -24
- package/src/components/Link/LinkTypes.tsx +0 -8
- package/src/components/List/ListTypes.tsx +0 -5
- package/src/components/Logo/LogoTypes.tsx +0 -56
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/components/Notification/NotificationTypes.tsx +0 -5
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
- package/src/components/Select/SelectTypes.tsx +0 -10
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
- package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
- package/src/components/Text/TextTypes.tsx +0 -6
- package/src/components/TextInput/TextInputTypes.tsx +0 -48
- package/src/components/Toggle/ToggleTypes.tsx +0 -4
- package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
- package/src/helpers/enums.ts +0 -4
- package/src/utils/siteSections.ts +0 -10
|
@@ -11,15 +11,8 @@ import { withDesign } from "storybook-addon-designs";
|
|
|
11
11
|
import Heading from "../Heading/Heading";
|
|
12
12
|
import SimpleGrid from "../Grid/SimpleGrid";
|
|
13
13
|
import Toggle from "./Toggle";
|
|
14
|
-
import { ToggleSizes } from "./ToggleTypes";
|
|
15
14
|
import { getCategory } from "../../utils/componentCategories";
|
|
16
15
|
import DSProvider from "../../theme/provider";
|
|
17
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
18
|
-
|
|
19
|
-
export const sizeEnumValues = getStorybookEnumValues(
|
|
20
|
-
ToggleSizes,
|
|
21
|
-
"ToggleSizes"
|
|
22
|
-
);
|
|
23
16
|
|
|
24
17
|
<Meta
|
|
25
18
|
title={getCategory("Toggle")}
|
|
@@ -33,7 +26,6 @@ export const sizeEnumValues = getStorybookEnumValues(
|
|
|
33
26
|
jest: ["Toggle.test.tsx"],
|
|
34
27
|
}}
|
|
35
28
|
argTypes={{
|
|
36
|
-
additionalStyles: { control: false },
|
|
37
29
|
defaultChecked: { control: false },
|
|
38
30
|
id: { control: false },
|
|
39
31
|
key: { table: { disable: true } },
|
|
@@ -42,9 +34,7 @@ export const sizeEnumValues = getStorybookEnumValues(
|
|
|
42
34
|
ref: { table: { disable: true } },
|
|
43
35
|
size: {
|
|
44
36
|
control: {
|
|
45
|
-
|
|
46
|
-
table: { defaultValue: { summary: "ToggleSizes.Default" } },
|
|
47
|
-
options: sizeEnumValues.options,
|
|
37
|
+
table: { defaultValue: { summary: "default" } },
|
|
48
38
|
},
|
|
49
39
|
},
|
|
50
40
|
}}
|
|
@@ -55,7 +45,7 @@ export const sizeEnumValues = getStorybookEnumValues(
|
|
|
55
45
|
| Component Version | DS Version |
|
|
56
46
|
| ----------------- | ---------- |
|
|
57
47
|
| Added | `0.25.8` |
|
|
58
|
-
| Latest | `0.
|
|
48
|
+
| Latest | `0.28.0` |
|
|
59
49
|
|
|
60
50
|
## Table of Contents
|
|
61
51
|
|
|
@@ -89,7 +79,6 @@ should be short and to the point, often three words or less.
|
|
|
89
79
|
<Story
|
|
90
80
|
name="Toggle"
|
|
91
81
|
args={{
|
|
92
|
-
additionalStyles: undefined,
|
|
93
82
|
defaultChecked: false,
|
|
94
83
|
helperText: "This is the helper text!",
|
|
95
84
|
id: "toggle-1",
|
|
@@ -104,7 +93,7 @@ should be short and to the point, often three words or less.
|
|
|
104
93
|
size: "ToogleSizes.Large",
|
|
105
94
|
}}
|
|
106
95
|
>
|
|
107
|
-
{(args) => <Toggle {...args}
|
|
96
|
+
{(args) => <Toggle {...args} />}
|
|
108
97
|
</Story>
|
|
109
98
|
</Canvas>
|
|
110
99
|
|
|
@@ -143,10 +132,10 @@ Resources:
|
|
|
143
132
|
<Toggle
|
|
144
133
|
defaultChecked={true}
|
|
145
134
|
id="small-checked"
|
|
146
|
-
size=
|
|
135
|
+
size="small"
|
|
147
136
|
labelText="On"
|
|
148
137
|
/>
|
|
149
|
-
<Toggle id="default-small" size=
|
|
138
|
+
<Toggle id="default-small" size="small" labelText="Off" />
|
|
150
139
|
</VStack>
|
|
151
140
|
</SimpleGrid>
|
|
152
141
|
</DSProvider>
|
|
@@ -5,7 +5,6 @@ import * as React from "react";
|
|
|
5
5
|
import renderer from "react-test-renderer";
|
|
6
6
|
|
|
7
7
|
import Toggle from "./Toggle";
|
|
8
|
-
import { ToggleSizes } from "./ToggleTypes";
|
|
9
8
|
|
|
10
9
|
describe("Toggle Accessibility", () => {
|
|
11
10
|
it("Passes axe accessibility test", async () => {
|
|
@@ -17,7 +16,7 @@ describe("Toggle Accessibility", () => {
|
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
describe("Toggle", () => {
|
|
20
|
-
let changeHandler
|
|
19
|
+
let changeHandler: jest.MockedFunction<() => void>;
|
|
21
20
|
|
|
22
21
|
beforeEach(() => {
|
|
23
22
|
changeHandler = jest.fn();
|
|
@@ -142,7 +141,7 @@ describe("Toggle", () => {
|
|
|
142
141
|
id="Toggle-disabled"
|
|
143
142
|
labelText="Test Label"
|
|
144
143
|
isDisabled
|
|
145
|
-
size=
|
|
144
|
+
size="small"
|
|
146
145
|
/>
|
|
147
146
|
)
|
|
148
147
|
.toJSON();
|
|
@@ -10,10 +10,10 @@ import * as React from "react";
|
|
|
10
10
|
import HelperErrorText, {
|
|
11
11
|
HelperErrorTextType,
|
|
12
12
|
} from "../HelperErrorText/HelperErrorText";
|
|
13
|
-
import {
|
|
13
|
+
import { AriaAttributes } from "../../utils/interfaces";
|
|
14
|
+
|
|
15
|
+
export type ToggleSizes = "default" | "small";
|
|
14
16
|
export interface ToggleProps {
|
|
15
|
-
/** Optionally pass in additional Chakra-based styles. */
|
|
16
|
-
additionalStyles?: { [key: string]: any };
|
|
17
17
|
/** Used for uncontrolled scenarios. Sets the state of the Toggle when the page first loads.
|
|
18
18
|
* If true, the toggle will be initially set to the "on" position. */
|
|
19
19
|
defaultChecked?: boolean;
|
|
@@ -57,7 +57,6 @@ export const onChangeDefault = () => {
|
|
|
57
57
|
export const Toggle = chakra(
|
|
58
58
|
React.forwardRef<HTMLInputElement, ToggleProps>((props, ref?) => {
|
|
59
59
|
const {
|
|
60
|
-
additionalStyles = {},
|
|
61
60
|
defaultChecked = false,
|
|
62
61
|
helperText,
|
|
63
62
|
id,
|
|
@@ -69,11 +68,11 @@ export const Toggle = chakra(
|
|
|
69
68
|
labelText,
|
|
70
69
|
name,
|
|
71
70
|
onChange = onChangeDefault,
|
|
72
|
-
size =
|
|
71
|
+
size = "default",
|
|
73
72
|
...rest
|
|
74
73
|
} = props;
|
|
75
|
-
const footnote
|
|
76
|
-
const ariaAttributes = {};
|
|
74
|
+
const footnote = isInvalid ? invalidText : helperText;
|
|
75
|
+
const ariaAttributes: AriaAttributes = {};
|
|
77
76
|
const styles = useMultiStyleConfig("Toggle", { isDisabled, size });
|
|
78
77
|
const switchStyles = useStyleConfig("Switch", { size });
|
|
79
78
|
ariaAttributes["aria-label"] =
|
|
@@ -87,7 +86,7 @@ export const Toggle = chakra(
|
|
|
87
86
|
|
|
88
87
|
return (
|
|
89
88
|
<>
|
|
90
|
-
<Box __css={
|
|
89
|
+
<Box __css={styles} {...rest}>
|
|
91
90
|
<Switch
|
|
92
91
|
id={id}
|
|
93
92
|
name={name || "default"}
|
|
@@ -95,7 +94,7 @@ export const Toggle = chakra(
|
|
|
95
94
|
isInvalid={isInvalid}
|
|
96
95
|
isRequired={isRequired}
|
|
97
96
|
ref={ref}
|
|
98
|
-
size={size ===
|
|
97
|
+
size={size === "default" ? "lg" : "sm"}
|
|
99
98
|
lineHeight="1.5"
|
|
100
99
|
{...(isChecked !== undefined
|
|
101
100
|
? {
|
|
@@ -113,10 +112,10 @@ export const Toggle = chakra(
|
|
|
113
112
|
</Box>
|
|
114
113
|
{footnote && (
|
|
115
114
|
<HelperErrorText
|
|
116
|
-
additionalStyles={styles.helperErrorText}
|
|
117
115
|
id={`${id}-helperText`}
|
|
118
116
|
isInvalid={isInvalid}
|
|
119
117
|
text={footnote}
|
|
118
|
+
__css={styles.helperErrorText}
|
|
120
119
|
/>
|
|
121
120
|
)}
|
|
122
121
|
</>
|
|
@@ -9,19 +9,8 @@ import {
|
|
|
9
9
|
import { withDesign } from "storybook-addon-designs";
|
|
10
10
|
|
|
11
11
|
import VideoPlayer from "./VideoPlayer";
|
|
12
|
-
import { VideoPlayerAspectRatios, VideoPlayerTypes } from "./VideoPlayerTypes";
|
|
13
12
|
import { getCategory } from "../../utils/componentCategories";
|
|
14
13
|
import DSProvider from "../../theme/provider";
|
|
15
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
16
|
-
|
|
17
|
-
export const ratiosEnumValues = getStorybookEnumValues(
|
|
18
|
-
VideoPlayerAspectRatios,
|
|
19
|
-
"VideoPlayerAspectRatios"
|
|
20
|
-
);
|
|
21
|
-
export const typesEnumValues = getStorybookEnumValues(
|
|
22
|
-
VideoPlayerTypes,
|
|
23
|
-
"VideoPlayerTypes"
|
|
24
|
-
);
|
|
25
14
|
|
|
26
15
|
<Meta
|
|
27
16
|
title={getCategory("VideoPlayer")}
|
|
@@ -36,21 +25,16 @@ export const typesEnumValues = getStorybookEnumValues(
|
|
|
36
25
|
}}
|
|
37
26
|
argTypes={{
|
|
38
27
|
aspectRatio: {
|
|
39
|
-
control: { type: "select" },
|
|
40
28
|
table: {
|
|
41
|
-
defaultValue: { summary: "
|
|
29
|
+
defaultValue: { summary: "sixteenByNine" },
|
|
42
30
|
},
|
|
43
|
-
options: ratiosEnumValues.options,
|
|
44
31
|
},
|
|
45
32
|
className: { control: false },
|
|
46
33
|
id: { control: false },
|
|
47
34
|
showHelperInvalidText: {
|
|
48
35
|
table: { defaultValue: { summary: true } },
|
|
49
36
|
},
|
|
50
|
-
videoType: {
|
|
51
|
-
control: { type: "select" },
|
|
52
|
-
options: typesEnumValues.options,
|
|
53
|
-
},
|
|
37
|
+
videoType: {},
|
|
54
38
|
}}
|
|
55
39
|
/>
|
|
56
40
|
|
|
@@ -59,7 +43,7 @@ export const typesEnumValues = getStorybookEnumValues(
|
|
|
59
43
|
| Component Version | DS Version |
|
|
60
44
|
| ----------------- | ---------- |
|
|
61
45
|
| Added | `0.23.2` |
|
|
62
|
-
| Latest | `0.
|
|
46
|
+
| Latest | `0.28.0` |
|
|
63
47
|
|
|
64
48
|
## Table of Contents
|
|
65
49
|
|
|
@@ -94,7 +78,7 @@ is `16:9`.
|
|
|
94
78
|
<Story
|
|
95
79
|
name="VideoPlayer"
|
|
96
80
|
args={{
|
|
97
|
-
aspectRatio: "
|
|
81
|
+
aspectRatio: "sixteenByNine",
|
|
98
82
|
className: undefined,
|
|
99
83
|
descriptionText:
|
|
100
84
|
"Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
|
|
@@ -112,9 +96,9 @@ is `16:9`.
|
|
|
112
96
|
{(args) => (
|
|
113
97
|
<VideoPlayer
|
|
114
98
|
{...args}
|
|
115
|
-
aspectRatio={
|
|
99
|
+
aspectRatio={args.aspectRatio}
|
|
116
100
|
embedCode={args.embedCode}
|
|
117
|
-
videoType={args.videoType &&
|
|
101
|
+
videoType={args.videoType && args.videoType}
|
|
118
102
|
/>
|
|
119
103
|
)}
|
|
120
104
|
</Story>
|
|
@@ -170,7 +154,9 @@ https://www.youtube.com/watch?v=nm-dD2tx6bk
|
|
|
170
154
|
|
|
171
155
|
## Example Embed Code Snippets
|
|
172
156
|
|
|
173
|
-
The examples below are shown with precise HTML formatting. However, often the
|
|
157
|
+
The examples below are shown with precise HTML formatting. However, often the
|
|
158
|
+
embed code snippets provided by 3rd party video services are delivered as one
|
|
159
|
+
long string.
|
|
174
160
|
|
|
175
161
|
### Vimeo
|
|
176
162
|
|
|
@@ -201,14 +187,12 @@ The examples below are shown with precise HTML formatting. However, often the em
|
|
|
201
187
|
|
|
202
188
|
## Errored
|
|
203
189
|
|
|
204
|
-
If the necessary props are not passed to the `VideoPlayer` component, the
|
|
190
|
+
If the necessary props are not passed to the `VideoPlayer` component, the
|
|
191
|
+
component UI will display an error message.
|
|
205
192
|
|
|
206
193
|
<Canvas>
|
|
207
194
|
<DSProvider>
|
|
208
|
-
<VideoPlayer
|
|
209
|
-
videoId="https://vimeo.com/474719268"
|
|
210
|
-
videoType={VideoPlayerTypes.Vimeo}
|
|
211
|
-
/>
|
|
195
|
+
<VideoPlayer videoId="https://vimeo.com/474719268" videoType="vimeo" />
|
|
212
196
|
</DSProvider>
|
|
213
197
|
</Canvas>
|
|
214
198
|
|
|
@@ -221,7 +205,7 @@ It's possible to include HTML in the `helperText` prop.
|
|
|
221
205
|
<VideoPlayer
|
|
222
206
|
helperText="This helper text <b>contains HTML</b>."
|
|
223
207
|
videoId="474719268"
|
|
224
|
-
videoType=
|
|
208
|
+
videoType="vimeo"
|
|
225
209
|
/>
|
|
226
210
|
</DSProvider>
|
|
227
211
|
</Canvas>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { render, RenderResult, screen } from "@testing-library/react";
|
|
3
3
|
import { axe } from "jest-axe";
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
6
|
import VideoPlayer from "./VideoPlayer";
|
|
7
|
-
import { VideoPlayerAspectRatios, VideoPlayerTypes } from "./VideoPlayerTypes";
|
|
8
7
|
|
|
9
8
|
describe("VideoPlayer Accessibility", () => {
|
|
10
9
|
it("passes axe accessibility test", async () => {
|
|
11
10
|
const { container } = render(
|
|
12
|
-
<VideoPlayer videoType=
|
|
11
|
+
<VideoPlayer videoType="youtube" videoId="nm-dD2tx6bk" />
|
|
13
12
|
);
|
|
14
13
|
expect(await axe(container)).toHaveNoViolations();
|
|
15
14
|
});
|
|
@@ -17,13 +16,11 @@ describe("VideoPlayer Accessibility", () => {
|
|
|
17
16
|
|
|
18
17
|
describe("VideoPlayer", () => {
|
|
19
18
|
const videoId = "nm-dD2tx6bk";
|
|
20
|
-
let utils;
|
|
19
|
+
let utils: RenderResult;
|
|
21
20
|
|
|
22
21
|
describe("YouTube player", () => {
|
|
23
22
|
beforeEach(() => {
|
|
24
|
-
utils = render(
|
|
25
|
-
<VideoPlayer videoType={VideoPlayerTypes.YouTube} videoId={videoId} />
|
|
26
|
-
);
|
|
23
|
+
utils = render(<VideoPlayer videoType="youtube" videoId={videoId} />);
|
|
27
24
|
});
|
|
28
25
|
|
|
29
26
|
it("Renders VideoPlayer container", () => {
|
|
@@ -46,9 +43,7 @@ describe("VideoPlayer", () => {
|
|
|
46
43
|
const videoId = "474719268";
|
|
47
44
|
|
|
48
45
|
beforeEach(() => {
|
|
49
|
-
utils = render(
|
|
50
|
-
<VideoPlayer videoType={VideoPlayerTypes.Vimeo} videoId={videoId} />
|
|
51
|
-
);
|
|
46
|
+
utils = render(<VideoPlayer videoType="vimeo" videoId={videoId} />);
|
|
52
47
|
});
|
|
53
48
|
|
|
54
49
|
it("Renders VideoPlayer iframe", () => {
|
|
@@ -107,7 +102,7 @@ describe("VideoPlayer", () => {
|
|
|
107
102
|
beforeEach(() => {
|
|
108
103
|
utils = render(
|
|
109
104
|
<VideoPlayer
|
|
110
|
-
videoType=
|
|
105
|
+
videoType="youtube"
|
|
111
106
|
videoId={videoId}
|
|
112
107
|
headingText="Video Player Heading"
|
|
113
108
|
descriptionText="Video Player description text."
|
|
@@ -133,7 +128,7 @@ describe("VideoPlayer", () => {
|
|
|
133
128
|
it("does not render the helper text", () => {
|
|
134
129
|
utils.rerender(
|
|
135
130
|
<VideoPlayer
|
|
136
|
-
videoType=
|
|
131
|
+
videoType="youtube"
|
|
137
132
|
videoId={videoId}
|
|
138
133
|
headingText="Video Player Heading"
|
|
139
134
|
descriptionText="Video Player description text."
|
|
@@ -151,7 +146,7 @@ describe("VideoPlayer", () => {
|
|
|
151
146
|
it("Uses iframeTitle prop to add custom title attribute to iframe", () => {
|
|
152
147
|
render(
|
|
153
148
|
<VideoPlayer
|
|
154
|
-
videoType=
|
|
149
|
+
videoType="vimeo"
|
|
155
150
|
videoId="474719268"
|
|
156
151
|
iframeTitle="My custom iframe title."
|
|
157
152
|
/>
|
|
@@ -164,9 +159,9 @@ describe("VideoPlayer", () => {
|
|
|
164
159
|
it("Throws error if the videoId prop not is formatted properly", () => {
|
|
165
160
|
render(
|
|
166
161
|
<VideoPlayer
|
|
167
|
-
videoType=
|
|
162
|
+
videoType="vimeo"
|
|
168
163
|
videoId="http://vimeo.com/474719268"
|
|
169
|
-
aspectRatio=
|
|
164
|
+
aspectRatio="fourByThree"
|
|
170
165
|
/>
|
|
171
166
|
);
|
|
172
167
|
expect(
|
|
@@ -191,7 +186,7 @@ describe("VideoPlayer", () => {
|
|
|
191
186
|
"Only the `videoId` prop was set."
|
|
192
187
|
);
|
|
193
188
|
|
|
194
|
-
render(<VideoPlayer videoType=
|
|
189
|
+
render(<VideoPlayer videoType="vimeo" />);
|
|
195
190
|
expect(warn).toHaveBeenCalledWith(
|
|
196
191
|
"NYPL Reservoir VideoPlayer: The `videoId` prop is also required. " +
|
|
197
192
|
"Only the `videoType` prop was set."
|
|
@@ -200,7 +195,7 @@ describe("VideoPlayer", () => {
|
|
|
200
195
|
render(
|
|
201
196
|
<VideoPlayer
|
|
202
197
|
embedCode="<iframe src='https://player.vimeo.com/video/421404144?h=5467db7edd' width='640' height='360' frameborder='0' allow='autoplay; fullscreen; picture-in-picture' allowfullscreen></iframe>"
|
|
203
|
-
videoType=
|
|
198
|
+
videoType="vimeo"
|
|
204
199
|
videoId="http://vimeo.com/474719268"
|
|
205
200
|
/>
|
|
206
201
|
);
|
|
@@ -212,7 +207,7 @@ describe("VideoPlayer", () => {
|
|
|
212
207
|
render(
|
|
213
208
|
<VideoPlayer
|
|
214
209
|
embedCode="<iframe src='https://player.vimeo.com/video/421404144?h=5467db7edd' width='640' height='360' frameborder='0' allow='autoplay; fullscreen; picture-in-picture' allowfullscreen></iframe>"
|
|
215
|
-
videoType=
|
|
210
|
+
videoType="vimeo"
|
|
216
211
|
/>
|
|
217
212
|
);
|
|
218
213
|
expect(warn).toHaveBeenCalledWith(
|
|
@@ -245,7 +240,7 @@ describe("VideoPlayer", () => {
|
|
|
245
240
|
<VideoPlayer
|
|
246
241
|
id="video-player-without-text"
|
|
247
242
|
videoId="474719268"
|
|
248
|
-
videoType=
|
|
243
|
+
videoType="vimeo"
|
|
249
244
|
/>
|
|
250
245
|
)
|
|
251
246
|
.toJSON();
|
|
@@ -257,7 +252,7 @@ describe("VideoPlayer", () => {
|
|
|
257
252
|
id="video-player-with-text"
|
|
258
253
|
helperText="VideoPlayer helper test."
|
|
259
254
|
videoId="474719268"
|
|
260
|
-
videoType=
|
|
255
|
+
videoType="vimeo"
|
|
261
256
|
/>
|
|
262
257
|
)
|
|
263
258
|
.toJSON();
|
|
@@ -277,7 +272,7 @@ describe("VideoPlayer", () => {
|
|
|
277
272
|
<VideoPlayer
|
|
278
273
|
id="video-player-error"
|
|
279
274
|
videoId="https://vimeo.com/474719268"
|
|
280
|
-
videoType=
|
|
275
|
+
videoType="vimeo"
|
|
281
276
|
/>
|
|
282
277
|
)
|
|
283
278
|
.toJSON();
|
|
@@ -286,7 +281,7 @@ describe("VideoPlayer", () => {
|
|
|
286
281
|
<VideoPlayer
|
|
287
282
|
id="chakra"
|
|
288
283
|
videoId="474719268"
|
|
289
|
-
videoType=
|
|
284
|
+
videoType="vimeo"
|
|
290
285
|
p="20px"
|
|
291
286
|
color="ui.error.primary"
|
|
292
287
|
/>
|
|
@@ -297,7 +292,7 @@ describe("VideoPlayer", () => {
|
|
|
297
292
|
<VideoPlayer
|
|
298
293
|
id="props"
|
|
299
294
|
videoId="474719268"
|
|
300
|
-
videoType=
|
|
295
|
+
videoType="vimeo"
|
|
301
296
|
data-testid="props"
|
|
302
297
|
/>
|
|
303
298
|
)
|
|
@@ -3,9 +3,12 @@ import * as React from "react";
|
|
|
3
3
|
|
|
4
4
|
import ComponentWrapper from "../ComponentWrapper/ComponentWrapper";
|
|
5
5
|
import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
|
|
6
|
-
import { VideoPlayerAspectRatios, VideoPlayerTypes } from "./VideoPlayerTypes";
|
|
7
|
-
import { getVariant } from "../../utils/utils";
|
|
8
6
|
|
|
7
|
+
export type VideoPlayerTypes = "vimeo" | "youtube";
|
|
8
|
+
export type VideoPlayerAspectRatios =
|
|
9
|
+
| "fourByThree"
|
|
10
|
+
| "sixteenByNine"
|
|
11
|
+
| "square";
|
|
9
12
|
export interface VideoPlayerProps {
|
|
10
13
|
/** Optional aspect ratio prop to control the sizing of the video player; if
|
|
11
14
|
* omitted, the video player defaults to `sixteen-by-nine` */
|
|
@@ -57,12 +60,12 @@ export const VideoPlayer = chakra(
|
|
|
57
60
|
} = props;
|
|
58
61
|
|
|
59
62
|
const iframeTitleFinal =
|
|
60
|
-
videoType ===
|
|
63
|
+
videoType === "vimeo"
|
|
61
64
|
? iframeTitle || "Vimeo video player"
|
|
62
65
|
: iframeTitle || "YouTube video player";
|
|
63
66
|
|
|
64
67
|
const videoSrc =
|
|
65
|
-
videoType ===
|
|
68
|
+
videoType === "vimeo"
|
|
66
69
|
? `https://player.vimeo.com/video/${videoId}?autoplay=0&loop=0`
|
|
67
70
|
: `https://www.youtube.com/embed/${videoId}?disablekb=1&autoplay=0&fs=1&modestbranding=0`;
|
|
68
71
|
|
|
@@ -138,9 +141,7 @@ export const VideoPlayer = chakra(
|
|
|
138
141
|
isInvalid = true;
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
const variant = isInvalid
|
|
142
|
-
? "invalid"
|
|
143
|
-
: getVariant(aspectRatio, VideoPlayerAspectRatios);
|
|
144
|
+
const variant = isInvalid ? "invalid" : aspectRatio;
|
|
144
145
|
const styles = useMultiStyleConfig("VideoPlayer", { variant });
|
|
145
146
|
|
|
146
147
|
const embedElement = embedCodeFinal ? (
|
|
@@ -169,9 +170,11 @@ export const VideoPlayer = chakra(
|
|
|
169
170
|
<span dangerouslySetInnerHTML={{ __html: errorMessage }} />
|
|
170
171
|
) : (
|
|
171
172
|
<ComponentWrapper
|
|
172
|
-
headingText={headingText ? headingText :
|
|
173
|
-
descriptionText={descriptionText ? descriptionText :
|
|
174
|
-
helperText={
|
|
173
|
+
headingText={headingText ? headingText : undefined}
|
|
174
|
+
descriptionText={descriptionText ? descriptionText : undefined}
|
|
175
|
+
helperText={
|
|
176
|
+
helperText && showHelperInvalidText ? helperText : undefined
|
|
177
|
+
}
|
|
175
178
|
id={`${id}-componentWrapper`}
|
|
176
179
|
>
|
|
177
180
|
<Box __css={styles.inside}>{embedElement}</Box>
|
|
@@ -92,8 +92,12 @@ wrap the elements in the `DSProvider` component.
|
|
|
92
92
|
<Canvas>
|
|
93
93
|
<DSProvider>
|
|
94
94
|
<ButtonGroup>
|
|
95
|
-
<Button isDisabled={false}>
|
|
96
|
-
|
|
95
|
+
<Button id="enabled" isDisabled={false}>
|
|
96
|
+
Enabled
|
|
97
|
+
</Button>
|
|
98
|
+
<Button id="disabled" isDisabled>
|
|
99
|
+
Disabled
|
|
100
|
+
</Button>
|
|
97
101
|
</ButtonGroup>
|
|
98
102
|
</DSProvider>
|
|
99
103
|
</Canvas>
|
|
@@ -259,7 +263,9 @@ const Button = {
|
|
|
259
263
|
Now this variant can be rendered:
|
|
260
264
|
|
|
261
265
|
```tsx
|
|
262
|
-
<Button buttonType=
|
|
266
|
+
<Button buttonType="secondary" id="secondary">
|
|
267
|
+
Press me
|
|
268
|
+
</Button>
|
|
263
269
|
```
|
|
264
270
|
|
|
265
271
|
### Breakpoints
|
|
@@ -438,13 +444,13 @@ In the following example, the `Button` component has been passed `p` and `maxW`
|
|
|
438
444
|
props which are shorthand for "padding" and "max-width", respectively.
|
|
439
445
|
|
|
440
446
|
```jsx
|
|
441
|
-
<Button p="s" maxW="200px">
|
|
447
|
+
<Button id="styleprops" p="s" maxW="200px">
|
|
442
448
|
Button
|
|
443
449
|
</Button>
|
|
444
450
|
```
|
|
445
451
|
|
|
446
452
|
<DSProvider>
|
|
447
|
-
<Button p="s" maxW="200px">
|
|
453
|
+
<Button id="styleprops" p="s" maxW="200px">
|
|
448
454
|
Button
|
|
449
455
|
</Button>
|
|
450
456
|
</DSProvider>
|
|
@@ -507,8 +513,7 @@ _Note: more patterns will be added._
|
|
|
507
513
|
All DS components _should_ be used with their current styles. If a DS component
|
|
508
514
|
needs an updated style, first contact the Design System and UX teams about this
|
|
509
515
|
update. If you really _need_ to update a style and there is no available
|
|
510
|
-
variant, then you can add styles directly
|
|
511
|
-
moment, not all DS components have this prop or feature.
|
|
516
|
+
variant, then you can add styles directly as style prop.
|
|
512
517
|
|
|
513
518
|
For example, if the `Heading` component should render the text in NYPL's green
|
|
514
519
|
color used for "success primary" and add a bold font weight, then you can do
|
|
@@ -522,10 +527,8 @@ return (
|
|
|
522
527
|
<div>
|
|
523
528
|
<Heading
|
|
524
529
|
level={2}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
fontWeight: theme.fontWeights.bold,
|
|
528
|
-
}}
|
|
530
|
+
color={theme.colors.ui.success.primary}
|
|
531
|
+
fontWeight={theme.fontWeights.bold}
|
|
529
532
|
>
|
|
530
533
|
Get a Digital Library Card Today in a Few Easy Steps
|
|
531
534
|
</Heading>
|