vanilla-framework 4.14.0 → 4.16.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.
Files changed (45) hide show
  1. package/package.json +19 -16
  2. package/scss/_base_button.scss +1 -1
  3. package/scss/_base_details.scss +1 -1
  4. package/scss/_base_forms.scss +8 -7
  5. package/scss/_base_hr.scss +2 -3
  6. package/scss/_base_icon-definitions.scss +29 -0
  7. package/scss/_base_links.scss +1 -1
  8. package/scss/_base_placeholders.scss +3 -3
  9. package/scss/_base_typography-definitions.scss +1 -1
  10. package/scss/_global_functions.scss +17 -5
  11. package/scss/_layouts_application-panels.scss +3 -12
  12. package/scss/_layouts_application.scss +2 -2
  13. package/scss/_layouts_fluid-breakout.scss +2 -2
  14. package/scss/_patterns_accordion.scss +1 -1
  15. package/scss/_patterns_article-pagination.scss +4 -5
  16. package/scss/_patterns_buttons.scss +1 -1
  17. package/scss/_patterns_chip.scss +8 -9
  18. package/scss/_patterns_code-snippet.scss +1 -1
  19. package/scss/_patterns_contextual-menu.scss +1 -1
  20. package/scss/_patterns_cta.scss +27 -0
  21. package/scss/_patterns_equal-height-row.scss +87 -43
  22. package/scss/_patterns_grid.scss +74 -2
  23. package/scss/_patterns_icons.scss +10 -8
  24. package/scss/_patterns_image.scss +53 -15
  25. package/scss/_patterns_links.scss +1 -1
  26. package/scss/_patterns_list-tree.scss +49 -43
  27. package/scss/_patterns_lists.scss +58 -17
  28. package/scss/_patterns_logo-section.scss +4 -42
  29. package/scss/_patterns_matrix.scss +2 -2
  30. package/scss/_patterns_navigation-reduced.scss +50 -14
  31. package/scss/_patterns_navigation.scss +119 -36
  32. package/scss/_patterns_pull-quotes.scss +1 -1
  33. package/scss/_patterns_rule.scss +6 -2
  34. package/scss/_patterns_search-and-filter.scss +11 -12
  35. package/scss/_patterns_separator.scss +1 -0
  36. package/scss/_patterns_side-navigation.scss +1 -1
  37. package/scss/_patterns_status-label.scss +5 -0
  38. package/scss/_patterns_table-mobile-card.scss +1 -1
  39. package/scss/_patterns_tooltips.scss +26 -8
  40. package/scss/_settings_breakpoints.scss +16 -0
  41. package/scss/_settings_colors.scss +17 -8
  42. package/scss/_utilities_floats.scss +6 -6
  43. package/scss/_utilities_hide.scss +9 -9
  44. package/scss/_utilities_show.scss +3 -3
  45. package/scss/_vanilla.scss +2 -0
@@ -1,12 +1,36 @@
1
+ /*
2
+ @classreference
3
+ equal-height-row:
4
+ Equal height row:
5
+ .p-equal-height-row:
6
+ Main element of the equal height row component.
7
+ "&.has-divider-1":
8
+ Cross-column divider shown between the first and second grid rows.
9
+ "&.has-divider-2":
10
+ Cross-column divider shown between the second and third grid rows.
11
+ "&.has-divider-3":
12
+ Cross-column divider shown between the third and fourth grid rows.
13
+ .p-equal-height-row--wrap:
14
+ Wraps contents such that two items appear per row on medium screen sizes.
15
+ Column:
16
+ .p-equal-height-row__col:
17
+ Column element within an equal height row.
18
+ Item:
19
+ .p-equal-height-row__item:
20
+ Item element within an equal height row column.
21
+ */
22
+
1
23
  @import 'settings';
2
24
 
3
25
  @mixin vf-p-equal-height-row {
4
- .p-equal-height-row {
26
+ .p-equal-height-row,
27
+ .p-equal-height-row--wrap {
5
28
  @extend %vf-row;
29
+
6
30
  position: relative;
7
31
 
8
32
  .p-equal-height-row__col {
9
- // smaller screens each column will have border top by default
33
+ // At smaller sizes, each column will have top border by default
10
34
  border-top-color: $colors--theme--border-low-contrast;
11
35
  border-top-style: solid;
12
36
  border-top-width: 1px;
@@ -15,21 +39,24 @@
15
39
  grid-row: span 4;
16
40
  grid-template-rows: subgrid;
17
41
  margin-bottom: $spv--small;
18
- margin-top: -1px;
19
42
  position: relative;
20
43
 
21
44
  @media screen and ($breakpoint-small <= width < $breakpoint-large) {
22
45
  grid-column: span $grid-columns-medium;
23
46
  grid-template-columns: subgrid;
24
47
 
25
- // for medium screen, each column item will take half of the available cols from the parent grid
48
+ // At medium size, each column item will take half of the available
49
+ // cols from the parent grid
26
50
  .p-equal-height-row__item {
27
51
  grid-column: span calc($grid-columns-medium / 2);
28
52
  }
29
53
 
30
- // for medium screen, position the first column item on the left of the grid
54
+ // At medium size, position the first column item on the left of the
55
+ // grid
31
56
  .p-equal-height-row__item:first-child {
32
- grid-row: span 100; // this needs to be sufficiently large so remaining column items won't get stretched
57
+ // This needs to be sufficiently large so remaining column items won't
58
+ // get stretched
59
+ grid-row: span 100;
33
60
  }
34
61
  }
35
62
 
@@ -42,63 +69,80 @@
42
69
 
43
70
  // DIVIDERS
44
71
 
45
- // For each row or column grid we only have access to two pseudo elements
46
- // if 1st-divider (::before) is present, assume 2nd-divider (::after) isn't, then 3rd-divider must be (::after)
47
- // if 2nd-divider (::after) is present, assume 1st-divider (::before) isn't, then 3rd-divider must be (::before)
72
+ // For each row or column grid we only have access to two pseudo elements:
73
+ // If 1st-divider (::before) is present, assume 2nd-divider (::after) isn't, then 3rd-divider must be (::after)
74
+ // If 2nd-divider (::after) is present, assume 1st-divider (::before) isn't, then 3rd-divider must be (::before)
48
75
  &.has-divider-1::before,
49
76
  &.has-divider-2::after,
50
77
  &.has-divider-3:not(.has-divider-1)::before,
51
78
  &.has-divider-3:not(.has-divider-2)::after {
52
- // row level dividers are not visible on smaller screen sizes
53
79
  @extend %vf-pseudo-border;
54
- background-color: $colors--theme--border-low-contrast; // override border color to be low contrast
80
+
81
+ // Override border color to be low contrast
82
+ background-color: $colors--theme--border-low-contrast;
83
+ // Row-level dividers are not visible on smaller screen sizes
55
84
  display: none;
56
- }
85
+ grid-column-end: span 12;
86
+ grid-column-start: 1;
87
+ margin: auto;
57
88
 
58
- @media screen and (width >= $breakpoint-large) {
59
- &.has-divider-1::before,
60
- &.has-divider-2::after,
61
- &.has-divider-3:not(.has-divider-1)::before,
62
- &.has-divider-3:not(.has-divider-2)::after {
89
+ @media screen and (width >= $breakpoint-large) {
63
90
  display: block;
64
- grid-column-end: span 12;
65
- grid-column-start: 1;
66
- margin: auto;
67
91
  }
92
+ }
68
93
 
69
- &.has-divider-1::before {
70
- grid-row: 2;
71
- }
94
+ &.has-divider-1::before {
95
+ grid-row: 2;
96
+ }
72
97
 
73
- &.has-divider-2::after {
74
- grid-row: 3;
75
- }
98
+ &.has-divider-2::after {
99
+ grid-row: 3;
100
+ }
76
101
 
77
- // when 3rd-divider is present and 1st-divider is not present
78
- &.has-divider-3:not(.has-divider-1)::before,
79
- // when 3rd-divider is present and 2nd-divider is not present
80
- &.has-divider-3:not(.has-divider-2)::after,
81
- // when only 3rd-divider is present
82
- &.has-divider-3:not(.has-divider-1):not(.has-divider-2)::before {
83
- grid-row: 4;
84
- }
102
+ // When 3rd-divider is present and 1st-divider is not present
103
+ &.has-divider-3:not(.has-divider-1)::before,
104
+ // When 3rd-divider is present and 2nd-divider is not present
105
+ &.has-divider-3:not(.has-divider-2)::after,
106
+ // When only 3rd-divider is present
107
+ &.has-divider-3:not(.has-divider-1):not(.has-divider-2)::before {
108
+ grid-row: 4;
109
+ }
85
110
 
86
- &.has-divider-3:not(.has-divider-1):not(.has-divider-2)::after {
87
- display: none;
88
- }
111
+ &.has-divider-3:not(.has-divider-1):not(.has-divider-2)::after {
112
+ display: none;
89
113
  }
90
114
  }
91
115
 
92
- // support for 25-75 split on large screen size for this pattern
93
- .row--25-75-on-large > .col,
94
- .row > .col-9 {
95
- & .p-equal-height-row {
96
- grid-template-columns: repeat($grid-columns-small, minmax(0, 1fr));
116
+ // WRAP VARIANT
97
117
 
118
+ // This variant displays multiple columns side-by-side and wraps them at
119
+ // medium size; we have to unset some grid properties from the default
120
+ // variant to enable this functionality
121
+ .p-equal-height-row--wrap {
122
+ .p-equal-height-row__col {
98
123
  @media screen and ($breakpoint-small <= width < $breakpoint-large) {
99
- grid-template-columns: repeat($grid-columns-medium, minmax(0, 1fr));
124
+ // Fit 2 columns onto each row at medium size
125
+ grid-column: span calc($grid-columns-medium / 2);
126
+ grid-template-columns: none;
127
+
128
+ .p-equal-height-row__item {
129
+ grid-column: auto;
130
+ }
131
+
132
+ .p-equal-height-row__item:first-child {
133
+ grid-row: auto;
134
+ }
100
135
  }
136
+ }
137
+ }
101
138
 
139
+ // ADVANCED GRID SUPPORT
140
+
141
+ // Support for 25-75 split on large screen size
142
+ .row--25-75-on-large > .col,
143
+ .row > .col-9 {
144
+ & .p-equal-height-row,
145
+ & .p-equal-height-row--wrap {
102
146
  @media screen and (width >= $breakpoint-large) {
103
147
  grid-template-columns: repeat(9, minmax(0, 1fr));
104
148
  }
@@ -39,7 +39,7 @@
39
39
  // (see https://github.com/canonical/vanilla-framework/issues/3199)
40
40
  .grid-demo .col,
41
41
  .grid-demo [class*='#{$grid-column-prefix}'] {
42
- background: transparentize($color-negative, 0.9);
42
+ background: $colors--theme--background-negative-default;
43
43
  margin-bottom: $spv--small;
44
44
  }
45
45
 
@@ -167,11 +167,12 @@
167
167
 
168
168
  // variants
169
169
 
170
+ // deprecated, will be removed in v5
170
171
  .row.is-bordered {
171
172
  position: relative;
172
173
 
173
174
  &::before {
174
- background: $color-mid-light;
175
+ background: $colors--theme--border-low-contrast;
175
176
  content: '';
176
177
  height: 1px;
177
178
  left: map-get($grid-margin-widths, small);
@@ -319,6 +320,77 @@
319
320
  }
320
321
  }
321
322
 
323
+ // 75/25 split on medium and large screens
324
+ .row--75-25 {
325
+ @extend %vf-row;
326
+
327
+ > .col {
328
+ @include vf-grid-column($grid-columns-small);
329
+
330
+ @media (min-width: $threshold-4-6-col) {
331
+ &:nth-of-type(1) {
332
+ @include vf-grid-column(4);
333
+ }
334
+
335
+ &:nth-of-type(2) {
336
+ @include vf-grid-column(2);
337
+ }
338
+
339
+ // if there is only one column, use the whole width
340
+ &:only-of-type {
341
+ @include vf-grid-column(6);
342
+ }
343
+ }
344
+
345
+ @media (min-width: $threshold-6-12-col) {
346
+ &:nth-of-type(1) {
347
+ @include vf-grid-column($col-75);
348
+ }
349
+
350
+ &:nth-of-type(2) {
351
+ @include vf-grid-column($col-25);
352
+ }
353
+ }
354
+ }
355
+ }
356
+
357
+ .row--75-25-on-medium {
358
+ @extend %vf-row;
359
+
360
+ > .col {
361
+ @media ($threshold-4-6-col <= width < $threshold-6-12-col) {
362
+ &:nth-of-type(1) {
363
+ @include vf-grid-column(4);
364
+ }
365
+
366
+ &:nth-of-type(2) {
367
+ @include vf-grid-column(2);
368
+ }
369
+
370
+ // if there is only one column, use the whole width
371
+ &:only-of-type {
372
+ @include vf-grid-column(6);
373
+ }
374
+ }
375
+ }
376
+ }
377
+
378
+ .row--75-25-on-large {
379
+ @extend %vf-row;
380
+
381
+ > .col {
382
+ @media (min-width: $threshold-6-12-col) {
383
+ &:nth-of-type(1) {
384
+ @include vf-grid-column($col-75);
385
+ }
386
+
387
+ &:nth-of-type(2) {
388
+ @include vf-grid-column($col-25);
389
+ }
390
+ }
391
+ }
392
+ }
393
+
322
394
  .row--25-25-50 {
323
395
  @extend %vf-row;
324
396
 
@@ -130,21 +130,23 @@
130
130
 
131
131
  @mixin vf-p-icon-chevron {
132
132
  .p-icon--chevron-up {
133
- transform: rotate(180deg);
134
- }
135
- .p-icon--chevron-left {
136
- transform: rotate(90deg);
133
+ @include vf-icon-chevron-up-themed;
137
134
  }
138
135
  .p-icon--chevron-right {
139
- transform: rotate(-90deg);
136
+ @include vf-icon-chevron-right-themed;
137
+ }
138
+ .p-icon--chevron-down {
139
+ @include vf-icon-chevron-down-themed;
140
+ }
141
+ .p-icon--chevron-left {
142
+ @include vf-icon-chevron-left-themed;
140
143
  }
141
144
 
142
- .p-icon--chevron-left,
145
+ .p-icon--chevron-up,
143
146
  .p-icon--chevron-right,
144
147
  .p-icon--chevron-down,
145
- .p-icon--chevron-up {
148
+ .p-icon--chevron-left {
146
149
  @extend %icon;
147
- @include vf-icon-chevron-themed;
148
150
  }
149
151
  }
150
152
 
@@ -4,6 +4,8 @@
4
4
  Image container:
5
5
  .p-image-container:
6
6
  Main element of the image component.
7
+ "&.is-cover":
8
+ Cover variant, to be used to set the `.p-image-container__image` within to cover the container.
7
9
  "&.is-highlighted":
8
10
  Highlighted variant, to be used to highlight contents.
9
11
  .p-image-container--16-9:
@@ -16,6 +18,8 @@
16
18
  Wraps contents in a container with an aspect ratio of 2.4:1.
17
19
  .p-image-container--square:
18
20
  Wraps contents in a container with an aspect ratio of 1:1.
21
+ .p-image-container--(16-9|3-2|2-3|cinematic|square)-on-(small|medium|large):
22
+ Wraps contents in a container with the specified aspect ratio on the specified breakpoint.
19
23
  Image:
20
24
  .p-image-container__image:
21
25
  Image element within an image container.
@@ -23,6 +27,54 @@
23
27
 
24
28
  @import 'settings';
25
29
 
30
+ // Mapping of aspect ratio class names to their `aspect-ratio` values (width / height).
31
+ $aspect-ratios: (
32
+ '16-9': calc(16 / 9),
33
+ '3-2': calc(3 / 2),
34
+ '2-3': calc(2 / 3),
35
+ 'cinematic': 2.4,
36
+ 'square': 1,
37
+ );
38
+
39
+ @mixin aspect-ratio-classes {
40
+ @each $aspect-ratio, $aspect-ratio-value in $aspect-ratios {
41
+ .p-image-container--#{$aspect-ratio} {
42
+ aspect-ratio: $aspect-ratio-value;
43
+ }
44
+ }
45
+
46
+ @each $breakpoint-name, $breakpoint-bounds-pair in $breakpoint-bounds {
47
+ $min-width: map-get($breakpoint-bounds-pair, min);
48
+ $max-width: map-get($breakpoint-bounds-pair, max);
49
+
50
+ @if $min-width and $max-width {
51
+ @media ($min-width <= width < $max-width) {
52
+ @each $aspect-ratio, $aspect-ratio-value in $aspect-ratios {
53
+ .p-image-container--#{$aspect-ratio}-on-#{$breakpoint-name} {
54
+ aspect-ratio: $aspect-ratio-value;
55
+ }
56
+ }
57
+ }
58
+ } @else if $min-width {
59
+ @media (width >= $min-width) {
60
+ @each $aspect-ratio, $aspect-ratio-value in $aspect-ratios {
61
+ .p-image-container--#{$aspect-ratio}-on-#{$breakpoint-name} {
62
+ aspect-ratio: $aspect-ratio-value;
63
+ }
64
+ }
65
+ }
66
+ } @else if $max-width {
67
+ @media (width < $max-width) {
68
+ @each $aspect-ratio, $aspect-ratio-value in $aspect-ratios {
69
+ .p-image-container--#{$aspect-ratio}-on-#{$breakpoint-name} {
70
+ aspect-ratio: $aspect-ratio-value;
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+
26
78
  @mixin vf-p-image {
27
79
  .p-image-container,
28
80
  [class^='p-image-container--'] {
@@ -52,21 +104,7 @@
52
104
  }
53
105
  }
54
106
 
55
- .p-image-container--16-9 {
56
- aspect-ratio: 16/9;
57
- }
58
- .p-image-container--3-2 {
59
- aspect-ratio: 3/2;
60
- }
61
- .p-image-container--2-3 {
62
- aspect-ratio: 2/3;
63
- }
64
- .p-image-container--cinematic {
65
- aspect-ratio: 2.4/1;
66
- }
67
- .p-image-container--square {
68
- aspect-ratio: 1/1;
69
- }
107
+ @include aspect-ratio-classes;
70
108
 
71
109
  // Deprecated; will be removed in v5
72
110
  .p-image--bordered {
@@ -41,7 +41,7 @@
41
41
  top: -999px;
42
42
 
43
43
  &:focus {
44
- @include vf-focus;
44
+ @include vf-focus-themed;
45
45
 
46
46
  left: 0;
47
47
  padding: $spv--x-small;
@@ -1,87 +1,93 @@
1
1
  @import 'settings';
2
2
 
3
3
  @mixin vf-p-list-tree {
4
- %list-tree-icon {
5
- $icon-size: 0.9375rem; // 15px
6
- background: {
7
- position: center;
8
- repeat: no-repeat;
9
- }
4
+ $list-tree-toggle-icon-size: 1rem;
5
+ $list-tree-item-indent-size: calc($sph--x-large + map-get($icon-sizes, small) / 2);
10
6
 
7
+ %list-tree-icon {
11
8
  content: ' ';
12
9
  display: block;
13
- height: $icon-size;
14
- left: -0.75rem;
10
+ height: $list-tree-toggle-icon-size;
11
+ left: 0;
15
12
  pointer-events: none;
16
13
  position: absolute;
17
- top: 0.4rem;
18
- width: $icon-size;
14
+ top: 0.3rem;
15
+ width: $list-tree-toggle-icon-size;
16
+ }
17
+
18
+ %list-tree-expand-icon {
19
+ @extend %list-tree-icon;
20
+ @include vf-icon-chevron-right-themed;
21
+ }
22
+
23
+ %list-tree-collapse-icon {
24
+ @extend %list-tree-icon;
25
+ @include vf-icon-chevron-down-themed;
26
+ }
27
+
28
+ .p-list-tree__link,
29
+ .p-list-tree__toggle {
30
+ color: $colors--theme--text-default;
31
+ cursor: pointer;
32
+
33
+ &:hover {
34
+ color: $colors--theme--link-default;
35
+ text-decoration: underline;
36
+ }
37
+
38
+ &.is-active {
39
+ color: $colors--theme--link-default;
40
+ }
19
41
  }
20
42
 
21
43
  .p-list-tree {
22
- border-left: 1px solid $color-mid-light;
23
44
  list-style-type: none;
24
- margin-left: $sp-medium;
25
- padding: 0 0 0 $sp-x-small;
45
+ margin-left: $sp-x-small;
46
+ padding-left: $sph--small;
26
47
 
27
48
  .p-list-tree {
28
49
  display: none;
29
- margin-left: 0;
50
+ margin: 0;
51
+ padding: 0;
30
52
 
31
53
  &[aria-hidden='false'] {
32
54
  display: block;
33
55
  }
34
56
 
35
- &[aria-hidden='false']::after {
36
- @extend %list-tree-icon;
37
-
38
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='15' width='15' viewBox='0 0 15 15'%3E%3Cdefs%3E%3Cpath id='a' d='M0 0h15v15H0z'/%3E%3C/defs%3E%3Cg fill-rule='evenodd' fill='none'%3E%3Cuse xlink:href='%23a' fill='%23FFF'/%3E%3Cpath stroke='%23888' d='M.5.5h14v14H.5z'/%3E%3Cpath fill='%23888' d='M4 8V7h7v1z'/%3E%3C/g%3E%3C/svg%3E");
39
- // At this point we need to push this icon above the --group icon.
40
- z-index: 1;
57
+ &[aria-hidden='false']::before {
58
+ @extend %list-tree-collapse-icon;
41
59
  }
42
60
  }
43
61
  }
44
62
 
45
63
  .p-list-tree__item {
46
- @include vf-focus;
64
+ @include vf-focus-themed;
47
65
 
48
66
  margin-top: $sp-xx-small;
49
- padding-left: 0.8rem;
67
+ padding-left: $list-tree-item-indent-size;
50
68
  position: relative;
69
+ }
51
70
 
71
+ .p-list-tree__toggle[aria-expanded='false'] {
52
72
  &::before {
53
- background: $color-mid-light;
54
- content: ' ';
55
- display: block;
56
- height: 1px;
57
- left: -$sp-x-small;
58
- pointer-events: none;
59
- position: absolute;
60
- top: 0.8rem;
61
- width: 0.625rem;
73
+ @extend %list-tree-expand-icon;
62
74
  }
63
75
  }
64
76
 
65
- .p-list-tree__item--group::after {
66
- @extend %list-tree-icon;
67
-
68
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='15' width='15' viewBox='0 0 15 15'%3E%3Cdefs%3E%3Cpath id='a' d='M0 0h15v15H0z'/%3E%3C/defs%3E%3Cg fill-rule='evenodd' fill='none'%3E%3Cuse xlink:href='%23a' fill='%23FFF'/%3E%3Cpath stroke='%23888' d='M.5.5h14v14H.5z'/%3E%3Cpath fill='%23888' d='M7 4h1v7H7z'/%3E%3Cpath fill='%23888' d='M4 8V7h7v1z'/%3E%3C/g%3E%3C/svg%3E");
69
- }
70
-
71
77
  .p-list-tree__toggle {
72
- @include vf-focus;
78
+ @include vf-focus-themed;
73
79
 
74
80
  background: transparent;
75
81
  border: 0;
76
82
  font-weight: normal;
77
- margin: 0 0.5rem 0 -1.75rem;
78
- padding: 0 0.5rem 0 1.75rem;
83
+ margin: 0 0 0 (-$list-tree-item-indent-size);
84
+ padding: 0 $sph--small 0 $list-tree-item-indent-size;
79
85
  transition-duration: 0s;
80
86
 
87
+ // Hide the default button styling for toggles
88
+ &[aria-expanded='true'],
81
89
  &:hover {
82
- background: transparent;
83
- color: $color-link;
84
- text-decoration: underline;
90
+ background: $colors--theme--background-default;
85
91
  }
86
92
  }
87
93
  }
@@ -3,24 +3,24 @@ $list-status-icon-height: $default-icon-size;
3
3
  $list-step-bullet-margin: $sph--x-large;
4
4
 
5
5
  @mixin vf-p-list-placeholders {
6
- // container for stepped lists (`ol`)
7
- // defines the layout and resets the native browser counter
6
+ // Container for .p-stepped-list and .p-stepped-list--detailed ordered lists;
7
+ // Defines the layout and resets a custom counter
8
8
  %numbered-step-container {
9
- counter-reset: list-item;
9
+ counter-reset: p-stepped-list-counter;
10
10
  display: flex;
11
11
  flex-direction: column;
12
12
  list-style: none;
13
13
  padding-left: 0;
14
14
  }
15
15
 
16
- // list item for stepped lists (`li`)
17
- // increments the default browser counter
16
+ // List item for .p-stepped-list and .p-stepped-list--detailed ordered lists;
17
+ // Increments the custom counter
18
18
  %numbered-step-item {
19
- counter-increment: list-item;
19
+ counter-increment: p-stepped-list-counter;
20
20
  }
21
21
 
22
- // title for stepped lists
23
- // displays the title and step counter
22
+ // Title for .p-stepped-list and .p-stepped-list--detailed ordered lists;
23
+ // Displays the title and step counter
24
24
  %numbered-step-title {
25
25
  list-style: none;
26
26
  margin-left: 0;
@@ -28,7 +28,7 @@ $list-step-bullet-margin: $sph--x-large;
28
28
  position: relative;
29
29
 
30
30
  &::before {
31
- content: counter(list-item) '.';
31
+ content: counter(p-stepped-list-counter) '.';
32
32
  display: block;
33
33
  height: map-get($line-heights, default-text);
34
34
  left: 0;
@@ -39,16 +39,30 @@ $list-step-bullet-margin: $sph--x-large;
39
39
  }
40
40
  }
41
41
 
42
- // used with .p-list--nested-counter
42
+ // Styles for .p-list--nested-counter
43
43
  %nested-counter {
44
44
  // Counter is named and it will be reset for each "ol" element.
45
- counter-reset: list-item;
45
+ counter-reset: p-list-nested-counter-top;
46
+
47
+ li {
48
+ counter-increment: p-list-nested-counter-top;
49
+ }
50
+
46
51
  li::marker {
47
- // "counters" function returns a string representing the current value of the named counter ("list-item").
48
- // It is used to insert a string between different levels of nested counters.
49
- // Source: https://www.w3schools.com/css/css_counters.asp
50
- content: counters(list-item, '.') '. ';
51
- counter-increment: list-item;
52
+ content: counter(p-list-nested-counter-top) '. ';
53
+ }
54
+
55
+ // Counter is named and it will be reset for each nested "ol" element.
56
+ li ol {
57
+ counter-reset: p-list-nested-counter-nested;
58
+ }
59
+
60
+ li ol li {
61
+ counter-increment: p-list-nested-counter-nested;
62
+ }
63
+
64
+ li ol li::marker {
65
+ content: counter(p-list-nested-counter-top) '.' counter(p-list-nested-counter-nested) '. ';
52
66
  }
53
67
  }
54
68
 
@@ -80,7 +94,10 @@ $list-step-bullet-margin: $sph--x-large;
80
94
  top: $spv--small;
81
95
  }
82
96
 
97
+ // Styles for .p-list--divided ordered lists
83
98
  %vf-list-item-ordered {
99
+ counter-increment: p-list-divided-counter;
100
+
84
101
  &::marker {
85
102
  content: none;
86
103
  display: none;
@@ -88,9 +105,32 @@ $list-step-bullet-margin: $sph--x-large;
88
105
 
89
106
  &::before {
90
107
  color: $colors--theme--text-default;
91
- content: counters(list-item, '.') '. ';
108
+ // If .p-list--divided ordered list is not within stepped list, display
109
+ // counter as unique whole number
110
+ content: counter(p-list-divided-counter) '.';
92
111
  display: inline-block;
93
112
  text-align: right;
113
+
114
+ // If .p-list--divided ordered list is within a stepped list, display
115
+ // counter as decimal nested under parent number
116
+ .p-stepped-list &,
117
+ .p-stepped-list--detailed & {
118
+ content: counter(p-stepped-list-counter) '.' counter(p-list-divided-counter) '.';
119
+ }
120
+ }
121
+
122
+ // If .p-list--divided is within another .p-list--divided, display counter
123
+ // as decimal nested under parent number
124
+ ol.p-list--divided {
125
+ counter-reset: p-list-divided-nested-counter;
126
+
127
+ .p-list__item {
128
+ counter-increment: p-list-divided-nested-counter;
129
+
130
+ &::before {
131
+ content: counter(p-list-divided-counter) '.' counter(p-list-divided-nested-counter) '.';
132
+ }
133
+ }
94
134
  }
95
135
  }
96
136
 
@@ -187,6 +227,7 @@ $list-step-bullet-margin: $sph--x-large;
187
227
 
188
228
  // stylelint-disable selector-max-type -- we want to target ordered lists
189
229
  ol.p-list--divided {
230
+ counter-reset: p-list-divided-counter;
190
231
  list-style: none;
191
232
 
192
233
  .p-list__item {