@apolitical/component-library 8.11.2 → 8.11.3-lrn-102

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.
@@ -3,432 +3,434 @@
3
3
  @import './icons', './mixins';
4
4
 
5
5
  @layer base {
6
- button,
7
- .button {
8
- @include transition(background color border-color text-decoration-color);
9
-
10
- background: get-map($theme, 'button_primary_bg');
11
- padding: px-to-rem(get-map($button-medium, 'padding-top'))
12
- px-to-rem(get-map($button-medium, 'padding-horizontal'))
13
- px-to-rem(get-map($button-medium, 'padding-bottom'));
14
- position: relative;
15
- text-align: center;
16
- font-size: px-to-rem(get-map($button-medium, 'font-size'));
17
- font-weight: 700;
18
- text-decoration: none;
19
- border-radius: 360rem; // Completely round corners. This could be any large number but 360 evokes a circle well!
20
- border: none;
21
- cursor: pointer;
22
- box-sizing: border-box;
23
- display: inline-block;
24
-
25
- &,
26
- &:hover,
27
- &:active,
28
- &:focus,
29
- &:focus-visible {
30
- color: get-map($theme, 'button_primary');
31
- }
32
-
33
- &:hover {
34
- background: get-map($theme, 'button_primary_bg_hover');
35
- }
36
-
37
- &:active,
38
- &.active {
39
- background: get-map($theme, 'button_primary_bg_active');
40
- }
41
-
42
- &:focus,
43
- &:focus-visible {
44
- background: get-map($theme, 'button_primary_bg_focus');
45
- }
46
-
47
- // TODO: remove when we have new styling
48
- &.new {
49
- background: get-map($theme, 'button_new_primary_bg');
50
- padding: px-to-rem(get-map($button-medium, 'padding-top_new'))
51
- px-to-rem(get-map($button-medium, 'padding-horizontal_new'))
52
- px-to-rem(get-map($button-medium, 'padding-bottom_new'));
53
- color: get-map($theme, 'button_primary');
54
-
55
- &:hover,
56
- &:focus,
57
- &:focus-visible,
58
- &:active {
59
- background: get-map($theme, 'button_new_primary_bg_hover');
60
- }
61
- }
62
-
63
- @each $size, $styles in $sizes {
64
- &.#{$size} {
65
- padding: px-to-rem(get-map($styles, 'padding-top'))
66
- px-to-rem(get-map($styles, 'padding-horizontal'))
67
- px-to-rem(get-map($styles, 'padding-bottom'));
68
- font-size: px-to-rem(get-map($styles, 'font-size'));
69
-
70
- // TODO: remove `new` styling when we switch to new styling everywhere
71
- &.new {
72
- padding: px-to-rem(get-map($styles, 'padding-top_new'))
73
- px-to-rem(get-map($styles, 'padding-horizontal_new'))
74
- px-to-rem(get-map($styles, 'padding-bottom_new'));
75
- }
76
-
77
- &.icon {
78
- margin-top: px-to-rem(get-map($styles, 'icon-offset'));
79
-
80
- &.left::before {
81
- margin-right: px-to-rem(get-map($styles, 'icon-gutter'));
82
- }
83
-
84
- &.right::before {
85
- margin-left: px-to-rem(get-map($styles, 'icon-gutter'));
86
- }
87
- }
88
- }
89
- }
90
-
91
- &.full-width {
92
- width: 100%;
93
- }
6
+ .v1styles {
7
+ button,
8
+ .button {
9
+ @include transition(background color border-color text-decoration-color);
10
+
11
+ background: get-map($theme, 'button_primary_bg');
12
+ padding: px-to-rem(get-map($button-medium, 'padding-top'))
13
+ px-to-rem(get-map($button-medium, 'padding-horizontal'))
14
+ px-to-rem(get-map($button-medium, 'padding-bottom'));
15
+ position: relative;
16
+ text-align: center;
17
+ font-size: px-to-rem(get-map($button-medium, 'font-size'));
18
+ font-weight: 700;
19
+ text-decoration: none;
20
+ border-radius: 360rem; // Completely round corners. This could be any large number but 360 evokes a circle well!
21
+ border: none;
22
+ cursor: pointer;
23
+ box-sizing: border-box;
24
+ display: inline-block;
94
25
 
95
- &.destructive {
96
26
  &,
97
27
  &:hover,
98
28
  &:active,
99
29
  &:focus,
100
30
  &:focus-visible {
101
- background: get-map($theme, 'button_primary_destructive_bg');
102
- color: get-map($theme, 'button_primary_destructive');
103
- }
104
-
105
- &:hover,
106
- &:active {
107
- background: get-map($theme, 'button_primary_destructive_bg_hover');
108
- }
109
-
110
- &:focus,
111
- &:focus-visible {
112
- box-shadow: $outline get-map($theme, 'button_primary_destructive_box-shadow');
113
- }
114
- }
115
-
116
- &.secondary {
117
- background: get-map($theme, 'button_secondary_bg');
118
- border: px-to-rem(get-map($secondary, 'border')) solid
119
- get-map($theme, 'button_secondary_border');
120
-
121
- &,
122
- &:hover {
123
- color: get-map($theme, 'button_secondary');
31
+ color: get-map($theme, 'button_primary');
124
32
  }
125
33
 
126
34
  &:hover {
127
- background: get-map($theme, 'button_secondary_bg_hover');
35
+ background: get-map($theme, 'button_primary_bg_hover');
128
36
  }
129
37
 
130
38
  &:active,
131
- &:focus,
132
- &:focus-visible {
133
- color: get-map($theme, 'button_secondary_focus');
134
- border-color: get-map($theme, 'button_secondary_border_focus');
135
- }
136
-
137
- &:active {
138
- background: get-map($theme, 'button_secondary_bg_active');
39
+ &.active {
40
+ background: get-map($theme, 'button_primary_bg_active');
139
41
  }
140
42
 
141
43
  &:focus,
142
44
  &:focus-visible {
143
- background: get-map($theme, 'button_secondary_bg_focus');
45
+ background: get-map($theme, 'button_primary_bg_focus');
144
46
  }
145
47
 
146
- &.muted {
147
- border-color: get-map($theme, 'button_secondary_border_muted');
48
+ // TODO: remove when we have new styling
49
+ &.new {
50
+ background: get-map($theme, 'button_new_primary_bg');
51
+ padding: px-to-rem(get-map($button-medium, 'padding-top_new'))
52
+ px-to-rem(get-map($button-medium, 'padding-horizontal_new'))
53
+ px-to-rem(get-map($button-medium, 'padding-bottom_new'));
54
+ color: get-map($theme, 'button_primary');
148
55
 
149
- &,
56
+ &:hover,
57
+ &:focus,
58
+ &:focus-visible,
150
59
  &:active {
151
- background: get-map($theme, 'button_secondary_bg_muted');
152
- color: get-map($theme, 'button_secondary_muted');
60
+ background: get-map($theme, 'button_new_primary_bg_hover');
153
61
  }
62
+ }
154
63
 
155
- &:hover,
156
- &:focus,
157
- &:focus-visible {
158
- background: get-map($theme, 'button_secondary_bg_muted_hover');
159
- color: get-map($theme, 'button_secondary_muted_hover');
160
- border-color: get-map($theme, 'button_secondary_border_muted_hover');
64
+ @each $size, $styles in $sizes {
65
+ &.#{$size} {
66
+ padding: px-to-rem(get-map($styles, 'padding-top'))
67
+ px-to-rem(get-map($styles, 'padding-horizontal'))
68
+ px-to-rem(get-map($styles, 'padding-bottom'));
69
+ font-size: px-to-rem(get-map($styles, 'font-size'));
70
+
71
+ // TODO: remove `new` styling when we switch to new styling everywhere
72
+ &.new {
73
+ padding: px-to-rem(get-map($styles, 'padding-top_new'))
74
+ px-to-rem(get-map($styles, 'padding-horizontal_new'))
75
+ px-to-rem(get-map($styles, 'padding-bottom_new'));
76
+ }
77
+
78
+ &.icon {
79
+ margin-top: px-to-rem(get-map($styles, 'icon-offset'));
80
+
81
+ &.left::before {
82
+ margin-right: px-to-rem(get-map($styles, 'icon-gutter'));
83
+ }
84
+
85
+ &.right::before {
86
+ margin-left: px-to-rem(get-map($styles, 'icon-gutter'));
87
+ }
88
+ }
161
89
  }
162
90
  }
163
91
 
92
+ &.full-width {
93
+ width: 100%;
94
+ }
95
+
164
96
  &.destructive {
165
97
  &,
166
98
  &:hover,
167
99
  &:active,
168
100
  &:focus,
169
101
  &:focus-visible {
170
- background: get-map($theme, 'button_secondary_bg_destructive');
171
- color: get-map($theme, 'button_secondary_destructive');
172
- border-color: get-map($theme, 'button_secondary_border_destructive');
102
+ background: get-map($theme, 'button_primary_destructive_bg');
103
+ color: get-map($theme, 'button_primary_destructive');
173
104
  }
174
- }
175
105
 
176
- &.disabled {
177
- &,
178
106
  &:hover,
179
- &:active,
107
+ &:active {
108
+ background: get-map($theme, 'button_primary_destructive_bg_hover');
109
+ }
110
+
180
111
  &:focus,
181
112
  &:focus-visible {
182
- background: get-map($theme, 'button_secondary_bg_disabled');
183
- color: get-map($theme, 'button_secondary_disabled');
184
- border-color: get-map($theme, 'button_secondary_border_disabled');
113
+ box-shadow: $outline get-map($theme, 'button_primary_destructive_box-shadow');
185
114
  }
186
115
  }
187
116
 
188
- // TODO: remove when we have new styling
189
- &.new {
190
- border: none;
117
+ &.secondary {
118
+ background: get-map($theme, 'button_secondary_bg');
119
+ border: px-to-rem(get-map($secondary, 'border')) solid
120
+ get-map($theme, 'button_secondary_border');
191
121
 
192
122
  &,
193
- &:hover,
123
+ &:hover {
124
+ color: get-map($theme, 'button_secondary');
125
+ }
126
+
127
+ &:hover {
128
+ background: get-map($theme, 'button_secondary_bg_hover');
129
+ }
130
+
194
131
  &:active,
195
132
  &:focus,
196
133
  &:focus-visible {
197
- color: get-map($theme, 'button_new_secondary');
134
+ color: get-map($theme, 'button_secondary_focus');
135
+ border-color: get-map($theme, 'button_secondary_border_focus');
136
+ }
137
+
138
+ &:active {
139
+ background: get-map($theme, 'button_secondary_bg_active');
198
140
  }
199
141
 
200
- &:hover,
201
- &:active,
202
142
  &:focus,
203
143
  &:focus-visible {
204
- background: get-map($theme, 'button_new_secondary_bg_hover');
144
+ background: get-map($theme, 'button_secondary_bg_focus');
205
145
  }
206
- }
207
- }
208
146
 
209
- &.tertiary {
210
- &:not(.new) {
211
- padding: px-to-rem(get-map($tertiary, 'padding-top'))
212
- px-to-rem(get-map($tertiary, 'padding-horizontal'))
213
- px-to-rem(get-map($tertiary, 'padding-bottom'));
214
- bottom: px-to-rem(get-map($tertiary, 'padding-top'));
215
- right: px-to-rem(get-map($tertiary, 'padding-horizontal'));
216
- }
147
+ &.muted {
148
+ border-color: get-map($theme, 'button_secondary_border_muted');
217
149
 
218
- text-decoration: underline;
219
- text-decoration-color: transparent;
150
+ &,
151
+ &:active {
152
+ background: get-map($theme, 'button_secondary_bg_muted');
153
+ color: get-map($theme, 'button_secondary_muted');
154
+ }
220
155
 
221
- &,
222
- &:focus,
223
- &:focus-visible {
224
- background: get-map($theme, 'button_tertiary_bg');
225
- color: get-map($theme, 'button_tertiary');
226
- text-decoration-color: get-map($theme, 'button_tertiary_text-decoration');
227
- }
156
+ &:hover,
157
+ &:focus,
158
+ &:focus-visible {
159
+ background: get-map($theme, 'button_secondary_bg_muted_hover');
160
+ color: get-map($theme, 'button_secondary_muted_hover');
161
+ border-color: get-map($theme, 'button_secondary_border_muted_hover');
162
+ }
163
+ }
228
164
 
229
- &:hover,
230
- &:active {
231
- text-decoration-color: currentcolor;
232
- }
165
+ &.destructive {
166
+ &,
167
+ &:hover,
168
+ &:active,
169
+ &:focus,
170
+ &:focus-visible {
171
+ background: get-map($theme, 'button_secondary_bg_destructive');
172
+ color: get-map($theme, 'button_secondary_destructive');
173
+ border-color: get-map($theme, 'button_secondary_border_destructive');
174
+ }
175
+ }
233
176
 
234
- &:hover {
235
- color: get-map($theme, 'button_tertiary_hover');
236
- }
177
+ &.disabled {
178
+ &,
179
+ &:hover,
180
+ &:active,
181
+ &:focus,
182
+ &:focus-visible {
183
+ background: get-map($theme, 'button_secondary_bg_disabled');
184
+ color: get-map($theme, 'button_secondary_disabled');
185
+ border-color: get-map($theme, 'button_secondary_border_disabled');
186
+ }
187
+ }
237
188
 
238
- &:active {
239
- color: get-map($theme, 'button_tertiary_active');
240
- }
189
+ // TODO: remove when we have new styling
190
+ &.new {
191
+ border: none;
241
192
 
242
- &.muted {
243
- color: get-map($theme, 'button_tertiary_muted');
193
+ &,
194
+ &:hover,
195
+ &:active,
196
+ &:focus,
197
+ &:focus-visible {
198
+ color: get-map($theme, 'button_new_secondary');
199
+ }
244
200
 
245
- &:hover,
246
- &:focus,
247
- &:focus-visible {
248
- color: get-map($theme, 'button_tertiary_muted_hover');
201
+ &:hover,
202
+ &:active,
203
+ &:focus,
204
+ &:focus-visible {
205
+ background: get-map($theme, 'button_new_secondary_bg_hover');
206
+ }
249
207
  }
250
208
  }
251
209
 
252
- &.disabled {
253
- &,
254
- &:hover,
255
- &:active,
256
- &:focus,
257
- &:focus-visible {
258
- background: get-map($theme, 'button_tertiary_disabled_bg');
259
- color: get-map($theme, 'button_tertiary_disabled');
260
- text-decoration-color: get-map(
261
- $theme,
262
- 'button_tertiary_disabled_text-decoration'
263
- );
210
+ &.tertiary {
211
+ &:not(.new) {
212
+ padding: px-to-rem(get-map($tertiary, 'padding-top'))
213
+ px-to-rem(get-map($tertiary, 'padding-horizontal'))
214
+ px-to-rem(get-map($tertiary, 'padding-bottom'));
215
+ bottom: px-to-rem(get-map($tertiary, 'padding-top'));
216
+ right: px-to-rem(get-map($tertiary, 'padding-horizontal'));
264
217
  }
265
- }
266
218
 
267
- &.full-width {
268
- right: 0;
269
- }
219
+ text-decoration: underline;
220
+ text-decoration-color: transparent;
270
221
 
271
- // TODO: remove when we have new styling
272
- &.new {
273
- color: get-map($theme, 'button_new_tertiary');
274
- text-decoration-color: currentcolor;
275
-
276
- &:hover,
277
- &:active,
222
+ &,
278
223
  &:focus,
279
224
  &:focus-visible {
280
- background: get-map($theme, 'button_new_secondary_bg_hover');
281
- color: get-map($theme, 'button_new_secondary');
225
+ background: get-map($theme, 'button_tertiary_bg');
226
+ color: get-map($theme, 'button_tertiary');
227
+ text-decoration-color: get-map($theme, 'button_tertiary_text-decoration');
282
228
  }
283
- }
284
- }
285
-
286
- &.icon {
287
- display: inline-flex;
288
- align-items: center;
289
- flex-flow: row;
290
- place-content: center;
291
-
292
- &::before {
293
- content: '';
294
- background: currentcolor;
295
- width: px-to-rem(get-map($button-medium, 'icon-width'));
296
- height: px-to-rem(get-map($button-medium, 'icon-width'));
297
- display: inline-block;
298
- vertical-align: middle;
299
- }
300
229
 
301
- &.left {
302
- &::before {
303
- margin-right: px-to-rem(get-map($button-medium, 'icon-gutter'));
230
+ &:hover,
231
+ &:active {
232
+ text-decoration-color: currentcolor;
304
233
  }
305
234
 
306
- &.no-text::before {
307
- margin-right: 0;
235
+ &:hover {
236
+ color: get-map($theme, 'button_tertiary_hover');
308
237
  }
309
- }
310
238
 
311
- &.right {
312
- &::before {
313
- margin-left: px-to-rem(get-map($button-medium, 'icon-gutter'));
314
- order: 2;
239
+ &:active {
240
+ color: get-map($theme, 'button_tertiary_active');
315
241
  }
316
242
 
317
- &.no-text::before {
318
- margin-left: 0;
319
- }
320
- }
243
+ &.muted {
244
+ color: get-map($theme, 'button_tertiary_muted');
321
245
 
322
- @each $icon, $large-icon, $medium-icon, $small-icon in $icons {
323
- $icon-sizes: ('large', $large-icon), ('medium', $medium-icon),
324
- ('small', $small-icon);
246
+ &:hover,
247
+ &:focus,
248
+ &:focus-visible {
249
+ color: get-map($theme, 'button_tertiary_muted_hover');
250
+ }
251
+ }
325
252
 
326
- @at-root {
327
- %icon-#{$icon} {
328
- @include icon-styling($icon, $icon-sizes);
253
+ &.disabled {
254
+ &,
255
+ &:hover,
256
+ &:active,
257
+ &:focus,
258
+ &:focus-visible {
259
+ background: get-map($theme, 'button_tertiary_disabled_bg');
260
+ color: get-map($theme, 'button_tertiary_disabled');
261
+ text-decoration-color: get-map(
262
+ $theme,
263
+ 'button_tertiary_disabled_text-decoration'
264
+ );
329
265
  }
330
266
  }
331
267
 
332
- &.#{$icon} {
333
- @extend %icon-#{$icon};
268
+ &.full-width {
269
+ right: 0;
334
270
  }
335
271
 
336
- &.hover_#{$icon} {
272
+ // TODO: remove when we have new styling
273
+ &.new {
274
+ color: get-map($theme, 'button_new_tertiary');
275
+ text-decoration-color: currentcolor;
276
+
337
277
  &:hover,
278
+ &:active,
338
279
  &:focus,
339
280
  &:focus-visible {
340
- @extend %icon-#{$icon};
281
+ background: get-map($theme, 'button_new_secondary_bg_hover');
282
+ color: get-map($theme, 'button_new_secondary');
341
283
  }
342
284
  }
343
285
  }
344
286
 
345
- &.animate {
287
+ &.icon {
288
+ display: inline-flex;
289
+ align-items: center;
290
+ flex-flow: row;
291
+ place-content: center;
292
+
346
293
  &::before {
347
- @include transition(transform, #{get-map($animation, 'duration')}s, ease);
294
+ content: '';
295
+ background: currentcolor;
296
+ width: px-to-rem(get-map($button-medium, 'icon-width'));
297
+ height: px-to-rem(get-map($button-medium, 'icon-width'));
298
+ display: inline-block;
299
+ vertical-align: middle;
300
+ }
348
301
 
349
- transform: none;
302
+ &.left {
303
+ &::before {
304
+ margin-right: px-to-rem(get-map($button-medium, 'icon-gutter'));
305
+ }
306
+
307
+ &.no-text::before {
308
+ margin-right: 0;
309
+ }
350
310
  }
351
311
 
352
- &.bounce {
353
- @include animate {
354
- @keyframes bounce {
355
- 0%,
356
- 100% {
357
- transform: scale(1);
358
- }
312
+ &.right {
313
+ &::before {
314
+ margin-left: px-to-rem(get-map($button-medium, 'icon-gutter'));
315
+ order: 2;
316
+ }
359
317
 
360
- 70% {
361
- transform: scale(#{get-map($animation-bounce, 'scale')});
362
- }
318
+ &.no-text::before {
319
+ margin-left: 0;
320
+ }
321
+ }
322
+
323
+ @each $icon, $large-icon, $medium-icon, $small-icon in $icons {
324
+ $icon-sizes: ('large', $large-icon), ('medium', $medium-icon),
325
+ ('small', $small-icon);
326
+
327
+ @at-root {
328
+ %icon-#{$icon} {
329
+ @include icon-styling($icon, $icon-sizes);
363
330
  }
331
+ }
364
332
 
333
+ &.#{$icon} {
334
+ @extend %icon-#{$icon};
335
+ }
336
+
337
+ &.hover_#{$icon} {
338
+ &:hover,
365
339
  &:focus,
366
- &:active,
367
- &.do-animation {
368
- &::before {
369
- animation: bounce #{get-map($animation-bounce, 'duration')}s #{get-map(
370
- $animation-bounce,
371
- 'iteration'
372
- )};
373
- }
340
+ &:focus-visible {
341
+ @extend %icon-#{$icon};
374
342
  }
375
343
  }
376
344
  }
377
345
 
378
- &.rotate-180::before {
379
- transform: rotate(180deg);
380
- }
381
- }
382
- }
346
+ &.animate {
347
+ &::before {
348
+ @include transition(transform, #{get-map($animation, 'duration')}s, ease);
383
349
 
384
- &.disabled {
385
- cursor: not-allowed;
386
- opacity: 0.3;
387
- }
350
+ transform: none;
351
+ }
388
352
 
389
- &[data-hover-text] {
390
- position: relative;
353
+ &.bounce {
354
+ @include animate {
355
+ @keyframes bounce {
356
+ 0%,
357
+ 100% {
358
+ transform: scale(1);
359
+ }
360
+
361
+ 70% {
362
+ transform: scale(#{get-map($animation-bounce, 'scale')});
363
+ }
364
+ }
391
365
 
392
- &::before,
393
- .text {
394
- @include transition(opacity);
366
+ &:focus,
367
+ &:active,
368
+ &.do-animation {
369
+ &::before {
370
+ animation: bounce #{get-map($animation-bounce, 'duration')}s #{get-map(
371
+ $animation-bounce,
372
+ 'iteration'
373
+ )};
374
+ }
375
+ }
376
+ }
377
+ }
395
378
 
396
- opacity: 1;
379
+ &.rotate-180::before {
380
+ transform: rotate(180deg);
381
+ }
382
+ }
397
383
  }
398
384
 
399
- &::after {
400
- @include transition(
401
- width height opacity right,
402
- 0s 0s 0.2s 0.2s,
403
- ease-in-out,
404
- 0s 0s 0.1s 0.1s
405
- );
406
-
407
- content: '';
408
- width: 0;
409
- height: 0;
410
- position: absolute;
411
- top: px-to-rem(get-map($secondary-destruction, 'offset'));
412
- right: get-map($secondary-destruction, 'right');
413
- display: flex;
414
- align-items: center;
415
- justify-content: center;
416
- opacity: 0;
385
+ &.disabled {
386
+ cursor: not-allowed;
387
+ opacity: 0.3;
417
388
  }
418
389
 
419
- &:hover,
420
- &:focus {
390
+ &[data-hover-text] {
391
+ position: relative;
392
+
421
393
  &::before,
422
394
  .text {
423
- opacity: 0;
395
+ @include transition(opacity);
396
+
397
+ opacity: 1;
424
398
  }
425
399
 
426
400
  &::after {
427
- content: attr(data-hover-text);
428
- width: 100%;
429
- height: 100%;
430
- right: 0;
431
- opacity: 1;
401
+ @include transition(
402
+ width height opacity right,
403
+ 0s 0s 0.2s 0.2s,
404
+ ease-in-out,
405
+ 0s 0s 0.1s 0.1s
406
+ );
407
+
408
+ content: '';
409
+ width: 0;
410
+ height: 0;
411
+ position: absolute;
412
+ top: px-to-rem(get-map($secondary-destruction, 'offset'));
413
+ right: get-map($secondary-destruction, 'right');
414
+ display: flex;
415
+ align-items: center;
416
+ justify-content: center;
417
+ opacity: 0;
418
+ }
419
+
420
+ &:hover,
421
+ &:focus {
422
+ &::before,
423
+ .text {
424
+ opacity: 0;
425
+ }
426
+
427
+ &::after {
428
+ content: attr(data-hover-text);
429
+ width: 100%;
430
+ height: 100%;
431
+ right: 0;
432
+ opacity: 1;
433
+ }
432
434
  }
433
435
  }
434
436
  }