@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
|
@@ -6,16 +6,20 @@ exports[`Card Renders the UI snapshot correctly 1`] = `
|
|
|
6
6
|
id="regularCard"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
className="
|
|
9
|
+
className="css-0"
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
|
-
className="the-
|
|
12
|
+
className="the-wrap css-0"
|
|
13
13
|
>
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
<div
|
|
15
|
+
className="the-crop css-0"
|
|
16
|
+
>
|
|
17
|
+
<img
|
|
18
|
+
alt="Alt text"
|
|
19
|
+
className="css-0"
|
|
20
|
+
src="https://placeimg.com/400/200/arch"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
19
23
|
</div>
|
|
20
24
|
</div>
|
|
21
25
|
<div
|
|
@@ -55,16 +59,20 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
|
|
|
55
59
|
id="cardWithExtendedStyles"
|
|
56
60
|
>
|
|
57
61
|
<div
|
|
58
|
-
className="
|
|
62
|
+
className="css-0"
|
|
59
63
|
>
|
|
60
64
|
<div
|
|
61
|
-
className="the-
|
|
65
|
+
className="the-wrap css-0"
|
|
62
66
|
>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
<div
|
|
68
|
+
className="the-crop css-0"
|
|
69
|
+
>
|
|
70
|
+
<img
|
|
71
|
+
alt="Alt text"
|
|
72
|
+
className="css-0"
|
|
73
|
+
src="https://placeimg.com/300/400/arch"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
68
76
|
</div>
|
|
69
77
|
</div>
|
|
70
78
|
<div
|
|
@@ -96,6 +104,8 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
|
|
|
96
104
|
className="css-0"
|
|
97
105
|
href="online"
|
|
98
106
|
id="link-online"
|
|
107
|
+
rel={null}
|
|
108
|
+
target={null}
|
|
99
109
|
>
|
|
100
110
|
Read Online
|
|
101
111
|
</a>
|
|
@@ -103,6 +113,8 @@ exports[`Card Renders the UI snapshot correctly 2`] = `
|
|
|
103
113
|
className="css-0"
|
|
104
114
|
href="#url"
|
|
105
115
|
id="link-icon"
|
|
116
|
+
rel={null}
|
|
117
|
+
target={null}
|
|
106
118
|
>
|
|
107
119
|
<svg
|
|
108
120
|
aria-hidden={true}
|
|
@@ -149,16 +161,20 @@ exports[`Card Renders the UI snapshot correctly 3`] = `
|
|
|
149
161
|
id="cardWithNoCTAs"
|
|
150
162
|
>
|
|
151
163
|
<div
|
|
152
|
-
className="
|
|
164
|
+
className="css-0"
|
|
153
165
|
>
|
|
154
166
|
<div
|
|
155
|
-
className="the-
|
|
167
|
+
className="the-wrap css-0"
|
|
156
168
|
>
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
169
|
+
<div
|
|
170
|
+
className="the-crop css-0"
|
|
171
|
+
>
|
|
172
|
+
<img
|
|
173
|
+
alt="Alt text"
|
|
174
|
+
className="css-0"
|
|
175
|
+
src="https://placeimg.com/300/400/arch"
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
162
178
|
</div>
|
|
163
179
|
</div>
|
|
164
180
|
<div
|
|
@@ -193,16 +209,20 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
|
|
|
193
209
|
id="cardWithNoContent"
|
|
194
210
|
>
|
|
195
211
|
<div
|
|
196
|
-
className="
|
|
212
|
+
className="css-0"
|
|
197
213
|
>
|
|
198
214
|
<div
|
|
199
|
-
className="the-
|
|
215
|
+
className="the-wrap css-0"
|
|
200
216
|
>
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
217
|
+
<div
|
|
218
|
+
className="the-crop css-0"
|
|
219
|
+
>
|
|
220
|
+
<img
|
|
221
|
+
alt="Alt text"
|
|
222
|
+
className="css-0"
|
|
223
|
+
src="https://placeimg.com/300/400/arch"
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
206
226
|
</div>
|
|
207
227
|
</div>
|
|
208
228
|
<div
|
|
@@ -226,6 +246,8 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
|
|
|
226
246
|
className="css-0"
|
|
227
247
|
href="online"
|
|
228
248
|
id="link-online"
|
|
249
|
+
rel={null}
|
|
250
|
+
target={null}
|
|
229
251
|
>
|
|
230
252
|
Read Online
|
|
231
253
|
</a>
|
|
@@ -233,6 +255,8 @@ exports[`Card Renders the UI snapshot correctly 4`] = `
|
|
|
233
255
|
className="css-0"
|
|
234
256
|
href="#url"
|
|
235
257
|
id="link-icon"
|
|
258
|
+
rel={null}
|
|
259
|
+
target={null}
|
|
236
260
|
>
|
|
237
261
|
<svg
|
|
238
262
|
aria-hidden={true}
|
|
@@ -304,6 +328,8 @@ exports[`Card Renders the UI snapshot correctly 5`] = `
|
|
|
304
328
|
className="css-0"
|
|
305
329
|
href="online"
|
|
306
330
|
id="link-online"
|
|
331
|
+
rel={null}
|
|
332
|
+
target={null}
|
|
307
333
|
>
|
|
308
334
|
Read Online
|
|
309
335
|
</a>
|
|
@@ -311,6 +337,8 @@ exports[`Card Renders the UI snapshot correctly 5`] = `
|
|
|
311
337
|
className="css-0"
|
|
312
338
|
href="#url"
|
|
313
339
|
id="link-icon"
|
|
340
|
+
rel={null}
|
|
341
|
+
target={null}
|
|
314
342
|
>
|
|
315
343
|
<svg
|
|
316
344
|
aria-hidden={true}
|
|
@@ -360,16 +388,20 @@ exports[`Card Renders the UI snapshot correctly 6`] = `
|
|
|
360
388
|
id="fullclick"
|
|
361
389
|
>
|
|
362
390
|
<div
|
|
363
|
-
className="
|
|
391
|
+
className="css-0"
|
|
364
392
|
>
|
|
365
393
|
<div
|
|
366
|
-
className="the-
|
|
394
|
+
className="the-wrap css-0"
|
|
367
395
|
>
|
|
368
|
-
<
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
396
|
+
<div
|
|
397
|
+
className="the-crop css-0"
|
|
398
|
+
>
|
|
399
|
+
<img
|
|
400
|
+
alt="Alt text"
|
|
401
|
+
className="css-0"
|
|
402
|
+
src="https://placeimg.com/400/200/arch"
|
|
403
|
+
/>
|
|
404
|
+
</div>
|
|
373
405
|
</div>
|
|
374
406
|
</div>
|
|
375
407
|
<div
|
|
@@ -11,6 +11,7 @@ import DSProvider from "../../theme/provider";
|
|
|
11
11
|
| Component Version | DS Version |
|
|
12
12
|
| ----------------- | ---------- |
|
|
13
13
|
| Added | `0.25.1` |
|
|
14
|
+
| Latest | `0.25.1` |
|
|
14
15
|
|
|
15
16
|
Note: This needs the use of the `DSProvider` component. See the
|
|
16
17
|
[README](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/chakra-ui--page#dsprovider)
|
|
@@ -63,16 +64,12 @@ the `templateColumns` and `templateRows`.
|
|
|
63
64
|
height="200px"
|
|
64
65
|
templateRows="repeat(2, 1fr)"
|
|
65
66
|
templateColumns="repeat(5, 1fr)"
|
|
66
|
-
gap="
|
|
67
|
+
gap="l"
|
|
67
68
|
>
|
|
68
|
-
<GridItem
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/>
|
|
73
|
-
<GridItem colSpan={2} bg="var(--nypl-colors-ui-success-primary)" />
|
|
74
|
-
<GridItem colSpan={2} bg="var(--nypl-colors-ui-success-secondary)" />
|
|
75
|
-
<GridItem colSpan={4} bg="var(--nypl-colors-ui-link-secondary)" />
|
|
69
|
+
<GridItem rowSpan={2} colSpan={1} bg="ui.link.primary" />
|
|
70
|
+
<GridItem colSpan={2} bg="ui.success.primary" />
|
|
71
|
+
<GridItem colSpan={2} bg="ui.success.secondary" />
|
|
72
|
+
<GridItem colSpan={4} bg="ui.link.secondary" />
|
|
76
73
|
</Grid>
|
|
77
74
|
</DSProvider>
|
|
78
75
|
</Canvas>
|
|
@@ -82,11 +79,11 @@ the `templateColumns` and `templateRows`.
|
|
|
82
79
|
height="200px"
|
|
83
80
|
templateRows="repeat(2, 1fr)"
|
|
84
81
|
templateColumns="repeat(5, 1fr)"
|
|
85
|
-
gap="
|
|
82
|
+
gap="l"
|
|
86
83
|
>
|
|
87
|
-
<GridItem rowSpan={2} colSpan={1} bg="
|
|
88
|
-
<GridItem colSpan={2} bg="
|
|
89
|
-
<GridItem colSpan={2} bg="
|
|
90
|
-
<GridItem colSpan={4} bg="
|
|
84
|
+
<GridItem rowSpan={2} colSpan={1} bg="ui.link.primary" />
|
|
85
|
+
<GridItem colSpan={2} bg="ui.success.primary" />
|
|
86
|
+
<GridItem colSpan={2} bg="ui.success.secondary" />
|
|
87
|
+
<GridItem colSpan={4} bg="ui.link.secondary" />
|
|
91
88
|
</Grid>
|
|
92
89
|
```
|
|
@@ -368,7 +368,7 @@ describe("DatePicker", () => {
|
|
|
368
368
|
// Note: Have to add an initial date so that the snapshot tests always
|
|
369
369
|
// pass. Otherwise, it'll use the _current_ date which changes
|
|
370
370
|
// based on the day it is tested and is not what we want.
|
|
371
|
-
it
|
|
371
|
+
it("renders the UI snapshot correctly", () => {
|
|
372
372
|
const basic = renderer
|
|
373
373
|
.create(
|
|
374
374
|
<DatePicker
|
|
@@ -805,10 +805,12 @@ describe("DatePicker", () => {
|
|
|
805
805
|
const input = screen.getByLabelText(
|
|
806
806
|
/Select the year you want to visit NYPL/i
|
|
807
807
|
);
|
|
808
|
-
const
|
|
808
|
+
const mockYear = 2021;
|
|
809
809
|
|
|
810
810
|
expect(
|
|
811
|
-
screen.queryByText(
|
|
811
|
+
screen.queryByText(
|
|
812
|
+
`${(mockYear as any) - 4} - ${(mockYear as any) + 7}`
|
|
813
|
+
)
|
|
812
814
|
).not.toBeInTheDocument();
|
|
813
815
|
|
|
814
816
|
userEvent.click(input);
|
|
@@ -817,16 +819,16 @@ describe("DatePicker", () => {
|
|
|
817
819
|
// before the current year to seven years after the current year. For year
|
|
818
820
|
// 2021, it will display 2017 - 2028.
|
|
819
821
|
expect(
|
|
820
|
-
screen.getByText(`${(
|
|
822
|
+
screen.getByText(`${(mockYear as any) - 4} - ${(mockYear as any) + 7}`)
|
|
821
823
|
).toBeInTheDocument();
|
|
822
824
|
// This calendar displays 12 years to select from.
|
|
823
825
|
// It should display the four previous years from the current year.
|
|
824
826
|
for (let i = 4; i > 0; i--) {
|
|
825
|
-
expect(screen.getByText((
|
|
827
|
+
expect(screen.getByText((mockYear as any) - i)).toBeInTheDocument();
|
|
826
828
|
}
|
|
827
829
|
// It should display the eight next years from the current year.
|
|
828
830
|
for (let i = 0; i < 8; i++) {
|
|
829
|
-
expect(screen.getByText((
|
|
831
|
+
expect(screen.getByText((mockYear as any) + i)).toBeInTheDocument();
|
|
830
832
|
}
|
|
831
833
|
});
|
|
832
834
|
|
|
@@ -587,6 +587,7 @@ exports[`DatePicker Single input renders the UI snapshot correctly 1`] = `
|
|
|
587
587
|
onClick={[Function]}
|
|
588
588
|
onFocus={[Function]}
|
|
589
589
|
required={false}
|
|
590
|
+
step={null}
|
|
590
591
|
type="text"
|
|
591
592
|
value="1988-01-02"
|
|
592
593
|
/>
|
|
@@ -625,12 +626,9 @@ exports[`DatePicker Single input renders the UI snapshot correctly 2`] = `
|
|
|
625
626
|
onClick={[Function]}
|
|
626
627
|
onFocus={[Function]}
|
|
627
628
|
required={false}
|
|
629
|
+
step={null}
|
|
628
630
|
type="text"
|
|
629
|
-
<<<<<<< HEAD
|
|
630
|
-
value="2021-11-17"
|
|
631
|
-
=======
|
|
632
631
|
value="1988-01-02"
|
|
633
|
-
>>>>>>> development
|
|
634
632
|
/>
|
|
635
633
|
</div>
|
|
636
634
|
</div>
|
|
@@ -678,6 +676,7 @@ exports[`DatePicker Single input renders the UI snapshot correctly 3`] = `
|
|
|
678
676
|
onClick={[Function]}
|
|
679
677
|
onFocus={[Function]}
|
|
680
678
|
required={false}
|
|
679
|
+
step={null}
|
|
681
680
|
type="text"
|
|
682
681
|
value="1988/02/01"
|
|
683
682
|
/>
|
|
@@ -729,6 +728,7 @@ exports[`DatePicker Single input renders the UI snapshot correctly 4`] = `
|
|
|
729
728
|
onClick={[Function]}
|
|
730
729
|
onFocus={[Function]}
|
|
731
730
|
required={false}
|
|
731
|
+
step={null}
|
|
732
732
|
type="text"
|
|
733
733
|
value="1988-01-02"
|
|
734
734
|
/>
|
|
@@ -793,6 +793,7 @@ exports[`DatePicker Single input renders the UI snapshot correctly 5`] = `
|
|
|
793
793
|
onClick={[Function]}
|
|
794
794
|
onFocus={[Function]}
|
|
795
795
|
required={false}
|
|
796
|
+
step={null}
|
|
796
797
|
type="text"
|
|
797
798
|
value="1988-01-02"
|
|
798
799
|
/>
|
|
@@ -28,7 +28,8 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
28
28
|
parameters={{
|
|
29
29
|
design: {
|
|
30
30
|
type: "figma",
|
|
31
|
-
url:
|
|
31
|
+
url:
|
|
32
|
+
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10734%3A3945",
|
|
32
33
|
},
|
|
33
34
|
jest: ["Icon.test.tsx"],
|
|
34
35
|
}}
|
|
@@ -44,7 +45,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
44
45
|
| Component Version | DS Version |
|
|
45
46
|
| ----------------- | ---------- |
|
|
46
47
|
| Added | `0.0.4` |
|
|
47
|
-
| Latest | `0.25.
|
|
48
|
+
| Latest | `0.25.8` |
|
|
48
49
|
|
|
49
50
|
<Description of={Icon} />
|
|
50
51
|
|
|
@@ -5,6 +5,7 @@ import action_check_circle from "../../../icons/svg/action_check_circle.svg";
|
|
|
5
5
|
import action_help_default from "../../../icons/svg/action_help_default.svg";
|
|
6
6
|
import action_help_outline from "../../../icons/svg/action_help_outline.svg";
|
|
7
7
|
import action_launch from "../../../icons/svg/action_launch.svg";
|
|
8
|
+
import alert_notification_important from "../../../icons/svg/alert_notification_important.svg";
|
|
8
9
|
import arrow from "../../../icons/svg/arrow.svg";
|
|
9
10
|
import brooklyn from "../../../icons/svg/brooklyn.svg";
|
|
10
11
|
import check from "../../../icons/svg/check.svg";
|
|
@@ -57,6 +58,7 @@ export default {
|
|
|
57
58
|
action_help_default,
|
|
58
59
|
action_help_outline,
|
|
59
60
|
action_launch,
|
|
61
|
+
alert_notification_important,
|
|
60
62
|
arrow,
|
|
61
63
|
brooklyn,
|
|
62
64
|
check,
|
|
@@ -52,6 +52,7 @@ export enum IconNames {
|
|
|
52
52
|
ActionCheckCircle = "action_check_circle",
|
|
53
53
|
ActionHelpDefault = "action_help_default",
|
|
54
54
|
ActionHelpOutline = "action_help_outline",
|
|
55
|
+
AlertNotificationImportant = "alert_notification_important",
|
|
55
56
|
ActionLaunch = "action_launch",
|
|
56
57
|
Arrow = "arrow",
|
|
57
58
|
Check = "check",
|
|
@@ -11,8 +11,16 @@ import { VStack } from "@chakra-ui/react";
|
|
|
11
11
|
import Image from "./Image";
|
|
12
12
|
import { ImageRatios, ImageSizes, ImageTypes } from "./ImageTypes";
|
|
13
13
|
import Heading from "../Heading/Heading";
|
|
14
|
+
import SimpleGrid from "../Grid/SimpleGrid";
|
|
14
15
|
import { getCategory } from "../../utils/componentCategories";
|
|
15
16
|
|
|
17
|
+
export const imageBlockStyles = {
|
|
18
|
+
margin: "auto",
|
|
19
|
+
maxWidth: "360px",
|
|
20
|
+
textAlign: "center",
|
|
21
|
+
width: "100%",
|
|
22
|
+
};
|
|
23
|
+
|
|
16
24
|
<Meta
|
|
17
25
|
title={getCategory("Image")}
|
|
18
26
|
component={Image}
|
|
@@ -20,7 +28,8 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
20
28
|
parameters={{
|
|
21
29
|
design: {
|
|
22
30
|
type: "figma",
|
|
23
|
-
url:
|
|
31
|
+
url:
|
|
32
|
+
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11896%3A45379",
|
|
24
33
|
},
|
|
25
34
|
jest: ["Image.test.tsx"],
|
|
26
35
|
}}
|
|
@@ -36,7 +45,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
36
45
|
| Component Version | DS Version |
|
|
37
46
|
| ----------------- | ---------- |
|
|
38
47
|
| Added | `0.0.6` |
|
|
39
|
-
| Latest | `0.25.
|
|
48
|
+
| Latest | `0.25.8` |
|
|
40
49
|
|
|
41
50
|
<Description of={Image} />
|
|
42
51
|
|
|
@@ -102,28 +111,61 @@ Use the `ImageSizes` prop to set the desired size.
|
|
|
102
111
|
|
|
103
112
|
<Canvas>
|
|
104
113
|
<Story name="Image Sizes">
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
<SimpleGrid columns={1}>
|
|
115
|
+
<div style={{ textAlign: "center" }}>
|
|
116
|
+
<Heading id="ExtraExtraSmall" text="ImageSizes.ExtraExtraSmall" />
|
|
117
|
+
<Image
|
|
118
|
+
alt="Alt text"
|
|
119
|
+
imageCaption="64px"
|
|
120
|
+
imageSize={ImageSizes.ExtraExtraSmall}
|
|
121
|
+
src="https://placeimg.com/400/300/animals"
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
<div style={{ textAlign: "center" }}>
|
|
125
|
+
<Heading id="ExtraSmall" text="ImageSizes.ExtraSmall" />
|
|
126
|
+
<Image
|
|
127
|
+
alt="Alt text"
|
|
128
|
+
imageCaption="96px"
|
|
129
|
+
imageSize={ImageSizes.ExtraSmall}
|
|
130
|
+
src="https://placeimg.com/400/300/animals"
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
<div style={{ textAlign: "center" }}>
|
|
134
|
+
<Heading id="Small" text="ImageSizes.Small" />
|
|
135
|
+
<Image
|
|
136
|
+
alt="Alt text"
|
|
137
|
+
imageCaption="165px"
|
|
138
|
+
imageSize={ImageSizes.Small}
|
|
139
|
+
src="https://placeimg.com/400/300/animals"
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
<div style={{ textAlign: "center" }}>
|
|
143
|
+
<Heading id="Medium" text="ImageSizes.Medium" />
|
|
144
|
+
<Image
|
|
145
|
+
alt="Alt text"
|
|
146
|
+
imageCaption="225px"
|
|
147
|
+
imageSize={ImageSizes.Medium}
|
|
148
|
+
src="https://placeimg.com/400/300/animals"
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
<div style={{ textAlign: "center" }}>
|
|
152
|
+
<Heading id="Large" text="ImageSizes.Large" />
|
|
153
|
+
<Image
|
|
154
|
+
alt="Alt text"
|
|
155
|
+
imageCaption="360px"
|
|
156
|
+
imageSize={ImageSizes.Large}
|
|
157
|
+
src="https://placeimg.com/400/300/animals"
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
<div style={{ textAlign: "center" }}>
|
|
161
|
+
<Heading id="Default" text="ImageSizes.Default" />
|
|
162
|
+
<Image
|
|
163
|
+
alt="Alt text"
|
|
164
|
+
imageCaption="100%"
|
|
165
|
+
src="https://placeimg.com/400/300/animals"
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
</SimpleGrid>
|
|
127
169
|
</Story>
|
|
128
170
|
</Canvas>
|
|
129
171
|
|
|
@@ -137,56 +179,72 @@ in an element with a fixed width value.
|
|
|
137
179
|
|
|
138
180
|
<Canvas>
|
|
139
181
|
<Story name="Image Aspect Ratios">
|
|
140
|
-
<
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
182
|
+
<SimpleGrid columns={1}>
|
|
183
|
+
<div style={imageBlockStyles}>
|
|
184
|
+
<Heading id="fourbythree" text="ImageRatios.FourByThree" />
|
|
185
|
+
<Image
|
|
186
|
+
alt="Alt text"
|
|
187
|
+
imageAspectRatio={ImageRatios.FourByThree}
|
|
188
|
+
src="https://placeimg.com/400/300/animals"
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
<div style={imageBlockStyles}>
|
|
192
|
+
<Heading id="onebytwo" text="ImageRatios.OneByTwo" />
|
|
193
|
+
<Image
|
|
194
|
+
alt="Alt text"
|
|
195
|
+
imageAspectRatio={ImageRatios.OneByTwo}
|
|
196
|
+
src="https://placeimg.com/400/300/animals"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
<div style={imageBlockStyles}>
|
|
200
|
+
<Heading id="original" text="ImageRatios.Original" />
|
|
201
|
+
<Image
|
|
202
|
+
alt="Alt text"
|
|
203
|
+
imageAspectRatio={ImageRatios.Original}
|
|
204
|
+
src="https://placeimg.com/400/300/animals"
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
<div style={imageBlockStyles}>
|
|
208
|
+
<Heading id="sixteenbynine" text="ImageRatios.SixteenByNine" />
|
|
209
|
+
<Image
|
|
210
|
+
alt="Alt text"
|
|
211
|
+
imageAspectRatio={ImageRatios.SixteenByNine}
|
|
212
|
+
src="https://placeimg.com/400/300/animals"
|
|
213
|
+
/>
|
|
214
|
+
</div>
|
|
215
|
+
<div style={imageBlockStyles}>
|
|
216
|
+
<Heading id="square" text="ImageRatios.Square" />
|
|
217
|
+
<Image
|
|
218
|
+
alt="Alt text"
|
|
219
|
+
imageAspectRatio={ImageRatios.Square}
|
|
220
|
+
src="https://placeimg.com/400/300/animals"
|
|
221
|
+
/>
|
|
222
|
+
</div>
|
|
223
|
+
<div style={imageBlockStyles}>
|
|
224
|
+
<Heading id="threebyfour" text="ImageRatios.ThreeByFour" />
|
|
225
|
+
<Image
|
|
226
|
+
alt="Alt text"
|
|
227
|
+
imageAspectRatio={ImageRatios.ThreeByFour}
|
|
228
|
+
src="https://placeimg.com/400/300/animals"
|
|
229
|
+
/>
|
|
230
|
+
</div>
|
|
231
|
+
<div style={imageBlockStyles}>
|
|
232
|
+
<Heading id="threebytwo" text="ImageRatios.ThreeByTwo" />
|
|
233
|
+
<Image
|
|
234
|
+
alt="Alt text"
|
|
235
|
+
imageAspectRatio={ImageRatios.ThreeByTwo}
|
|
236
|
+
src="https://placeimg.com/400/300/animals"
|
|
237
|
+
/>
|
|
238
|
+
</div>
|
|
239
|
+
<div style={imageBlockStyles}>
|
|
240
|
+
<Heading id="twobyone" text="ImageRatios.TwoByOne" />
|
|
241
|
+
<Image
|
|
242
|
+
alt="Alt text"
|
|
243
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
244
|
+
src="https://placeimg.com/400/300/animals"
|
|
245
|
+
/>
|
|
246
|
+
</div>
|
|
247
|
+
</SimpleGrid>
|
|
190
248
|
</Story>
|
|
191
249
|
</Canvas>
|
|
192
250
|
|
|
@@ -200,21 +258,25 @@ in an element with a fixed width value.
|
|
|
200
258
|
|
|
201
259
|
<Canvas>
|
|
202
260
|
<Story name="Image Types">
|
|
203
|
-
<
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
261
|
+
<SimpleGrid columns={1}>
|
|
262
|
+
<div style={imageBlockStyles}>
|
|
263
|
+
<Heading id="default" text="ImageTypes.Default" />
|
|
264
|
+
<Image
|
|
265
|
+
alt="Alt text"
|
|
266
|
+
imageAspectRatio={ImageRatios.Square}
|
|
267
|
+
imageType={ImageTypes.Default}
|
|
268
|
+
src="https://placeimg.com/400/400/animals"
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
271
|
+
<div style={imageBlockStyles}>
|
|
272
|
+
<Heading id="circle" text="ImageTypes.Circle" />
|
|
273
|
+
<Image
|
|
274
|
+
alt="Alt text"
|
|
275
|
+
imageAspectRatio={ImageRatios.Square}
|
|
276
|
+
imageType={ImageTypes.Circle}
|
|
277
|
+
src="https://placeimg.com/400/400/animals"
|
|
278
|
+
/>
|
|
279
|
+
</div>
|
|
280
|
+
</SimpleGrid>
|
|
219
281
|
</Story>
|
|
220
282
|
</Canvas>
|