vanilla-framework 4.18.5 → 4.20.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-framework",
3
- "version": "4.18.5",
3
+ "version": "4.20.0",
4
4
  "author": {
5
5
  "email": "webteam@canonical.com",
6
6
  "name": "Canonical Webteam"
@@ -59,10 +59,10 @@
59
59
  "devDependencies": {
60
60
  "@canonical/cookie-policy": "3.6.5",
61
61
  "@canonical/latest-news": "1.5.0",
62
- "@percy/cli": "1.30.3",
62
+ "@percy/cli": "1.30.6",
63
63
  "@testing-library/cypress": "10.0.2",
64
64
  "autoprefixer": "10.4.20",
65
- "cypress": "13.16.0",
65
+ "cypress": "13.17.0",
66
66
  "jest": "29.7.0",
67
67
  "js-beautify": "1.15.1",
68
68
  "markdown-spellcheck": "1.3.1",
@@ -71,15 +71,15 @@
71
71
  "postcss": "8.4.49",
72
72
  "postcss-cli": "11.0.0",
73
73
  "postcss-scss": "4.0.9",
74
- "prettier": "3.4.1",
75
- "sass": "1.81.0",
76
- "style-dictionary": "4.2.0",
77
- "stylelint": "16.11.0",
74
+ "prettier": "3.4.2",
75
+ "sass": "1.83.1",
76
+ "style-dictionary": "4.3.0",
77
+ "stylelint": "16.12.0",
78
78
  "stylelint-config-recommended-scss": "14.1.0",
79
79
  "stylelint-order": "6.0.4",
80
80
  "stylelint-prettier": "5.0.2",
81
81
  "svgo": "3.3.2",
82
- "yaml": "2.6.1"
82
+ "yaml": "2.7.0"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "sass": "^1.79.0"
@@ -1471,3 +1471,18 @@
1471
1471
  @mixin vf-icon-website-themed {
1472
1472
  @include vf-themed-icon($light-value: vf-icon-website-url($colors--light-theme--icon), $dark-value: vf-icon-website-url($colors--dark-theme--icon));
1473
1473
  }
1474
+
1475
+ // ICONS ADDED IN JANUARY 2025 v4.19.0
1476
+
1477
+ // credit card
1478
+ @function vf-icon-credit-card-url($color) {
1479
+ @return url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16px' height='16px' viewBox='0 0 16 16' fill='none'%3E%3Cpath fill='#{vf-url-friendly-color($color)}' fill-rule='evenodd' d='M13 4.5H3c-.27614 0-.5.22386-.5.5v.75h11V5c0-.27614-.2239-.5-.5-.5ZM2.5 11V7.25h11V11c0 .2761-.2239.5-.5.5H3c-.27614 0-.5-.2239-.5-.5ZM3 3c-1.10457 0-2 .89543-2 2v6c0 1.1046.89543 2 2 2h10c1.1046 0 2-.8954 2-2V5c0-1.10457-.8954-2-2-2H3Zm7.75 5.5c-.4142 0-.75.33579-.75.75v.5c0 .4142.3358.75.75.75h.5c.4142 0 .75-.3358.75-.75v-.5c0-.41421-.3358-.75-.75-.75h-.5Z' clip-rule='evenodd'/%3E%3C/svg%3E");
1480
+ }
1481
+
1482
+ @mixin vf-icon-credit-card($color) {
1483
+ background-image: vf-icon-credit-card-url($color);
1484
+ }
1485
+
1486
+ @mixin vf-icon-credit-card-themed {
1487
+ @include vf-themed-icon($light-value: vf-icon-credit-card-url($colors--light-theme--icon), $dark-value: vf-icon-credit-card-url($colors--dark-theme--icon));
1488
+ }
@@ -2042,4 +2042,13 @@
2042
2042
  }
2043
2043
  }
2044
2044
 
2045
+ // ICONS ADDED IN JANUARY 2025
2046
+
2047
+ @mixin vf-p-icon-credit-card {
2048
+ .p-icon--credit-card {
2049
+ @extend %icon;
2050
+ @include vf-icon-credit-card-themed;
2051
+ }
2052
+ }
2053
+
2045
2054
  // **Base and Pattern mixins accurate as of October 2024**
@@ -134,6 +134,12 @@ $list-step-bullet-margin: $sph--x-large;
134
134
  }
135
135
  }
136
136
 
137
+ %vf-list-item-with-divisor-common-properties {
138
+ margin: 0;
139
+ padding-bottom: $sph--large;
140
+ padding-top: $sph--small;
141
+ }
142
+
137
143
  %vf-list-item-bullet {
138
144
  &::before {
139
145
  color: $colors--theme--text-default;
@@ -149,6 +155,7 @@ $list-step-bullet-margin: $sph--x-large;
149
155
  position: relative;
150
156
 
151
157
  > .p-list--divided,
158
+ > .p-list--horizontal-section,
152
159
  > .p-list {
153
160
  margin-left: 0;
154
161
  }
@@ -161,10 +168,9 @@ $list-step-bullet-margin: $sph--x-large;
161
168
  }
162
169
 
163
170
  @mixin vf-list-item-divided {
171
+ @extend %vf-list-item-with-divisor-common-properties;
172
+
164
173
  box-shadow: inset 0px 1px 0px 0px $colors--theme--border-low-contrast;
165
- margin: 0;
166
- padding-bottom: $sph--large;
167
- padding-top: $sph--small;
168
174
 
169
175
  &:first-child {
170
176
  box-shadow: none;
@@ -175,6 +181,21 @@ $list-step-bullet-margin: $sph--x-large;
175
181
  }
176
182
  }
177
183
 
184
+ @mixin vf-list-item-horizontal-section {
185
+ @extend %vf-list-item-with-divisor-common-properties;
186
+
187
+ // Allows list item pseudo-elements to be absolutely positioned relative to the list item
188
+ position: relative;
189
+ }
190
+
191
+ // Offset a list item icon (tick or cross) away from the divisor above it
192
+ @mixin vf-list-item-icon-divisor-offset {
193
+ &.is-ticked::before,
194
+ &.is-crossed::before {
195
+ top: $spv--medium;
196
+ }
197
+ }
198
+
178
199
  // Mixin for inline list items
179
200
  @mixin vf-inline-list-item {
180
201
  display: inline;
@@ -199,6 +220,87 @@ $list-step-bullet-margin: $sph--x-large;
199
220
  }
200
221
  }
201
222
 
223
+ // Sets horizontal list section grid column count and makes list item borders span the full grid width.
224
+ // $columns: Number of columns that the list items should be divided into.
225
+ // $skip-cols: Number of columns at the start of each row to skip
226
+ @mixin list-horizontal-section-row-width($columns, $skip-cols: 0) {
227
+ --columns: #{$columns + $skip-cols};
228
+ // List item borders span full grid width, not list item width.
229
+ // Multiply 100% width by the number of columns to create a border that spans the full grid width.
230
+ .p-list__item:nth-child(#{$columns}n + 1)::after {
231
+ background: $colors--theme--border-low-contrast;
232
+ content: '';
233
+ height: 1px;
234
+ left: 0;
235
+ position: absolute;
236
+ top: 0;
237
+ // 100% * columns = total width of all list item columns in a row
238
+ // (gutter width) * (columns - 1) = total width of all gutters in a row
239
+ // width = (width of list items) + (width of gutters)
240
+ width: calc(100% * #{$columns} + #{$columns - 1} * map-get($grid-gutter-widths, default));
241
+ }
242
+
243
+ @if $skip-cols > 0 {
244
+ @for $i from 1 through $skip-cols {
245
+ .p-list__item:nth-child(#{$columns}n + #{$i}) {
246
+ grid-column-start: #{($i + 1)};
247
+ }
248
+ }
249
+ }
250
+ }
251
+
252
+ @mixin vf-p-list-horizontal-section {
253
+ $horizontal-list-section-medium-content-width: 66ch;
254
+ $horizontal-list-section-large-content-width: 100ch;
255
+
256
+ .p-list--horizontal-section-wrapper {
257
+ container-type: inline-size;
258
+
259
+ .p-list--horizontal-section {
260
+ @extend %vf-list;
261
+ @extend %fixed-width-container;
262
+
263
+ display: grid;
264
+
265
+ @container (width >= #{$horizontal-list-section-medium-content-width}) {
266
+ grid-gap: 0 map-get($grid-gutter-widths, default);
267
+ }
268
+
269
+ @container (width < #{$horizontal-list-section-medium-content-width}) {
270
+ @include list-horizontal-section-row-width($columns: 1);
271
+ }
272
+
273
+ @container (#{$horizontal-list-section-medium-content-width} <= width < #{$horizontal-list-section-large-content-width}) {
274
+ @include list-horizontal-section-row-width($columns: 2);
275
+ }
276
+
277
+ // We cannot override the default behavior with modifiers, as each container query creates styles for different pseudo-element indices
278
+ // So, we need to negate variant selectors before applying any styling that does not apply to all variants
279
+ &:not(.is-25-75) {
280
+ @container (width >= #{$horizontal-list-section-large-content-width}) {
281
+ @include list-horizontal-section-row-width($columns: 4);
282
+ }
283
+ }
284
+
285
+ // --columns is set in the container queries above
286
+ grid-template-columns: repeat(var(--columns), 1fr);
287
+
288
+ .p-list__item {
289
+ @extend %vf-list-item;
290
+ @include vf-list-item-icon-divisor-offset;
291
+ @include vf-list-item-horizontal-section;
292
+ }
293
+ }
294
+
295
+ .p-list--horizontal-section.is-25-75 {
296
+ // skip first column on large
297
+ @container (width >= #{$horizontal-list-section-large-content-width}) {
298
+ @include list-horizontal-section-row-width($columns: 3, $skip-cols: 1);
299
+ }
300
+ }
301
+ }
302
+ }
303
+
202
304
  // A list with separators between items
203
305
  @mixin vf-p-list-divided {
204
306
  .p-list--divided {
@@ -207,11 +309,7 @@ $list-step-bullet-margin: $sph--x-large;
207
309
  .p-list__item {
208
310
  @extend %vf-list-item;
209
311
  @include vf-list-item-divided;
210
-
211
- &.is-ticked::before,
212
- &.is-crossed::before {
213
- top: $spv--medium;
214
- }
312
+ @include vf-list-item-icon-divisor-offset;
215
313
  }
216
314
 
217
315
  & & {
@@ -226,7 +324,8 @@ $list-step-bullet-margin: $sph--x-large;
226
324
  }
227
325
 
228
326
  // stylelint-disable selector-max-type -- we want to target ordered lists
229
- ol.p-list--divided {
327
+ ol.p-list--divided,
328
+ ol.p-list--horizontal-section {
230
329
  counter-reset: p-list-divided-counter;
231
330
  list-style: none;
232
331
 
@@ -489,6 +588,7 @@ $list-step-bullet-margin: $sph--x-large;
489
588
  @include vf-p-list-placeholders;
490
589
 
491
590
  @include vf-p-list;
591
+ @include vf-p-list-horizontal-section;
492
592
  @include vf-p-list-divided;
493
593
  @include vf-p-list-item-state;
494
594
  @include vf-p-inline-list;
@@ -73,8 +73,10 @@
73
73
 
74
74
  {%- macro _hero_title_block() -%}
75
75
  {%- if has_full_width_image -%}
76
+ {%- if has_subtitle -%}
76
77
  {#- On full-width-image, the h1 and h2 are in separate columns, so there must be no margin-bottom to keep h1 close to h2 on smaller screens -#}
77
- {% set title_class = "u-no-margin--bottom" %}
78
+ {% set title_class = "u-no-margin--bottom" %}
79
+ {%- endif -%}
78
80
  {%- endif -%}
79
81
 
80
82
  {#- Only add a class attribute if needed -#}
@@ -19,7 +19,7 @@
19
19
  {%- set has_cta = cta_content|trim|length > 0 -%}
20
20
 
21
21
  <div class="u-fixed-width">
22
- <hr class="u-hide--small">
22
+ <hr class="p-rule">
23
23
 
24
24
  {% if has_description == true -%}
25
25
  {%- if is_description_full_width_on_desktop == true -%}