@codeforamerica/marcomms-design-system 1.15.2 → 1.17.0

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.
@@ -1,76 +1,134 @@
1
1
  import { css } from "lit";
2
2
 
3
3
  export const typographyStyles = css`
4
- .serif {
5
- font-family: var(--font-family-serif) !important;
6
- }
4
+ // =====
7
5
 
8
- .sans-serif {
9
- font-family: var(--font-family-sans-serif) !important;
6
+ // Typography spacing
7
+
8
+ // Add a single space around paragraphs, blockquotes, and lists
9
+ p, ul, ol, blockquote {
10
+ & + * {
11
+ margin-block-start: var(--spacing, var(--spacing-layout-1, 1.5rem));
12
+ }
13
+ * + & {
14
+ margin-block-start: var(--spacing, var(--spacing-layout-1, 1.5rem));
15
+ }
10
16
  }
11
17
 
12
- .normal {
13
- font-weight: normal !important;
18
+ h1, h2, h3, h4, .h1, .h2, .h3, .h4, .display-1, .display-2 {
19
+ // Add a single line space after headings
20
+ & + * {
21
+ margin-block-start: var(--spacing, var(--spacing-layout-1, 1.5rem));
22
+ }
23
+
24
+ // Add two line spaces before headings
25
+ * + & {
26
+ --spacing: var(--spacing-layout-2);
27
+
28
+ margin-block-start: --spacing;
29
+ }
30
+
31
+ // Only add a single space between headings and other headings
32
+ & + & {
33
+ --spacing: var(--spacing-layout-1);
34
+ }
35
+
36
+ // Reduce space after breadcrumbs and eyebrows
37
+ cfa-breadcrumbs + & {
38
+ margin-block-start: var(--spacing-layout-half) !important;
39
+ }
40
+
41
+ .eyebrow + & {
42
+ margin-block-start: 0 !important;
43
+ }
14
44
  }
15
45
 
16
- .strong {
17
- font-weight: bold !important;
46
+ h1, .h1, .display-1, .display-2 {
47
+ text-wrap: balance;
18
48
  }
19
49
 
20
- italic {
21
- font-style: italic !important;
50
+ // =====
51
+
52
+ // Font styles
53
+
54
+ .regular {
55
+ font-family: var(--font-family-base);
56
+ font-size: var(--font-size-base);
57
+ line-height: var(--line-height-base);
22
58
  }
23
59
 
24
- .display 1 {
25
- font-family: var(--font-family-display-1);
60
+ .display-1 {
61
+ font-family: var(--font-family-heading);
26
62
  font-size: var(--font-size-display-1);
27
- font-weight: var(--font-weight-display-1);
28
- letter-spacing: var(--letter-spacing-display-1);
63
+ font-weight: bold;
29
64
  line-height: var(--line-height-display-1);
65
+ letter-spacing: var(--letter-spacing-display-1);
30
66
  }
31
67
 
32
68
  .display-2 {
33
- font-family: var(--font-family-display-2);
69
+ font-family: var(--font-family-heading);
34
70
  font-size: var(--font-size-display-2);
35
- font-weight: var(--font-weight-display-2);
36
- letter-spacing: var(--letter-spacing-display-2);
71
+ font-weight: bold;
37
72
  line-height: var(--line-height-display-2);
73
+ letter-spacing: var(--letter-spacing-display-2);
38
74
  }
39
75
 
76
+ h1,
40
77
  .h1 {
41
- font-family: var(--font-family-h1);
78
+ font-family: var(--font-family-heading);
42
79
  font-size: var(--font-size-h1);
43
- font-weight: var(--font-weight-h1);
44
- letter-spacing: var(--letter-spacing-h1);
80
+ font-weight: bold;
45
81
  line-height: var(--line-height-h1);
82
+ letter-spacing: var(--letter-spacing-h1);
46
83
  }
47
84
 
85
+ h2,
48
86
  .h2 {
49
- font-family: var(--font-family-h2);
87
+ font-family: var(--font-family-heading);
50
88
  font-size: var(--font-size-h2);
51
- font-weight: var(--font-weight-h2);
52
- letter-spacing: var(--letter-spacing-h2);
89
+ font-weight: bold;
53
90
  line-height: var(--line-height-h2);
91
+ letter-spacing: var(--letter-spacing-h2);
54
92
  }
55
93
 
94
+ h3,
56
95
  .h3 {
57
- font-family: var(--font-family-h3);
96
+ font-family: var(--font-family-heading);
58
97
  font-size: var(--font-size-h3);
59
- font-weight: var(--font-weight-h3);
60
- letter-spacing: var(--letter-spacing-h3);
98
+ font-weight: bold;
61
99
  line-height: var(--line-height-h3);
100
+ letter-spacing: var(--letter-spacing-h3);
62
101
  }
63
102
 
103
+ h4,
64
104
  .h4 {
65
- font-family: var(--font-family-h4);
105
+ font-family: var(--font-family-heading);
66
106
  font-size: var(--font-size-h4);
67
- font-weight: var(--font-weight-h4);
68
- letter-spacing: var(--letter-spacing-h4);
107
+ font-weight: bold;
69
108
  line-height: var(--line-height-h4);
109
+ letter-spacing: var(--letter-spacing-h4);
110
+ }
111
+
112
+ .extra-large {
113
+ font-size: var(--font-size-extra-large);
114
+ line-height: var(--line-height-extra-large);
115
+ letter-spacing: var(--letter-spacing-extra-large);
116
+ }
117
+
118
+ .large {
119
+ font-size: var(--font-size-large);
120
+ line-height: var(--line-height-large);
121
+ letter-spacing: var(--letter-spacing-large);
122
+ }
123
+
124
+ .small {
125
+ font-size: var(--font-size-small);
126
+ line-height: var(--line-height-small);
127
+ letter-spacing: var(--letter-spacing-small);
70
128
  }
71
129
 
72
130
  .eyebrow {
73
- font-family: var(--font-family-eyebrow);
131
+ font-family: var(--font-family-sans-serif);
74
132
  font-size: var(--font-size-eyebrow);
75
133
  font-weight: var(--font-weight-eyebrow);
76
134
  letter-spacing: var(--letter-spacing-eyebrow);
@@ -90,22 +148,272 @@ export const typographyStyles = css`
90
148
  margin-block-end: var(--spacing-layout-half);
91
149
  position: relative;
92
150
  text-transform: uppercase;
151
+
152
+ &::after {
153
+ border-block-end: var(--hairline) solid currentColor;
154
+ content: "";
155
+ flex-grow: 1;
156
+ margin-left: var(--spacing-component-3);
157
+ }
158
+ }
159
+
160
+ .subtle {
161
+ opacity: 0.6;
162
+ }
163
+
164
+ .serif {
165
+ font-family: var(--font-family-serif);
166
+ }
167
+
168
+ .sans-serif {
169
+ font-family: var(--font-family-sans-serif);
170
+ }
171
+
172
+ i,
173
+ em,
174
+ .italic {
175
+ font-style: italic;
176
+ }
177
+
178
+ b,
179
+ strong,
180
+ .strong {
181
+ font-weight: bold;
182
+ }
183
+
184
+ .normal {
185
+ font-weight: normal;
186
+ }
187
+
188
+ .prominent-link,
189
+ a.prominent-link {
190
+ --accent-color: var(--purple-60);
191
+
192
+ font-weight: bold;
193
+ text-decoration: underline;
194
+ text-decoration-color: var(--accent-color);
195
+ text-decoration-thickness: var(--medium);
196
+ text-underline-offset: 0.4em;
197
+ transition: color 0.2s ease-in-out, border-color 0.2s ease-in-out;
198
+
199
+ &:hover {
200
+ --accent-color: var(--red-60);
201
+ }
202
+
203
+ &:not(:has(cfa-icon))::after {
204
+ @include icon.icon;
205
+
206
+ content: "arrow_right_alt";
207
+ display: inline-block;
208
+ padding-inline-start: 0.1em;
209
+ text-decoration: none;
210
+ transition: padding 0.2s ease-in-out;
211
+ width: 1em;
212
+ }
213
+
214
+ &:not(:has(cfa-icon)):hover::after {
215
+ padding-inline-start: 0.3em;
216
+ }
217
+
218
+ cfa-icon {
219
+ text-decoration: none;
220
+ }
221
+ }
222
+
223
+ .white-text,
224
+ .text-light /* fallback */ {
225
+ -moz-osx-font-smoothing: grayscale; // Sharper antialising for white text on a dark background
226
+ -webkit-font-smoothing: antialiased; // Sharper antialising for white text on a dark background
227
+ color: var(--white);
228
+ --link-color: var(--white);
229
+ --link-hover-color: var(--white);
230
+ }
231
+
232
+ // =====
233
+
234
+ // Highlights
235
+
236
+ .highlight {
237
+ --highlight-offset: 0.2em;
238
+
239
+ box-decoration-break: clone;
240
+ display: inline;
241
+ background: linear-gradient(to top, transparent 0%, transparent var(--highlight-offset), var(--highlight-color) var(--highlight-offset), var(--highlight-color) calc(var(--highlight-offset) + var(--highlight-thickness)), transparent calc(var(--highlight-offset) + var(--highlight-thickness)), transparent 100%);
242
+ padding-inline: 0.1em;
243
+ -webkit-box-decoration-break: clone;
244
+ margin-inline-start: -0.1em;
245
+ margin-inline-end: -0.1em;
246
+ word-wrap: break-word;
247
+ }
248
+
249
+ // ======
250
+
251
+ // Lists
252
+
253
+ .ul,
254
+ .content ul {
255
+ list-style-type: disc;
256
+ padding-left: var(--spacing-layout-1);
257
+ }
258
+
259
+ .ul + *,
260
+ .content ul + *,
261
+ * + .ul,
262
+ * + .content ul {
263
+ margin-block-start: var(--spacing, var(--spacing-layout-1));
264
+ }
265
+
266
+ .ul > li,
267
+ .content ul > li {
268
+ margin-inline-start: 0;
269
+ padding-left: var(--spacing-component-2);
270
+ }
271
+
272
+ .ul > li + li,
273
+ .content ul > li + li {
274
+ margin-block-start: var(--spacing-layout-half);
275
+ }
276
+
277
+ .ul > li > ul,
278
+ .content ul > li > ul {
279
+ margin-block-start: var(--spacing-layout-half);
280
+ }
281
+
282
+ .ol,
283
+ .content ol {
284
+ list-style-type: decimal;
285
+ padding-left: var(--spacing-layout-1);
286
+ }
287
+
288
+ .ol + *,
289
+ .content ol + *,
290
+ * + .ol,
291
+ * + .content ol {
292
+ margin-block-start: var(--spacing, var(--spacing-layout-1));
293
+ }
294
+
295
+ .ol > li,
296
+ .content ol > li {
297
+ margin-inline-start: 0;
298
+ padding-inline-start: var(--spacing-component-2);
299
+ }
300
+
301
+ .ol > li + li,
302
+ .content ol > li + li {
303
+ margin-block-start: var(--spacing-layout-half);
304
+ }
305
+
306
+ .ol > li > ul,
307
+ .content ol > li > ul {
308
+ margin-block-start: var(--spacing-layout-half);
309
+ }
310
+
311
+ .ul--unstyled {
312
+ list-style: none;
313
+ padding: 0;
314
+ }
315
+
316
+ .ul--unstyled > li {
317
+ margin-inline: 0;
318
+ padding: 0;
93
319
  }
94
320
 
95
- .eyebrow-with-line::after {
96
- border-block-end: var(--hairline) solid var(--text-color);
321
+ .ul--line-separators > li + li::before {
322
+ border-block-start: 1px solid var(--gray-20);
97
323
  content: "";
98
- flex-grow: 1;
99
- margin-left: var(--spacing-component-3);
324
+ display: block;
325
+ margin-block: var(--spacing-layout-half);
326
+ width: 100%;
100
327
  }
101
328
 
102
- .small {
103
- font-size: var(--font-size-small);
104
- letter-spacing: var(--letter-spacing-small);
105
- line-height: var(--line-height-small);
329
+ .ul--inline,
330
+ .ul--inline-with-separators,
331
+ .ul--inline-with-line-separators {
332
+ display: inline;
333
+ list-style: none;
334
+ padding-inline: 0 !important;
335
+ padding-left: 0 !important;
106
336
  }
107
337
 
108
- .subtle {
109
- color: var(--text-color-subtle);
338
+ .ul--inline > li,
339
+ .ul--inline-with-separators > li,
340
+ .ul--inline-with-line-separators > li {
341
+ display: inline-block;
342
+ margin-inline-end: var(--spacing-component-3);
343
+ padding: 0 !important;
344
+ }
345
+
346
+ .ul--inline li:last-child,
347
+ .ul--inline-with-separators li:last-child,
348
+ .ul--inline-with-line-separators li:last-child {
349
+ margin-inline-end: 0;
350
+ }
351
+
352
+ .ul--inline > li + li,
353
+ .ul--inline-with-separators > li + li,
354
+ .ul--inline-with-line-separators > li + li {
355
+ margin-block-start: 0;
356
+ }
357
+
358
+ .ul--inline-with-separators li,
359
+ .ul--inline-with-line-separators li {
360
+ margin-inline-end: 0;
361
+ }
362
+
363
+ .ul--inline-with-separators > li::after {
364
+ content: "•";
365
+ margin-inline: var(--spacing-component-2);
366
+ opacity: 0.5;
367
+ }
368
+
369
+ .ul--inline-with-separators > li:last-child::after {
370
+ content: "";
371
+ }
372
+
373
+ .ul--inline-with-line-separators > li::after {
374
+ content: "|";
375
+ margin-inline: var(--spacing-component-2);
376
+ opacity: 0.5;
377
+ }
378
+
379
+ .ul--inline-with-line-separators > li:last-child::after {
380
+ content: "";
381
+ }
382
+
383
+ // ===
384
+
385
+ // Horizontal rule
386
+
387
+ hr {
388
+ --color: currentColor;
389
+
390
+ background-color: var(--color);
391
+ border: 0;
392
+ color: var(--color);
393
+ display: block;
394
+ font-size: 0;
395
+ height: var(--hairline);
396
+ margin-block: var(--spacing-layout-1);
397
+ opacity: 0.4;
398
+ }
399
+
400
+ // ===
401
+
402
+ // Icons
403
+
404
+ .icon {
405
+ -webkit-font-feature-settings: 'liga';
406
+ direction: ltr;
407
+ display: inline-block;
408
+ font-family: 'Material Symbols Rounded';
409
+ font-feature-settings: 'liga';
410
+ font-size: 1.4em;
411
+ font-style: normal;
412
+ font-weight: normal;
413
+ letter-spacing: normal;
414
+ text-transform: none;
415
+ vertical-align: middle;
416
+ white-space: nowrap;
417
+ word-wrap: normal;
110
418
  }
111
419
  `;