@nypl/design-system-react-components 0.25.4 → 0.25.8
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 +52 -0
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/Icons/IconSvgs.d.ts +1 -0
- package/dist/components/Icons/IconTypes.d.ts +1 -0
- package/dist/components/Image/ImageTypes.d.ts +3 -1
- package/dist/components/Link/LinkTypes.d.ts +1 -0
- package/dist/components/Notification/Notification.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Toggle/Toggle.d.ts +47 -0
- package/dist/components/Toggle/ToggleSizes.d.ts +4 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +5 -3
- package/dist/design-system-react-components.cjs.development.js +921 -360
- 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 +917 -353
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/theme/components/breadcrumb.d.ts +9 -0
- package/dist/theme/components/notification.d.ts +8 -4
- package/dist/theme/components/toggle.d.ts +68 -0
- package/dist/theme/foundations/spacing.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/Accordion/Accordion.stories.mdx +1 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +20 -3
- 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.tsx +0 -1
- package/src/components/Card/Card.stories.mdx +74 -7
- package/src/components/Card/Card.tsx +9 -8
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +67 -35
- package/src/components/Chakra/Grid.stories.mdx +11 -14
- package/src/components/DatePicker/DatePicker.test.tsx +8 -6
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +5 -4
- package/src/components/Icons/Icon.stories.mdx +3 -2
- package/src/components/Icons/IconSvgs.tsx +2 -0
- package/src/components/Icons/IconTypes.tsx +1 -0
- package/src/components/Image/Image.stories.mdx +152 -90
- package/src/components/Image/Image.test.tsx +10 -0
- 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 +1 -1
- package/src/components/Link/Link.stories.mdx +2 -3
- package/src/components/Link/Link.test.tsx +71 -0
- package/src/components/Link/Link.tsx +41 -9
- package/src/components/Link/LinkTypes.tsx +1 -0
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +201 -0
- package/src/components/Notification/Notification.stories.mdx +36 -3
- package/src/components/Notification/Notification.test.tsx +62 -16
- package/src/components/Notification/Notification.tsx +17 -5
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +117 -0
- package/src/components/Pagination/Pagination.stories.mdx +1 -2
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +42 -0
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +2 -3
- package/src/components/SearchBar/SearchBar.Test.tsx +64 -20
- package/src/components/SearchBar/SearchBar.stories.mdx +3 -4
- package/src/components/SearchBar/SearchBar.tsx +4 -1
- package/src/components/Select/Select.stories.mdx +132 -55
- package/src/components/Select/Select.test.tsx +2 -2
- package/src/components/Select/Select.tsx +6 -2
- package/src/components/Slider/Slider.stories.mdx +3 -2
- package/src/components/Slider/Slider.test.tsx +35 -0
- package/src/components/Slider/Slider.tsx +8 -2
- package/src/components/Template/Template.stories.mdx +1 -2
- package/src/components/Toggle/Toggle.stories.mdx +176 -0
- package/src/components/Toggle/Toggle.test.tsx +140 -0
- package/src/components/Toggle/Toggle.tsx +118 -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 +39 -18
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +103 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +57 -17
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +48 -0
- package/src/index.ts +8 -0
- package/src/theme/components/breadcrumb.ts +11 -1
- package/src/theme/components/card.ts +4 -5
- package/src/theme/components/global.ts +1 -1
- package/src/theme/components/icon.ts +2 -2
- package/src/theme/components/image.ts +8 -0
- package/src/theme/components/notification.ts +8 -6
- package/src/theme/components/toggle.ts +65 -0
- package/src/theme/foundations/spacing.ts +3 -0
- package/src/theme/index.ts +2 -0
- package/src/utils/componentCategories.ts +3 -1
|
@@ -74,6 +74,14 @@ describe("Image", () => {
|
|
|
74
74
|
const figCaption = renderer
|
|
75
75
|
.create(<Image src="test.png" alt="" imageCaption="Caption" />)
|
|
76
76
|
.toJSON();
|
|
77
|
+
const sizeExtraExtraSmall = renderer
|
|
78
|
+
.create(
|
|
79
|
+
<Image src="test.png" alt="" imageSize={ImageSizes.ExtraExtraSmall} />
|
|
80
|
+
)
|
|
81
|
+
.toJSON();
|
|
82
|
+
const sizeExtraSmall = renderer
|
|
83
|
+
.create(<Image src="test.png" alt="" imageSize={ImageSizes.ExtraSmall} />)
|
|
84
|
+
.toJSON();
|
|
77
85
|
const sizeSmall = renderer
|
|
78
86
|
.create(<Image src="test.png" alt="" imageSize={ImageSizes.Small} />)
|
|
79
87
|
.toJSON();
|
|
@@ -152,6 +160,8 @@ describe("Image", () => {
|
|
|
152
160
|
.toJSON();
|
|
153
161
|
expect(basic).toMatchSnapshot();
|
|
154
162
|
expect(figCaption).toMatchSnapshot();
|
|
163
|
+
expect(sizeExtraExtraSmall).toMatchSnapshot();
|
|
164
|
+
expect(sizeExtraSmall).toMatchSnapshot();
|
|
155
165
|
expect(sizeSmall).toMatchSnapshot();
|
|
156
166
|
expect(sizeMedium).toMatchSnapshot();
|
|
157
167
|
expect(sizeLarge).toMatchSnapshot();
|
|
@@ -54,6 +54,22 @@ exports[`Image Renders the UI snapshot correctly 5`] = `
|
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
56
|
exports[`Image Renders the UI snapshot correctly 6`] = `
|
|
57
|
+
<img
|
|
58
|
+
alt=""
|
|
59
|
+
className="css-0"
|
|
60
|
+
src="test.png"
|
|
61
|
+
/>
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
exports[`Image Renders the UI snapshot correctly 7`] = `
|
|
65
|
+
<img
|
|
66
|
+
alt=""
|
|
67
|
+
className="css-0"
|
|
68
|
+
src="test.png"
|
|
69
|
+
/>
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
exports[`Image Renders the UI snapshot correctly 8`] = `
|
|
57
73
|
<div
|
|
58
74
|
className="the-wrap css-0"
|
|
59
75
|
>
|
|
@@ -69,7 +85,7 @@ exports[`Image Renders the UI snapshot correctly 6`] = `
|
|
|
69
85
|
</div>
|
|
70
86
|
`;
|
|
71
87
|
|
|
72
|
-
exports[`Image Renders the UI snapshot correctly
|
|
88
|
+
exports[`Image Renders the UI snapshot correctly 9`] = `
|
|
73
89
|
<div
|
|
74
90
|
className="the-wrap css-0"
|
|
75
91
|
>
|
|
@@ -85,7 +101,7 @@ exports[`Image Renders the UI snapshot correctly 7`] = `
|
|
|
85
101
|
</div>
|
|
86
102
|
`;
|
|
87
103
|
|
|
88
|
-
exports[`Image Renders the UI snapshot correctly
|
|
104
|
+
exports[`Image Renders the UI snapshot correctly 10`] = `
|
|
89
105
|
<img
|
|
90
106
|
alt=""
|
|
91
107
|
className="css-0"
|
|
@@ -93,7 +109,7 @@ exports[`Image Renders the UI snapshot correctly 8`] = `
|
|
|
93
109
|
/>
|
|
94
110
|
`;
|
|
95
111
|
|
|
96
|
-
exports[`Image Renders the UI snapshot correctly
|
|
112
|
+
exports[`Image Renders the UI snapshot correctly 11`] = `
|
|
97
113
|
<div
|
|
98
114
|
className="the-wrap css-0"
|
|
99
115
|
>
|
|
@@ -109,7 +125,7 @@ exports[`Image Renders the UI snapshot correctly 9`] = `
|
|
|
109
125
|
</div>
|
|
110
126
|
`;
|
|
111
127
|
|
|
112
|
-
exports[`Image Renders the UI snapshot correctly
|
|
128
|
+
exports[`Image Renders the UI snapshot correctly 12`] = `
|
|
113
129
|
<div
|
|
114
130
|
className="the-wrap css-0"
|
|
115
131
|
>
|
|
@@ -125,7 +141,7 @@ exports[`Image Renders the UI snapshot correctly 10`] = `
|
|
|
125
141
|
</div>
|
|
126
142
|
`;
|
|
127
143
|
|
|
128
|
-
exports[`Image Renders the UI snapshot correctly
|
|
144
|
+
exports[`Image Renders the UI snapshot correctly 13`] = `
|
|
129
145
|
<div
|
|
130
146
|
className="the-wrap css-0"
|
|
131
147
|
>
|
|
@@ -141,7 +157,7 @@ exports[`Image Renders the UI snapshot correctly 11`] = `
|
|
|
141
157
|
</div>
|
|
142
158
|
`;
|
|
143
159
|
|
|
144
|
-
exports[`Image Renders the UI snapshot correctly
|
|
160
|
+
exports[`Image Renders the UI snapshot correctly 14`] = `
|
|
145
161
|
<div
|
|
146
162
|
className="the-wrap css-0"
|
|
147
163
|
>
|
|
@@ -157,7 +173,7 @@ exports[`Image Renders the UI snapshot correctly 12`] = `
|
|
|
157
173
|
</div>
|
|
158
174
|
`;
|
|
159
175
|
|
|
160
|
-
exports[`Image Renders the UI snapshot correctly
|
|
176
|
+
exports[`Image Renders the UI snapshot correctly 15`] = `
|
|
161
177
|
<div
|
|
162
178
|
className="the-wrap css-0"
|
|
163
179
|
>
|
|
@@ -173,7 +189,7 @@ exports[`Image Renders the UI snapshot correctly 13`] = `
|
|
|
173
189
|
</div>
|
|
174
190
|
`;
|
|
175
191
|
|
|
176
|
-
exports[`Image Renders the UI snapshot correctly
|
|
192
|
+
exports[`Image Renders the UI snapshot correctly 16`] = `
|
|
177
193
|
<div
|
|
178
194
|
className="the-wrap css-0"
|
|
179
195
|
>
|
|
@@ -26,8 +26,7 @@ import DSProvider from "../../theme/provider";
|
|
|
26
26
|
parameters={{
|
|
27
27
|
design: {
|
|
28
28
|
type: "figma",
|
|
29
|
-
url:
|
|
30
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36854%3A24387",
|
|
29
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36854%3A24387",
|
|
31
30
|
},
|
|
32
31
|
jest: ["Link.test.tsx"],
|
|
33
32
|
}}
|
|
@@ -48,7 +47,7 @@ import DSProvider from "../../theme/provider";
|
|
|
48
47
|
| Component Version | DS Version |
|
|
49
48
|
| ----------------- | ---------- |
|
|
50
49
|
| Added | `0.0.4` |
|
|
51
|
-
| Latest | `0.25.
|
|
50
|
+
| Latest | `0.25.8` |
|
|
52
51
|
|
|
53
52
|
<Description of={Link} />
|
|
54
53
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
3
|
import { axe } from "jest-axe";
|
|
4
|
+
import renderer from "react-test-renderer";
|
|
4
5
|
|
|
5
6
|
import Link from "./Link";
|
|
6
7
|
import { LinkTypes } from "./LinkTypes";
|
|
@@ -139,6 +140,76 @@ describe("Link", () => {
|
|
|
139
140
|
).toThrowError("Please pass only one child into `Link`.");
|
|
140
141
|
});
|
|
141
142
|
|
|
143
|
+
it("renders the UI snapshot correctly", () => {
|
|
144
|
+
const standard = renderer
|
|
145
|
+
.create(
|
|
146
|
+
<Link href="#passed-in-link" id="standard-link" type={LinkTypes.Action}>
|
|
147
|
+
Standard
|
|
148
|
+
</Link>
|
|
149
|
+
)
|
|
150
|
+
.toJSON();
|
|
151
|
+
const typeForwards = renderer
|
|
152
|
+
.create(
|
|
153
|
+
<Link
|
|
154
|
+
href="#passed-in-link"
|
|
155
|
+
id="forwards-link"
|
|
156
|
+
type={LinkTypes.Forwards}
|
|
157
|
+
>
|
|
158
|
+
Forwards
|
|
159
|
+
</Link>
|
|
160
|
+
)
|
|
161
|
+
.toJSON();
|
|
162
|
+
const typeBackwards = renderer
|
|
163
|
+
.create(
|
|
164
|
+
<Link
|
|
165
|
+
href="#passed-in-link"
|
|
166
|
+
id="backwards-link"
|
|
167
|
+
type={LinkTypes.Backwards}
|
|
168
|
+
>
|
|
169
|
+
Backwards
|
|
170
|
+
</Link>
|
|
171
|
+
)
|
|
172
|
+
.toJSON();
|
|
173
|
+
const typeExternal = renderer
|
|
174
|
+
.create(
|
|
175
|
+
<Link
|
|
176
|
+
href="#passed-in-link"
|
|
177
|
+
id="external-link"
|
|
178
|
+
type={LinkTypes.External}
|
|
179
|
+
>
|
|
180
|
+
External
|
|
181
|
+
</Link>
|
|
182
|
+
)
|
|
183
|
+
.toJSON();
|
|
184
|
+
const typeButton = renderer
|
|
185
|
+
.create(
|
|
186
|
+
<Link href="#passed-in-link" id="button-link" type={LinkTypes.Button}>
|
|
187
|
+
Button
|
|
188
|
+
</Link>
|
|
189
|
+
)
|
|
190
|
+
.toJSON();
|
|
191
|
+
const withIconChild = renderer
|
|
192
|
+
.create(
|
|
193
|
+
<Link href="#passed-in-link" id="icon-link" type={LinkTypes.Action}>
|
|
194
|
+
<Icon
|
|
195
|
+
align={IconAlign.Left}
|
|
196
|
+
className="more-link"
|
|
197
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
198
|
+
id="link-icon"
|
|
199
|
+
name={IconNames.Download}
|
|
200
|
+
/>
|
|
201
|
+
Download
|
|
202
|
+
</Link>
|
|
203
|
+
)
|
|
204
|
+
.toJSON();
|
|
205
|
+
expect(standard).toMatchSnapshot();
|
|
206
|
+
expect(typeForwards).toMatchSnapshot();
|
|
207
|
+
expect(typeBackwards).toMatchSnapshot();
|
|
208
|
+
expect(typeExternal).toMatchSnapshot();
|
|
209
|
+
expect(typeButton).toMatchSnapshot();
|
|
210
|
+
expect(withIconChild).toMatchSnapshot();
|
|
211
|
+
});
|
|
212
|
+
|
|
142
213
|
// TODO:
|
|
143
214
|
// it("Passes the ref to the input element", () => {
|
|
144
215
|
// const ref = React.createRef<HTMLAnchorElement>();
|
|
@@ -27,7 +27,7 @@ export interface LinkProps {
|
|
|
27
27
|
* Renders the `Link` children components with a direction arrow icon based
|
|
28
28
|
* on the `Backwards` or `Forwards` `LinkTypes` type.
|
|
29
29
|
*/
|
|
30
|
-
function getWithDirectionIcon(children, type: LinkTypes) {
|
|
30
|
+
function getWithDirectionIcon(children, type: LinkTypes, linkId) {
|
|
31
31
|
let iconRotation;
|
|
32
32
|
let iconAlign;
|
|
33
33
|
let icon = null;
|
|
@@ -42,12 +42,15 @@ function getWithDirectionIcon(children, type: LinkTypes) {
|
|
|
42
42
|
iconAlign = IconAlign.Right;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
const iconId = `${linkId}-icon`;
|
|
46
|
+
|
|
45
47
|
icon = (
|
|
46
48
|
<Icon
|
|
47
|
-
name={IconNames.Arrow}
|
|
48
49
|
align={iconAlign}
|
|
49
|
-
iconRotation={iconRotation}
|
|
50
50
|
className="more-link"
|
|
51
|
+
iconRotation={iconRotation}
|
|
52
|
+
id={iconId}
|
|
53
|
+
name={IconNames.Arrow}
|
|
51
54
|
/>
|
|
52
55
|
);
|
|
53
56
|
|
|
@@ -60,6 +63,25 @@ function getWithDirectionIcon(children, type: LinkTypes) {
|
|
|
60
63
|
);
|
|
61
64
|
}
|
|
62
65
|
|
|
66
|
+
function getExternalIcon(children, linkId) {
|
|
67
|
+
const iconId = `${linkId}-icon`;
|
|
68
|
+
const icon = (
|
|
69
|
+
<Icon
|
|
70
|
+
align={IconAlign.Right}
|
|
71
|
+
className="more-link"
|
|
72
|
+
id={iconId}
|
|
73
|
+
name={IconNames.ActionLaunch}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
{children}
|
|
80
|
+
{icon}
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
63
85
|
/**
|
|
64
86
|
* A component that uses an `href` prop or a child anchor element, to create
|
|
65
87
|
* an anchor element with added styling and conventions.
|
|
@@ -93,19 +115,25 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
93
115
|
if (
|
|
94
116
|
type === LinkTypes.Action ||
|
|
95
117
|
type === LinkTypes.Forwards ||
|
|
96
|
-
type === LinkTypes.Backwards
|
|
118
|
+
type === LinkTypes.Backwards ||
|
|
119
|
+
type === LinkTypes.External
|
|
97
120
|
) {
|
|
98
121
|
variant = "moreLink";
|
|
99
122
|
} else if (type === LinkTypes.Button) {
|
|
100
123
|
variant = "button";
|
|
101
124
|
}
|
|
102
125
|
const style = useStyleConfig("Link", { variant });
|
|
103
|
-
// Render with specific direction arrows
|
|
104
|
-
//
|
|
126
|
+
// Render with specific direction arrows if the type is
|
|
127
|
+
// Forwards or Backwards. Or render with the launch icon
|
|
128
|
+
// if the type is External. Otherwise, do not add an icon.
|
|
105
129
|
const newChildren =
|
|
106
|
-
type === LinkTypes.Forwards || type === LinkTypes.Backwards
|
|
107
|
-
|
|
108
|
-
|
|
130
|
+
((type === LinkTypes.Forwards || type === LinkTypes.Backwards) &&
|
|
131
|
+
getWithDirectionIcon(children, type, id)) ||
|
|
132
|
+
(type === LinkTypes.External && getExternalIcon(children, id)) ||
|
|
133
|
+
children;
|
|
134
|
+
|
|
135
|
+
const rel = type === LinkTypes.External ? "nofollow" : null;
|
|
136
|
+
const target = type === LinkTypes.External ? "_blank" : null;
|
|
109
137
|
|
|
110
138
|
if (!href) {
|
|
111
139
|
// React Types error makes this fail:
|
|
@@ -123,6 +151,8 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
123
151
|
...linkProps,
|
|
124
152
|
...childProps,
|
|
125
153
|
ref,
|
|
154
|
+
rel,
|
|
155
|
+
target,
|
|
126
156
|
},
|
|
127
157
|
[childrenToClone.props.children]
|
|
128
158
|
);
|
|
@@ -132,6 +162,8 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
132
162
|
as="a"
|
|
133
163
|
className={className}
|
|
134
164
|
ref={ref}
|
|
165
|
+
rel={rel}
|
|
166
|
+
target={target}
|
|
135
167
|
{...linkProps}
|
|
136
168
|
__css={{ ...style, ...additionalStyles }}
|
|
137
169
|
>
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Link renders the UI snapshot correctly 1`] = `
|
|
4
|
+
<a
|
|
5
|
+
className="css-0"
|
|
6
|
+
href="#passed-in-link"
|
|
7
|
+
id="standard-link"
|
|
8
|
+
rel={null}
|
|
9
|
+
target={null}
|
|
10
|
+
>
|
|
11
|
+
Standard
|
|
12
|
+
</a>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`Link renders the UI snapshot correctly 2`] = `
|
|
16
|
+
<a
|
|
17
|
+
className="css-0"
|
|
18
|
+
href="#passed-in-link"
|
|
19
|
+
id="forwards-link"
|
|
20
|
+
rel={null}
|
|
21
|
+
target={null}
|
|
22
|
+
>
|
|
23
|
+
Forwards
|
|
24
|
+
<svg
|
|
25
|
+
aria-hidden={true}
|
|
26
|
+
className="chakra-icon more-link css-onkibi"
|
|
27
|
+
focusable={false}
|
|
28
|
+
id="forwards-link-icon"
|
|
29
|
+
role="img"
|
|
30
|
+
title="arrow icon"
|
|
31
|
+
viewBox="0 0 24 24"
|
|
32
|
+
>
|
|
33
|
+
<g
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
strokeWidth="1.5"
|
|
36
|
+
>
|
|
37
|
+
<path
|
|
38
|
+
d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
|
|
39
|
+
fill="none"
|
|
40
|
+
strokeLinecap="round"
|
|
41
|
+
/>
|
|
42
|
+
<path
|
|
43
|
+
d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
|
|
44
|
+
fill="currentColor"
|
|
45
|
+
strokeLinecap="round"
|
|
46
|
+
/>
|
|
47
|
+
<circle
|
|
48
|
+
cx="12"
|
|
49
|
+
cy="12"
|
|
50
|
+
fill="none"
|
|
51
|
+
r="11.25"
|
|
52
|
+
strokeMiterlimit="10"
|
|
53
|
+
/>
|
|
54
|
+
</g>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`Link renders the UI snapshot correctly 3`] = `
|
|
60
|
+
<a
|
|
61
|
+
className="css-0"
|
|
62
|
+
href="#passed-in-link"
|
|
63
|
+
id="backwards-link"
|
|
64
|
+
rel={null}
|
|
65
|
+
target={null}
|
|
66
|
+
>
|
|
67
|
+
<svg
|
|
68
|
+
aria-hidden={true}
|
|
69
|
+
className="chakra-icon more-link css-onkibi"
|
|
70
|
+
focusable={false}
|
|
71
|
+
id="backwards-link-icon"
|
|
72
|
+
role="img"
|
|
73
|
+
title="arrow icon"
|
|
74
|
+
viewBox="0 0 24 24"
|
|
75
|
+
>
|
|
76
|
+
<g
|
|
77
|
+
stroke="currentColor"
|
|
78
|
+
strokeWidth="1.5"
|
|
79
|
+
>
|
|
80
|
+
<path
|
|
81
|
+
d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
|
|
82
|
+
fill="none"
|
|
83
|
+
strokeLinecap="round"
|
|
84
|
+
/>
|
|
85
|
+
<path
|
|
86
|
+
d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
|
|
87
|
+
fill="currentColor"
|
|
88
|
+
strokeLinecap="round"
|
|
89
|
+
/>
|
|
90
|
+
<circle
|
|
91
|
+
cx="12"
|
|
92
|
+
cy="12"
|
|
93
|
+
fill="none"
|
|
94
|
+
r="11.25"
|
|
95
|
+
strokeMiterlimit="10"
|
|
96
|
+
/>
|
|
97
|
+
</g>
|
|
98
|
+
</svg>
|
|
99
|
+
Backwards
|
|
100
|
+
</a>
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`Link renders the UI snapshot correctly 4`] = `
|
|
104
|
+
<a
|
|
105
|
+
className="css-0"
|
|
106
|
+
href="#passed-in-link"
|
|
107
|
+
id="external-link"
|
|
108
|
+
rel="nofollow"
|
|
109
|
+
target="_blank"
|
|
110
|
+
>
|
|
111
|
+
External
|
|
112
|
+
<svg
|
|
113
|
+
aria-hidden={true}
|
|
114
|
+
className="chakra-icon more-link css-onkibi"
|
|
115
|
+
focusable={false}
|
|
116
|
+
id="external-link-icon"
|
|
117
|
+
role="img"
|
|
118
|
+
title="action_launch icon"
|
|
119
|
+
viewBox="0 0 24 24"
|
|
120
|
+
>
|
|
121
|
+
<g
|
|
122
|
+
stroke="currentColor"
|
|
123
|
+
strokeWidth="1.5"
|
|
124
|
+
>
|
|
125
|
+
<path
|
|
126
|
+
d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
|
|
127
|
+
fill="none"
|
|
128
|
+
strokeLinecap="round"
|
|
129
|
+
/>
|
|
130
|
+
<path
|
|
131
|
+
d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
|
|
132
|
+
fill="currentColor"
|
|
133
|
+
strokeLinecap="round"
|
|
134
|
+
/>
|
|
135
|
+
<circle
|
|
136
|
+
cx="12"
|
|
137
|
+
cy="12"
|
|
138
|
+
fill="none"
|
|
139
|
+
r="11.25"
|
|
140
|
+
strokeMiterlimit="10"
|
|
141
|
+
/>
|
|
142
|
+
</g>
|
|
143
|
+
</svg>
|
|
144
|
+
</a>
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
exports[`Link renders the UI snapshot correctly 5`] = `
|
|
148
|
+
<a
|
|
149
|
+
className="css-0"
|
|
150
|
+
href="#passed-in-link"
|
|
151
|
+
id="button-link"
|
|
152
|
+
rel={null}
|
|
153
|
+
target={null}
|
|
154
|
+
>
|
|
155
|
+
Button
|
|
156
|
+
</a>
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
exports[`Link renders the UI snapshot correctly 6`] = `
|
|
160
|
+
<a
|
|
161
|
+
className="css-0"
|
|
162
|
+
href="#passed-in-link"
|
|
163
|
+
id="icon-link"
|
|
164
|
+
rel={null}
|
|
165
|
+
target={null}
|
|
166
|
+
>
|
|
167
|
+
<svg
|
|
168
|
+
aria-hidden={true}
|
|
169
|
+
className="chakra-icon more-link css-onkibi"
|
|
170
|
+
focusable={false}
|
|
171
|
+
id="link-icon"
|
|
172
|
+
role="img"
|
|
173
|
+
title="download icon"
|
|
174
|
+
viewBox="0 0 24 24"
|
|
175
|
+
>
|
|
176
|
+
<g
|
|
177
|
+
stroke="currentColor"
|
|
178
|
+
strokeWidth="1.5"
|
|
179
|
+
>
|
|
180
|
+
<path
|
|
181
|
+
d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
|
|
182
|
+
fill="none"
|
|
183
|
+
strokeLinecap="round"
|
|
184
|
+
/>
|
|
185
|
+
<path
|
|
186
|
+
d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
|
|
187
|
+
fill="currentColor"
|
|
188
|
+
strokeLinecap="round"
|
|
189
|
+
/>
|
|
190
|
+
<circle
|
|
191
|
+
cx="12"
|
|
192
|
+
cy="12"
|
|
193
|
+
fill="none"
|
|
194
|
+
r="11.25"
|
|
195
|
+
strokeMiterlimit="10"
|
|
196
|
+
/>
|
|
197
|
+
</g>
|
|
198
|
+
</svg>
|
|
199
|
+
Download
|
|
200
|
+
</a>
|
|
201
|
+
`;
|
|
@@ -27,8 +27,7 @@ import DSProvider from "../../theme/provider";
|
|
|
27
27
|
parameters={{
|
|
28
28
|
design: {
|
|
29
29
|
type: "figma",
|
|
30
|
-
url:
|
|
31
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/?node-id=10734%3A812",
|
|
30
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/?node-id=10734%3A812",
|
|
32
31
|
},
|
|
33
32
|
jest: ["Notification.test.tsx"],
|
|
34
33
|
}}
|
|
@@ -39,7 +38,7 @@ import DSProvider from "../../theme/provider";
|
|
|
39
38
|
| Component Version | DS Version |
|
|
40
39
|
| ----------------- | ---------- |
|
|
41
40
|
| Added | `0.23.2` |
|
|
42
|
-
| Latest | `0.25.
|
|
41
|
+
| Latest | `0.25.8` |
|
|
43
42
|
|
|
44
43
|
<Description of={Notification} />
|
|
45
44
|
|
|
@@ -67,6 +66,7 @@ within a parent element.
|
|
|
67
66
|
nisi erat porttitor ligula.
|
|
68
67
|
</>
|
|
69
68
|
),
|
|
69
|
+
showIcon: true,
|
|
70
70
|
}}
|
|
71
71
|
>
|
|
72
72
|
{(args) => (
|
|
@@ -194,6 +194,39 @@ within a parent element.
|
|
|
194
194
|
</DSProvider>
|
|
195
195
|
</Canvas>
|
|
196
196
|
|
|
197
|
+
### Without Icon
|
|
198
|
+
|
|
199
|
+
The `Notification` icon can be hidden with the `showIcon` prop set to `false`.
|
|
200
|
+
|
|
201
|
+
<Canvas>
|
|
202
|
+
<DSProvider>
|
|
203
|
+
<Notification
|
|
204
|
+
notificationHeading="Standard Notification without Icon"
|
|
205
|
+
notificationContent={
|
|
206
|
+
<>
|
|
207
|
+
Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus
|
|
208
|
+
mollis interdum. Morbi leo risus, porta ac consectetur ac, vestibulum
|
|
209
|
+
at eros. Cum sociis natoque penatibus et magnis dis parturient montes,
|
|
210
|
+
nascetur ridiculus mus.
|
|
211
|
+
</>
|
|
212
|
+
}
|
|
213
|
+
showIcon={false}
|
|
214
|
+
/>
|
|
215
|
+
<Notification
|
|
216
|
+
notificationContent={
|
|
217
|
+
<>
|
|
218
|
+
This is an Standard Notification without a heading or icon. Cras
|
|
219
|
+
mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis
|
|
220
|
+
interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at
|
|
221
|
+
eros. Cum sociis natoque penatibus et magnis dis parturient montes,
|
|
222
|
+
nascetur ridiculus mus.
|
|
223
|
+
</>
|
|
224
|
+
}
|
|
225
|
+
showIcon={false}
|
|
226
|
+
/>
|
|
227
|
+
</DSProvider>
|
|
228
|
+
</Canvas>
|
|
229
|
+
|
|
197
230
|
## Custom Icon
|
|
198
231
|
|
|
199
232
|
The default icon can be overridden by using the `icon` prop to pass a custom `Icon` component.
|