@codeforamerica/marcomms-design-system 1.0.0 → 1.0.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/banner.js +152 -0
  7. package/src/components/banner.stories.js +115 -0
  8. package/src/components/bar.js +102 -0
  9. package/src/components/bar.stories.js +22 -0
  10. package/src/components/blob.js +119 -0
  11. package/src/components/blob.stories.js +64 -0
  12. package/src/components/box.js +55 -0
  13. package/src/components/box.stories.js +24 -0
  14. package/src/components/breadcrumbs.js +80 -0
  15. package/src/components/breadcrumbs.stories.js +27 -0
  16. package/src/components/button.js +167 -0
  17. package/src/components/button.scss +162 -0
  18. package/src/components/button.stories.js +49 -0
  19. package/src/components/callout.js +62 -0
  20. package/src/components/callout.stories.js +20 -0
  21. package/src/components/card.js +403 -0
  22. package/src/components/card.stories.js +170 -0
  23. package/src/components/carousel.js +182 -0
  24. package/src/components/carousel.stories.js +61 -0
  25. package/src/components/cta.js +99 -0
  26. package/src/components/cta.stories.js +22 -0
  27. package/src/components/details.scss +71 -0
  28. package/src/components/details.stories.js +27 -0
  29. package/src/components/flexible-layout.js +126 -0
  30. package/src/components/flexible-layout.stories.js +48 -0
  31. package/src/components/form-elements.scss +305 -0
  32. package/src/components/form-elements.stories.js +134 -0
  33. package/src/components/icon.js +41 -0
  34. package/src/components/icon.scss +31 -0
  35. package/src/components/icon.stories.js +16 -0
  36. package/src/components/label.js +63 -0
  37. package/src/components/label.stories.js +29 -0
  38. package/src/components/link-list.scss +80 -0
  39. package/src/components/link-list.stories.js +52 -0
  40. package/src/components/loader.scss +24 -0
  41. package/src/components/loader.stories.js +12 -0
  42. package/src/components/logo-card.js +93 -0
  43. package/src/components/logo-card.stories.js +48 -0
  44. package/src/components/nav.js +99 -0
  45. package/src/components/nav.stories.js +40 -0
  46. package/src/components/page-nav.js +171 -0
  47. package/src/components/page-nav.stories.js +112 -0
  48. package/src/components/pager.js +98 -0
  49. package/src/components/pager.stories.js +30 -0
  50. package/src/components/pagination.js +116 -0
  51. package/src/components/pagination.stories.js +30 -0
  52. package/src/components/person-card.js +240 -0
  53. package/src/components/person-card.stories.js +58 -0
  54. package/src/components/pill.js +33 -0
  55. package/src/components/pill.stories.js +23 -0
  56. package/src/components/promo.js +83 -0
  57. package/src/components/promo.stories.js +37 -0
  58. package/src/components/pullquote.js +42 -0
  59. package/src/components/pullquote.stories.js +16 -0
  60. package/src/components/quote.js +84 -0
  61. package/src/components/quote.stories.js +23 -0
  62. package/src/components/reveal.js +83 -0
  63. package/src/components/reveal.stories.js +40 -0
  64. package/src/components/slide.js +121 -0
  65. package/src/components/slide.stories.js +53 -0
  66. package/src/components/social-icon.js +233 -0
  67. package/src/components/social-icon.stories.js +36 -0
  68. package/src/components/stat.js +92 -0
  69. package/src/components/stat.stories.js +28 -0
  70. package/src/components/tab-list.js +114 -0
  71. package/src/components/tab-list.stories.js +18 -0
  72. package/src/components/tab.js +95 -0
  73. package/src/components/tab.stories.js +29 -0
  74. package/src/components/tile.js +150 -0
  75. package/src/components/tile.stories.js +41 -0
  76. package/src/components/transcript.js +44 -0
  77. package/src/components/transcript.stories.js +167 -0
  78. package/src/core/_base.scss +86 -0
  79. package/src/core/_grid.scss +295 -0
  80. package/src/core/_helpers.scss +111 -0
  81. package/src/core/_layout.scss +79 -0
  82. package/src/core/_reset.scss +53 -0
  83. package/src/core/_tokens.scss +251 -0
  84. package/src/core/_typography.scss +426 -0
  85. package/src/core/_wordpress.scss +27 -0
  86. package/src/core/colors.mdx +100 -0
  87. package/src/core/typography.mdx +66 -0
  88. package/src/shared/common.js +15 -0
  89. package/src/shared/layout.js +14 -0
  90. package/src/shared/typography.js +111 -0
  91. package/src/styles.scss +16 -0
@@ -0,0 +1,295 @@
1
+ @use "sass:math";
2
+
3
+ @import "~sass-flex-mixin/flex";
4
+
5
+ $base-font-size: 20px;
6
+
7
+ $grid-columns: 12;
8
+ $gutter-width: 1.5 * $base-font-size; // equivalent to --gutter-width token (i.e. --spacing-layout-1)
9
+ $outer-margin: 1.5 * $base-font-size; // equivalent to --outer-margin token (i.e. --spacing-layout-1)
10
+
11
+ $breakpoints: sm 480px 480px, md 768px 768px;
12
+ $flexboxgrid-max-width: 1200px;
13
+
14
+ $gutter-compensation: $gutter-width * .5 * -1;
15
+ $half-gutter-width: $gutter-width * .5;
16
+
17
+ .wrapper {
18
+ box-sizing: border-box;
19
+ max-width: $flexboxgrid-max-width;
20
+ margin: 0 auto;
21
+ }
22
+
23
+ .container-fluid {
24
+ margin-right: auto;
25
+ margin-left: auto;
26
+ padding-right: $outer-margin;
27
+ padding-left: $outer-margin;
28
+ }
29
+
30
+ .row {
31
+ @include flexbox();
32
+ @include flex(0, 1, auto);
33
+ @include flex-direction(row);
34
+ @include flex-wrap(wrap);
35
+
36
+ box-sizing: border-box;
37
+ margin-right: $gutter-compensation;
38
+ margin-left: $gutter-compensation;
39
+ }
40
+
41
+ .row.reverse {
42
+ @include flex-direction(row-reverse);
43
+ }
44
+
45
+ .col.reverse {
46
+ @include flex-direction(column-reverse);
47
+ }
48
+
49
+ @mixin flexboxgrid-sass-col-common {
50
+ box-sizing: border-box;
51
+
52
+ // split @include flex(0, 0, auto) into individual props
53
+ @include flex-grow(0);
54
+ @include flex-shrink(0);
55
+
56
+ // we leave @include flex-basis(auto) out of common because
57
+ // in some spots we need it and some we dont
58
+ // more why here: https://github.com/kristoferjoseph/flexboxgrid/issues/126
59
+
60
+ padding-right: $half-gutter-width;
61
+ padding-left: $half-gutter-width;
62
+ }
63
+
64
+ $name: xs;
65
+ .col-#{$name} {
66
+ @include flexboxgrid-sass-col-common;
67
+ @include flex-basis(auto);
68
+ }
69
+ @for $i from 1 through $grid-columns {
70
+ .col-#{$name}-#{$i} {
71
+ @include flexboxgrid-sass-col-common;
72
+ @include flex-basis(math.div(100%, $grid-columns) * $i);
73
+ max-width: math.div(100%, $grid-columns) * $i;
74
+ }
75
+ }
76
+ @for $i from 1 through $grid-columns {
77
+ .col-#{$name}-offset-#{$i} {
78
+ @include flexboxgrid-sass-col-common;
79
+ margin-left: math.div(100%, $grid-columns) * $i;
80
+ }
81
+ }
82
+ .col-#{$name} {
83
+ @include flex-grow(1);
84
+ @include flex-basis(0);
85
+ max-width: 100%;
86
+ }
87
+ .start-#{$name} {
88
+ @include justify-content(flex-start);
89
+ text-align: start;
90
+ }
91
+
92
+ .center-#{$name} {
93
+ @include justify-content(center);
94
+ text-align: center;
95
+ }
96
+
97
+ .end-#{$name} {
98
+ @include justify-content(flex-end);
99
+ text-align: end;
100
+ }
101
+
102
+ .top-#{$name} {
103
+ @include align-items(flex-start);
104
+ }
105
+
106
+ .middle-#{$name} {
107
+ @include align-items(center);
108
+ }
109
+
110
+ .bottom-#{$name} {
111
+ @include align-items(flex-end);
112
+ }
113
+
114
+ .around-#{$name} {
115
+ @include justify-content(space-around);
116
+ }
117
+
118
+ .between-#{$name} {
119
+ @include justify-content(space-between);
120
+ }
121
+
122
+ .first-#{$name} {
123
+ order: -1;
124
+ }
125
+
126
+ .last-#{$name} {
127
+ order: 1;
128
+ }
129
+
130
+
131
+ @each $breakpoint in $breakpoints {
132
+ $name: nth($breakpoint, 1);
133
+ $size: nth($breakpoint, 2);
134
+ $container: nth($breakpoint, 3);
135
+ @media only screen and (min-width: $size) {
136
+ .container {
137
+ width: $container;
138
+ }
139
+
140
+ .col-#{$name} {
141
+ @include flexboxgrid-sass-col-common;
142
+ @include flex-basis(auto);
143
+ }
144
+ @for $i from 1 through $grid-columns {
145
+ .col-#{$name}-#{$i} {
146
+ @include flexboxgrid-sass-col-common;
147
+ @include flex-basis(math.div(100%, $grid-columns) * $i);
148
+ max-width: math.div(100%, $grid-columns) * $i;
149
+ }
150
+ }
151
+ @for $i from 1 through $grid-columns {
152
+ .col-#{$name}-offset-#{$i} {
153
+ @include flexboxgrid-sass-col-common;
154
+ margin-left: math.div(100%, $grid-columns) * $i
155
+ }
156
+ }
157
+ .col-#{$name} {
158
+ @include flex-grow(1);
159
+ @include flex-basis(0);
160
+ max-width: 100%;
161
+ }
162
+ .start-#{$name} {
163
+ @include justify-content(flex-start);
164
+ text-align: start;
165
+ }
166
+
167
+ .center-#{$name} {
168
+ @include justify-content(center);
169
+ text-align: center;
170
+ }
171
+
172
+ .end-#{$name} {
173
+ @include justify-content(flex-end);
174
+ text-align: end;
175
+ }
176
+
177
+ .top-#{$name} {
178
+ @include align-items(flex-start);
179
+ }
180
+
181
+ .middle-#{$name} {
182
+ @include align-items(center);
183
+ }
184
+
185
+ .bottom-#{$name} {
186
+ @include align-items(flex-end);
187
+ }
188
+
189
+ .around-#{$name} {
190
+ @include justify-content(space-around);
191
+ }
192
+
193
+ .between-#{$name} {
194
+ @include justify-content(space-between);
195
+ }
196
+
197
+ .first-#{$name} {
198
+ order: -1;
199
+ }
200
+
201
+ .last-#{$name} {
202
+ order: 1;
203
+ }
204
+ }
205
+ }
206
+
207
+ .row {
208
+ flex-basis: 100%;
209
+ row-gap: var(--spacing-layout-1);
210
+ }
211
+
212
+ .row--no-gutters {
213
+ margin-left: 0;
214
+ margin-right: 0;
215
+
216
+ & > *[class*='col-'] {
217
+ padding-left: 0;
218
+ padding-right: 0;
219
+ }
220
+ }
221
+
222
+ .container-fluid {
223
+ display: flex;
224
+ flex-direction: column;
225
+
226
+ & > .row {
227
+ flex: 1;
228
+ }
229
+
230
+ @each $breakpoint in $breakpoints {
231
+ $name: nth($breakpoint, 1);
232
+ $size: nth($breakpoint, 2);
233
+ @media only screen and (min-width: $size) {
234
+ @for $i from 1 through 3 {
235
+ .row-#{$name}-#{$i} {
236
+ flex: $i !important;
237
+ }
238
+ .row-first-#{$name} {
239
+ order: -1;
240
+ }
241
+ .row-last-#{$name} {
242
+ order: 1;
243
+ }
244
+ }
245
+ }
246
+ }
247
+
248
+ }
249
+
250
+ @each $breakpoint in $breakpoints {
251
+ $name: nth($breakpoint, 1);
252
+
253
+ // Stop Flexbox Grid alignment from affecting text-alignment
254
+ .start-xs,
255
+ .center-xs,
256
+ .end-xs,
257
+ .start-#{$name},
258
+ .center-#{$name},
259
+ .end-#{$name} {
260
+ text-align: inherit;
261
+ }
262
+
263
+ // Alignment class for aligning row items at the top of a row
264
+ .top-xs,
265
+ .top-#{$name} {
266
+ align-items: flex-start;
267
+ }
268
+
269
+ // Alignment class for aligning row items in the middle of a row vertically
270
+ .middle-xs,
271
+ .middle-#{$name} {
272
+ align-items: center;
273
+ }
274
+
275
+ // Alignment class for aligning row items at the bottom of a row
276
+ .bottom-xs,
277
+ .bottom-#{$name} {
278
+ align-items: flex-end;
279
+ }
280
+
281
+ // Alignment class for stretching items to fill row
282
+ .stretch-xs,
283
+ .stretch-#{$name} {
284
+ align-items: stretch;
285
+
286
+ & > * {
287
+ display: flex;
288
+ }
289
+ }
290
+ }
291
+
292
+ @function column-span($columns) {
293
+ $width: ( math.div($flexboxgrid-max-width - $outer-margin, $grid-columns) * $columns ) - $gutter-width;
294
+ @return $width;
295
+ }
@@ -0,0 +1,111 @@
1
+
2
+ // Text alignment
3
+
4
+ .text-left {
5
+ text-align: start !important;
6
+ }
7
+
8
+ .text-center {
9
+ text-align: center !important;
10
+ }
11
+
12
+ .text-right {
13
+ text-align: end !important;
14
+ }
15
+
16
+ // Text color
17
+
18
+ .color-purple {
19
+ color: var(--purple-80);
20
+ }
21
+
22
+ .color-red {
23
+ color: var(--red-80);
24
+ }
25
+
26
+ .color-green {
27
+ color: var(--green-80);
28
+ }
29
+
30
+ // Margins
31
+
32
+ .no-margin {
33
+ margin: 0;
34
+ }
35
+
36
+ // Rounded
37
+ .rounded-corners {
38
+ border-radius: var(--rounded-corners);
39
+ }
40
+
41
+ // Hidden
42
+
43
+ .is-hidden {
44
+ border: 0;
45
+ clip: rect(0, 0, 0, 0);
46
+ height: 1px;
47
+ margin: -1px;
48
+ overflow: hidden;
49
+ padding: 0;
50
+ position: absolute;
51
+ white-space: nowrap;
52
+ width: 1px;
53
+ }
54
+
55
+ // Loading
56
+
57
+ .is-loading {
58
+ position: relative;
59
+ opacity: 0.4;
60
+
61
+ &:after {
62
+ content: '';
63
+ height: 100%;
64
+ left: 0;
65
+ overflow: hidden;
66
+ position: absolute;
67
+ top: 0;
68
+ width: 100%;
69
+ }
70
+ }
71
+
72
+ // Screen-reader-only (for example, for adding screenreader labels to semantic icons)
73
+
74
+ .sr-only,
75
+ .screen-reader-text {
76
+ border: 0;
77
+ clip: rect(0, 0, 0, 0);
78
+ height: 1px;
79
+ margin: -1px;
80
+ overflow: hidden;
81
+ padding: 0;
82
+ position: absolute;
83
+ white-space: nowrap;
84
+ width: 1px;
85
+ }
86
+
87
+ // Skip link
88
+
89
+ a.skip-link {
90
+ background-color: var(--white);
91
+ height: 1px;
92
+ left: -999px;
93
+ overflow: hidden;
94
+ position: absolute;
95
+ text-decoration: none;
96
+ top: auto;
97
+ width: 1px;
98
+ z-index: -999;
99
+
100
+ &:focus,
101
+ &:active {
102
+ height: initial;
103
+ left: var(--spacing-component-2);
104
+ overflow: auto;
105
+ padding: var(--spacing-component-2);
106
+ text-align: center;
107
+ top: var(--spacing-component-2);
108
+ width: initial;
109
+ z-index: 999;
110
+ }
111
+ }
@@ -0,0 +1,79 @@
1
+ @use "grid";
2
+
3
+ // Sections
4
+
5
+ .section {
6
+ --bg-color: var(--white);
7
+ --border: var(--hairline) solid var(--black-10);
8
+ --padding: var(--spacing-layout-2);
9
+ --spacing: var(--spacing-layout-1);
10
+
11
+ background-color: var(--bg-color);
12
+ border-block-start: var(--border);
13
+ padding-block: var(--padding);
14
+ }
15
+
16
+ // ======
17
+
18
+ // Cluster
19
+
20
+ .cluster {
21
+ overflow: hidden;
22
+
23
+ & > * {
24
+ display: flex;
25
+ flex-wrap: wrap;
26
+ margin: var(--spacing, calc(var(--spacing-layout-1) / 2 * -1));
27
+ }
28
+
29
+ & > * > * {
30
+ margin: var(--spacing, calc(var(--spacing-layout-1) / 2));
31
+ }
32
+ }
33
+
34
+ // =====
35
+
36
+ // Stack
37
+
38
+ .stack {
39
+ --spacing: var(--spacing-layout-1);
40
+
41
+ & > * + * {
42
+ margin-block-start: var(--spacing);
43
+ }
44
+ }
45
+
46
+ .stack-with-lines {
47
+ & > * + *::before {
48
+ border-block-start: var(--hairline) solid var(--black-20);
49
+ content: "";
50
+ display: block;
51
+ margin-block: var(--spacing, var(--spacing-layout-1));
52
+ width: 100%;
53
+ }
54
+ }
55
+
56
+ // =====
57
+
58
+ // Grid
59
+
60
+ .grid {
61
+ --spacing: var(--spacing-layout-1);
62
+
63
+ display: grid;
64
+ grid-gap: var(--spacing);
65
+ grid-template-columns: repeat(auto-fit, minmax(var(--column-span-3), 1fr));
66
+ justify-content: center;
67
+
68
+ @media (min-width: 768px) {
69
+ grid-template-columns: repeat(auto-fit, minmax(var(--column-span-4), 1fr));
70
+
71
+ & > * {
72
+ max-width: var(--column-span-4);
73
+ }
74
+ }
75
+
76
+ & > * {
77
+ height: 100%;
78
+ }
79
+ }
@@ -0,0 +1,53 @@
1
+ // Use a more-intuitive box-sizing model.
2
+ *, *::before, *::after {
3
+ box-sizing: border-box;
4
+ }
5
+
6
+ // Remove default margin
7
+ * {
8
+ margin: 0;
9
+ }
10
+
11
+ // Set default text-wrap of 'pretty'
12
+ * {
13
+ text-wrap: pretty;
14
+ }
15
+
16
+ // Wrap overly long words
17
+ * {
18
+ overflow-wrap: break-word;
19
+ text-overflow: ellipsis;
20
+ word-break: break-word;
21
+ }
22
+
23
+ // Fix Safari antialiasing for variable fonts
24
+ * {
25
+ font-synthesis: none !important;
26
+ }
27
+
28
+ // Improve text rendering
29
+ body {
30
+ -webkit-font-smoothing: antialiased;
31
+ }
32
+
33
+ // Reasonable media defaults
34
+ img, picture, video, canvas, svg {
35
+ display: block;
36
+ height: auto;
37
+ max-width: 100%;
38
+ }
39
+
40
+ // Remove built-in form typography styles
41
+ input, button, textarea, select {
42
+ font: inherit;
43
+ }
44
+
45
+ // Avoid text overflows
46
+ p, h1, h2, h3, h4, h5, h6 {
47
+ overflow-wrap: break-word;
48
+ }
49
+
50
+ // Create a root stacking context
51
+ #root, #__next {
52
+ isolation: isolate;
53
+ }