@nypl/design-system-react-components 0.25.12 → 0.25.13
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 +63 -1
- package/dist/components/Accordion/Accordion.d.ts +5 -3
- package/dist/components/Accordion/AccordionTypes.d.ts +5 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +3 -3
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +11 -20
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +4 -2
- package/dist/components/Heading/Heading.d.ts +4 -4
- package/dist/components/Heading/HeadingTypes.d.ts +1 -1
- package/dist/components/Hero/Hero.d.ts +7 -4
- package/dist/components/Icons/IconTypes.d.ts +1 -0
- package/dist/components/Image/Image.d.ts +25 -7
- package/dist/components/Image/ImageTypes.d.ts +4 -4
- package/dist/components/Logo/LogoTypes.d.ts +2 -2
- package/dist/components/Notification/Notification.d.ts +4 -4
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +4 -2
- package/dist/components/Select/Select.d.ts +2 -2
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -4
- package/dist/components/StructuredContent/StructuredContent.d.ts +9 -22
- package/dist/components/Tabs/Tabs.d.ts +3 -3
- package/dist/components/Template/Template.d.ts +13 -5
- package/dist/components/Text/Text.d.ts +3 -3
- package/dist/components/Text/TextTypes.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +2 -2
- package/dist/components/Toggle/Toggle.d.ts +6 -7
- package/dist/components/Toggle/{ToggleSizes.d.ts → ToggleTypes.d.ts} +1 -1
- package/dist/design-system-react-components.cjs.development.js +505 -422
- 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 +514 -435
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/enums.d.ts +4 -0
- package/dist/index.d.ts +7 -8
- package/dist/theme/components/accordion.d.ts +7 -12
- package/dist/theme/components/breadcrumb.d.ts +3 -0
- package/dist/theme/components/card.d.ts +4 -4
- package/dist/theme/components/checkbox.d.ts +1 -0
- package/dist/theme/components/checkboxGroup.d.ts +3 -1
- package/dist/theme/components/global.d.ts +2 -1
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/image.d.ts +1 -1
- package/dist/theme/components/notification.d.ts +4 -4
- package/dist/theme/components/pagination.d.ts +2 -5
- package/dist/theme/components/radio.d.ts +1 -0
- package/dist/theme/components/radioGroup.d.ts +3 -1
- package/dist/theme/components/select.d.ts +3 -0
- package/dist/theme/components/toggle.d.ts +13 -1
- package/package.json +1 -1
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +34 -0
- package/src/components/Accordion/Accordion.stories.mdx +150 -66
- package/src/components/Accordion/Accordion.test.tsx +44 -17
- package/src/components/Accordion/Accordion.tsx +50 -20
- package/src/components/Accordion/AccordionTypes.tsx +5 -0
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +244 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +17 -15
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +6 -6
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +6 -6
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -1
- package/src/components/Card/Card.stories.mdx +236 -165
- package/src/components/Card/Card.test.tsx +36 -18
- package/src/components/Card/Card.tsx +84 -59
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +25 -65
- package/src/components/Chakra/Center.stories.mdx +2 -2
- package/src/components/Checkbox/Checkbox.stories.mdx +13 -1
- package/src/components/Checkbox/Checkbox.test.tsx +58 -2
- package/src/components/Checkbox/Checkbox.tsx +6 -1
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +76 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +73 -9
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +79 -9
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +10 -7
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +169 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +1 -1
- package/src/components/DatePicker/DatePicker.test.tsx +5 -2
- package/src/components/DatePicker/DatePicker.tsx +5 -2
- package/src/components/Form/Form.stories.mdx +47 -9
- package/src/components/Form/Form.test.tsx +1 -1
- package/src/components/Form/Form.tsx +3 -1
- package/src/components/Grid/SimpleGrid.stories.mdx +53 -35
- package/src/components/Grid/SimpleGrid.test.tsx +15 -9
- package/src/components/Heading/Heading.stories.mdx +21 -23
- package/src/components/Heading/Heading.test.tsx +7 -7
- package/src/components/Heading/Heading.tsx +10 -14
- package/src/components/Heading/HeadingTypes.tsx +1 -1
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +1 -1
- package/src/components/Hero/Hero.stories.mdx +27 -27
- package/src/components/Hero/Hero.test.tsx +113 -58
- package/src/components/Hero/Hero.tsx +43 -20
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +6 -4
- package/src/components/HorizontalRule/HorizontalRule.tsx +3 -2
- package/src/components/Icons/Icon.stories.mdx +50 -18
- package/src/components/Icons/Icon.test.tsx +13 -2
- package/src/components/Icons/Icon.tsx +11 -6
- package/src/components/Icons/IconTypes.tsx +1 -0
- package/src/components/Image/Image.stories.mdx +133 -68
- package/src/components/Image/Image.test.tsx +32 -48
- package/src/components/Image/Image.tsx +46 -26
- package/src/components/Image/ImageTypes.ts +4 -4
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +60 -13
- package/src/components/Link/Link.tsx +8 -1
- package/src/components/List/List.stories.mdx +1 -1
- package/src/components/List/List.test.tsx +7 -4
- package/src/components/List/List.tsx +7 -4
- package/src/components/Logo/Logo.stories.mdx +13 -13
- package/src/components/Logo/Logo.test.tsx +12 -2
- package/src/components/Logo/Logo.tsx +10 -5
- package/src/components/Logo/LogoTypes.tsx +1 -1
- package/src/components/Notification/Notification.stories.mdx +5 -5
- package/src/components/Notification/Notification.tsx +10 -10
- package/src/components/Pagination/Pagination.stories.mdx +4 -3
- package/src/components/Pagination/Pagination.test.tsx +30 -2
- package/src/components/Pagination/Pagination.tsx +6 -3
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +1 -1
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +6 -2
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +3 -1
- package/src/components/Radio/Radio.stories.mdx +13 -1
- package/src/components/Radio/Radio.test.tsx +56 -2
- package/src/components/Radio/Radio.tsx +6 -1
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +61 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +73 -9
- package/src/components/RadioGroup/RadioGroup.test.tsx +72 -7
- package/src/components/RadioGroup/RadioGroup.tsx +10 -7
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +140 -0
- package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +3 -3
- package/src/components/Select/Select.stories.mdx +26 -16
- package/src/components/Select/Select.test.tsx +1 -36
- package/src/components/Select/Select.tsx +4 -16
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +12 -14
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +6 -8
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +5 -7
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/Slider/Slider.stories.mdx +41 -8
- package/src/components/Slider/Slider.tsx +4 -4
- package/src/components/StatusBadge/StatusBadge.test.tsx +3 -1
- package/src/components/StatusBadge/StatusBadge.tsx +1 -1
- package/src/components/StructuredContent/StructuredContent.stories.mdx +103 -54
- package/src/components/StructuredContent/StructuredContent.test.tsx +129 -102
- package/src/components/StructuredContent/StructuredContent.tsx +43 -53
- package/src/components/StyleGuide/ColorCard.tsx +3 -3
- package/src/components/StyleGuide/Typography.stories.mdx +17 -12
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/Tabs.stories.mdx +8 -8
- package/src/components/Tabs/Tabs.test.tsx +13 -11
- package/src/components/Tabs/Tabs.tsx +18 -15
- package/src/components/Template/Template.stories.mdx +62 -25
- package/src/components/Template/Template.test.tsx +35 -5
- package/src/components/Template/Template.tsx +26 -13
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +4 -2
- package/src/components/Text/Text.stories.mdx +13 -15
- package/src/components/Text/Text.test.tsx +6 -15
- package/src/components/Text/Text.tsx +7 -12
- package/src/components/Text/TextTypes.tsx +1 -1
- package/src/components/TextInput/TextInput.stories.mdx +9 -9
- package/src/components/TextInput/TextInput.test.tsx +28 -27
- package/src/components/TextInput/TextInput.tsx +4 -4
- package/src/components/Toggle/Toggle.stories.mdx +12 -22
- package/src/components/Toggle/Toggle.test.tsx +15 -2
- package/src/components/Toggle/Toggle.tsx +8 -9
- package/src/components/Toggle/{ToggleSizes.tsx → ToggleTypes.tsx} +1 -1
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +64 -0
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -6
- package/src/components/VideoPlayer/VideoPlayer.tsx +14 -7
- package/src/docs/{Intro.stories.mdx → Welcome.stories.mdx} +5 -9
- package/src/{components/Card/CardTypes.tsx → helpers/enums.ts} +2 -2
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useCarouselStyles.stories.mdx +10 -0
- package/src/hooks/useNYPLTheme.ts +1 -1
- package/src/index.ts +7 -14
- package/src/theme/components/accordion.ts +7 -12
- package/src/theme/components/breadcrumb.ts +3 -0
- package/src/theme/components/card.ts +29 -20
- package/src/theme/components/checkboxGroup.ts +3 -1
- package/src/theme/components/global.ts +4 -3
- package/src/theme/components/hero.ts +1 -1
- package/src/theme/components/icon.ts +5 -2
- package/src/theme/components/image.ts +1 -1
- package/src/theme/components/list.ts +1 -1
- package/src/theme/components/notification.ts +5 -5
- package/src/theme/components/pagination.ts +2 -5
- package/src/theme/components/progressIndicator.ts +3 -3
- package/src/theme/components/radioGroup.ts +3 -1
- package/src/theme/components/select.ts +6 -0
- package/src/theme/components/toggle.ts +26 -3
- package/src/utils/componentCategories.ts +27 -19
- package/dist/components/Card/CardTypes.d.ts +0 -4
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +0 -4
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +0 -4
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +0 -4
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +0 -4
|
@@ -11,9 +11,8 @@ import { withDesign } from "storybook-addon-designs";
|
|
|
11
11
|
import Button from "../Button/Button";
|
|
12
12
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
13
13
|
import Card, { CardHeading, CardContent, CardActions } from "./Card";
|
|
14
|
-
import { CardLayouts } from "./CardTypes";
|
|
15
14
|
import Heading from "../Heading/Heading";
|
|
16
|
-
import {
|
|
15
|
+
import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
17
16
|
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
18
17
|
import Icon from "../Icons/Icon";
|
|
19
18
|
import Image from "../Image/Image";
|
|
@@ -21,6 +20,7 @@ import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
|
|
|
21
20
|
import Link from "../Link/Link";
|
|
22
21
|
import { LinkTypes } from "../Link/LinkTypes";
|
|
23
22
|
import SimpleGrid from "../Grid/SimpleGrid";
|
|
23
|
+
import { LayoutTypes } from "../../helpers/enums";
|
|
24
24
|
import { getCategory } from "../../utils/componentCategories";
|
|
25
25
|
import DSProvider from "../../theme/provider";
|
|
26
26
|
import { getStorybookEnumValues } from "../../utils/utils";
|
|
@@ -33,9 +33,9 @@ export const imageSizesEnumValues = getStorybookEnumValues(
|
|
|
33
33
|
ImageSizes,
|
|
34
34
|
"ImageSizes"
|
|
35
35
|
);
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
"
|
|
36
|
+
export const LayoutTypesEnumValues = getStorybookEnumValues(
|
|
37
|
+
LayoutTypes,
|
|
38
|
+
"LayoutTypes"
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
<Meta
|
|
@@ -54,36 +54,40 @@ export const cardLayoutsEnumValues = getStorybookEnumValues(
|
|
|
54
54
|
border: {
|
|
55
55
|
table: { defaultValue: { summary: false } },
|
|
56
56
|
},
|
|
57
|
-
center: {
|
|
58
|
-
table: { defaultValue: { summary: false } },
|
|
59
|
-
},
|
|
60
57
|
className: { control: false },
|
|
61
58
|
foregroundColor: { control: { type: "color" } },
|
|
62
59
|
id: { control: false },
|
|
63
|
-
|
|
60
|
+
imageProps: { disable: true },
|
|
61
|
+
"imageProps.alt": {
|
|
62
|
+
control: { type: "text" },
|
|
64
63
|
table: { defaultValue: { summary: "" } },
|
|
65
64
|
},
|
|
66
|
-
|
|
65
|
+
"imageProps.aspectRatio": {
|
|
67
66
|
control: { type: "select" },
|
|
68
67
|
table: { defaultValue: { summary: "ImageRatios.Square" } },
|
|
69
68
|
options: imageRatiosEnumValues.options,
|
|
70
69
|
},
|
|
71
|
-
|
|
70
|
+
"imageProps.caption": { control: false },
|
|
71
|
+
"imageProps.component": { control: false },
|
|
72
|
+
"imageProps.credit": { control: false },
|
|
73
|
+
"imageProps.isAtEnd": {
|
|
72
74
|
table: { defaultValue: { summary: false } },
|
|
73
75
|
},
|
|
74
|
-
|
|
75
|
-
imageSize: {
|
|
76
|
+
"imageProps.size": {
|
|
76
77
|
control: { type: "select" },
|
|
77
78
|
table: { defaultValue: { summary: "ImageSizes.Default" } },
|
|
78
79
|
options: imageSizesEnumValues.options,
|
|
79
80
|
},
|
|
80
|
-
|
|
81
|
+
"imageProps.src": {
|
|
81
82
|
table: { defaultValue: { summary: "" } },
|
|
82
83
|
},
|
|
84
|
+
isCentered: {
|
|
85
|
+
table: { defaultValue: { summary: false } },
|
|
86
|
+
},
|
|
83
87
|
layout: {
|
|
84
88
|
control: { type: "radio" },
|
|
85
|
-
table: { defaultValue: { summary: "
|
|
86
|
-
options:
|
|
89
|
+
table: { defaultValue: { summary: "LayoutTypes.Column" } },
|
|
90
|
+
options: LayoutTypesEnumValues.options,
|
|
87
91
|
},
|
|
88
92
|
}}
|
|
89
93
|
/>
|
|
@@ -93,7 +97,7 @@ export const cardLayoutsEnumValues = getStorybookEnumValues(
|
|
|
93
97
|
| Component Version | DS Version |
|
|
94
98
|
| ----------------- | ---------- |
|
|
95
99
|
| Added | `0.24.0` |
|
|
96
|
-
| Latest | `0.25.
|
|
100
|
+
| Latest | `0.25.13` |
|
|
97
101
|
|
|
98
102
|
<Description of={Card} />
|
|
99
103
|
|
|
@@ -127,26 +131,34 @@ headings and CTAs.
|
|
|
127
131
|
args={{
|
|
128
132
|
backgroundColor: undefined,
|
|
129
133
|
border: false,
|
|
130
|
-
center: false,
|
|
131
134
|
className: undefined,
|
|
132
135
|
foregroundColor: undefined,
|
|
133
136
|
id: "card-id",
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
"imageProps.alt": "Alt text",
|
|
138
|
+
"imageProps.aspectRatio": "ImageRatios.Square",
|
|
139
|
+
"imageProps.component": undefined,
|
|
140
|
+
"imageProps.isAtEnd": false,
|
|
141
|
+
"imageProps.size": "ImageSizes.Default",
|
|
142
|
+
"imageProps.src": "https://placeimg.com/400/300/animals",
|
|
143
|
+
isCentered: false,
|
|
144
|
+
layout: "LayoutTypes.Row",
|
|
141
145
|
mainActionLink: undefined,
|
|
142
146
|
}}
|
|
143
147
|
>
|
|
144
148
|
{(args) => (
|
|
145
149
|
<Card
|
|
146
150
|
{...args}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
imageProps={{
|
|
152
|
+
alt: args["imageProps.alt"],
|
|
153
|
+
aspectRatio: imageRatiosEnumValues.getValue(
|
|
154
|
+
args["imageProps.aspectRatio"]
|
|
155
|
+
),
|
|
156
|
+
component: args["imageProps.component"],
|
|
157
|
+
isAtEnd: args["imageProps.isAtEnd"],
|
|
158
|
+
size: imageSizesEnumValues.getValue(args["imageProps.size"]),
|
|
159
|
+
src: args["imageProps.src"],
|
|
160
|
+
}}
|
|
161
|
+
layout={LayoutTypesEnumValues.getValue(args.layout)}
|
|
150
162
|
>
|
|
151
163
|
<CardHeading level={HeadingLevels.Two} id="main-heading1">
|
|
152
164
|
Optional Header
|
|
@@ -192,7 +204,7 @@ headings and CTAs.
|
|
|
192
204
|
|
|
193
205
|
By default, the image is always the first element within a `Card`. This means
|
|
194
206
|
the image is at the top of a `Card` with a column layout and on the left side of
|
|
195
|
-
a `Card` with a row layout. However, you can use the `
|
|
207
|
+
a `Card` with a row layout. However, you can use the `imageProps.isAtEnd` boolean prop
|
|
196
208
|
to override the default placement and move the image to the last element within
|
|
197
209
|
a `Card`.
|
|
198
210
|
|
|
@@ -202,9 +214,11 @@ a `Card`.
|
|
|
202
214
|
<Story name="Card Image Position">
|
|
203
215
|
<SimpleGrid columns={2}>
|
|
204
216
|
<Card
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
217
|
+
imageProps={{
|
|
218
|
+
alt: "Alt text",
|
|
219
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
220
|
+
src: "https://placeimg.com/400/200/animals",
|
|
221
|
+
}}
|
|
208
222
|
>
|
|
209
223
|
<CardHeading level={HeadingLevels.Three} id="props-heading1">
|
|
210
224
|
Image on Top (default)
|
|
@@ -215,10 +229,12 @@ a `Card`.
|
|
|
215
229
|
</CardContent>
|
|
216
230
|
</Card>
|
|
217
231
|
<Card
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
imageProps={{
|
|
233
|
+
alt: "Alt text",
|
|
234
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
235
|
+
isAtEnd: true,
|
|
236
|
+
src: "https://placeimg.com/400/200/animals",
|
|
237
|
+
}}
|
|
222
238
|
>
|
|
223
239
|
<CardHeading level={HeadingLevels.Three} id="props-heading2">
|
|
224
240
|
Image on Bottom
|
|
@@ -238,11 +254,13 @@ a `Card`.
|
|
|
238
254
|
<DSProvider>
|
|
239
255
|
<SimpleGrid columns={1}>
|
|
240
256
|
<Card
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
257
|
+
imageProps={{
|
|
258
|
+
alt: "Alt text",
|
|
259
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
260
|
+
src: "https://placeimg.com/400/200/animals",
|
|
261
|
+
}}
|
|
262
|
+
isCentered
|
|
263
|
+
layout={LayoutTypes.Row}
|
|
246
264
|
>
|
|
247
265
|
<CardHeading level={HeadingLevels.Four} id="row-heading1">
|
|
248
266
|
Image on Left (default)
|
|
@@ -254,12 +272,14 @@ a `Card`.
|
|
|
254
272
|
</CardContent>
|
|
255
273
|
</Card>
|
|
256
274
|
<Card
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
275
|
+
imageProps={{
|
|
276
|
+
alt: "Alt text",
|
|
277
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
278
|
+
isAtEnd: true,
|
|
279
|
+
src: "https://placeimg.com/400/200/animals",
|
|
280
|
+
}}
|
|
281
|
+
isCentered
|
|
282
|
+
layout={LayoutTypes.Row}
|
|
263
283
|
>
|
|
264
284
|
<CardHeading level={HeadingLevels.Four} id="row-heading2">
|
|
265
285
|
Image on Right
|
|
@@ -277,7 +297,7 @@ a `Card`.
|
|
|
277
297
|
## Image Size
|
|
278
298
|
|
|
279
299
|
By default, the image width is `100%` for a `Card` with a column layout and
|
|
280
|
-
`225px` for a `Card` with a row layout. However, you can use the `
|
|
300
|
+
`225px` for a `Card` with a row layout. However, you can use the `imageProps.size`
|
|
281
301
|
prop to override the default width.
|
|
282
302
|
|
|
283
303
|
### Column Cards
|
|
@@ -286,11 +306,13 @@ prop to override the default width.
|
|
|
286
306
|
<Story name="Card Image Size">
|
|
287
307
|
<SimpleGrid columns={1}>
|
|
288
308
|
<Card
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
309
|
+
imageProps={{
|
|
310
|
+
alt: "Alt text",
|
|
311
|
+
aspectRatio: ImageRatios.Square,
|
|
312
|
+
size: ImageSizes.ExtraExtraSmall,
|
|
313
|
+
src: "https://placeimg.com/400/200/animals",
|
|
314
|
+
}}
|
|
315
|
+
isCentered
|
|
294
316
|
>
|
|
295
317
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
296
318
|
Extra Extra Small Image
|
|
@@ -305,11 +327,13 @@ prop to override the default width.
|
|
|
305
327
|
</Card>
|
|
306
328
|
<HorizontalRule />
|
|
307
329
|
<Card
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
330
|
+
imageProps={{
|
|
331
|
+
alt: "Alt text",
|
|
332
|
+
aspectRatio: ImageRatios.Square,
|
|
333
|
+
size: ImageSizes.ExtraSmall,
|
|
334
|
+
src: "https://placeimg.com/400/200/animals",
|
|
335
|
+
}}
|
|
336
|
+
isCentered
|
|
313
337
|
>
|
|
314
338
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
315
339
|
Extra Small Image
|
|
@@ -324,11 +348,13 @@ prop to override the default width.
|
|
|
324
348
|
</Card>
|
|
325
349
|
<HorizontalRule />
|
|
326
350
|
<Card
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
351
|
+
imageProps={{
|
|
352
|
+
alt: "Alt text",
|
|
353
|
+
aspectRatio: ImageRatios.Square,
|
|
354
|
+
size: ImageSizes.Small,
|
|
355
|
+
src: "https://placeimg.com/400/200/animals",
|
|
356
|
+
}}
|
|
357
|
+
isCentered
|
|
332
358
|
>
|
|
333
359
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
334
360
|
Small Image
|
|
@@ -343,11 +369,13 @@ prop to override the default width.
|
|
|
343
369
|
</Card>
|
|
344
370
|
<HorizontalRule />
|
|
345
371
|
<Card
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
372
|
+
imageProps={{
|
|
373
|
+
alt: "Alt text",
|
|
374
|
+
aspectRatio: ImageRatios.Square,
|
|
375
|
+
size: ImageSizes.Medium,
|
|
376
|
+
src: "https://placeimg.com/400/200/animals",
|
|
377
|
+
}}
|
|
378
|
+
isCentered
|
|
351
379
|
>
|
|
352
380
|
<CardHeading level={HeadingLevels.Three} id="column2-heading1">
|
|
353
381
|
Medium Image
|
|
@@ -362,11 +390,13 @@ prop to override the default width.
|
|
|
362
390
|
</Card>
|
|
363
391
|
<HorizontalRule />
|
|
364
392
|
<Card
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
393
|
+
imageProps={{
|
|
394
|
+
alt: "Alt text",
|
|
395
|
+
aspectRatio: ImageRatios.Square,
|
|
396
|
+
size: ImageSizes.Large,
|
|
397
|
+
src: "https://placeimg.com/400/200/animals",
|
|
398
|
+
}}
|
|
399
|
+
isCentered
|
|
370
400
|
>
|
|
371
401
|
<CardHeading level={HeadingLevels.Three} id="column3-heading1">
|
|
372
402
|
Large Image
|
|
@@ -381,10 +411,12 @@ prop to override the default width.
|
|
|
381
411
|
</Card>
|
|
382
412
|
<HorizontalRule />
|
|
383
413
|
<Card
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
414
|
+
imageProps={{
|
|
415
|
+
alt: "Alt text",
|
|
416
|
+
aspectRatio: ImageRatios.Square,
|
|
417
|
+
src: "https://placeimg.com/400/200/animals",
|
|
418
|
+
}}
|
|
419
|
+
isCentered
|
|
388
420
|
>
|
|
389
421
|
<CardHeading level={HeadingLevels.Three} id="column-4heading1">
|
|
390
422
|
Default Image
|
|
@@ -407,12 +439,14 @@ prop to override the default width.
|
|
|
407
439
|
<DSProvider>
|
|
408
440
|
<SimpleGrid columns={1}>
|
|
409
441
|
<Card
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
442
|
+
imageProps={{
|
|
443
|
+
alt: "Alt text",
|
|
444
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
445
|
+
size: ImageSizes.ExtraExtraSmall,
|
|
446
|
+
src: "https://placeimg.com/400/200/animals",
|
|
447
|
+
}}
|
|
448
|
+
isCentered
|
|
449
|
+
layout={LayoutTypes.Row}
|
|
416
450
|
>
|
|
417
451
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
418
452
|
Extra Extra Small Image
|
|
@@ -425,12 +459,14 @@ prop to override the default width.
|
|
|
425
459
|
</CardContent>
|
|
426
460
|
</Card>
|
|
427
461
|
<Card
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
462
|
+
imageProps={{
|
|
463
|
+
alt: "Alt text",
|
|
464
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
465
|
+
size: ImageSizes.ExtraSmall,
|
|
466
|
+
src: "https://placeimg.com/400/200/animals",
|
|
467
|
+
}}
|
|
468
|
+
isCentered
|
|
469
|
+
layout={LayoutTypes.Row}
|
|
434
470
|
>
|
|
435
471
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
436
472
|
Extra Small Image
|
|
@@ -443,12 +479,14 @@ prop to override the default width.
|
|
|
443
479
|
</CardContent>
|
|
444
480
|
</Card>
|
|
445
481
|
<Card
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
482
|
+
imageProps={{
|
|
483
|
+
alt: "Alt text",
|
|
484
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
485
|
+
size: ImageSizes.Small,
|
|
486
|
+
src: "https://placeimg.com/400/200/animals",
|
|
487
|
+
}}
|
|
488
|
+
isCentered
|
|
489
|
+
layout={LayoutTypes.Row}
|
|
452
490
|
>
|
|
453
491
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
454
492
|
Small Image
|
|
@@ -461,12 +499,14 @@ prop to override the default width.
|
|
|
461
499
|
</CardContent>
|
|
462
500
|
</Card>
|
|
463
501
|
<Card
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
502
|
+
imageProps={{
|
|
503
|
+
alt: "Alt text",
|
|
504
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
505
|
+
size: ImageSizes.Medium,
|
|
506
|
+
src: "https://placeimg.com/400/200/animals",
|
|
507
|
+
}}
|
|
508
|
+
isCentered
|
|
509
|
+
layout={LayoutTypes.Row}
|
|
470
510
|
>
|
|
471
511
|
<CardHeading level={HeadingLevels.Three} id="row3-heading2">
|
|
472
512
|
Medium Image
|
|
@@ -480,12 +520,14 @@ prop to override the default width.
|
|
|
480
520
|
</CardContent>
|
|
481
521
|
</Card>
|
|
482
522
|
<Card
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
523
|
+
imageProps={{
|
|
524
|
+
alt: "Alt text",
|
|
525
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
526
|
+
size: ImageSizes.Large,
|
|
527
|
+
src: "https://placeimg.com/400/200/animals",
|
|
528
|
+
}}
|
|
529
|
+
isCentered
|
|
530
|
+
layout={LayoutTypes.Row}
|
|
489
531
|
>
|
|
490
532
|
<CardHeading level={HeadingLevels.Three} id="row4-heading1">
|
|
491
533
|
Large Image
|
|
@@ -500,11 +542,13 @@ prop to override the default width.
|
|
|
500
542
|
</CardContent>
|
|
501
543
|
</Card>
|
|
502
544
|
<Card
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
545
|
+
imageProps={{
|
|
546
|
+
alt: "Alt text",
|
|
547
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
548
|
+
src: "https://placeimg.com/400/200/animals",
|
|
549
|
+
}}
|
|
550
|
+
isCentered
|
|
551
|
+
layout={LayoutTypes.Row}
|
|
508
552
|
>
|
|
509
553
|
<CardHeading level={HeadingLevels.Three} id="row5-heading2">
|
|
510
554
|
Default Image
|
|
@@ -528,9 +572,11 @@ prop to override the default width.
|
|
|
528
572
|
<Story name="Cards in a Grid">
|
|
529
573
|
<SimpleGrid columns={3}>
|
|
530
574
|
<Card
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
575
|
+
imageProps={{
|
|
576
|
+
alt: "Alt text",
|
|
577
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
578
|
+
src: "https://placeimg.com/400/200/animals",
|
|
579
|
+
}}
|
|
534
580
|
>
|
|
535
581
|
<CardHeading level={HeadingLevels.Three} id="grid1-heading1">
|
|
536
582
|
Card Heading
|
|
@@ -541,9 +587,11 @@ prop to override the default width.
|
|
|
541
587
|
</CardContent>
|
|
542
588
|
</Card>
|
|
543
589
|
<Card
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
590
|
+
imageProps={{
|
|
591
|
+
alt: "Alt text",
|
|
592
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
593
|
+
src: "https://placeimg.com/410/210/animals",
|
|
594
|
+
}}
|
|
547
595
|
>
|
|
548
596
|
<CardHeading level={HeadingLevels.Three} id="grid2-heading1">
|
|
549
597
|
Card Heading
|
|
@@ -554,9 +602,11 @@ prop to override the default width.
|
|
|
554
602
|
</CardContent>
|
|
555
603
|
</Card>
|
|
556
604
|
<Card
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
605
|
+
imageProps={{
|
|
606
|
+
alt: "Alt text",
|
|
607
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
608
|
+
src: "https://placeimg.com/420/220/animals",
|
|
609
|
+
}}
|
|
560
610
|
>
|
|
561
611
|
<CardHeading level={HeadingLevels.Three} id="grid3-heading1">
|
|
562
612
|
Card Heading
|
|
@@ -567,9 +617,11 @@ prop to override the default width.
|
|
|
567
617
|
</CardContent>
|
|
568
618
|
</Card>
|
|
569
619
|
<Card
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
620
|
+
imageProps={{
|
|
621
|
+
alt: "Alt text",
|
|
622
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
623
|
+
src: "https://placeimg.com/430/230/animals",
|
|
624
|
+
}}
|
|
573
625
|
>
|
|
574
626
|
<CardHeading level={HeadingLevels.Three} id="grid4-heading1">
|
|
575
627
|
Card Heading
|
|
@@ -580,9 +632,11 @@ prop to override the default width.
|
|
|
580
632
|
</CardContent>
|
|
581
633
|
</Card>
|
|
582
634
|
<Card
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
635
|
+
imageProps={{
|
|
636
|
+
alt: "Alt text",
|
|
637
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
638
|
+
src: "https://placeimg.com/440/200/animals",
|
|
639
|
+
}}
|
|
586
640
|
>
|
|
587
641
|
<CardHeading level={HeadingLevels.Three} id="grid5-heading1">
|
|
588
642
|
Card Heading
|
|
@@ -593,9 +647,11 @@ prop to override the default width.
|
|
|
593
647
|
</CardContent>
|
|
594
648
|
</Card>
|
|
595
649
|
<Card
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
650
|
+
imageProps={{
|
|
651
|
+
alt: "Alt text",
|
|
652
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
653
|
+
src: "https://placeimg.com/450/200/animals",
|
|
654
|
+
}}
|
|
599
655
|
>
|
|
600
656
|
<CardHeading level={HeadingLevels.Three} id="grid6-heading1">
|
|
601
657
|
Card Heading
|
|
@@ -615,11 +671,13 @@ prop to override the default width.
|
|
|
615
671
|
<Story name="Cards in a Stack">
|
|
616
672
|
<SimpleGrid columns={1}>
|
|
617
673
|
<Card
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
674
|
+
imageProps={{
|
|
675
|
+
alt: "Alt text",
|
|
676
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
677
|
+
src: "https://placeimg.com/400/200/animals",
|
|
678
|
+
}}
|
|
679
|
+
isCentered
|
|
680
|
+
layout={LayoutTypes.Row}
|
|
623
681
|
>
|
|
624
682
|
<CardHeading level={HeadingLevels.Four} id="stack1-heading1">
|
|
625
683
|
Card Heading
|
|
@@ -631,11 +689,13 @@ prop to override the default width.
|
|
|
631
689
|
</CardContent>
|
|
632
690
|
</Card>
|
|
633
691
|
<Card
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
692
|
+
imageProps={{
|
|
693
|
+
alt: "Alt text",
|
|
694
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
695
|
+
src: "https://placeimg.com/410/210/animals",
|
|
696
|
+
}}
|
|
697
|
+
isCentered
|
|
698
|
+
layout={LayoutTypes.Row}
|
|
639
699
|
>
|
|
640
700
|
<CardHeading level={HeadingLevels.Four} id="stack2-heading2">
|
|
641
701
|
Card Heading
|
|
@@ -647,11 +707,13 @@ prop to override the default width.
|
|
|
647
707
|
</CardContent>
|
|
648
708
|
</Card>
|
|
649
709
|
<Card
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
710
|
+
imageProps={{
|
|
711
|
+
alt: "Alt text",
|
|
712
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
713
|
+
src: "https://placeimg.com/420/220/animals",
|
|
714
|
+
}}
|
|
715
|
+
isCentered
|
|
716
|
+
layout={LayoutTypes.Row}
|
|
655
717
|
>
|
|
656
718
|
<CardHeading level={HeadingLevels.Four} id="stack3-heading3">
|
|
657
719
|
Card Heading
|
|
@@ -668,17 +730,20 @@ prop to override the default width.
|
|
|
668
730
|
|
|
669
731
|
## Custom Image Component
|
|
670
732
|
|
|
671
|
-
Instead of passing a path for the `
|
|
672
|
-
component in using the `
|
|
733
|
+
Instead of passing a path for the `imageProps.src` prop, you can pass a custom
|
|
734
|
+
image component in using the `imageProps.component` prop.
|
|
673
735
|
|
|
674
736
|
<Canvas withToolbar>
|
|
675
737
|
<Story name="Custom Image Component">
|
|
676
738
|
<Card
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
739
|
+
imageProps={{
|
|
740
|
+
alt: "Alt text",
|
|
741
|
+
aspectRatio: ImageRatios.SixteenByNine,
|
|
742
|
+
component: (
|
|
743
|
+
<Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
|
|
744
|
+
),
|
|
745
|
+
src: "https://placeimg.com/400/200/animals",
|
|
746
|
+
}}
|
|
682
747
|
>
|
|
683
748
|
<CardHeading level={HeadingLevels.Two} id="img1-heading1">
|
|
684
749
|
Card Component with Custom Image Component
|
|
@@ -743,7 +808,7 @@ component in using the `imageComponent` prop.
|
|
|
743
808
|
</SimpleGrid>
|
|
744
809
|
<br />
|
|
745
810
|
<SimpleGrid columns={1}>
|
|
746
|
-
<Card layout={
|
|
811
|
+
<Card layout={LayoutTypes.Row} border>
|
|
747
812
|
<CardHeading level={HeadingLevels.Three} id="no-img4-heading1">
|
|
748
813
|
Card Heading
|
|
749
814
|
</CardHeading>
|
|
@@ -756,7 +821,7 @@ component in using the `imageComponent` prop.
|
|
|
756
821
|
eget metus.
|
|
757
822
|
</CardContent>
|
|
758
823
|
</Card>
|
|
759
|
-
<Card layout={
|
|
824
|
+
<Card layout={LayoutTypes.Row} border>
|
|
760
825
|
<CardHeading level={HeadingLevels.Three} id="no-img5-heading1">
|
|
761
826
|
Card Heading
|
|
762
827
|
</CardHeading>
|
|
@@ -769,7 +834,7 @@ component in using the `imageComponent` prop.
|
|
|
769
834
|
eget metus.
|
|
770
835
|
</CardContent>
|
|
771
836
|
</Card>
|
|
772
|
-
<Card layout={
|
|
837
|
+
<Card layout={LayoutTypes.Row} border>
|
|
773
838
|
<CardHeading level={HeadingLevels.Three} id="no-img6-heading1">
|
|
774
839
|
Card Heading
|
|
775
840
|
</CardHeading>
|
|
@@ -796,9 +861,11 @@ see both patterns.
|
|
|
796
861
|
<Canvas>
|
|
797
862
|
<Story name="Card With Link Heading">
|
|
798
863
|
<Card
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
864
|
+
imageProps={{
|
|
865
|
+
alt: "Alt text",
|
|
866
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
867
|
+
src: "https://placeimg.com/400/200/animals",
|
|
868
|
+
}}
|
|
802
869
|
>
|
|
803
870
|
<CardHeading
|
|
804
871
|
level={HeadingLevels.Three}
|
|
@@ -844,9 +911,11 @@ from being having the full-click functionality.
|
|
|
844
911
|
<Story name="Card With Full-Click Functionality">
|
|
845
912
|
<SimpleGrid columns={2}>
|
|
846
913
|
<Card
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
914
|
+
imageProps={{
|
|
915
|
+
alt: "Alt text",
|
|
916
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
917
|
+
src: "https://placeimg.com/400/200/animals",
|
|
918
|
+
}}
|
|
850
919
|
mainActionLink="http://nypl.org"
|
|
851
920
|
>
|
|
852
921
|
<CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
|
|
@@ -870,10 +939,12 @@ from being having the full-click functionality.
|
|
|
870
939
|
</CardActions>
|
|
871
940
|
</Card>
|
|
872
941
|
<Card
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
942
|
+
imageProps={{
|
|
943
|
+
alt: "Alt text",
|
|
944
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
945
|
+
isAtEnd: true,
|
|
946
|
+
src: "https://placeimg.com/410/210/animals",
|
|
947
|
+
}}
|
|
877
948
|
mainActionLink="http://nypl.org"
|
|
878
949
|
>
|
|
879
950
|
<CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
|