@nypl/design-system-react-components 0.25.5 → 0.25.9
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 +91 -1
- package/README.md +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +6 -6
- package/dist/components/Button/ButtonTypes.d.ts +0 -1
- package/dist/components/Card/Card.d.ts +6 -4
- package/dist/components/Checkbox/Checkbox.d.ts +3 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +3 -2
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -2
- package/dist/components/DatePicker/DatePicker.d.ts +3 -2
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Heading/Heading.d.ts +7 -3
- package/dist/components/Heading/HeadingTypes.d.ts +6 -6
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +5 -2
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -2
- package/dist/components/Icons/Icon.d.ts +4 -4
- package/dist/components/Icons/IconSvgs.d.ts +1 -21
- package/dist/components/Icons/IconTypes.d.ts +1 -23
- package/dist/components/Image/Image.d.ts +11 -3
- package/dist/components/Image/ImageTypes.d.ts +3 -1
- package/dist/components/Link/LinkTypes.d.ts +1 -0
- package/dist/components/Logo/Logo.d.ts +28 -0
- package/dist/components/Logo/LogoSvgs.d.ts +18 -0
- package/dist/components/Logo/LogoTypes.d.ts +30 -0
- package/dist/components/Modal/Modal.d.ts +0 -4
- package/dist/components/Notification/Notification.d.ts +4 -2
- package/dist/components/Placeholder/Placeholder.d.ts +3 -5
- package/dist/components/Radio/Radio.d.ts +6 -5
- package/dist/components/RadioGroup/RadioGroup.d.ts +3 -2
- package/dist/components/SearchBar/SearchBar.d.ts +10 -2
- package/dist/components/Select/Select.d.ts +5 -2
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -4
- package/dist/components/Slider/Slider.d.ts +3 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -1
- package/dist/components/StructuredContent/StructuredContent.d.ts +41 -0
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +5 -0
- package/dist/components/Table/Table.d.ts +23 -0
- package/dist/components/Template/Template.d.ts +8 -3
- package/dist/components/Text/Text.d.ts +2 -2
- package/dist/components/TextInput/TextInput.d.ts +4 -3
- package/dist/components/Toggle/Toggle.d.ts +48 -0
- package/dist/components/Toggle/ToggleSizes.d.ts +4 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +17 -6
- package/dist/design-system-react-components.cjs.development.js +5989 -5490
- 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 +6057 -5551
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/styles.css +2 -2
- package/dist/theme/components/breadcrumb.d.ts +9 -0
- package/dist/theme/components/button.d.ts +0 -12
- package/dist/theme/components/card.d.ts +14 -2
- package/dist/theme/components/customTable.d.ts +47 -0
- package/dist/theme/components/fieldset.d.ts +2 -2
- package/dist/theme/components/global.d.ts +1 -1
- package/dist/theme/components/heading.d.ts +4 -0
- package/dist/theme/components/label.d.ts +1 -1
- package/dist/theme/components/link.d.ts +14 -1
- package/dist/theme/components/list.d.ts +0 -2
- package/dist/theme/components/logo.d.ts +4 -0
- package/dist/theme/components/notification.d.ts +8 -4
- package/dist/theme/components/searchBar.d.ts +7 -13
- package/dist/theme/components/select.d.ts +1 -0
- package/dist/theme/components/structuredContent.d.ts +33 -0
- package/dist/theme/components/template.d.ts +10 -10
- package/dist/theme/components/textInput.d.ts +2 -0
- package/dist/theme/components/toggle.d.ts +71 -0
- package/dist/theme/foundations/spacing.d.ts +2 -0
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +2 -3
- package/src/__tests__/utils/utils.test.ts +23 -1
- package/src/components/Accordion/Accordion.stories.mdx +15 -14
- package/src/components/Autosuggest/Autosuggest.stories.mdx +2 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +24 -48
- package/src/components/Autosuggest/_Autosuggest.scss +2 -6
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +50 -14
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +20 -0
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +198 -0
- package/src/components/Button/Button.stories.mdx +93 -48
- package/src/components/Button/Button.test.tsx +0 -12
- package/src/components/Button/Button.tsx +7 -8
- package/src/components/Button/ButtonTypes.tsx +0 -1
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -12
- package/src/components/Card/Card.stories.mdx +246 -64
- package/src/components/Card/Card.test.tsx +45 -22
- package/src/components/Card/Card.tsx +26 -13
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +75 -37
- package/src/components/Chakra/Box.stories.mdx +3 -3
- package/src/components/Chakra/Center.stories.mdx +5 -5
- package/src/components/Chakra/Grid.stories.mdx +14 -17
- package/src/components/Chakra/Stack.stories.mdx +2 -2
- package/src/components/Checkbox/Checkbox.stories.mdx +37 -15
- package/src/components/Checkbox/Checkbox.tsx +13 -8
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +48 -16
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -10
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +6 -3
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +151 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +36 -23
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +85 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +63 -18
- package/src/components/DatePicker/DatePicker.test.tsx +8 -6
- package/src/components/DatePicker/DatePicker.tsx +10 -6
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +41 -22
- package/src/components/Fieldset/Fieldset.stories.mdx +19 -8
- package/src/components/Form/Form.stories.mdx +49 -41
- package/src/components/Form/Form.tsx +5 -4
- package/src/components/Grid/SimpleGrid.stories.mdx +26 -26
- package/src/components/Heading/Heading.stories.mdx +59 -23
- package/src/components/Heading/Heading.test.tsx +82 -18
- package/src/components/Heading/Heading.tsx +31 -31
- package/src/components/Heading/HeadingTypes.tsx +6 -6
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +71 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +55 -27
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +42 -15
- package/src/components/HelperErrorText/HelperErrorText.tsx +24 -24
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +41 -4
- package/src/components/Hero/Hero.stories.mdx +72 -53
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +9 -8
- package/src/components/HorizontalRule/HorizontalRule.tsx +2 -4
- package/src/components/Icons/Icon.stories.mdx +77 -75
- package/src/components/Icons/Icon.tsx +4 -5
- package/src/components/Icons/IconSvgs.tsx +2 -42
- package/src/components/Icons/IconTypes.tsx +1 -24
- package/src/components/Image/Image.stories.mdx +214 -104
- package/src/components/Image/Image.test.tsx +10 -0
- package/src/components/Image/Image.tsx +21 -10
- package/src/components/Image/ImageTypes.ts +2 -0
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
- package/src/components/Label/Label.stories.mdx +21 -20
- package/src/components/Link/Link.stories.mdx +103 -53
- package/src/components/Link/Link.test.tsx +108 -7
- package/src/components/Link/Link.tsx +58 -19
- package/src/components/Link/LinkTypes.tsx +1 -0
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +261 -0
- package/src/components/List/List.stories.mdx +36 -24
- package/src/components/Logo/Logo.stories.mdx +220 -0
- package/src/components/Logo/Logo.test.tsx +98 -0
- package/src/components/Logo/Logo.tsx +97 -0
- package/src/components/Logo/LogoSvgs.tsx +34 -0
- package/src/components/Logo/LogoTypes.tsx +32 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +71 -0
- package/src/components/Modal/Modal.stories.mdx +20 -5
- package/src/components/Modal/Modal.tsx +2 -8
- package/src/components/Notification/Notification.stories.mdx +96 -40
- package/src/components/Notification/Notification.test.tsx +62 -16
- package/src/components/Notification/Notification.tsx +26 -9
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +121 -0
- package/src/components/Pagination/Pagination.stories.mdx +18 -8
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +42 -0
- package/src/components/Placeholder/Placeholder.tsx +7 -14
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +74 -46
- package/src/components/Radio/Radio.stories.mdx +39 -19
- package/src/components/Radio/Radio.tsx +13 -9
- package/src/components/RadioGroup/RadioGroup.stories.mdx +50 -16
- package/src/components/RadioGroup/RadioGroup.tsx +15 -11
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +6 -3
- package/src/components/SearchBar/SearchBar.Test.tsx +114 -22
- package/src/components/SearchBar/SearchBar.stories.mdx +111 -33
- package/src/components/SearchBar/SearchBar.tsx +57 -33
- package/src/components/Select/Select.stories.mdx +177 -66
- package/src/components/Select/Select.test.tsx +2 -2
- package/src/components/Select/Select.tsx +22 -12
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +50 -16
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +8 -4
- package/src/components/Slider/Slider.stories.mdx +74 -23
- package/src/components/Slider/Slider.test.tsx +35 -0
- package/src/components/Slider/Slider.tsx +22 -11
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +60 -30
- package/src/components/StatusBadge/StatusBadge.stories.mdx +33 -18
- package/src/components/StatusBadge/StatusBadge.tsx +2 -1
- package/src/components/StructuredContent/StructuredContent.stories.mdx +427 -0
- package/src/components/StructuredContent/StructuredContent.test.tsx +376 -0
- package/src/components/StructuredContent/StructuredContent.tsx +153 -0
- package/src/components/StructuredContent/StructuredContentTypes.tsx +5 -0
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +283 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +32 -83
- package/src/components/StyleGuide/Breakpoints.stories.mdx +1 -11
- package/src/components/StyleGuide/Buttons.stories.mdx +3 -18
- package/src/components/StyleGuide/ColorCard.tsx +1 -2
- package/src/components/StyleGuide/Colors.stories.mdx +3 -11
- package/src/components/StyleGuide/DesignTokens.stories.mdx +3 -8
- package/src/components/StyleGuide/Forms.stories.mdx +2 -10
- package/src/components/StyleGuide/Iconography.stories.mdx +8 -34
- package/src/components/StyleGuide/Spacing.stories.mdx +3 -14
- package/src/components/StyleGuide/Typography.stories.mdx +64 -76
- package/src/components/Table/Table.stories.mdx +66 -0
- package/src/components/Table/Table.test.tsx +60 -0
- package/src/components/Table/Table.tsx +116 -0
- package/src/components/Tabs/Tabs.stories.mdx +19 -13
- package/src/components/Tabs/Tabs.test.tsx +1 -1
- package/src/components/Template/Template.stories.mdx +57 -49
- package/src/components/Template/Template.test.tsx +65 -5
- package/src/components/Template/Template.tsx +35 -5
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +76 -0
- package/src/components/Text/Text.stories.mdx +33 -11
- package/src/components/Text/Text.tsx +2 -2
- package/src/components/TextInput/TextInput.stories.mdx +84 -17
- package/src/components/TextInput/TextInput.test.tsx +96 -0
- package/src/components/TextInput/TextInput.tsx +12 -8
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +240 -0
- package/src/components/Toggle/Toggle.stories.mdx +200 -0
- package/src/components/Toggle/Toggle.test.tsx +140 -0
- package/src/components/Toggle/Toggle.tsx +123 -0
- package/src/components/Toggle/ToggleSizes.tsx +4 -0
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +255 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +96 -25
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +103 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +72 -22
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +57 -3
- package/src/docs/Chakra.stories.mdx +5 -8
- package/src/docs/Intro.stories.mdx +2 -2
- package/src/index.ts +13 -4
- package/src/styles/base/_03-base.scss +1 -1
- package/src/styles/base/_place-holder.scss +7 -7
- package/src/styles.scss +1 -5
- package/src/theme/components/breadcrumb.ts +14 -4
- package/src/theme/components/button.ts +5 -12
- package/src/theme/components/card.ts +9 -7
- package/src/theme/components/checkbox.ts +1 -1
- package/src/theme/components/customTable.ts +50 -0
- package/src/theme/components/datePicker.ts +1 -1
- package/src/theme/components/global.ts +7 -7
- package/src/theme/components/heading.ts +13 -11
- package/src/theme/components/helperErrorText.ts +1 -1
- package/src/theme/components/icon.ts +2 -2
- package/src/theme/components/image.ts +9 -1
- package/src/theme/components/link.ts +17 -5
- package/src/theme/components/list.ts +1 -3
- package/src/theme/components/logo.ts +54 -0
- package/src/theme/components/notification.ts +9 -7
- package/src/theme/components/searchBar.ts +7 -13
- package/src/theme/components/select.ts +1 -0
- package/src/theme/components/statusBadge.ts +1 -1
- package/src/theme/components/structuredContent.ts +54 -0
- package/src/theme/components/template.ts +10 -10
- package/src/theme/components/text.ts +6 -6
- package/src/theme/components/textInput.ts +1 -0
- package/src/theme/components/toggle.ts +69 -0
- package/src/theme/components/videoPlayer.ts +0 -2
- package/src/theme/foundations/global.ts +2 -2
- package/src/theme/foundations/spacing.ts +3 -0
- package/src/theme/foundations/typography.ts +84 -12
- package/src/theme/index.ts +8 -0
- package/src/utils/componentCategories.ts +4 -2
- package/src/utils/utils.ts +17 -0
- package/dist/__tests__/utils/bem.test.d.ts +0 -1
- package/dist/components/CardEdition/CardEdition.d.ts +0 -21
- package/dist/components/CardEdition/CardEdition.stories.d.ts +0 -27
- package/dist/components/Input/Input.d.ts +0 -36
- package/dist/components/Input/Input.stories.d.ts +0 -29
- package/dist/components/Input/InputTypes.d.ts +0 -6
- package/dist/components/StyleGuide/UIDocCard.d.ts +0 -11
- package/dist/helpers/CSSVariablesHelper.d.ts +0 -3
- package/dist/helpers/getCSSVariable.d.ts +0 -1
- package/dist/interfaces.d.ts +0 -3
- package/dist/utils/bem.d.ts +0 -1
- package/src/__tests__/utils/bem.test.ts +0 -37
- package/src/components/CardEdition/CardEdition.stories.tsx +0 -122
- package/src/components/CardEdition/CardEdition.test.tsx +0 -395
- package/src/components/CardEdition/CardEdition.tsx +0 -60
- package/src/components/CardEdition/_CardEdition.scss +0 -137
- package/src/components/Input/Input.stories.tsx +0 -133
- package/src/components/Input/Input.test.tsx +0 -266
- package/src/components/Input/Input.tsx +0 -81
- package/src/components/Input/InputTypes.tsx +0 -8
- package/src/components/Input/_Input.scss +0 -78
- package/src/components/StyleGuide/UIDocCard.tsx +0 -36
- package/src/helpers/CSSVariablesHelper.tsx +0 -34
- package/src/helpers/getCSSVariable.tsx +0 -5
- package/src/interfaces.ts +0 -3
- package/src/utils/bem.ts +0 -44
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Toggle: {
|
|
3
|
+
parts: string[];
|
|
4
|
+
baseStyle: {
|
|
5
|
+
label: {
|
|
6
|
+
display: string;
|
|
7
|
+
alignItems: string;
|
|
8
|
+
width: string;
|
|
9
|
+
};
|
|
10
|
+
helper: {
|
|
11
|
+
marginLeft: string;
|
|
12
|
+
marginTop: string;
|
|
13
|
+
marginBottom: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
defaultProps: {
|
|
17
|
+
size: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
Switch: {
|
|
21
|
+
baseStyle: {
|
|
22
|
+
opacity: number;
|
|
23
|
+
track: {
|
|
24
|
+
border: string;
|
|
25
|
+
borderColor: string;
|
|
26
|
+
p: string;
|
|
27
|
+
_checked: {
|
|
28
|
+
bg: string;
|
|
29
|
+
borderColor: string;
|
|
30
|
+
opacity: number;
|
|
31
|
+
};
|
|
32
|
+
_invalid: {
|
|
33
|
+
bg: string;
|
|
34
|
+
borderColor: string;
|
|
35
|
+
"> span": {
|
|
36
|
+
bg: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
_disabled: {
|
|
40
|
+
bg: string;
|
|
41
|
+
borderColor: string;
|
|
42
|
+
_checked: {
|
|
43
|
+
opacity: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
_focus: {
|
|
47
|
+
outline: string;
|
|
48
|
+
outlineColor: string;
|
|
49
|
+
outlineOffset: string;
|
|
50
|
+
zIndex: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
label: {
|
|
54
|
+
fontSize: string;
|
|
55
|
+
marginLeft: string;
|
|
56
|
+
_disabled: {
|
|
57
|
+
fontStyle: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
thumb: {
|
|
61
|
+
_disabled: {
|
|
62
|
+
bg: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
defaultProps: {
|
|
67
|
+
colorScheme: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export default _default;
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* Chakra Number Value | Chakra Name value | DS Variable
|
|
24
24
|
* ------------------- | ----------------- | -----------------
|
|
25
|
+
* 0.5 | xxxs | --nypl-space-xxxs
|
|
25
26
|
* 1 | xxs | --nypl-space-xxs
|
|
26
27
|
* 2 | xs | --nypl-space-xs
|
|
27
28
|
* 4 | s | --nypl-space-s
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
export declare const spacing: {
|
|
35
36
|
px: string;
|
|
36
37
|
0: string;
|
|
38
|
+
xxxs: string;
|
|
37
39
|
0.5: string;
|
|
38
40
|
xxs: string;
|
|
39
41
|
1: string;
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -10,3 +10,13 @@ export declare const range: (start: number, stop: number, step?: number) => numb
|
|
|
10
10
|
* value, if provided, will be used.
|
|
11
11
|
*/
|
|
12
12
|
export declare const getVariant: (variant: any, collection: any, fallback?: any) => any;
|
|
13
|
+
/**
|
|
14
|
+
* Given an enum object and its name, this will return (1) an array `options`
|
|
15
|
+
* of all values with the enum name as the prefix, and (2) a function that
|
|
16
|
+
* returns the correct enum value given a string from the `options` array.
|
|
17
|
+
* @NOTE this is only used for Storybook documentation.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getStorybookEnumValues: (enumObject: any, name: any) => {
|
|
20
|
+
options: string[];
|
|
21
|
+
getValue: (key: any) => any;
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nypl/design-system-react-components",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.9",
|
|
4
4
|
"description": "Design System React Components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"src"
|
|
15
15
|
],
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">10
|
|
17
|
+
"node": ">10"
|
|
18
18
|
},
|
|
19
19
|
"author": "NYPL",
|
|
20
20
|
"license": "Apache-2.0",
|
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
"jest": "27.3.1",
|
|
117
117
|
"jest-axe": "5.0.1",
|
|
118
118
|
"jsdom": "15.2.1",
|
|
119
|
-
"node-sass": "4.14.1",
|
|
120
119
|
"node-sass-glob-importer": "5.3.2",
|
|
121
120
|
"normalize.css": "8.0.1",
|
|
122
121
|
"postcss": "8.3.6",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { range } from "../../utils/utils";
|
|
1
|
+
import { getStorybookEnumValues, range } from "../../utils/utils";
|
|
2
|
+
import { ButtonTypes } from "../../components/Button/ButtonTypes";
|
|
2
3
|
|
|
3
4
|
describe("range", () => {
|
|
4
5
|
it("returns an array of values not including the stop argument", () => {
|
|
@@ -16,3 +17,24 @@ describe("range", () => {
|
|
|
16
17
|
expect(range(2, 20, 5)).toEqual([2, 7, 12, 17]);
|
|
17
18
|
});
|
|
18
19
|
});
|
|
20
|
+
|
|
21
|
+
describe("getStorybookEnumValues", () => {
|
|
22
|
+
const enumValues = getStorybookEnumValues(ButtonTypes, "ButtonTypes");
|
|
23
|
+
|
|
24
|
+
it("returns an array of values from the enum passed", () => {
|
|
25
|
+
expect(enumValues.options).toEqual([
|
|
26
|
+
"ButtonTypes.Primary",
|
|
27
|
+
"ButtonTypes.Secondary",
|
|
28
|
+
"ButtonTypes.Callout",
|
|
29
|
+
"ButtonTypes.Pill",
|
|
30
|
+
"ButtonTypes.Link",
|
|
31
|
+
"ButtonTypes.NoBrand",
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("returns a function with the value of the argument passed", () => {
|
|
36
|
+
expect(enumValues.getValue("ButtonTypes.Primary")).toEqual("primary");
|
|
37
|
+
expect(enumValues.getValue("ButtonTypes.Callout")).toEqual("callout");
|
|
38
|
+
expect(enumValues.getValue("ButtonTypes.NoBrand")).toEqual("noBrand");
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Meta,
|
|
3
|
-
Story,
|
|
4
2
|
ArgsTable,
|
|
5
3
|
Canvas,
|
|
6
4
|
Description,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Meta,
|
|
6
|
+
Story,
|
|
7
|
+
} from "@storybook/addon-docs";
|
|
8
|
+
import ReactDOMServer from "react-dom/server";
|
|
9
9
|
import { withDesign } from "storybook-addon-designs";
|
|
10
|
+
|
|
11
|
+
import Accordion from "./Accordion";
|
|
10
12
|
import Card, { CardHeading, CardContent } from "../Card/Card";
|
|
11
13
|
import { CardLayouts } from "../Card/CardTypes";
|
|
12
|
-
import { ImageRatios } from "../Image/ImageTypes";
|
|
13
14
|
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
14
|
-
import {
|
|
15
|
-
import ReactDOMServer from "react-dom/server";
|
|
15
|
+
import { ImageRatios } from "../Image/ImageTypes";
|
|
16
16
|
import { getCategory } from "../../utils/componentCategories";
|
|
17
17
|
|
|
18
18
|
<Meta
|
|
@@ -22,14 +22,14 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
22
22
|
parameters={{
|
|
23
23
|
design: {
|
|
24
24
|
type: "figma",
|
|
25
|
-
url:
|
|
26
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=10734%3A2520",
|
|
25
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=10734%3A2520",
|
|
27
26
|
},
|
|
28
27
|
jest: ["Accordion.test.tsx"],
|
|
29
28
|
}}
|
|
30
29
|
argTypes={{
|
|
31
|
-
contentData: {
|
|
32
|
-
id: {
|
|
30
|
+
contentData: { control: false },
|
|
31
|
+
id: { control: false },
|
|
32
|
+
isDefaultOpen: { table: { defaultValue: { summary: false } } },
|
|
33
33
|
}}
|
|
34
34
|
/>
|
|
35
35
|
|
|
@@ -57,9 +57,8 @@ necessary icon, Chakra components, and styles.
|
|
|
57
57
|
|
|
58
58
|
<Canvas withToolbar>
|
|
59
59
|
<Story
|
|
60
|
-
name="
|
|
60
|
+
name="Accordion with Controls"
|
|
61
61
|
args={{
|
|
62
|
-
isDefaultOpen: false,
|
|
63
62
|
contentData: [
|
|
64
63
|
{
|
|
65
64
|
label: "Tom Nook",
|
|
@@ -83,6 +82,8 @@ necessary icon, Chakra components, and styles.
|
|
|
83
82
|
),
|
|
84
83
|
},
|
|
85
84
|
],
|
|
85
|
+
id: "accordion-id",
|
|
86
|
+
isDefaultOpen: false,
|
|
86
87
|
}}
|
|
87
88
|
>
|
|
88
89
|
{(args) => <Accordion {...args} />}
|
|
@@ -119,7 +120,7 @@ const contentData = [
|
|
|
119
120
|
<Accordion contentData={contentData} />
|
|
120
121
|
```
|
|
121
122
|
|
|
122
|
-
<ArgsTable story="
|
|
123
|
+
<ArgsTable story="Accordion with Controls" />
|
|
123
124
|
|
|
124
125
|
## FAQ example
|
|
125
126
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Meta, Story
|
|
1
|
+
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
|
2
2
|
import Autosuggest from "react-autosuggest";
|
|
3
|
+
|
|
3
4
|
import * as stories from "./Autosuggest.stories.tsx";
|
|
4
5
|
import { getCategory } from "../../utils/componentCategories";
|
|
5
6
|
|
|
@@ -3,10 +3,7 @@ import React, { useState } from "react";
|
|
|
3
3
|
import Autosuggest from "react-autosuggest";
|
|
4
4
|
import Icon from "../Icons/Icon";
|
|
5
5
|
import { IconNames } from "../Icons/IconTypes";
|
|
6
|
-
import
|
|
7
|
-
import Input from "../Input/Input";
|
|
8
|
-
import { InputTypes } from "../Input/InputTypes";
|
|
9
|
-
import HelperErrorText from "../HelperErrorText/HelperErrorText";
|
|
6
|
+
import TextInput from "../TextInput/TextInput";
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* StoryWrapper
|
|
@@ -21,29 +18,16 @@ const libraryRenderInputComponent = (
|
|
|
21
18
|
inputProps: React.HTMLProps<HTMLInputElement>
|
|
22
19
|
) => {
|
|
23
20
|
return (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{'"'}ba{'"'}.
|
|
35
|
-
</HelperErrorText>
|
|
36
|
-
<Input
|
|
37
|
-
type={InputTypes.text}
|
|
38
|
-
id="library-autosuggest"
|
|
39
|
-
aria-required={true}
|
|
40
|
-
aria-labelledby="library-autosuggest-label id-helperText"
|
|
41
|
-
attributes={{
|
|
42
|
-
name: "homeLibraryName",
|
|
43
|
-
...inputProps,
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
</>
|
|
21
|
+
<TextInput
|
|
22
|
+
attributes={{
|
|
23
|
+
...inputProps,
|
|
24
|
+
}}
|
|
25
|
+
id="library-autosuggest"
|
|
26
|
+
isRequired
|
|
27
|
+
labelText="Home Library"
|
|
28
|
+
name="homeLibraryName"
|
|
29
|
+
helperText="Select your home library. Start by typing the name of the library. Try 'ba'."
|
|
30
|
+
/>
|
|
47
31
|
);
|
|
48
32
|
};
|
|
49
33
|
|
|
@@ -148,20 +132,14 @@ const FishExample = () => {
|
|
|
148
132
|
];
|
|
149
133
|
const renderInputComponent = (inputProps) => {
|
|
150
134
|
return (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
attributes={{
|
|
160
|
-
name: "favoriteFish",
|
|
161
|
-
...inputProps,
|
|
162
|
-
}}
|
|
163
|
-
/>
|
|
164
|
-
</>
|
|
135
|
+
<TextInput
|
|
136
|
+
attributes={{
|
|
137
|
+
...inputProps,
|
|
138
|
+
}}
|
|
139
|
+
id="library-fish-autosuggest"
|
|
140
|
+
labelText="Fish in Animal Crossing"
|
|
141
|
+
name="favoriteFish"
|
|
142
|
+
/>
|
|
165
143
|
);
|
|
166
144
|
};
|
|
167
145
|
const onChange = (_: any, { newValue }) => setValue(newValue);
|
|
@@ -218,16 +196,14 @@ const searchBarRenderInputComponent = (
|
|
|
218
196
|
inputProps: React.HTMLProps<HTMLInputElement>
|
|
219
197
|
) => {
|
|
220
198
|
return (
|
|
221
|
-
<
|
|
222
|
-
type={InputTypes.text}
|
|
223
|
-
id="autosuggest-searchBar"
|
|
224
|
-
aria-required={true}
|
|
225
|
-
ariaLabelledBy="autosuggest-button"
|
|
199
|
+
<TextInput
|
|
226
200
|
attributes={{
|
|
227
|
-
name: "homeLibraryName",
|
|
228
|
-
"aria-describedby": "autosuggest-helperText",
|
|
229
201
|
...inputProps,
|
|
230
202
|
}}
|
|
203
|
+
id="autosuggest-searchBar"
|
|
204
|
+
isRequired
|
|
205
|
+
labelText="home library"
|
|
206
|
+
name="homeLibraryName"
|
|
231
207
|
/>
|
|
232
208
|
);
|
|
233
209
|
};
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
width: 100%;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.react-autosuggest__input {
|
|
9
|
-
@extend .input;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
.react-autosuggest__input--focused {
|
|
13
9
|
outline: none;
|
|
14
10
|
}
|
|
@@ -28,9 +24,9 @@
|
|
|
28
24
|
background-color: var(--nypl-colors-ui-white);
|
|
29
25
|
display: block;
|
|
30
26
|
font-weight: 300;
|
|
31
|
-
margin-top:
|
|
27
|
+
margin-top: 1px; // accounts for the focus ring on the input
|
|
32
28
|
outline: 1px solid var(--nypl-colors-ui-gray-light-cool);
|
|
33
|
-
position:
|
|
29
|
+
position: relative;
|
|
34
30
|
width: 100%;
|
|
35
31
|
z-index: 2;
|
|
36
32
|
}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Meta,
|
|
3
|
-
Story,
|
|
4
|
-
Canvas,
|
|
5
2
|
ArgsTable,
|
|
3
|
+
Canvas,
|
|
6
4
|
Description,
|
|
7
|
-
|
|
5
|
+
Meta,
|
|
6
|
+
Story,
|
|
7
|
+
} from "@storybook/addon-docs";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
10
|
import Breadcrumbs from "./Breadcrumbs";
|
|
11
11
|
import { ColorVariants } from "./BreadcrumbsTypes";
|
|
12
|
-
import DSProvider from "../../theme/provider";
|
|
13
12
|
import Heading from "../Heading/Heading";
|
|
14
13
|
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
15
14
|
import Link from "../Link/Link";
|
|
16
15
|
import { getCategory } from "../../utils/componentCategories";
|
|
16
|
+
import DSProvider from "../../theme/provider";
|
|
17
|
+
import { getStorybookEnumValues } from "../../utils/utils";
|
|
18
|
+
|
|
19
|
+
export const enumValues = getStorybookEnumValues(
|
|
20
|
+
ColorVariants,
|
|
21
|
+
"ColorVariants"
|
|
22
|
+
);
|
|
17
23
|
|
|
18
24
|
<Meta
|
|
19
25
|
title={getCategory("Breadcrumbs")}
|
|
@@ -28,8 +34,13 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
28
34
|
}}
|
|
29
35
|
argTypes={{
|
|
30
36
|
additionalStyles: { control: false },
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
breadcrumbsData: { control: false },
|
|
38
|
+
className: { control: false },
|
|
39
|
+
colorVariant: {
|
|
40
|
+
control: { type: "select" },
|
|
41
|
+
options: enumValues.options,
|
|
42
|
+
},
|
|
43
|
+
id: { control: false },
|
|
33
44
|
}}
|
|
34
45
|
/>
|
|
35
46
|
|
|
@@ -38,7 +49,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
38
49
|
| Component Version | DS Version |
|
|
39
50
|
| ----------------- | ---------- |
|
|
40
51
|
| Added | `0.0.3` |
|
|
41
|
-
| Latest | `0.25.
|
|
52
|
+
| Latest | `0.25.8` |
|
|
42
53
|
|
|
43
54
|
<Description of={Breadcrumbs} />
|
|
44
55
|
|
|
@@ -46,21 +57,29 @@ The `Breadcrumbs` component is a navigation element that provides a breadcrumb p
|
|
|
46
57
|
|
|
47
58
|
<Canvas withToolbar>
|
|
48
59
|
<Story
|
|
49
|
-
name="Breadcrumbs
|
|
60
|
+
name="Breadcrumbs with Controls"
|
|
50
61
|
args={{
|
|
62
|
+
additionalStyles: undefined,
|
|
51
63
|
breadcrumbsData: [
|
|
52
64
|
{ url: "#", text: "Parent" },
|
|
53
65
|
{ url: "#", text: "Child" },
|
|
54
66
|
{ url: "#", text: "Grandchild" },
|
|
55
67
|
],
|
|
56
|
-
|
|
68
|
+
className: undefined,
|
|
69
|
+
colorVariant: undefined,
|
|
70
|
+
id: "breadcrumbs-id",
|
|
57
71
|
}}
|
|
58
72
|
>
|
|
59
|
-
{(args) =>
|
|
73
|
+
{(args) => (
|
|
74
|
+
<Breadcrumbs
|
|
75
|
+
{...args}
|
|
76
|
+
colorVariant={enumValues.getValue(args.colorVariant)}
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
60
79
|
</Story>
|
|
61
80
|
</Canvas>
|
|
62
81
|
|
|
63
|
-
<ArgsTable story="Breadcrumbs
|
|
82
|
+
<ArgsTable story="Breadcrumbs with Controls" />
|
|
64
83
|
|
|
65
84
|
### Long Titles
|
|
66
85
|
|
|
@@ -91,12 +110,12 @@ The `Breadcrumbs` component background color can be set using the `colorVariant`
|
|
|
91
110
|
<Story
|
|
92
111
|
name="Color Variations"
|
|
93
112
|
args={{
|
|
94
|
-
colorVariant: ColorVariants.
|
|
113
|
+
colorVariant: ColorVariants.Blogs,
|
|
95
114
|
}}
|
|
96
115
|
>
|
|
97
116
|
{(args) => (
|
|
98
117
|
<>
|
|
99
|
-
<Heading level={HeadingLevels.Three}>
|
|
118
|
+
<Heading level={HeadingLevels.Three}>Blogs</Heading>
|
|
100
119
|
<Breadcrumbs
|
|
101
120
|
breadcrumbsData={[
|
|
102
121
|
{ url: "#", text: "Parent" },
|
|
@@ -113,6 +132,23 @@ The `Breadcrumbs` component background color can be set using the `colorVariant`
|
|
|
113
132
|
</Story>
|
|
114
133
|
</Canvas>
|
|
115
134
|
|
|
135
|
+
<Canvas>
|
|
136
|
+
<DSProvider>
|
|
137
|
+
<Heading level={HeadingLevels.Three}>Books and More</Heading>
|
|
138
|
+
<Breadcrumbs
|
|
139
|
+
breadcrumbsData={[
|
|
140
|
+
{ url: "#", text: "Parent" },
|
|
141
|
+
{ url: "#", text: "Child" },
|
|
142
|
+
{
|
|
143
|
+
url: "#",
|
|
144
|
+
text: "Grandchild",
|
|
145
|
+
},
|
|
146
|
+
]}
|
|
147
|
+
colorVariant={ColorVariants.BooksAndMore}
|
|
148
|
+
/>
|
|
149
|
+
</DSProvider>
|
|
150
|
+
</Canvas>
|
|
151
|
+
|
|
116
152
|
<Canvas>
|
|
117
153
|
<DSProvider>
|
|
118
154
|
<Heading level={HeadingLevels.Three}>Locations</Heading>
|
|
@@ -41,6 +41,24 @@ describe("Breadcrumbs Snapshot", () => {
|
|
|
41
41
|
/>
|
|
42
42
|
)
|
|
43
43
|
.toJSON();
|
|
44
|
+
const breadcrumbsBlogsVariant = renderer
|
|
45
|
+
.create(
|
|
46
|
+
<Breadcrumbs
|
|
47
|
+
breadcrumbsData={breadcrumbsData}
|
|
48
|
+
colorVariant={ColorVariants.Blogs}
|
|
49
|
+
id="breadcrumbs-test"
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
.toJSON();
|
|
53
|
+
const breadcrumbsLocationsVariant = renderer
|
|
54
|
+
.create(
|
|
55
|
+
<Breadcrumbs
|
|
56
|
+
breadcrumbsData={breadcrumbsData}
|
|
57
|
+
colorVariant={ColorVariants.Blogs}
|
|
58
|
+
id="breadcrumbs-test"
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
.toJSON();
|
|
44
62
|
const breadcrumbsAdditionalStyles = renderer
|
|
45
63
|
.create(
|
|
46
64
|
<Breadcrumbs
|
|
@@ -55,6 +73,8 @@ describe("Breadcrumbs Snapshot", () => {
|
|
|
55
73
|
|
|
56
74
|
expect(breadcrumbsSnapshot).toMatchSnapshot();
|
|
57
75
|
expect(breadcrumbsVariantColor).toMatchSnapshot();
|
|
76
|
+
expect(breadcrumbsBlogsVariant).toMatchSnapshot();
|
|
77
|
+
expect(breadcrumbsLocationsVariant).toMatchSnapshot();
|
|
58
78
|
expect(breadcrumbsAdditionalStyles).toMatchSnapshot();
|
|
59
79
|
});
|
|
60
80
|
});
|