-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy path_patterns_lists.scss
601 lines (501 loc) · 15 KB
/
_patterns_lists.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
@import 'settings';
$list-status-icon-height: $default-icon-size;
$list-step-bullet-margin: $sph--x-large;
@mixin vf-p-list-placeholders {
// Container for .p-stepped-list and .p-stepped-list--detailed ordered lists;
// Defines the layout and resets a custom counter
%numbered-step-container {
counter-reset: p-stepped-list-counter;
display: flex;
flex-direction: column;
list-style: none;
padding-left: 0;
}
// List item for .p-stepped-list and .p-stepped-list--detailed ordered lists;
// Increments the custom counter
%numbered-step-item {
counter-increment: p-stepped-list-counter;
}
// Title for .p-stepped-list and .p-stepped-list--detailed ordered lists;
// Displays the title and step counter
%numbered-step-title {
list-style: none;
margin-left: 0;
padding-left: calc(map-get($line-heights, default-text) + $list-step-bullet-margin);
position: relative;
&::before {
content: counter(p-stepped-list-counter) '.';
display: block;
height: map-get($line-heights, default-text);
left: 0;
margin-right: $list-step-bullet-margin;
position: absolute;
text-align: right;
width: map-get($line-heights, default-text);
}
}
// Styles for .p-list--nested-counter
%nested-counter {
// Counter is named and it will be reset for each "ol" element.
counter-reset: p-list-nested-counter-top;
li {
counter-increment: p-list-nested-counter-top;
}
li::marker {
content: counter(p-list-nested-counter-top) '. ';
}
// Counter is named and it will be reset for each nested "ol" element.
li ol {
counter-reset: p-list-nested-counter-nested;
}
li ol li {
counter-increment: p-list-nested-counter-nested;
}
li ol li::marker {
content: counter(p-list-nested-counter-top) '.' counter(p-list-nested-counter-nested) '. ';
}
}
// Mixin for list items
%vf-list-item {
padding-bottom: $spv--x-small;
padding-top: $spv--x-small;
// FIXME: we need a better way to handle forms within lists
// stylelint-disable selector-max-type
form & {
padding-bottom: 0;
padding-top: 0;
label {
margin-bottom: $spv-nudge-compensation;
}
}
// stylelint-enable selector-max-type
}
%vf-list-item-state-base {
@extend %vf-list;
background-repeat: no-repeat;
background-size: $list-status-icon-height;
content: '';
display: inline-block;
height: $sph--large;
top: $spv--small;
}
// Styles for .p-list--divided ordered lists
%vf-list-item-ordered {
counter-increment: p-list-divided-counter;
&::marker {
content: none;
display: none;
}
&::before {
color: $colors--theme--text-default;
// If .p-list--divided ordered list is not within stepped list, display
// counter as unique whole number
content: counter(p-list-divided-counter) '.';
display: inline-block;
text-align: right;
// If .p-list--divided ordered list is within a stepped list, display
// counter as decimal nested under parent number
.p-stepped-list &,
.p-stepped-list--detailed & {
content: counter(p-stepped-list-counter) '.' counter(p-list-divided-counter) '.';
}
}
// If .p-list--divided is within another .p-list--divided, display counter
// as decimal nested under parent number
ol.p-list--divided {
counter-reset: p-list-divided-nested-counter;
.p-list__item {
counter-increment: p-list-divided-nested-counter;
&::before {
content: counter(p-list-divided-counter) '.' counter(p-list-divided-nested-counter) '.';
}
}
}
}
%vf-list-item-with-divisor-common-properties {
margin: 0;
padding-bottom: $sph--large;
padding-top: $sph--small;
}
%vf-list-item-bullet {
&::before {
color: $colors--theme--text-default;
content: '•';
display: inline-block;
text-align: right;
}
}
}
@mixin vf-list-item-has-prefix {
padding-left: $sp-x-large;
position: relative;
> .p-list--divided,
> .p-list--horizontal-section,
> .p-list {
margin-left: 0;
}
&::before {
left: 0;
position: absolute;
width: $sp-medium;
}
}
@mixin vf-list-item-divided {
@extend %vf-list-item-with-divisor-common-properties;
box-shadow: inset 0px 1px 0px 0px $colors--theme--border-low-contrast;
&:first-child {
box-shadow: none;
}
.p-list--divided > .p-list__item:first-child {
box-shadow: inset 0px 1px 0px 0px $colors--theme--border-low-contrast;
}
}
@mixin vf-list-item-horizontal-section {
@extend %vf-list-item-with-divisor-common-properties;
// Allows list item pseudo-elements to be absolutely positioned relative to the list item
position: relative;
}
// Offset a list item icon (tick or cross) away from the divisor above it
@mixin vf-list-item-icon-divisor-offset {
&.is-ticked::before,
&.is-crossed::before {
top: $spv--medium;
}
}
// Mixin for inline list items
@mixin vf-inline-list-item {
display: inline;
list-style: none;
margin-right: $sph--large;
&.last-item,
&:last-of-type {
margin-right: 0;
}
}
// List styling using list class
@mixin vf-p-list {
.p-list {
@extend %vf-clearfix;
@extend %vf-list;
&__item {
@extend %vf-list-item;
}
}
}
// Sets horizontal list section grid column count and makes list item borders span the full grid width.
// $columns: Number of columns that the list items should be divided into.
// $skip-cols: Number of columns at the start of each row to skip
@mixin list-horizontal-section-row-width($columns, $skip-cols: 0) {
--columns: #{$columns + $skip-cols};
// List item borders span full grid width, not list item width.
// Multiply 100% width by the number of columns to create a border that spans the full grid width.
.p-list__item:nth-child(#{$columns}n + 1)::after {
background: $colors--theme--border-low-contrast;
content: '';
height: 1px;
left: 0;
position: absolute;
top: 0;
// 100% * columns = total width of all list item columns in a row
// (gutter width) * (columns - 1) = total width of all gutters in a row
// width = (width of list items) + (width of gutters)
width: calc(100% * #{$columns} + #{$columns - 1} * map-get($grid-gutter-widths, default));
}
@if $skip-cols > 0 {
@for $i from 1 through $skip-cols {
.p-list__item:nth-child(#{$columns}n + #{$i}) {
grid-column-start: #{($i + 1)};
}
}
}
}
@mixin vf-p-list-horizontal-section {
$horizontal-list-section-medium-content-width: 66ch;
$horizontal-list-section-large-content-width: 100ch;
.p-list--horizontal-section-wrapper {
container-type: inline-size;
.p-list--horizontal-section {
@extend %vf-list;
@extend %fixed-width-container;
display: grid;
@container (width >= #{$horizontal-list-section-medium-content-width}) {
grid-gap: 0 map-get($grid-gutter-widths, default);
}
@container (width < #{$horizontal-list-section-medium-content-width}) {
@include list-horizontal-section-row-width($columns: 1);
}
@container (#{$horizontal-list-section-medium-content-width} <= width < #{$horizontal-list-section-large-content-width}) {
@include list-horizontal-section-row-width($columns: 2);
}
// We cannot override the default behavior with modifiers, as each container query creates styles for different pseudo-element indices
// So, we need to negate variant selectors before applying any styling that does not apply to all variants
&:not(.is-25-75) {
@container (width >= #{$horizontal-list-section-large-content-width}) {
@include list-horizontal-section-row-width($columns: 4);
}
}
// --columns is set in the container queries above
grid-template-columns: repeat(var(--columns), 1fr);
.p-list__item {
@extend %vf-list-item;
@include vf-list-item-icon-divisor-offset;
@include vf-list-item-horizontal-section;
}
}
.p-list--horizontal-section.is-25-75 {
// skip first column on large
@container (width >= #{$horizontal-list-section-large-content-width}) {
@include list-horizontal-section-row-width($columns: 3, $skip-cols: 1);
}
}
}
}
// A list with separators between items
@mixin vf-p-list-divided {
.p-list--divided {
@extend %vf-list;
.p-list__item {
@extend %vf-list-item;
@include vf-list-item-divided;
@include vf-list-item-icon-divisor-offset;
}
& & {
margin-bottom: 0;
margin-left: $sp-x-large;
padding-top: $sph--large;
.p-list__item:last-child {
padding-bottom: 0;
}
}
}
// stylelint-disable selector-max-type -- we want to target ordered lists
ol.p-list--divided,
ol.p-list--horizontal-section {
counter-reset: p-list-divided-counter;
list-style: none;
.p-list__item {
@extend %vf-list-item-ordered;
@include vf-list-item-has-prefix;
}
}
// stylelint-enable selector-max-type -- we want to target ordered lists
}
// Displays item with a state icon
@mixin vf-p-list-item-state {
.p-list__item.is-ticked {
@include vf-list-item-has-prefix;
&::before {
@extend %vf-list-item-state-base;
@include vf-icon-success-grey-themed;
}
}
.p-list__item.is-crossed {
@include vf-list-item-has-prefix;
&::before {
@extend %vf-list-item-state-base;
@include vf-icon-error-grey-themed;
}
}
// Displays item with a bullet
.p-list__item.has-bullet {
@extend %vf-list-item-bullet;
@include vf-list-item-has-prefix;
}
}
// Displays a list inline with spacing
@mixin vf-p-inline-list {
.p-inline-list {
margin-left: 0;
padding-left: 0;
}
.p-inline-list__item {
@include vf-inline-list-item;
}
}
// Displays a list inline with items separated by dots
@mixin vf-p-inline-list-middot {
.p-inline-list--middot {
margin-left: 0;
padding-left: 0;
.p-inline-list__item {
@include vf-inline-list-item;
margin-right: $sph--small;
position: relative;
&::after {
content: '\2022';
line-height: map-get($line-heights, default-text);
position: relative;
right: -0.25rem;
}
&:last-of-type,
.last-item {
&::after {
content: '';
}
}
}
}
}
@mixin vf-p-inline-list-stretch {
.p-inline-list--stretch {
display: flex;
flex-wrap: wrap;
margin-left: 0;
padding-left: 0;
.p-inline-list__item {
flex: 1 auto;
list-style: none;
}
}
}
// Displays a step by step list of instructions
@mixin vf-p-stepped-list {
.p-stepped-list {
@extend %vf-clearfix;
@extend %numbered-step-container;
margin-bottom: 0; // spacing has been moved onto __item; this ensures that the heading / paragraph spacing matches that of regular headings / paragraphs
margin-left: 0;
}
.p-stepped-list__item {
@extend %numbered-step-item;
// override unecessary col-8 class in markup; layout is handled with css below
float: none;
margin-left: 0;
overflow: visible;
padding-bottom: $spv--x-large;
position: relative;
width: 100%;
}
.p-stepped-list__bullet {
display: none;
}
// Indent titles
$bullet-width: map-get($line-heights, default-text);
$bullet-width-mobile: map-get($line-heights, default-text);
.p-stepped-list__title {
@extend %numbered-step-title;
}
.p-stepped-list__title + .p-stepped-list__content {
margin-left: $bullet-width-mobile + $list-step-bullet-margin;
@media (min-width: $threshold-6-12-col) {
padding-top: $spv-nudge;
}
@media (min-width: $breakpoint-heading-threshold) {
margin-left: $bullet-width + $list-step-bullet-margin;
}
}
@for $i from 4 through 1 {
// Bullet sizes for each heading level
$bullet-width: map-get($line-heights, h#{$i});
$bullet-width-mobile: map-get($line-heights, h#{$i}-mobile);
.p-heading--#{$i}.p-stepped-list__title,
h#{$i}.p-stepped-list__title {
padding-left: $bullet-width-mobile + $list-step-bullet-margin;
@media (min-width: $breakpoint-heading-threshold) {
padding-left: $bullet-width + $list-step-bullet-margin;
}
&::before {
height: $bullet-width-mobile;
width: $bullet-width-mobile;
@media (min-width: $breakpoint-heading-threshold) {
height: $bullet-width;
width: $bullet-width;
}
}
}
.p-heading--#{$i}.p-stepped-list__title + .p-stepped-list__content,
h#{$i}.p-stepped-list__title + .p-stepped-list__content {
margin-left: $bullet-width-mobile + $list-step-bullet-margin;
@media (min-width: $breakpoint-heading-threshold) {
margin-left: $bullet-width + $list-step-bullet-margin;
}
}
}
.p-stepped-list--detailed .p-stepped-list__title + .p-stepped-list__content {
@media (min-width: $threshold-6-12-col) {
margin-left: 0;
}
}
}
@mixin vf-p-stepped-list-detailed {
.p-stepped-list--detailed {
@extend %numbered-step-container;
margin-left: auto;
@supports (display: grid) {
.p-stepped-list__content {
@media (min-width: $threshold-4-6-col) {
grid-column-end: span 6;
margin-top: 0;
}
}
.p-stepped-list__title {
@media (min-width: $threshold-4-6-col) {
grid-column-end: span 6;
margin-top: 0;
}
}
}
.p-stepped-list__item {
@extend %numbered-step-item;
// TODO use new grid (`%vf-grid-row`)
@extend %vf-row;
@include vf-b-row-reset;
@media (min-width: $threshold-6-12-col) {
position: relative;
&::after {
background-color: $colors--theme--border-low-contrast;
content: '';
height: 1px;
left: 0;
position: absolute;
right: 0;
top: 0;
}
}
}
}
}
// Adaptor class `is-split` to split the items of a list into two columns
@mixin vf-p-list-split {
[class*='p-list'].is-split {
@media (min-width: $threshold-4-6-col) {
@supports ((-webkit-columns: 1) or (columns: 1)) {
column-gap: $sp-x-large;
columns: 2;
.p-list__item {
display: inline-block;
width: 100%;
}
}
@supports not ((-webkit-columns: 1) or (columns: 1)) {
display: flex;
flex-wrap: wrap;
.p-list__item {
width: calc(50% - 0.5rem);
}
}
&:nth-child(2n-1) {
margin-right: $sp-medium;
}
}
}
}
@mixin vf-p-list-nested-counter {
.p-list--nested-counter {
@extend %nested-counter;
}
}
@mixin vf-p-lists {
@include vf-p-list-placeholders;
@include vf-p-list;
@include vf-p-list-horizontal-section;
@include vf-p-list-divided;
@include vf-p-list-item-state;
@include vf-p-inline-list;
@include vf-p-inline-list-middot;
@include vf-p-inline-list-stretch;
@include vf-p-stepped-list;
@include vf-p-stepped-list-detailed;
@include vf-p-list-split;
@include vf-p-list-nested-counter;
}