@nypl/design-system-react-components 0.25.7 → 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 +29 -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 +613 -366
- 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 +606 -354
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +3 -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 +1 -1
- package/src/components/Accordion/Accordion.stories.mdx +1 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +10 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +99 -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.stories.mdx +1 -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 +6 -0
- package/src/theme/components/breadcrumb.ts +1 -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
|
@@ -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>
|
|
@@ -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
|
|