vanilla-framework 4.15.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 (37) hide show
  1. package/package.json +12 -10
  2. package/scss/_base_button.scss +1 -1
  3. package/scss/_base_details.scss +1 -1
  4. package/scss/_base_forms.scss +8 -2
  5. package/scss/_base_hr.scss +2 -3
  6. package/scss/_base_links.scss +1 -1
  7. package/scss/_base_placeholders.scss +2 -0
  8. package/scss/_base_typography-definitions.scss +1 -1
  9. package/scss/_global_functions.scss +17 -5
  10. package/scss/_layouts_fluid-breakout.scss +2 -2
  11. package/scss/_patterns_accordion.scss +1 -1
  12. package/scss/_patterns_article-pagination.scss +2 -2
  13. package/scss/_patterns_buttons.scss +1 -1
  14. package/scss/_patterns_chip.scss +8 -9
  15. package/scss/_patterns_code-snippet.scss +1 -1
  16. package/scss/_patterns_contextual-menu.scss +1 -1
  17. package/scss/_patterns_cta.scss +7 -0
  18. package/scss/_patterns_equal-height-row.scss +87 -43
  19. package/scss/_patterns_image.scss +51 -15
  20. package/scss/_patterns_links.scss +1 -1
  21. package/scss/_patterns_list-tree.scss +49 -43
  22. package/scss/_patterns_lists.scss +58 -17
  23. package/scss/_patterns_matrix.scss +2 -2
  24. package/scss/_patterns_navigation.scss +4 -4
  25. package/scss/_patterns_pull-quotes.scss +1 -1
  26. package/scss/_patterns_rule.scss +6 -2
  27. package/scss/_patterns_search-and-filter.scss +11 -12
  28. package/scss/_patterns_separator.scss +1 -0
  29. package/scss/_patterns_side-navigation.scss +1 -1
  30. package/scss/_patterns_status-label.scss +5 -0
  31. package/scss/_patterns_table-mobile-card.scss +1 -1
  32. package/scss/_patterns_tooltips.scss +26 -8
  33. package/scss/_settings_breakpoints.scss +16 -0
  34. package/scss/_settings_colors.scss +16 -13
  35. package/scss/_utilities_floats.scss +6 -6
  36. package/scss/_utilities_hide.scss +9 -9
  37. package/scss/_utilities_show.scss +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-framework",
3
- "version": "4.15.0",
3
+ "version": "4.16.0",
4
4
  "author": {
5
5
  "email": "webteam@canonical.com",
6
6
  "name": "Canonical Webteam"
@@ -29,8 +29,9 @@
29
29
  "scripts": {
30
30
  "start": "yarn build && yarn serve",
31
31
  "build": "yarn build-scss && yarn build-js && yarn build-class-references",
32
- "build-scss": "sass --load-path=node_modules --embed-sources --style=compressed scss:build/css && postcss --use autoprefixer --replace 'build/css/**/*.css' --map",
33
- "build:essential": "yarn run build-js && sass --load-path=node_modules --embed-sources --style=compressed scss/build.scss:build/css/build.css scss/docs:build/css/docs && postcss --use autoprefixer --replace 'build/css/**/*.css' --map",
32
+ "build-tokens": "((style-dictionary build --verbose --config ./sd.config.json) || true)",
33
+ "build-scss": "yarn build-tokens && sass --load-path=node_modules --embed-sources --style=compressed --silence-deprecation=mixed-decls scss:build/css && postcss --use autoprefixer --replace 'build/css/**/*.css' --map",
34
+ "build:essential": "yarn run build-js && sass --load-path=node_modules --embed-sources --style=compressed --silence-deprecation=mixed-decls scss/build.scss:build/css/build.css scss/docs:build/css/docs && postcss --use autoprefixer --replace 'build/css/**/*.css' --map",
34
35
  "build-js": "mkdir -p build/js/modules && cp node_modules/@canonical/cookie-policy/build/js/cookie-policy.js build/js/modules && cp node_modules/@canonical/latest-news/dist/latest-news.js build/js/modules && cp node_modules/js-beautify/js/lib/beautify.js node_modules/js-beautify/js/lib/beautify-html.js node_modules/js-beautify/js/lib/beautify-css.js build/js/modules",
35
36
  "build-class-references": "node scripts/create-class-references.js",
36
37
  "cypress:open": "cypress open",
@@ -41,8 +42,8 @@
41
42
  "test": "yarn lint-scss && yarn lint-prettier && yarn test-spelling && yarn test-scss && yarn jest",
42
43
  "lint-prettier": "prettier -c .",
43
44
  "lint-scss": "stylelint 'scss/**/*.scss'",
44
- "watch:scss": "sass --load-path=node_modules --embed-sources --style=compressed scss:build/css --watch",
45
- "watch:essential": "sass --load-path=node_modules --embed-sources --style=compressed scss/build.scss:build/css/build.css --watch",
45
+ "watch:scss": "sass --load-path=node_modules --embed-sources --style=compressed --silence-deprecation=mixed-decls scss:build/css --watch",
46
+ "watch:essential": "sass --load-path=node_modules --embed-sources --style=compressed --silence-deprecation=mixed-decls scss/build.scss:build/css/build.css --watch",
46
47
  "watch": "yarn build && yarn watch:scss",
47
48
  "clean": "rm -rf build docs/static/css node_modules/ yarn-error.log",
48
49
  "percy": "percy snapshot snapshots.js",
@@ -57,20 +58,21 @@
57
58
  "devDependencies": {
58
59
  "@canonical/cookie-policy": "3.6.4",
59
60
  "@canonical/latest-news": "1.5.0",
60
- "@percy/cli": "1.29.0",
61
+ "@percy/cli": "1.29.3",
61
62
  "@testing-library/cypress": "10.0.2",
62
- "autoprefixer": "10.4.19",
63
- "cypress": "13.13.2",
63
+ "autoprefixer": "10.4.20",
64
+ "cypress": "13.14.1",
64
65
  "jest": "29.7.0",
65
66
  "js-beautify": "1.15.1",
66
67
  "markdown-spellcheck": "1.3.1",
67
68
  "parker": "0.0.10",
68
- "postcss": "8.4.40",
69
+ "postcss": "8.4.44",
69
70
  "postcss-cli": "11.0.0",
70
71
  "postcss-scss": "4.0.9",
71
72
  "prettier": "3.3.3",
72
73
  "sass": "1.77.8",
73
- "stylelint": "16.8.1",
74
+ "style-dictionary": "4.1.0",
75
+ "stylelint": "16.9.0",
74
76
  "stylelint-config-recommended-scss": "14.1.0",
75
77
  "stylelint-order": "6.0.4",
76
78
  "stylelint-prettier": "5.0.2",
@@ -15,7 +15,7 @@
15
15
 
16
16
  %vf-button-base {
17
17
  @include vf-transition(#{background-color, border-color}, snap, in);
18
- @include vf-focus;
18
+ @include vf-focus-themed;
19
19
 
20
20
  border-style: solid;
21
21
  border-width: $input-border-thickness;
@@ -7,7 +7,7 @@
7
7
 
8
8
  summary {
9
9
  @extend %common-default-text-properties;
10
- @include vf-focus;
10
+ @include vf-focus-themed;
11
11
 
12
12
  margin-bottom: $spv-nudge; //push subsequent text onto baseline
13
13
  max-width: $text-max-width;
@@ -13,7 +13,7 @@
13
13
  // Default form input element styles
14
14
  %vf-input-elements {
15
15
  @extend %bordered-text-vertical-padding;
16
- @include vf-focus($has-validation: true);
16
+ @include vf-focus-themed($has-validation: true);
17
17
  @include vf-animation(#{background-color}, fast);
18
18
 
19
19
  // stylelint-disable property-no-vendor-prefix
@@ -145,7 +145,7 @@
145
145
 
146
146
  [type='file'] {
147
147
  @extend %bordered-text-vertical-padding;
148
- @include vf-focus;
148
+ @include vf-focus-themed;
149
149
 
150
150
  margin-bottom: $input-margin-bottom;
151
151
  width: 100%;
@@ -225,5 +225,11 @@
225
225
  margin-right: 0;
226
226
  padding: calc($spv--large - $input-border-thickness);
227
227
  }
228
+
229
+ legend {
230
+ &.is-required::before {
231
+ content: '* ';
232
+ }
233
+ }
228
234
  // stylelint-enable selector-max-type
229
235
  }
@@ -27,10 +27,8 @@
27
27
  // stylelint-disable selector-max-type -- base styles can use type selectors
28
28
  hr {
29
29
  @extend %hr;
30
- background: $colors--theme--border-default;
31
-
32
- margin-bottom: calc($spv--small - 1px);
33
30
 
31
+ // DEPRECATED: use `.p-rule--muted` instead
34
32
  &.is-muted {
35
33
  background-color: $colors--theme--border-low-contrast;
36
34
  }
@@ -40,6 +38,7 @@
40
38
  @extend %u-no-margin--bottom--hr;
41
39
  }
42
40
 
41
+ // DEPRECATED: use rule component inside of the grid instead
43
42
  &.is-fixed-width {
44
43
  @extend %fixed-width-hr;
45
44
  }
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  %vf-link-base {
11
- @include vf-focus;
11
+ @include vf-focus-themed;
12
12
 
13
13
  color: $colors--theme--link-default;
14
14
  text-decoration: none;
@@ -98,8 +98,10 @@
98
98
  }
99
99
 
100
100
  %hr {
101
+ background: $colors--theme--border-default;
101
102
  border: 0;
102
103
  height: 1px;
104
+ margin-bottom: calc($spv--small - 1px);
103
105
  margin-top: 0;
104
106
  position: relative;
105
107
  width: 100%;
@@ -1,7 +1,7 @@
1
1
  @mixin vf-b-typography-definitions {
2
2
  %vf-is-accent {
3
3
  &.is-accent {
4
- color: $color-accent;
4
+ color: $colors--theme--accent;
5
5
  }
6
6
  }
7
7
 
@@ -60,16 +60,22 @@
60
60
  }
61
61
  }
62
62
 
63
- // Adds visual focus to elements on :focus-visible,
64
- // or :focus if the browser doesn't support the former
65
- @mixin vf-focus($color: $colors--theme--focus, $width: $bar-thickness, $has-validation: false) {
63
+ // Adds visual focus to elements on :focus-visible or :focus if the browser
64
+ // doesn't support the former
65
+ @mixin vf-focus-themed($light-color: $colors--light-theme--focus, $dark-color: $colors--dark-theme--focus, $width: $bar-thickness, $has-validation: false) {
66
+ --vf-focus-outline-color: #{$light-color};
67
+
68
+ .is-dark & {
69
+ --vf-focus-outline-color: #{$dark-color};
70
+ }
71
+
66
72
  &:focus {
67
- outline: $width solid $color;
73
+ outline: $width solid var(--vf-focus-outline-color);
68
74
  outline-offset: -#{$width};
69
75
  }
70
76
 
71
77
  &:focus-visible {
72
- outline: $width solid $color;
78
+ outline: $width solid var(--vf-focus-outline-color);
73
79
  outline-offset: -#{$width};
74
80
  }
75
81
 
@@ -93,6 +99,12 @@
93
99
  }
94
100
  }
95
101
 
102
+ // This mixin is deprecated and will be removed in a future version of Vanilla.
103
+ // Please use vf-focus-themed instead.
104
+ @mixin vf-focus($color: $colors--theme--focus, $width: $bar-thickness, $has-validation: false) {
105
+ @include vf-focus-themed($light-color: $color, $width: $width, $has-validation: $has-validation);
106
+ }
107
+
96
108
  // Raises a number to a power (https://css-tricks.com/snippets/sass/power-function/)
97
109
  @function pow($number, $exponent) {
98
110
  $value: 1;
@@ -149,7 +149,7 @@
149
149
  grid-column: 2 / -1;
150
150
  grid-template-columns: repeat(2, minmax(0, 1fr));
151
151
 
152
- @media (max-width: $threshold-4-6-col - 1) {
152
+ @media (width < $threshold-4-6-col) {
153
153
  grid-template-columns: repeat(1, minmax(0, 1fr));
154
154
  width: $l-fluid-breakout-main-child-width;
155
155
  }
@@ -163,7 +163,7 @@
163
163
  &:nth-child(2) {
164
164
  justify-content: flex-end;
165
165
 
166
- @media (max-width: $threshold-4-6-col - 1) {
166
+ @media (width < $threshold-4-6-col) {
167
167
  justify-content: flex-start;
168
168
  }
169
169
  }
@@ -17,7 +17,7 @@
17
17
 
18
18
  .p-accordion__tab {
19
19
  @extend %single-border-text-vpadding--scaling;
20
- @include vf-focus;
20
+ @include vf-focus-themed;
21
21
 
22
22
  background-color: inherit;
23
23
  border: 0;
@@ -55,7 +55,7 @@
55
55
  padding-left: $sp-xx-large;
56
56
  text-align: left;
57
57
 
58
- @media (max-width: $breakpoint-x-small - 1) {
58
+ @media (width < $breakpoint-x-small) {
59
59
  margin-right: 0;
60
60
  width: auto;
61
61
 
@@ -84,7 +84,7 @@
84
84
  padding-right: $sp-xx-large;
85
85
  text-align: right;
86
86
 
87
- @media (max-width: $breakpoint-x-small - 1) {
87
+ @media (width < $breakpoint-x-small) {
88
88
  width: 100%;
89
89
  }
90
90
 
@@ -80,7 +80,7 @@
80
80
  $button-disabled-border-color: $colors--theme--button-positive-default,
81
81
  $button-text-color: $colors--theme--button-positive-text
82
82
  );
83
- @include vf-focus($colors--theme--positive-focus);
83
+ @include vf-focus-themed($light-color: $color-focus-positive);
84
84
  }
85
85
  }
86
86
 
@@ -1,22 +1,21 @@
1
1
  @use 'sass:math';
2
2
  @import 'settings';
3
- $chip-border-thickness: 1px;
4
3
 
5
4
  @mixin vf-p-chip {
6
5
  %vf-chip {
7
6
  @extend %small-text;
8
7
  @include vf-transition(#{background-color, border-color}, snap, out);
9
- @include vf-focus;
8
+ @include vf-focus-themed;
10
9
 
11
10
  align-items: baseline;
12
11
  border-radius: 1rem;
13
12
  display: inline-flex;
14
13
  margin: 0 $sph--small $input-margin-bottom 0;
15
14
  max-width: 100%;
16
- padding: calc($spv--x-small - $chip-border-thickness) $sph--small; // account for border thickness using calc
15
+ padding: calc($spv--x-small - $input-border-thickness) $sph--small; // account for border thickness using calc
17
16
  position: relative;
18
17
  user-select: none;
19
- vertical-align: calc($chip-border-thickness - map-get($nudges, p));
18
+ vertical-align: calc($input-border-thickness - map-get($nudges, p));
20
19
  white-space: nowrap;
21
20
 
22
21
  .p-chip__lead,
@@ -78,7 +77,7 @@ $chip-border-thickness: 1px;
78
77
  @extend %vf-chip;
79
78
 
80
79
  background-color: $colors--theme--background-neutral-default;
81
- border: $chip-border-thickness solid $colors--theme--border-neutral;
80
+ border: $input-border-thickness solid $colors--theme--border-neutral;
82
81
  border-color: $colors--theme--border-neutral;
83
82
  }
84
83
 
@@ -115,7 +114,7 @@ $chip-border-thickness: 1px;
115
114
  @extend %vf-chip;
116
115
 
117
116
  background-color: $colors--theme--background-positive-default;
118
- border: $chip-border-thickness solid $colors--theme--border-positive;
117
+ border: $input-border-thickness solid $colors--theme--border-positive;
119
118
  border-color: $colors--theme--border-positive;
120
119
  }
121
120
 
@@ -152,7 +151,7 @@ $chip-border-thickness: 1px;
152
151
  @extend %vf-chip;
153
152
 
154
153
  background-color: $colors--theme--background-caution-default;
155
- border: $chip-border-thickness solid $colors--theme--border-caution;
154
+ border: $input-border-thickness solid $colors--theme--border-caution;
156
155
  border-color: $colors--theme--border-caution;
157
156
  }
158
157
 
@@ -189,7 +188,7 @@ $chip-border-thickness: 1px;
189
188
  @extend %vf-chip;
190
189
 
191
190
  background-color: $colors--theme--background-negative-default;
192
- border: $chip-border-thickness solid $colors--theme--border-negative;
191
+ border: $input-border-thickness solid $colors--theme--border-negative;
193
192
  border-color: $colors--theme--border-negative;
194
193
  }
195
194
 
@@ -226,7 +225,7 @@ $chip-border-thickness: 1px;
226
225
  @extend %vf-chip;
227
226
 
228
227
  background-color: $colors--theme--background-information-default;
229
- border: $chip-border-thickness solid $colors--theme--border-information;
228
+ border: $input-border-thickness solid $colors--theme--border-information;
230
229
  border-color: $colors--theme--border-information;
231
230
  }
232
231
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  Code block:
11
11
  .p-code-snippet__block:
12
- Code block without any additonal styling elements.
12
+ Code block without any additional styling elements.
13
13
  "&.is-wrapped":
14
14
  Code block with wrapped content in lines.
15
15
  .p-code-snippet__block--icon:
@@ -66,7 +66,7 @@
66
66
  }
67
67
 
68
68
  .p-contextual-menu__link {
69
- @include vf-focus;
69
+ @include vf-focus-themed;
70
70
 
71
71
  border: 0;
72
72
  clear: both;
@@ -4,6 +4,8 @@
4
4
  CTA Block:
5
5
  .p-cta-block:
6
6
  Main element of the CTA block.
7
+ "&.is-borderless":
8
+ Borderless variant, to be used to hide top border and padding.
7
9
  */
8
10
 
9
11
  @import 'settings';
@@ -16,5 +18,10 @@
16
18
  flex-wrap: wrap;
17
19
  padding-bottom: $spv--x-large;
18
20
  padding-top: $spv--small;
21
+
22
+ &.is-borderless {
23
+ border: none;
24
+ padding-top: 0;
25
+ }
19
26
  }
20
27
  }
@@ -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
  }
@@ -18,6 +18,8 @@
18
18
  Wraps contents in a container with an aspect ratio of 2.4:1.
19
19
  .p-image-container--square:
20
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.
21
23
  Image:
22
24
  .p-image-container__image:
23
25
  Image element within an image container.
@@ -25,6 +27,54 @@
25
27
 
26
28
  @import 'settings';
27
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
+
28
78
  @mixin vf-p-image {
29
79
  .p-image-container,
30
80
  [class^='p-image-container--'] {
@@ -54,21 +104,7 @@
54
104
  }
55
105
  }
56
106
 
57
- .p-image-container--16-9 {
58
- aspect-ratio: 16/9;
59
- }
60
- .p-image-container--3-2 {
61
- aspect-ratio: 3/2;
62
- }
63
- .p-image-container--2-3 {
64
- aspect-ratio: 2/3;
65
- }
66
- .p-image-container--cinematic {
67
- aspect-ratio: 2.4/1;
68
- }
69
- .p-image-container--square {
70
- aspect-ratio: 1/1;
71
- }
107
+ @include aspect-ratio-classes;
72
108
 
73
109
  // Deprecated; will be removed in v5
74
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;