vanilla-framework 3.6.1 → 3.7.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/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # ![vanilla](https://assets.ubuntu.com/v1/70041419-vanilla-framework.png?w=35 'Vanilla') Vanilla Framework
2
2
 
3
- [![CircleCI build status](https://circleci.com/gh/canonical-web-and-design/vanilla-framework.svg?style=shield)](https://circleci.com/gh/canonical-web-and-design/vanilla-framework)
3
+ [![CircleCI build status](https://circleci.com/gh/canonical/vanilla-framework.svg?style=shield)](https://circleci.com/gh/canonical/vanilla-framework)
4
4
  [![npm version](https://badge.fury.io/js/vanilla-framework.svg)](http://badge.fury.io/js/vanilla-framework)
5
5
  [![Downloads](http://img.shields.io/npm/dm/vanilla-framework.svg)](https://www.npmjs.com/package/vanilla-framework)
6
- [![devDependency Status](https://david-dm.org/canonical-web-and-design/vanilla-framework/dev-status.svg)](https://david-dm.org/canonical-web-and-design/vanilla-framework#info=devDependencies)
6
+ [![devDependency Status](https://david-dm.org/canonical/vanilla-framework/dev-status.svg)](https://david-dm.org/canonical/vanilla-framework#info=devDependencies)
7
7
  [![Chat in #vanilla-framework on Freenode](https://img.shields.io/badge/chat-%23vanilla--framework-blue.svg)](http://webchat.freenode.net/?channels=vanilla-framework)
8
8
  [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io)
9
9
 
@@ -24,7 +24,7 @@ Vanilla Framework is an extensible CSS framework, built using [Sass](http://sass
24
24
 
25
25
  ### Hotlinking
26
26
 
27
- You can link to the latest build to add directly into your markup like so, by replacing the x values with the [version number you wish to link](https://github.com/canonical-web-and-design/vanilla-framework/releases).
27
+ You can link to the latest build to add directly into your markup like so, by replacing the x values with the [version number you wish to link](https://github.com/canonical/vanilla-framework/releases).
28
28
 
29
29
  ```html
30
30
  <link rel="stylesheet" href="https://assets.ubuntu.com/v1/vanilla-framework-version-x.x.x.min.css" />
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "bugs": {
7
7
  "email": "webteam@canonical.com",
8
- "url": "http://github.com/canonical-web-and-design/vanilla-framework/issues"
8
+ "url": "http://github.com/canonical/vanilla-framework/issues"
9
9
  },
10
10
  "description": "A simple, extendable CSS framework.",
11
11
  "homepage": "https://vanillaframework.io/",
@@ -23,7 +23,7 @@
23
23
  "name": "vanilla-framework",
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "https://github.com/canonical-web-and-design/vanilla-framework"
26
+ "url": "https://github.com/canonical/vanilla-framework"
27
27
  },
28
28
  "scripts": {
29
29
  "start": "yarn build && yarn serve",
@@ -32,6 +32,8 @@
32
32
  "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",
33
33
  "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",
34
34
  "build-class-references": "node scripts/create-class-references.js",
35
+ "cypress:open": "cypress open",
36
+ "cypress:run": "cypress run",
35
37
  "serve": "./entrypoint 0.0.0.0:${PORT}",
36
38
  "test-scss": "node -e 'require(\"./tests/parker\").parkerTest()'",
37
39
  "test-spelling": "mdspell templates/docs/**/*.md -r -n -a --en-gb",
@@ -45,7 +47,7 @@
45
47
  "percy": "percy exec -- node snapshots.js",
46
48
  "icon-svgs-to-mixins": "node scripts/convert-svgs-to-icon-mixins.js icons"
47
49
  },
48
- "version": "3.6.1",
50
+ "version": "3.7.0",
49
51
  "files": [
50
52
  "_index.scss",
51
53
  "/scss",
@@ -55,15 +57,17 @@
55
57
  "dependencies": {
56
58
  "@canonical/cookie-policy": "3.4.0",
57
59
  "@canonical/latest-news": "1.4.1",
58
- "autoprefixer": "10.4.7",
60
+ "autoprefixer": "10.4.8",
59
61
  "postcss": "8.4.14",
60
62
  "postcss-cli": "9.1.0",
61
63
  "postcss-scss": "4.0.4",
62
- "sass": "1.53.0",
64
+ "sass": "1.54.0",
63
65
  "yaml": "1.10.2"
64
66
  },
65
67
  "devDependencies": {
66
68
  "@percy/script": "1.1.0",
69
+ "@testing-library/cypress": "8.0.3",
70
+ "cypress": "10.6.0",
67
71
  "get-site-urls": "1.1.7",
68
72
  "markdown-spellcheck": "1.3.1",
69
73
  "parker": "0.0.10",
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  %vf-button-base {
17
- @include vf-animation(#{background-color, border-color}, snap, in);
17
+ @include vf-transition(#{background-color, border-color}, snap, in);
18
18
  @include vf-focus;
19
19
 
20
20
  border-radius: $border-radius;
@@ -64,13 +64,7 @@ $application-layout--side-nav-width-expanded: 15rem !default;
64
64
  // Navigation panel/drawer
65
65
  // -------------------------
66
66
  .l-navigation {
67
- @include vf-animation(
68
- $property: (
69
- transform,
70
- box-shadow,
71
- ),
72
- $duration: fast
73
- );
67
+ @include vf-transition($property: #{transform, box-shadow}, $duration: fast);
74
68
 
75
69
  bottom: 0;
76
70
  box-shadow: $panel-drop-shadow;
@@ -117,13 +111,7 @@ $application-layout--side-nav-width-expanded: 15rem !default;
117
111
  }
118
112
 
119
113
  .l-navigation {
120
- @include vf-animation(
121
- $property: (
122
- width,
123
- box-shadow,
124
- ),
125
- $duration: fast
126
- );
114
+ @include vf-transition($property: #{width, box-shadow}, $duration: fast);
127
115
 
128
116
  box-shadow: $panel-drop-shadow-transparent;
129
117
  overflow: hidden;
@@ -182,7 +170,7 @@ $application-layout--side-nav-width-expanded: 15rem !default;
182
170
  %vf-application-layout--faded-when-collapsed {
183
171
  // when app navigation panel is collapsed, fade out unnecessary elements
184
172
  @include vf-application-layout--when-collapsed() {
185
- @include vf-animation($property: opacity, $duration: snap);
173
+ @include vf-transition($property: opacity, $duration: snap);
186
174
 
187
175
  opacity: 0;
188
176
  }
@@ -246,13 +234,7 @@ $application-layout--side-nav-width-expanded: 15rem !default;
246
234
  }
247
235
 
248
236
  .l-aside {
249
- @include vf-animation(
250
- $property: (
251
- transform,
252
- box-shadow,
253
- ),
254
- $duration: snap
255
- );
237
+ @include vf-transition($property: #{transform, box-shadow}, $duration: snap);
256
238
 
257
239
  box-shadow: $panel-drop-shadow;
258
240
  grid-area: main;
@@ -28,13 +28,12 @@
28
28
  padding-right: $sph--large;
29
29
  position: relative;
30
30
  text-align: left;
31
- transition-duration: 0s;
32
31
  width: 100%;
33
32
  z-index: 2;
34
33
 
35
34
  &::before {
36
35
  @include vf-icon-chevron($color-mid-dark);
37
- @include vf-animation($property: transform, $duration: fast);
36
+ @include vf-transition($property: transform, $duration: fast);
38
37
  @extend %icon;
39
38
 
40
39
  content: '';
@@ -49,12 +48,15 @@
49
48
  &:hover {
50
49
  background-color: $colors--light-theme--background-hover;
51
50
  }
51
+ @include vf-transition(#{background-color, border-color});
52
52
  }
53
53
 
54
54
  &[aria-expanded='false'] {
55
55
  &::before {
56
56
  transform: rotate(-90deg);
57
57
  }
58
+
59
+ @include vf-transition(#{background-color, border-color});
58
60
  }
59
61
  }
60
62
 
@@ -88,11 +90,22 @@
88
90
  .p-accordion__panel {
89
91
  margin: 0;
90
92
  overflow: auto; // include child margins into its height
91
- padding-left: $sph--large + $icon-size + $sph--large * 2;
93
+ padding-left: $icon-size + $sph--large * 2;
92
94
 
95
+ @include vf-transition(#{transform, opacity}, fast);
93
96
  // Hides panel content
94
97
  &[aria-hidden='true'] {
95
- display: none;
98
+ height: 0;
99
+ opacity: 0;
100
+ transform: translate3d(0, -0.5rem, 0);
101
+ visibility: hidden;
102
+ }
103
+
104
+ &[aria-hidden='false'] {
105
+ height: auto;
106
+ opacity: 1;
107
+ transform: translate3d(0, 0, 0);
108
+ visibility: visible;
96
109
  }
97
110
 
98
111
  &.has-tick-elements {
@@ -4,7 +4,7 @@
4
4
  @mixin vf-p-chip {
5
5
  %vf-chip {
6
6
  @extend %small-text;
7
- @include vf-animation(#{background-color, border-color}, snap, out);
7
+ @include vf-transition(#{background-color, border-color}, snap, out);
8
8
  @include vf-focus;
9
9
 
10
10
  align-items: baseline;
@@ -89,7 +89,7 @@
89
89
  // In cases where contextual menu toggle is a button, we do not want it to
90
90
  // have a margin, but since it is never the last child in this pattern,
91
91
  // so we need to remove the margin.
92
- // https://github.com/canonical-web-and-design/vanilla-framework/pull/3584
92
+ // https://github.com/canonical/vanilla-framework/pull/3584
93
93
  margin-right: 0;
94
94
 
95
95
  &[aria-expanded='true'] .p-contextual-menu__indicator {
@@ -17,7 +17,7 @@
17
17
  &::before,
18
18
  &::after {
19
19
  $properties: #{background-color, border-color};
20
- @include vf-animation($properties);
20
+ @include vf-transition($properties);
21
21
 
22
22
  position: absolute;
23
23
  }
@@ -16,7 +16,7 @@
16
16
 
17
17
  @mixin vf-p-grid {
18
18
  // FIXME: this should be removed from framework SCSS
19
- // (see https://github.com/canonical-web-and-design/vanilla-framework/issues/3199)
19
+ // (see https://github.com/canonical/vanilla-framework/issues/3199)
20
20
  .grid-demo [class*='#{$grid-column-prefix}'] {
21
21
  background: transparentize($color-negative, 0.9);
22
22
  margin-bottom: $spv--small;
@@ -291,12 +291,6 @@ $list-status-icon-nudge: 0.3rem; // 0.3rem seems to be a magic number that posit
291
291
  }
292
292
  }
293
293
 
294
- .p-stepped-list--detailed .p-stepped-list__title + .p-stepped-list__content {
295
- @media (min-width: $threshold-6-12-col) {
296
- margin-left: 0;
297
- }
298
- }
299
-
300
294
  @for $i from 6 through 1 {
301
295
  // Bullet sizes for each heading level
302
296
  $bullet-width: map-get($line-heights, default-text);
@@ -307,6 +301,7 @@ $list-status-icon-nudge: 0.3rem; // 0.3rem seems to be a magic number that posit
307
301
  $bullet-width-mobile: map-get($line-heights, h#{$i}-mobile);
308
302
  }
309
303
 
304
+ .p-heading--#{$i}.p-stepped-list__title,
310
305
  h#{$i}.p-stepped-list__title {
311
306
  padding-left: $bullet-width-mobile + $sph--large;
312
307
 
@@ -324,6 +319,7 @@ $list-status-icon-nudge: 0.3rem; // 0.3rem seems to be a magic number that posit
324
319
  }
325
320
  }
326
321
 
322
+ .p-heading--#{$i}.p-stepped-list__title + .p-stepped-list__content,
327
323
  h#{$i}.p-stepped-list__title + .p-stepped-list__content {
328
324
  margin-left: $bullet-width-mobile + $sph--large;
329
325
 
@@ -332,6 +328,12 @@ $list-status-icon-nudge: 0.3rem; // 0.3rem seems to be a magic number that posit
332
328
  }
333
329
  }
334
330
  }
331
+
332
+ .p-stepped-list--detailed .p-stepped-list__title + .p-stepped-list__content {
333
+ @media (min-width: $threshold-6-12-col) {
334
+ margin-left: 0;
335
+ }
336
+ }
335
337
  }
336
338
 
337
339
  @mixin vf-p-stepped-list-detailed {
@@ -57,7 +57,7 @@ $spv-navigation-logo: 0.3125rem;
57
57
  $properties: #{background-color, color, opacity};
58
58
  @extend %navigation-link-responsive-padding-horizontal;
59
59
  @extend %navigation-link-responsive-padding-vertical;
60
- @include vf-animation($properties, snap);
60
+ @include vf-transition($properties, snap);
61
61
  @include vf-focus;
62
62
 
63
63
  // override button styles
@@ -443,7 +443,7 @@ $spv-navigation-logo: 0.3125rem;
443
443
  }
444
444
 
445
445
  .p-navigation__search-overlay {
446
- @include vf-animation(opacity, snap);
446
+ @include vf-transition(opacity, snap);
447
447
 
448
448
  background-color: $colors--light-theme--background-overlay;
449
449
  display: block;
@@ -70,7 +70,7 @@
70
70
  }
71
71
 
72
72
  .p-search-and-filter__panel {
73
- @include vf-animation(opacity, fast);
73
+ @include vf-transition(opacity, fast);
74
74
 
75
75
  background: $color-x-light;
76
76
  border-radius: $border-radius;
@@ -0,0 +1,113 @@
1
+ @import 'settings';
2
+
3
+ @mixin vf-p-side-navigation-expandable {
4
+ .p-side-navigation__item,
5
+ .p-side-navigation__item--title {
6
+ // position relative for the absolutely positioned `.p-side-navigation__expand` button
7
+ position: relative;
8
+ }
9
+ .p-side-navigation__link.is-expandable,
10
+ .p-side-navigation__text.is-expandable {
11
+ // extra padding to accomodate for `.p-side-navigation__expand` button
12
+ padding-right: 3rem;
13
+ }
14
+
15
+ .p-side-navigation__expand {
16
+ @include vf-button-base;
17
+ background: none;
18
+ border: 0;
19
+ border-radius: 0;
20
+ font-size: inherit;
21
+ line-height: inherit;
22
+ margin: 0;
23
+ padding-bottom: $spv--x-small;
24
+ padding-top: $spv--x-small;
25
+ position: absolute;
26
+ right: 0;
27
+ top: 0;
28
+
29
+ &::before {
30
+ @extend %icon;
31
+ @include vf-icon-chevron;
32
+ content: '';
33
+ transform: rotate(-90deg);
34
+ transition: transform 100ms;
35
+ }
36
+ }
37
+
38
+ .p-side-navigation__expand[aria-expanded='true']::before {
39
+ transform: rotate(0deg);
40
+ }
41
+
42
+ // transition
43
+ .p-side-navigation__list {
44
+ @include vf-animation(#{transform, opacity}, fast);
45
+ }
46
+ .p-side-navigation__expand[aria-expanded='false'] + .p-side-navigation__list {
47
+ height: 0;
48
+ opacity: 0;
49
+ transform: translate3d(0, -0.5rem, 0);
50
+ // disable transition on close
51
+ transition-duration: 0s;
52
+ visibility: hidden;
53
+ }
54
+
55
+ .p-side-navigation__expand[aria-expanded='true'] + .p-side-navigation__list {
56
+ height: auto;
57
+ opacity: 1;
58
+ transform: translate3d(0, 0, 0);
59
+ visibility: visible;
60
+ }
61
+
62
+ // Theming for the expandable variant
63
+ @if ($theme-default-p-side-navigation == 'dark') {
64
+ .p-side-navigation,
65
+ [class*='p-side-navigation--'] {
66
+ @include vf-side-navigation-expandable-theme-dark;
67
+
68
+ &.is-light {
69
+ @include vf-side-navigation-expandable-theme-light;
70
+ }
71
+ }
72
+ } @else {
73
+ .p-side-navigation,
74
+ [class*='p-side-navigation--'] {
75
+ @include vf-side-navigation-expandable-theme-light;
76
+
77
+ &.is-dark {
78
+ @include vf-side-navigation-expandable-theme-dark;
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ @mixin vf-side-navigation-expandable-theme($color-sidenav-text-active, $color-sidenav-item-background-hover, $color-sidenav-toggle-icon) {
85
+ .p-side-navigation__expand {
86
+ background-color: inherit;
87
+ &::before {
88
+ @include vf-icon-chevron($color-sidenav-toggle-icon);
89
+ }
90
+
91
+ &:hover {
92
+ background: $color-sidenav-item-background-hover;
93
+ color: $color-sidenav-text-active;
94
+ }
95
+ }
96
+ }
97
+
98
+ @mixin vf-side-navigation-expandable-theme-light {
99
+ @include vf-side-navigation-expandable-theme(
100
+ $color-sidenav-text-active: $colors--light-theme--text-default,
101
+ $color-sidenav-item-background-hover: $colors--light-theme--background-hover,
102
+ $color-sidenav-toggle-icon: $colors--light-theme--text-inactive
103
+ );
104
+ }
105
+
106
+ @mixin vf-side-navigation-expandable-theme-dark {
107
+ @include vf-side-navigation-expandable-theme(
108
+ $color-sidenav-text-active: $colors--dark-theme--text-default,
109
+ $color-sidenav-item-background-hover: $colors--dark-theme--background-hover,
110
+ // color of toggle icon - needed because of lack of rgba support in icon mixin
111
+ $color-sidenav-toggle-icon: #999
112
+ );
113
+ }
@@ -143,7 +143,7 @@
143
143
  }
144
144
 
145
145
  .p-side-navigation__overlay {
146
- @include vf-animation(opacity);
146
+ @include vf-transition(opacity);
147
147
 
148
148
  bottom: 0;
149
149
  left: 0;
@@ -47,7 +47,7 @@ $knob-size: $sp-unit * 2;
47
47
  &::before {
48
48
  @extend %vf-has-round-corners;
49
49
  @extend %vf-has-box-shadow;
50
- @include vf-animation($duration: slow);
50
+ @include vf-transition($duration: slow);
51
51
 
52
52
  background: $color-x-light;
53
53
  border: 1px solid $color-mid-dark;
@@ -55,7 +55,7 @@
55
55
 
56
56
  &::before {
57
57
  @extend %vf-pseudo-border;
58
- @include vf-animation(#{background-color, border-color}, snap, in);
58
+ @include vf-transition(#{background-color, border-color}, snap, in);
59
59
 
60
60
  bottom: 0;
61
61
  z-index: 1;
@@ -12,8 +12,16 @@ $animation-easing: (
12
12
  in: cubic-bezier(0.55, 0.055, 0.675, 0.19),
13
13
  );
14
14
 
15
- @mixin vf-animation($property: all, $duration: brisk, $easing: out) {
15
+ @mixin vf-transition($property: all, $duration: brisk, $easing: out) {
16
+ @if (type-of($property) != string) {
17
+ @error "vf-transition $property must be a string";
18
+ }
16
19
  transition-duration: map-get($animation-duration, $duration);
17
- transition-property: $property;
20
+ transition-property: unquote($property);
18
21
  transition-timing-function: map-get($animation-easing, $easing);
19
22
  }
23
+
24
+ // DEPRECATED: vf-animation mixin is deprecated and will be removed in future version of Vanilla, please use vf-transition instead
25
+ @mixin vf-animation($args...) {
26
+ @include vf-transition($args...);
27
+ }
@@ -38,6 +38,7 @@
38
38
  @import 'patterns_search-box';
39
39
  @import 'patterns_separator';
40
40
  @import 'patterns_side-navigation';
41
+ @import 'patterns_side-navigation-expandable';
41
42
  @import 'patterns_slider';
42
43
  @import 'patterns_status-label';
43
44
  @import 'patterns_strip';
@@ -121,6 +122,7 @@
121
122
  @include vf-p-segmented-control;
122
123
  @include vf-p-separator;
123
124
  @include vf-p-side-navigation;
125
+ @include vf-p-side-navigation-expandable;
124
126
  @include vf-p-slider;
125
127
  @include vf-p-status-label;
126
128
  @include vf-p-strip;