@nypl/design-system-react-components 0.27.0 → 0.28.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 +29 -0
- 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/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 +856 -1155
- 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 +858 -1220
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/types.d.ts +1 -0
- package/dist/index.d.ts +26 -47
- 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 -4
- 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 +2 -2
- 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 +143 -177
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Chakra/Box.stories.mdx +2 -6
- package/src/components/Chakra/Center.stories.mdx +5 -23
- package/src/components/Chakra/Flex.stories.mdx +4 -6
- package/src/components/Chakra/Stack.stories.mdx +9 -10
- 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 -80
- package/src/components/Link/Link.test.tsx +25 -53
- 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 +8 -9
- package/src/components/Modal/Modal.test.tsx +5 -10
- package/src/components/Modal/Modal.tsx +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +0 -12
- package/src/components/Select/Select.stories.mdx +8 -23
- package/src/components/Select/Select.test.tsx +6 -7
- package/src/components/Select/Select.tsx +13 -26
- 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 +62 -62
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +7 -8
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +0 -1
- package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +15 -18
- 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 +51 -45
- 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 -2
- 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/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/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
|
@@ -4,7 +4,6 @@ import { axe } from "jest-axe";
|
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
6
|
import Image from "./Image";
|
|
7
|
-
import { ImageRatios, ImageSizes, ImageTypes } from "./ImageTypes";
|
|
8
7
|
|
|
9
8
|
describe("Image Accessibility", () => {
|
|
10
9
|
it("passes axe accessibility for regular img element", async () => {
|
|
@@ -76,66 +75,52 @@ describe("Image", () => {
|
|
|
76
75
|
.create(<Image src="test.png" alt="" caption="Caption" credit="Credit" />)
|
|
77
76
|
.toJSON();
|
|
78
77
|
const sizeExtraExtraSmall = renderer
|
|
79
|
-
.create(<Image src="test.png" alt="" size=
|
|
78
|
+
.create(<Image src="test.png" alt="" size="xxsmall" />)
|
|
80
79
|
.toJSON();
|
|
81
80
|
const sizeExtraSmall = renderer
|
|
82
|
-
.create(<Image src="test.png" alt="" size=
|
|
81
|
+
.create(<Image src="test.png" alt="" size="xsmall" />)
|
|
83
82
|
.toJSON();
|
|
84
83
|
const sizeSmall = renderer
|
|
85
|
-
.create(<Image src="test.png" alt="" size=
|
|
84
|
+
.create(<Image src="test.png" alt="" size="small" />)
|
|
86
85
|
.toJSON();
|
|
87
86
|
const sizeMedium = renderer
|
|
88
|
-
.create(<Image src="test.png" alt="" size=
|
|
87
|
+
.create(<Image src="test.png" alt="" size="medium" />)
|
|
89
88
|
.toJSON();
|
|
90
89
|
const sizeLarge = renderer
|
|
91
|
-
.create(<Image src="test.png" alt="" size=
|
|
90
|
+
.create(<Image src="test.png" alt="" size="large" />)
|
|
92
91
|
.toJSON();
|
|
93
92
|
const ratioFourByThree = renderer
|
|
94
|
-
.create(
|
|
95
|
-
<Image src="test.png" alt="" aspectRatio={ImageRatios.FourByThree} />
|
|
96
|
-
)
|
|
93
|
+
.create(<Image src="test.png" alt="" aspectRatio="fourByThree" />)
|
|
97
94
|
.toJSON();
|
|
98
95
|
const ratioOneByTwo = renderer
|
|
99
|
-
.create(
|
|
100
|
-
<Image src="test.png" alt="" aspectRatio={ImageRatios.OneByTwo} />
|
|
101
|
-
)
|
|
96
|
+
.create(<Image src="test.png" alt="" aspectRatio="oneByTwo" />)
|
|
102
97
|
.toJSON();
|
|
103
98
|
const ratioOriginal = renderer
|
|
104
|
-
.create(
|
|
105
|
-
<Image src="test.png" alt="" aspectRatio={ImageRatios.Original} />
|
|
106
|
-
)
|
|
99
|
+
.create(<Image src="test.png" alt="" aspectRatio="original" />)
|
|
107
100
|
.toJSON();
|
|
108
101
|
const ratioSixteenByNine = renderer
|
|
109
|
-
.create(
|
|
110
|
-
<Image src="test.png" alt="" aspectRatio={ImageRatios.SixteenByNine} />
|
|
111
|
-
)
|
|
102
|
+
.create(<Image src="test.png" alt="" aspectRatio="sixteenByNine" />)
|
|
112
103
|
.toJSON();
|
|
113
104
|
const ratioSquare = renderer
|
|
114
|
-
.create(<Image src="test.png" alt="" aspectRatio=
|
|
105
|
+
.create(<Image src="test.png" alt="" aspectRatio="square" />)
|
|
115
106
|
.toJSON();
|
|
116
107
|
const ratioThreeByFour = renderer
|
|
117
|
-
.create(
|
|
118
|
-
<Image src="test.png" alt="" aspectRatio={ImageRatios.ThreeByFour} />
|
|
119
|
-
)
|
|
108
|
+
.create(<Image src="test.png" alt="" aspectRatio="threeByFour" />)
|
|
120
109
|
.toJSON();
|
|
121
110
|
const ratioThreeByTwo = renderer
|
|
122
|
-
.create(
|
|
123
|
-
<Image src="test.png" alt="" aspectRatio={ImageRatios.ThreeByTwo} />
|
|
124
|
-
)
|
|
111
|
+
.create(<Image src="test.png" alt="" aspectRatio="threeByTwo" />)
|
|
125
112
|
.toJSON();
|
|
126
113
|
const ratioTwoByOne = renderer
|
|
127
|
-
.create(
|
|
128
|
-
<Image src="test.png" alt="" aspectRatio={ImageRatios.TwoByOne} />
|
|
129
|
-
)
|
|
114
|
+
.create(<Image src="test.png" alt="" aspectRatio="twoByOne" />)
|
|
130
115
|
.toJSON();
|
|
131
116
|
const typeCircle = renderer
|
|
132
117
|
.create(
|
|
133
118
|
<Image
|
|
134
119
|
src="test.png"
|
|
135
120
|
alt=""
|
|
136
|
-
aspectRatio=
|
|
137
|
-
size=
|
|
138
|
-
imageType=
|
|
121
|
+
aspectRatio="square"
|
|
122
|
+
size="small"
|
|
123
|
+
imageType="circle"
|
|
139
124
|
/>
|
|
140
125
|
)
|
|
141
126
|
.toJSON();
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { Box, chakra, useMultiStyleConfig } from "@chakra-ui/react";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export type ImageRatios =
|
|
5
|
+
| "fourByThree"
|
|
6
|
+
| "oneByTwo"
|
|
7
|
+
| "original"
|
|
8
|
+
| "sixteenByNine"
|
|
9
|
+
| "square"
|
|
10
|
+
| "threeByFour"
|
|
11
|
+
| "threeByTwo"
|
|
12
|
+
| "twoByOne";
|
|
13
|
+
export type ImageSizes =
|
|
14
|
+
| "default"
|
|
15
|
+
| "xxsmall"
|
|
16
|
+
| "xsmall"
|
|
17
|
+
| "small"
|
|
18
|
+
| "medium"
|
|
19
|
+
| "large";
|
|
20
|
+
export type ImageTypes = "default" | "circle";
|
|
6
21
|
// Used for components that have an `imageProps` prop.
|
|
7
22
|
export interface ComponentImageProps {
|
|
8
23
|
/** String value used to populate the `alt` attribute of the internal `Image`
|
|
@@ -18,7 +33,7 @@ export interface ComponentImageProps {
|
|
|
18
33
|
/** Optional value to render as a credit for the internal `Image` component. */
|
|
19
34
|
credit?: string;
|
|
20
35
|
/** Optional value to control the size of the internal `Image` component.
|
|
21
|
-
* Defaults to `ImageSizes.
|
|
36
|
+
* Defaults to `ImageSizes.Default`. */
|
|
22
37
|
size?: ImageSizes;
|
|
23
38
|
/** Optional value that contains the path to an image. If omitted, the internal
|
|
24
39
|
* DS `Image` component will not render. */
|
|
@@ -30,7 +45,8 @@ interface ImageWrapperProps {
|
|
|
30
45
|
additionalWrapperStyles?: { [key: string]: any };
|
|
31
46
|
/** ClassName you can add in addition to 'image' */
|
|
32
47
|
className?: string;
|
|
33
|
-
/** Optional value to control the aspect ratio of the
|
|
48
|
+
/** Optional value to control the aspect ratio of the card image; default
|
|
49
|
+
* value is `"original"` */
|
|
34
50
|
aspectRatio?: ImageRatios;
|
|
35
51
|
/** Optional value to control the size of the image */
|
|
36
52
|
size?: ImageSizes;
|
|
@@ -42,7 +58,7 @@ export interface ImageProps extends ImageWrapperProps {
|
|
|
42
58
|
/** Optionally pass in additional Chakra-based styles only for the image. */
|
|
43
59
|
additionalImageStyles?: { [key: string]: any };
|
|
44
60
|
/** Alternate text description of the image */
|
|
45
|
-
alt
|
|
61
|
+
alt?: string;
|
|
46
62
|
/** Adding will wrap the image in a <figure> */
|
|
47
63
|
caption?: string;
|
|
48
64
|
/** Custom image component */
|
|
@@ -52,7 +68,7 @@ export interface ImageProps extends ImageWrapperProps {
|
|
|
52
68
|
/** Optional value for the image type */
|
|
53
69
|
imageType?: ImageTypes;
|
|
54
70
|
/** The src attribute is required, and contains the path to the image you want to embed. */
|
|
55
|
-
src
|
|
71
|
+
src?: string;
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
const ImageWrapper = chakra(
|
|
@@ -61,8 +77,8 @@ const ImageWrapper = chakra(
|
|
|
61
77
|
additionalWrapperStyles = {},
|
|
62
78
|
className = "",
|
|
63
79
|
children,
|
|
64
|
-
aspectRatio =
|
|
65
|
-
size =
|
|
80
|
+
aspectRatio = "original",
|
|
81
|
+
size = "default",
|
|
66
82
|
...rest
|
|
67
83
|
} = props;
|
|
68
84
|
const styles = useMultiStyleConfig("CustomImageWrapper", {
|
|
@@ -89,17 +105,17 @@ export const Image = chakra((props: ImageProps) => {
|
|
|
89
105
|
additionalImageStyles = {},
|
|
90
106
|
additionalWrapperStyles = {},
|
|
91
107
|
alt,
|
|
92
|
-
aspectRatio =
|
|
108
|
+
aspectRatio = "original",
|
|
93
109
|
caption,
|
|
94
110
|
className = "",
|
|
95
111
|
component,
|
|
96
112
|
credit,
|
|
97
|
-
imageType =
|
|
98
|
-
size =
|
|
113
|
+
imageType = "default",
|
|
114
|
+
size = "default",
|
|
99
115
|
src,
|
|
100
116
|
...rest
|
|
101
117
|
} = props;
|
|
102
|
-
const useImageWrapper = aspectRatio !==
|
|
118
|
+
const useImageWrapper = aspectRatio !== "original";
|
|
103
119
|
const styles = useMultiStyleConfig("CustomImage", {
|
|
104
120
|
variant: imageType,
|
|
105
121
|
size,
|
|
@@ -9,14 +9,9 @@ import {
|
|
|
9
9
|
import { withDesign } from "storybook-addon-designs";
|
|
10
10
|
|
|
11
11
|
import Link from "./Link";
|
|
12
|
-
import { LinkTypes } from "./LinkTypes";
|
|
13
12
|
import Icon from "../Icons/Icon";
|
|
14
|
-
import { IconAlign, IconNames, IconSizes } from "../Icons/IconTypes";
|
|
15
13
|
import { getCategory } from "../../utils/componentCategories";
|
|
16
14
|
import DSProvider from "../../theme/provider";
|
|
17
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
18
|
-
|
|
19
|
-
export const enumValues = getStorybookEnumValues(LinkTypes, "LinkTypes");
|
|
20
15
|
|
|
21
16
|
<Meta
|
|
22
17
|
title={getCategory("Link")}
|
|
@@ -30,15 +25,11 @@ export const enumValues = getStorybookEnumValues(LinkTypes, "LinkTypes");
|
|
|
30
25
|
jest: ["Link.test.tsx"],
|
|
31
26
|
}}
|
|
32
27
|
argTypes={{
|
|
33
|
-
additionalStyles: { control: false },
|
|
34
|
-
attributes: { control: false },
|
|
35
28
|
children: { table: { disable: true } },
|
|
36
29
|
key: { table: { disable: true } },
|
|
37
30
|
ref: { table: { disable: true } },
|
|
38
31
|
type: {
|
|
39
|
-
|
|
40
|
-
table: { defaultValue: { summary: "LinkTypes.Default" } },
|
|
41
|
-
options: enumValues.options,
|
|
32
|
+
table: { defaultValue: { summary: "default" } },
|
|
42
33
|
},
|
|
43
34
|
}}
|
|
44
35
|
/>
|
|
@@ -48,7 +39,7 @@ export const enumValues = getStorybookEnumValues(LinkTypes, "LinkTypes");
|
|
|
48
39
|
| Component Version | DS Version |
|
|
49
40
|
| ----------------- | ---------- |
|
|
50
41
|
| Added | `0.0.4` |
|
|
51
|
-
| Latest | `0.
|
|
42
|
+
| Latest | `0.28.0` |
|
|
52
43
|
|
|
53
44
|
## Table of Contents
|
|
54
45
|
|
|
@@ -69,22 +60,13 @@ export const enumValues = getStorybookEnumValues(LinkTypes, "LinkTypes");
|
|
|
69
60
|
<Story
|
|
70
61
|
name="Link with Controls"
|
|
71
62
|
args={{
|
|
72
|
-
additionalStyles: undefined,
|
|
73
|
-
attributes: {
|
|
74
|
-
rel: "nofollow",
|
|
75
|
-
onClick: (e) => e.preventDefault(),
|
|
76
|
-
},
|
|
77
63
|
className: "custom-class",
|
|
78
64
|
href: "https://nypl.org",
|
|
79
65
|
id: "nypl-link",
|
|
80
|
-
type: "
|
|
66
|
+
type: "action",
|
|
81
67
|
}}
|
|
82
68
|
>
|
|
83
|
-
{(args) =>
|
|
84
|
-
<Link {...args} type={enumValues.getValue(args.type)}>
|
|
85
|
-
Link
|
|
86
|
-
</Link>
|
|
87
|
-
)}
|
|
69
|
+
{(args) => <Link {...args}>Link</Link>}
|
|
88
70
|
</Story>
|
|
89
71
|
</Canvas>
|
|
90
72
|
|
|
@@ -104,35 +86,27 @@ Resources:
|
|
|
104
86
|
## Links With Icons
|
|
105
87
|
|
|
106
88
|
To render an `Icon` as part of the link, make sure that the `Link` component
|
|
107
|
-
wraps the `Icon`. Use `type=
|
|
89
|
+
wraps the `Icon`. Use `type="action"` to apply appropriate styling to
|
|
108
90
|
links with icons. Icons can be rendered to the left or right of the link text.
|
|
109
91
|
|
|
110
92
|
<Canvas>
|
|
111
93
|
<Story name="With Icons">
|
|
112
94
|
<VStack spacing="xs" align="flex-start">
|
|
113
|
-
<Link type=
|
|
114
|
-
<Icon name="headset" align=
|
|
95
|
+
<Link type="action" href="#passed-in-link">
|
|
96
|
+
<Icon name="headset" align="left" size="small" />
|
|
115
97
|
Headset Link
|
|
116
98
|
</Link>
|
|
117
|
-
<Link type=
|
|
118
|
-
<Icon name="clock" align=
|
|
99
|
+
<Link type="action" href="#passed-in-link">
|
|
100
|
+
<Icon name="clock" align="left" size="small" />
|
|
119
101
|
Clock Link
|
|
120
102
|
</Link>
|
|
121
|
-
<Link type=
|
|
122
|
-
<Icon
|
|
123
|
-
name={IconNames.Check}
|
|
124
|
-
align={IconAlign.Left}
|
|
125
|
-
size={IconSizes.Small}
|
|
126
|
-
/>
|
|
103
|
+
<Link type="action" href="#passed-in-link">
|
|
104
|
+
<Icon name="check" align="left" size="small" />
|
|
127
105
|
Check Link
|
|
128
106
|
</Link>
|
|
129
|
-
<Link type=
|
|
107
|
+
<Link type="action" href="#passed-in-link-right">
|
|
130
108
|
Check Link Right
|
|
131
|
-
<Icon
|
|
132
|
-
name={IconNames.Check}
|
|
133
|
-
align={IconAlign.Right}
|
|
134
|
-
size={IconSizes.Small}
|
|
135
|
-
/>
|
|
109
|
+
<Icon name="check" align="right" size="small" />
|
|
136
110
|
</Link>
|
|
137
111
|
</VStack>
|
|
138
112
|
</Story>
|
|
@@ -145,21 +119,21 @@ can use the `href` prop to generate an `<a>` element.
|
|
|
145
119
|
|
|
146
120
|
```jsx
|
|
147
121
|
// Existing anchor element
|
|
148
|
-
<Link type=
|
|
122
|
+
<Link type="action">
|
|
149
123
|
<a href="#existing-anchor-tag">link</a>
|
|
150
124
|
</Link>
|
|
151
125
|
|
|
152
126
|
// Also works with an icon component. Make sure to wrap the icon and anchor
|
|
153
127
|
// in a single element for this pattern.
|
|
154
|
-
<Link type=
|
|
128
|
+
<Link type="action">
|
|
155
129
|
<>
|
|
156
|
-
<Icon name=
|
|
130
|
+
<Icon name="check" align="left" size="small" />
|
|
157
131
|
<a href="#existing-anchor-tag">check link</a>
|
|
158
132
|
</>
|
|
159
133
|
</Link>
|
|
160
134
|
|
|
161
135
|
// Otherwise, the `href` prop will generate an `<a>` tag.
|
|
162
|
-
<Link type=
|
|
136
|
+
<Link type="action" href="#passed-in-link">
|
|
163
137
|
link
|
|
164
138
|
</Link>
|
|
165
139
|
```
|
|
@@ -168,22 +142,18 @@ can use the `href` prop to generate an `<a>` element.
|
|
|
168
142
|
<Story name="Anchor Element Rendering">
|
|
169
143
|
<>
|
|
170
144
|
This is a{" "}
|
|
171
|
-
<Link type=
|
|
145
|
+
<Link type="action">
|
|
172
146
|
<a href="#existing-anchor-tag">link</a>
|
|
173
147
|
</Link>{" "}
|
|
174
148
|
with the <a> element as a child of the `Link` component. This is a{" "}
|
|
175
|
-
<Link type=
|
|
149
|
+
<Link type="action" href="#passed-in-link">
|
|
176
150
|
link
|
|
177
151
|
</Link>{" "}
|
|
178
152
|
where the `Link` component uses the `href` prop and has a string-only
|
|
179
153
|
child. Finally, this is a{" "}
|
|
180
|
-
<Link type=
|
|
154
|
+
<Link type="action">
|
|
181
155
|
<>
|
|
182
|
-
<Icon
|
|
183
|
-
name={IconNames.Check}
|
|
184
|
-
align={IconAlign.Left}
|
|
185
|
-
size={IconSizes.Small}
|
|
186
|
-
/>
|
|
156
|
+
<Icon name="check" align="left" size="small" />
|
|
187
157
|
<a href="#existing-anchor-tag">link</a>
|
|
188
158
|
</>
|
|
189
159
|
</Link>{" "}
|
|
@@ -194,23 +164,6 @@ can use the `href` prop to generate an `<a>` element.
|
|
|
194
164
|
|
|
195
165
|
## Link with Routers
|
|
196
166
|
|
|
197
|
-
<Canvas>
|
|
198
|
-
<Story name="Link with Routers">
|
|
199
|
-
<div>With React Router</div>
|
|
200
|
-
<Router>
|
|
201
|
-
<Link type={LinkTypes.Action}>
|
|
202
|
-
<ReactRouterLink to="#">Next Page</ReactRouterLink>
|
|
203
|
-
</Link>
|
|
204
|
-
</Router>
|
|
205
|
-
<br />
|
|
206
|
-
<br />
|
|
207
|
-
<div>With NextJS</div>
|
|
208
|
-
<NextJsLink href="#" passHref>
|
|
209
|
-
<Link type={LinkTypes.Action}>Next Page</Link>
|
|
210
|
-
</NextJsLink>
|
|
211
|
-
</Story>
|
|
212
|
-
</Canvas>
|
|
213
|
-
|
|
214
167
|
### React Router
|
|
215
168
|
|
|
216
169
|
The Design System's `Link` component should wrap around `react-router`'s own
|
|
@@ -224,9 +177,9 @@ import {
|
|
|
224
177
|
BrowserRouter as Router,
|
|
225
178
|
Link as ReactRouterLink,
|
|
226
179
|
} from "react-router-dom";
|
|
227
|
-
import { Link
|
|
180
|
+
import { Link } from "@nypl/design-system-react-components";
|
|
228
181
|
|
|
229
|
-
<Link type=
|
|
182
|
+
<Link type="action">
|
|
230
183
|
<ReactRouterLink to="#">Next Page</ReactRouterLink>
|
|
231
184
|
</Link>;
|
|
232
185
|
|
|
@@ -234,12 +187,9 @@ import { Link, LinkTypes } from "@nypl/design-system-react-components";
|
|
|
234
187
|
// is not renamed but the DS's `Link` component is renamed
|
|
235
188
|
// to `DSLink`.
|
|
236
189
|
import { BrowserRouter, Link } from "react-router-dom";
|
|
237
|
-
import {
|
|
238
|
-
Link as DSLink,
|
|
239
|
-
LinkTypes,
|
|
240
|
-
} from "@nypl/design-system-react-components";
|
|
190
|
+
import { Link as DSLink } from "@nypl/design-system-react-components";
|
|
241
191
|
|
|
242
|
-
<DSLink type=
|
|
192
|
+
<DSLink type="action">
|
|
243
193
|
<Link to="#">Next Page</Link>
|
|
244
194
|
</DSLink>;
|
|
245
195
|
|
|
@@ -249,7 +199,7 @@ import {
|
|
|
249
199
|
import { BrowserRouter, Link } from "react-router-dom";
|
|
250
200
|
import DS from "@nypl/design-system-react-components";
|
|
251
201
|
|
|
252
|
-
<DS.Link type=
|
|
202
|
+
<DS.Link type="action">
|
|
253
203
|
<Link to="#">Next Page</Link>
|
|
254
204
|
</DS.Link>;
|
|
255
205
|
```
|
|
@@ -263,7 +213,7 @@ These props, along with an implicit `ref` from NextJS and the Design System's
|
|
|
263
213
|
pages in a NextJS app.
|
|
264
214
|
|
|
265
215
|
```jsx
|
|
266
|
-
import { Link
|
|
216
|
+
import { Link } from "@nypl/design-system-react-components";
|
|
267
217
|
|
|
268
218
|
/**
|
|
269
219
|
* This is just an example wrapper that works similarly to NextJS' `Link`
|
|
@@ -279,21 +229,21 @@ export const NextJsLink = (props: HTMLAnchorElement) =>
|
|
|
279
229
|
|
|
280
230
|
// Note that NextJS' `href` and `passHref` props are required.
|
|
281
231
|
<NextJsLink href="#" passHref>
|
|
282
|
-
<Link type=
|
|
232
|
+
<Link type="action">Next Page</Link>
|
|
283
233
|
</NextJsLink>;
|
|
284
234
|
```
|
|
285
235
|
|
|
286
236
|
export const NextJsLink = (props) =>
|
|
287
237
|
React.cloneElement(
|
|
288
238
|
props.children,
|
|
289
|
-
{
|
|
239
|
+
{ href: props.href },
|
|
290
240
|
props.children.props.children
|
|
291
241
|
);
|
|
292
242
|
|
|
293
243
|
<Canvas>
|
|
294
244
|
<DSProvider>
|
|
295
245
|
<NextJsLink href="#" passHref>
|
|
296
|
-
<Link type=
|
|
246
|
+
<Link type="action">Next Page</Link>
|
|
297
247
|
</NextJsLink>
|
|
298
248
|
</DSProvider>
|
|
299
249
|
</Canvas>
|
|
@@ -4,14 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
6
|
import Link from "./Link";
|
|
7
|
-
import { LinkTypes } from "./LinkTypes";
|
|
8
7
|
import Icon from "../Icons/Icon";
|
|
9
|
-
import {
|
|
10
|
-
IconAlign,
|
|
11
|
-
IconNames,
|
|
12
|
-
IconRotationTypes,
|
|
13
|
-
IconSizes,
|
|
14
|
-
} from "../Icons/IconTypes";
|
|
15
8
|
|
|
16
9
|
describe("Link Accessibility", () => {
|
|
17
10
|
it("passes axe accessibility test for children component", async () => {
|
|
@@ -32,12 +25,12 @@ describe("Link Accessibility", () => {
|
|
|
32
25
|
describe("Link", () => {
|
|
33
26
|
it("Can pass in an icon and text as children and url as prop", () => {
|
|
34
27
|
const utils = render(
|
|
35
|
-
<Link href="#passed-in-link" type=
|
|
28
|
+
<Link href="#passed-in-link" type="action">
|
|
36
29
|
<Icon
|
|
37
30
|
className="more-link"
|
|
38
|
-
name=
|
|
39
|
-
align=
|
|
40
|
-
iconRotation=
|
|
31
|
+
name="download"
|
|
32
|
+
align="left"
|
|
33
|
+
iconRotation="rotate0"
|
|
41
34
|
/>
|
|
42
35
|
Download
|
|
43
36
|
</Link>
|
|
@@ -57,13 +50,13 @@ describe("Link", () => {
|
|
|
57
50
|
|
|
58
51
|
it("Can pass a link with <a> tag and an icon", () => {
|
|
59
52
|
const utils = render(
|
|
60
|
-
<Link type=
|
|
53
|
+
<Link type="action">
|
|
61
54
|
<a href="#test2">
|
|
62
55
|
<Icon
|
|
63
56
|
className="more-link"
|
|
64
|
-
name=
|
|
65
|
-
align=
|
|
66
|
-
iconRotation=
|
|
57
|
+
name="download"
|
|
58
|
+
align="left"
|
|
59
|
+
iconRotation="rotate0"
|
|
67
60
|
/>
|
|
68
61
|
Test
|
|
69
62
|
</a>
|
|
@@ -75,25 +68,25 @@ describe("Link", () => {
|
|
|
75
68
|
|
|
76
69
|
it("Generated back link has icon", () => {
|
|
77
70
|
const utils = render(
|
|
78
|
-
<Link href="#passed-in-link" type=
|
|
71
|
+
<Link href="#passed-in-link" type="backwards">
|
|
79
72
|
content
|
|
80
73
|
</Link>
|
|
81
74
|
);
|
|
82
75
|
expect(utils.container.querySelector(".more-link")).toBeInTheDocument();
|
|
83
76
|
expect(
|
|
84
|
-
utils.container.querySelector(".more-link")
|
|
77
|
+
utils.container.querySelector(".more-link")?.getAttribute("class")
|
|
85
78
|
).toContain("chakra-icon more-link");
|
|
86
79
|
});
|
|
87
80
|
|
|
88
81
|
it("Generated forwards link has icon", () => {
|
|
89
82
|
const utils = render(
|
|
90
|
-
<Link href="#passed-in-link" type=
|
|
83
|
+
<Link href="#passed-in-link" type="forwards">
|
|
91
84
|
content
|
|
92
85
|
</Link>
|
|
93
86
|
);
|
|
94
87
|
expect(utils.container.querySelector(".more-link")).toBeInTheDocument();
|
|
95
88
|
expect(
|
|
96
|
-
utils.container.querySelector(".more-link")
|
|
89
|
+
utils.container.querySelector(".more-link")?.getAttribute("class")
|
|
97
90
|
).toContain("chakra-icon more-link");
|
|
98
91
|
});
|
|
99
92
|
|
|
@@ -112,11 +105,7 @@ describe("Link", () => {
|
|
|
112
105
|
expect(() =>
|
|
113
106
|
render(
|
|
114
107
|
<Link>
|
|
115
|
-
<Icon
|
|
116
|
-
name={IconNames.Download}
|
|
117
|
-
align={IconAlign.Left}
|
|
118
|
-
iconRotation={IconRotationTypes.Rotate0}
|
|
119
|
-
/>
|
|
108
|
+
<Icon name="download" align="left" iconRotation="rotate0" />
|
|
120
109
|
<a href="#test">Test</a>
|
|
121
110
|
</Link>
|
|
122
111
|
)
|
|
@@ -126,60 +115,48 @@ describe("Link", () => {
|
|
|
126
115
|
it("renders the UI snapshot correctly", () => {
|
|
127
116
|
const standard = renderer
|
|
128
117
|
.create(
|
|
129
|
-
<Link href="#passed-in-link" id="standard-link" type=
|
|
118
|
+
<Link href="#passed-in-link" id="standard-link" type="action">
|
|
130
119
|
Standard
|
|
131
120
|
</Link>
|
|
132
121
|
)
|
|
133
122
|
.toJSON();
|
|
134
123
|
const typeForwards = renderer
|
|
135
124
|
.create(
|
|
136
|
-
<Link
|
|
137
|
-
href="#passed-in-link"
|
|
138
|
-
id="forwards-link"
|
|
139
|
-
type={LinkTypes.Forwards}
|
|
140
|
-
>
|
|
125
|
+
<Link href="#passed-in-link" id="forwards-link" type="forwards">
|
|
141
126
|
Forwards
|
|
142
127
|
</Link>
|
|
143
128
|
)
|
|
144
129
|
.toJSON();
|
|
145
130
|
const typeBackwards = renderer
|
|
146
131
|
.create(
|
|
147
|
-
<Link
|
|
148
|
-
href="#passed-in-link"
|
|
149
|
-
id="backwards-link"
|
|
150
|
-
type={LinkTypes.Backwards}
|
|
151
|
-
>
|
|
132
|
+
<Link href="#passed-in-link" id="backwards-link" type="backwards">
|
|
152
133
|
Backwards
|
|
153
134
|
</Link>
|
|
154
135
|
)
|
|
155
136
|
.toJSON();
|
|
156
137
|
const typeExternal = renderer
|
|
157
138
|
.create(
|
|
158
|
-
<Link
|
|
159
|
-
href="#passed-in-link"
|
|
160
|
-
id="external-link"
|
|
161
|
-
type={LinkTypes.External}
|
|
162
|
-
>
|
|
139
|
+
<Link href="#passed-in-link" id="external-link" type="external">
|
|
163
140
|
External
|
|
164
141
|
</Link>
|
|
165
142
|
)
|
|
166
143
|
.toJSON();
|
|
167
144
|
const typeButton = renderer
|
|
168
145
|
.create(
|
|
169
|
-
<Link href="#passed-in-link" id="button-link" type=
|
|
146
|
+
<Link href="#passed-in-link" id="button-link" type="button">
|
|
170
147
|
Button
|
|
171
148
|
</Link>
|
|
172
149
|
)
|
|
173
150
|
.toJSON();
|
|
174
151
|
const withIconChild = renderer
|
|
175
152
|
.create(
|
|
176
|
-
<Link href="#passed-in-link" id="icon-link" type=
|
|
153
|
+
<Link href="#passed-in-link" id="icon-link" type="action">
|
|
177
154
|
<Icon
|
|
178
|
-
align=
|
|
155
|
+
align="left"
|
|
179
156
|
className="more-link"
|
|
180
|
-
iconRotation=
|
|
157
|
+
iconRotation="rotate0"
|
|
181
158
|
id="link-icon"
|
|
182
|
-
name=
|
|
159
|
+
name="download"
|
|
183
160
|
/>
|
|
184
161
|
Download
|
|
185
162
|
</Link>
|
|
@@ -187,21 +164,16 @@ describe("Link", () => {
|
|
|
187
164
|
.toJSON();
|
|
188
165
|
const withAchorChild = renderer
|
|
189
166
|
.create(
|
|
190
|
-
<Link id="anchor-link" type=
|
|
167
|
+
<Link id="anchor-link" type="action">
|
|
191
168
|
<a href="#existing-anchor-tag">check link</a>
|
|
192
169
|
</Link>
|
|
193
170
|
)
|
|
194
171
|
.toJSON();
|
|
195
172
|
const withAchorChildAndIcon = renderer
|
|
196
173
|
.create(
|
|
197
|
-
<Link id="anchor-icon-link" type=
|
|
174
|
+
<Link id="anchor-icon-link" type="action">
|
|
198
175
|
<>
|
|
199
|
-
<Icon
|
|
200
|
-
align={IconAlign.Left}
|
|
201
|
-
id="link-icon"
|
|
202
|
-
name={IconNames.Check}
|
|
203
|
-
size={IconSizes.Small}
|
|
204
|
-
/>
|
|
176
|
+
<Icon align="left" id="link-icon" name="check" size="small" />
|
|
205
177
|
<a href="#existing-anchor-tag">check link</a>
|
|
206
178
|
</>
|
|
207
179
|
</Link>
|