@codeforamerica/marcomms-design-system 1.16.0 → 1.17.1
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/dist/index.js +394 -151
- package/package.json +1 -1
- package/src/components/card.js +2 -95
- package/src/components/card.stories.js +10 -62
- package/src/shared/common.js +56 -6
- package/src/shared/typography.js +327 -41
package/package.json
CHANGED
package/src/components/card.js
CHANGED
|
@@ -184,99 +184,6 @@ class Card extends LitElement {
|
|
|
184
184
|
.logo img {
|
|
185
185
|
object-fit: contain;
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
/* --- */
|
|
189
|
-
|
|
190
|
-
/* Theme: Compact Card */
|
|
191
|
-
|
|
192
|
-
.card--compact {
|
|
193
|
-
--padding: var(--spacing-component-3);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.card--compact .title {
|
|
197
|
-
font-size: var(--font-size-h4);
|
|
198
|
-
line-height: var(--line-height-h4);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.card--compact .action-label {
|
|
202
|
-
padding-block-start: 0;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/* --- */
|
|
206
|
-
|
|
207
|
-
/* Theme: Horizontal Card */
|
|
208
|
-
|
|
209
|
-
@media (min-width: 768px) {
|
|
210
|
-
.card--horizontal,
|
|
211
|
-
a.card--horizontal {
|
|
212
|
-
align-items: stretch;
|
|
213
|
-
flex-direction: row;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.card--horizontal .visual {
|
|
217
|
-
aspect-ratio: initial;
|
|
218
|
-
height: auto;
|
|
219
|
-
flex: 0 0 50%;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.card--horizontal .logo {
|
|
223
|
-
border-block-end: 0;
|
|
224
|
-
border-inline-end: 1px solid var(--gray-20);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/* --- */
|
|
229
|
-
|
|
230
|
-
/* Theme: Horizontal Compact Card */
|
|
231
|
-
|
|
232
|
-
@media (min-width: 768px) {
|
|
233
|
-
.card--horizontal-compact,
|
|
234
|
-
a.card--horizontal-compact {
|
|
235
|
-
align-items: stretch;
|
|
236
|
-
flex-direction: row;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.card--horizontal-compact .visual {
|
|
240
|
-
aspect-ratio: initial;
|
|
241
|
-
flex: 0 0 34%;
|
|
242
|
-
height: auto;
|
|
243
|
-
position: relative;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.card--horizontal-compact .image picture {
|
|
247
|
-
position: absolute;
|
|
248
|
-
height: 100%;
|
|
249
|
-
width: 100%;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.card--horizontal-compact .logo {
|
|
253
|
-
border-block-end: 0;
|
|
254
|
-
border-right: 1px solid var(--gray-20);
|
|
255
|
-
padding: var(--spacing-component-4);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.card--horizontal-compact,
|
|
260
|
-
a.card--horizontal-compact {
|
|
261
|
-
--padding: var(--spacing-component-3);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.card--horizontal-compact .body {
|
|
265
|
-
gap: var(--spacing-component-2);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.card--horizontal-compact .header {
|
|
269
|
-
margin-block-end: var(--spacing-component-2);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.card--horizontal-compact .title {
|
|
273
|
-
font-size: var(--font-size-h4);
|
|
274
|
-
line-height: var(--line-height-h4);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.card--horizontal-compact .action-label {
|
|
278
|
-
padding-block-start: var(--spacing-component-2);
|
|
279
|
-
}
|
|
280
187
|
`,
|
|
281
188
|
];
|
|
282
189
|
visualTemplate() {
|
|
@@ -362,13 +269,13 @@ class Card extends LitElement {
|
|
|
362
269
|
</div>
|
|
363
270
|
<div class="body">
|
|
364
271
|
${this.text
|
|
365
|
-
? html` <div class="small" .innerHTML
|
|
272
|
+
? html` <div class="small" .innerHTML=${this.text}></div> `
|
|
366
273
|
: nothing}
|
|
367
274
|
${this.metaText
|
|
368
275
|
? html`
|
|
369
276
|
<div
|
|
370
277
|
class="meta-text small"
|
|
371
|
-
.innerHTML
|
|
278
|
+
.innerHTML=${this.metaText}
|
|
372
279
|
></div>
|
|
373
280
|
`
|
|
374
281
|
: nothing}
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
argTypes: {
|
|
7
7
|
theme: {
|
|
8
8
|
defaultValue: "default",
|
|
9
|
-
options: ["default"
|
|
9
|
+
options: ["default"],
|
|
10
10
|
control: { type: "radio" },
|
|
11
11
|
},
|
|
12
12
|
eyebrow: { type: "string" },
|
|
@@ -57,8 +57,8 @@ const Template = ({
|
|
|
57
57
|
eyebrow="${eyebrow}"
|
|
58
58
|
title="${title}"
|
|
59
59
|
label="${label}"
|
|
60
|
-
text
|
|
61
|
-
metaText
|
|
60
|
+
.text=${text}
|
|
61
|
+
.metaText=${metaText}
|
|
62
62
|
actionLabel="${actionLabel}"
|
|
63
63
|
>
|
|
64
64
|
</cfa-card>
|
|
@@ -71,7 +71,12 @@ Default.args = {
|
|
|
71
71
|
title: "Automatic Record Clearance",
|
|
72
72
|
label: "Now hiring",
|
|
73
73
|
text: "Working with state governments and communities to fundamentally transform the process of record clearance.",
|
|
74
|
-
metaText:
|
|
74
|
+
metaText: `
|
|
75
|
+
<ul class="ul ul--inline-with-separators">
|
|
76
|
+
<li>Updated May 7, 2026</li>
|
|
77
|
+
<li>In partnership with the community</li>
|
|
78
|
+
</ul>
|
|
79
|
+
`,
|
|
75
80
|
actionLabel: "Learn more",
|
|
76
81
|
linkUrl:
|
|
77
82
|
"https://codeforamerica.org/programs/criminal-justice/automatic-record-clearance/",
|
|
@@ -84,7 +89,7 @@ CardWithImage.args = {
|
|
|
84
89
|
title: "Food benefits",
|
|
85
90
|
label: "",
|
|
86
91
|
text: "Improving access to food assistance and delivery of benefits.",
|
|
87
|
-
metaText: "",
|
|
92
|
+
metaText: "Updated April 14, 2026",
|
|
88
93
|
linkUrl:
|
|
89
94
|
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
90
95
|
actionLabel: "Learn more",
|
|
@@ -112,63 +117,6 @@ CardWithLogo.args = {
|
|
|
112
117
|
visualAltText: "Code for America logo",
|
|
113
118
|
};
|
|
114
119
|
|
|
115
|
-
export const CompactCard = Template.bind({});
|
|
116
|
-
CompactCard.args = {
|
|
117
|
-
theme: "compact",
|
|
118
|
-
eyebrow: "Program",
|
|
119
|
-
title: "Food benefits",
|
|
120
|
-
label: "",
|
|
121
|
-
text: "Improving access to food assistance and delivery of benefits.",
|
|
122
|
-
metaText: "",
|
|
123
|
-
linkUrl:
|
|
124
|
-
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
125
|
-
actionLabel: "Learn more",
|
|
126
|
-
visualType: "image",
|
|
127
|
-
visualUrl:
|
|
128
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
129
|
-
visualThumbnailUrl:
|
|
130
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
131
|
-
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export const HorizontalCard = Template.bind({});
|
|
135
|
-
HorizontalCard.args = {
|
|
136
|
-
theme: "horizontal",
|
|
137
|
-
eyebrow: "Program",
|
|
138
|
-
title: "Food benefits",
|
|
139
|
-
label: "",
|
|
140
|
-
text: "Improving access to food assistance and delivery of benefits.",
|
|
141
|
-
metaText: "",
|
|
142
|
-
linkUrl:
|
|
143
|
-
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
144
|
-
actionLabel: "Learn more",
|
|
145
|
-
visualType: "image",
|
|
146
|
-
visualUrl:
|
|
147
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
148
|
-
visualThumbnailUrl:
|
|
149
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
150
|
-
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export const HorizontalCompactCard = Template.bind({});
|
|
154
|
-
HorizontalCompactCard.args = {
|
|
155
|
-
theme: "horizontal-compact",
|
|
156
|
-
eyebrow: "Program",
|
|
157
|
-
title: "Food benefits",
|
|
158
|
-
label: "",
|
|
159
|
-
text: "Improving access to food assistance and delivery of benefits.",
|
|
160
|
-
metaText: "",
|
|
161
|
-
linkUrl:
|
|
162
|
-
"https://codeforamerica.org/programs/social-safety-net/food-benefits/",
|
|
163
|
-
actionLabel: "Learn more",
|
|
164
|
-
visualType: "image",
|
|
165
|
-
visualUrl:
|
|
166
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-768x576.png",
|
|
167
|
-
visualThumbnailUrl:
|
|
168
|
-
"https://files.codeforamerica.org/2021/05/28124702/illustration_grocery-150x150.png",
|
|
169
|
-
visualAltText: "Illustration of groceries in a shopping basket and paper bag",
|
|
170
|
-
};
|
|
171
|
-
|
|
172
120
|
export const SkeletonCard = () => html`
|
|
173
121
|
<cfa-card-skeleton></cfa-card-skeleton>
|
|
174
122
|
`;
|
package/src/shared/common.js
CHANGED
|
@@ -1,15 +1,65 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
|
|
3
3
|
export const commonStyles = css`
|
|
4
|
-
*,
|
|
5
|
-
*::before,
|
|
6
|
-
*::after {
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
4
|
*:focus-visible,
|
|
11
5
|
*:target {
|
|
12
6
|
outline: var(--focus-outline);
|
|
13
7
|
position: relative;
|
|
14
8
|
}
|
|
9
|
+
|
|
10
|
+
// RESET
|
|
11
|
+
|
|
12
|
+
// Use a more-intuitive box-sizing model.
|
|
13
|
+
*, *::before, *::after {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Remove default margin
|
|
18
|
+
* {
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Set default text-wrap of 'pretty'
|
|
23
|
+
* {
|
|
24
|
+
text-wrap: pretty;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Wrap overly long words
|
|
28
|
+
* {
|
|
29
|
+
overflow-wrap: break-word;
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
word-break: break-word;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Fix Safari antialiasing for variable fonts
|
|
35
|
+
* {
|
|
36
|
+
font-synthesis: none !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Improve text rendering
|
|
40
|
+
body {
|
|
41
|
+
-webkit-font-smoothing: antialiased;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Reasonable media defaults
|
|
45
|
+
img, picture, video, canvas, svg {
|
|
46
|
+
display: block;
|
|
47
|
+
height: auto;
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Remove built-in form typography styles
|
|
52
|
+
input, button, textarea, select {
|
|
53
|
+
font: inherit;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Avoid text overflows
|
|
57
|
+
p, h1, h2, h3, h4, h5, h6 {
|
|
58
|
+
overflow-wrap: break-word;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Create a root stacking context
|
|
62
|
+
#root, #__next {
|
|
63
|
+
isolation: isolate;
|
|
64
|
+
}
|
|
15
65
|
`;
|