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