mp-design-system 0.6.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/dist/build/js/app.js +6 -4
  2. package/dist/build/js/app.js.map +1 -1
  3. package/dist/build/scss/library.css +1 -1
  4. package/dist/build/scss/library.css.map +1 -1
  5. package/dist/build/scss/main.css +1 -1
  6. package/dist/build/scss/main.css.map +1 -1
  7. package/package.json +1 -1
  8. package/src/_includes/components/campaign/campaign.config.js +3 -3
  9. package/src/_includes/components/card/card.scss +4 -14
  10. package/src/_includes/components/comparison-table/comparison-table.scss +5 -0
  11. package/src/_includes/components/industry-card/industry-card.njk +2 -2
  12. package/src/_includes/components/industry-card/industry-card.scss +4 -4
  13. package/src/_includes/components/meta-box/meta-box.scss +5 -1
  14. package/src/_includes/components/table/table.scss +4 -0
  15. package/src/_includes/components/usp/usp.scss +2 -7
  16. package/src/_includes/includes/related-events.njk +1 -1
  17. package/src/_includes/includes/resources.njk +1 -1
  18. package/src/_includes/layout.njk +28 -4
  19. package/src/assets/js/app.js +2 -0
  20. package/src/assets/js/imports/scrollbar-width.js +15 -0
  21. package/src/assets/js/imports/utilities.js +10 -0
  22. package/src/assets/scss/components/gallery.scss +16 -18
  23. package/src/assets/scss/library.scss +6 -2
  24. package/src/assets/scss/objects/grid.scss +0 -1
  25. package/src/assets/scss/tools/breakout.scss +2 -0
  26. package/src/assets/scss/utilities/display.scss +6 -4
  27. package/src/assets/scss/utilities/hr.scss +4 -0
  28. package/src/assets/scss/utilities/index.scss +4 -0
  29. package/src/components/utilities.md +47 -4
  30. package/src/patterns/grid-of-cards.njk +57 -21
  31. package/src/prototype/index.njk +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-design-system",
3
- "version": "0.6.2",
3
+ "version": "0.7.3",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -24,19 +24,19 @@ module.exports = {
24
24
  {
25
25
  title: 'Petrol',
26
26
  context: {
27
- classes: 'c-campaign__petrol'
27
+ classes: 'c-campaign--petrol'
28
28
  }
29
29
  },
30
30
  {
31
31
  title: 'Blue',
32
32
  context: {
33
- classes: 'c-campaign__blue'
33
+ classes: 'c-campaign--blue'
34
34
  }
35
35
  },
36
36
  {
37
37
  title: 'Orange',
38
38
  context: {
39
- classes: 'c-campaign__orange'
39
+ classes: 'c-campaign--orange'
40
40
  }
41
41
  }
42
42
  ],
@@ -170,20 +170,6 @@
170
170
  }
171
171
  }
172
172
 
173
- // &--fixed-aspect figure {
174
- // height: 0;
175
- // padding-bottom: 62.5%;
176
- // aspect-ratio: 16/10;
177
- // position: relative;
178
- // }
179
- // &--image-margin figure {
180
- // @include margin("s-m", "s-m", 0, "s-m");
181
- // }
182
-
183
- &--layout-single &__figure {
184
- @extend .u-16\/9;
185
- }
186
-
187
173
  &__primary {
188
174
  @include flow("s");
189
175
  }
@@ -418,3 +404,7 @@
418
404
  @include gap("s-l");
419
405
  }
420
406
  }
407
+
408
+ // IE11 fix
409
+ // This forces IE11 to use display:block instead of flex for single-column cards
410
+ _:-ms-fullscreen, :root .c-card, :root .c-card--layout-single .c-card__wrapper { display:block; }
@@ -52,6 +52,11 @@
52
52
  }
53
53
  }
54
54
 
55
+ thead img {
56
+ @include space('max-height', '3xl');
57
+ object-fit: contain;
58
+ }
59
+
55
60
  }
56
61
 
57
62
  @media only screen and (min-width: 640px) {
@@ -1,7 +1,7 @@
1
1
  <article class="mp c-industry-card">
2
2
  <a class="c-industry-card__link u-flow--xs" href="{{ params.link }}">
3
- <figure class="c-industry-card__image u-16/9">
4
- <img class="u-fill" src="{{ params.image.src }}" alt="{{ params.image.alt or params.title }}" />
3
+ <figure class="c-industry-card__image">
4
+ <img class="u-2/1" src="{{ params.image.src }}" alt="{{ params.image.alt or params.title }}" />
5
5
  </figure>
6
6
  <h3 class="c-h c-h--reset">{{ params.title }}</h3>
7
7
  </a>
@@ -5,11 +5,11 @@
5
5
  display: block;
6
6
  }
7
7
 
8
- &__image {
9
- @extend .u-16\/9
10
- }
11
-
12
8
  &:hover .c-h--reset {
13
9
  text-decoration: underline;
14
10
  }
11
+
12
+ img {
13
+ width: 100%;
14
+ }
15
15
  }
@@ -3,4 +3,8 @@
3
3
  @include padding('s-m');
4
4
  @include step(-1);
5
5
  @include flow('s');
6
- }
6
+
7
+ .u-wrap--fields {
8
+ @include padding-right(0)
9
+ }
10
+ }
@@ -77,6 +77,10 @@
77
77
  color: inherit;
78
78
  font-weight: weight();
79
79
  }
80
+
81
+ tbody td:nth-child(n+2) {
82
+ text-align: center;
83
+ }
80
84
  }
81
85
 
82
86
  @media (min-width: 30em) {
@@ -2,9 +2,7 @@
2
2
  @include padding('s-m');
3
3
  border: 1px solid;
4
4
  border-image-slice: 1;
5
- border-image-source: linear-gradient( to right,
6
- rgba(color('blue'), 0.5),
7
- rgba(color('green'), 0.5));
5
+ border-image-source: linear-gradient(to right, rgba(color('blue'),0.5), rgba(color('green'),0.5));
8
6
  position: relative;
9
7
 
10
8
  &__title {
@@ -12,10 +10,7 @@
12
10
  color: color('petrol');
13
11
 
14
12
  @supports(-webkit-text-fill-color:transparent) {
15
- background-image: -webkit-gradient(linear,
16
- 0% 0%,100% 100%,
17
- from(color('petrol')),
18
- to(color('blue')));
13
+ background-image: linear-gradient(to right, color('petrol'), color('blue') );
19
14
  -webkit-background-clip: text;
20
15
  -webkit-text-fill-color: transparent;
21
16
  display: inline-block;
@@ -3,7 +3,7 @@
3
3
  <aside class="c-slat c-slat--grey c-slat--padded">
4
4
  <div class="u-wrap u-flow">
5
5
  <h3 class="c-h c-h--upper">Related events</h3>
6
- <div class="o-grid o-grid--of-three">
6
+ <div class="o-grid o-grid--of-three o-grid--swipeable">
7
7
  {{ card({
8
8
  theme: {
9
9
  layout: 'single',
@@ -3,7 +3,7 @@
3
3
  <aside class="mp c-slat c-slat--grey c-slat--padded">
4
4
  <div class="u-wrap u-flow--xl">
5
5
  <h2 class="c-h c-h--step-3">Related resources</h2>
6
- <div class="o-grid o-grid--of-three">
6
+ <div class="o-grid o-grid--of-three o-grid--swipeable">
7
7
  {{ card({
8
8
  theme: {
9
9
  layout: 'single',
@@ -14,10 +14,31 @@
14
14
  <meta property="og:image:alt" content="{{ config.name }}" />
15
15
  <meta name="twitter:image" content="{{ config.openGraphImage }}" />
16
16
  <link rel="preconnect" href="https://fonts.gstatic.com">
17
- <script>if(document.documentElement){
18
- document.documentElement.classList.add('has-js');
19
- document.documentElement.classList.remove('no-js');
20
- }</script>
17
+ <script>
18
+ if(document.documentElement){
19
+ document.documentElement.classList.add('has-js');
20
+ document.documentElement.classList.remove('no-js');
21
+ }
22
+ // Calculate the height of the sidebar so it doesn't cause double scrollbars
23
+ function debounce(func, wait, immediate) {
24
+ var timeout;
25
+ return function() {
26
+ var context = this, args = arguments;
27
+ var later = function() {
28
+ timeout = null;
29
+ if (!immediate) func.apply(context, args);
30
+ };
31
+ var callNow = immediate && !timeout;
32
+ clearTimeout(timeout);
33
+ timeout = setTimeout(later, wait);
34
+ if (callNow) func.apply(context, args);
35
+ };
36
+ };
37
+ var resizeSidebar = debounce(function() {
38
+ var headerHeight = document.querySelector('.c-library__header').offsetHeight + 'px';
39
+ document.documentElement.style.setProperty('--headerHeight', headerHeight)
40
+ }, 250);
41
+ </script>
21
42
  <link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon-32x32.png">
22
43
  <link rel="stylesheet" href="/build/scss/main.css" />
23
44
  <script>window.MSInputMethodContext && document.documentMode && document.write('<script src="https://cdn.jsdelivr.net/gh/nuxodin/ie11CustomProperties@4.1.0/ie11CustomProperties.min.js"><\/script>');</script>
@@ -30,12 +51,15 @@
30
51
  <script src="/build/js/app.js"></script>
31
52
  <script>
32
53
  (function() {
54
+ // Prevent empty links from jumping to the top of page when clicked
33
55
  var links = document.querySelectorAll('a[href=""],a[href="#"]');
34
56
  for(var i = 0; links.length > i; i++) {
35
57
  links[i].addEventListener('click', function(event) {
36
58
  event.preventDefault();
37
59
  })
38
60
  }
61
+ window.addEventListener('resize', resizeSidebar);
62
+ resizeSidebar();
39
63
  })();
40
64
  </script>
41
65
  </body>
@@ -5,6 +5,7 @@ import Gallery from './imports/gallery';
5
5
  import HeroPattern from './imports/hero-pattern';
6
6
  import ResponsiveTable from './imports/responsive-table';
7
7
  import ScrollSpy from './imports/scroll-spy';
8
+ import ScrollbarWidth from './imports/scrollbar-width';
8
9
  import Tabs from './imports/tabs';
9
10
 
10
11
  (() => {
@@ -23,4 +24,5 @@ import Tabs from './imports/tabs';
23
24
  Tabs();
24
25
  ScrollSpy();
25
26
  ResponsiveTable();
27
+ ScrollbarWidth();
26
28
  })();
@@ -0,0 +1,15 @@
1
+ import { debounce } from './utilities';
2
+
3
+ function ScrollbarWidth() {
4
+ setScrollbarWidth();
5
+ window.addEventListener('resize', debounce(setScrollbarWidth, 250));
6
+ }
7
+
8
+ function setScrollbarWidth() {
9
+ document.documentElement.style.setProperty(
10
+ '--scrollbarWidth',
11
+ window.innerWidth - document.body.clientWidth + 'px'
12
+ );
13
+ }
14
+
15
+ export default ScrollbarWidth;
@@ -15,6 +15,16 @@ export function userPrefersReducedMotion() {
15
15
  return prefersReducedMotion;
16
16
  }
17
17
 
18
+ export const debounce = (func, limit) => {
19
+ let wait = false;
20
+ return () => {
21
+ if (wait) return;
22
+ func();
23
+ wait = true;
24
+ setTimeout(() => wait = false, limit);
25
+ }
26
+ }
27
+
18
28
  export const lerp = (x, y, a) => x * (1 - a) + y * a;
19
29
  export const clamp = (a, min = 0, max = 1) => Math.min(max, Math.max(min, a));
20
30
  export const invlerp = (x, y, a) => clamp((a - x) / (y - x));
@@ -10,8 +10,13 @@
10
10
  width: 100%;
11
11
 
12
12
  img {
13
- margin: 0 auto;
14
13
  display: block;
14
+ margin: 0 auto;
15
+
16
+ @supports (object-fit:contain) {
17
+ max-height: 500px;
18
+ object-fit: contain;
19
+ }
15
20
  }
16
21
 
17
22
  &:not(.active) {
@@ -24,29 +29,22 @@
24
29
  @include padding-bottom('s');
25
30
  display: flex;
26
31
  flex-direction: row;
27
- flex-wrap: nowrap;
28
- -webkit-overflow-scrolling: touch;
29
- scroll-behavior: smooth;
30
- scroll-snap-type: x mandatory;
31
- overflow-x: auto;
32
+ flex-wrap: wrap;
33
+ gap: 2%;
34
+ gap: max(8px, 2%);
32
35
 
33
36
  & > * {
34
37
  background: color('grey', 'step-3');
35
- max-width: 25%;
36
- max-height: var(--space-2xl);
37
- min-width: var(--space-l);
38
- min-height: var(--space-l);
39
- width: auto;
40
- scroll-snap-align: start;
41
-
42
- & + * {
43
- margin-left: var(--space-xs-s);
44
- }
38
+ @include space('min-height', 'l');
39
+ @include space('max-height', '2xl');
40
+ @include space('min-width', 'l');
41
+ max-width: 10.75%;
45
42
 
46
43
  img {
47
- min-height: 100%;
48
- opacity: 0.9;
44
+ height: 100%;
45
+ opacity: 0.8;
49
46
  object-fit: cover;
47
+ width: 100%;
50
48
  }
51
49
 
52
50
  &.active img {
@@ -71,7 +71,7 @@
71
71
  @media only screen and (min-width: 600px) {
72
72
  &--components &__body > * {
73
73
  overflow-y: scroll;
74
- height: calc(100vh - 115px);
74
+ height: calc( 100vh - var(--headerHeight) - 1px );
75
75
  }
76
76
  }
77
77
 
@@ -212,7 +212,11 @@
212
212
  }
213
213
 
214
214
  &__main {
215
- overflow-y: scroll;
215
+ overflow-y: auto;
216
+
217
+ @media only screen and (min-width: 600px) {
218
+ overflow-y: scroll;
219
+ }
216
220
  }
217
221
 
218
222
  &__frame {
@@ -26,7 +26,6 @@ $grid-gutter-width: 36;
26
26
  display: flex;
27
27
  flex-wrap: wrap;
28
28
  justify-content: stretch;
29
- align-items: flex-start;
30
29
  margin-bottom: calc(-1 * #{space-unit()});
31
30
  margin-bottom: calc(-1 * var(--gutter));
32
31
  width: 100%;
@@ -3,9 +3,11 @@
3
3
 
4
4
  @mixin breakout($pad: 0) {
5
5
  left: 50%;
6
+ left: calc( 50% + var(--scrollbarWidth)/2.0001 );
6
7
  position: relative;
7
8
  transform: translateX(-50vw);
8
9
  width: 100vw;
10
+ width: calc( 100vw - var(--scrollbarWidth) );
9
11
  padding-left: safe-space($pad);
10
12
  padding-right: safe-space($pad);
11
13
  }
@@ -109,10 +109,12 @@
109
109
  @include gap("s-l");
110
110
  }
111
111
 
112
- .u-16\/9 {
113
- height: 0;
114
- padding-bottom: 56.25%;
115
- position: relative;
112
+ @supports (object-fit: cover) {
113
+ .u-2\/1 {
114
+ aspect-ratio: 2 / 1;
115
+ object-fit: cover;
116
+ object-position: 75% 50%;
117
+ }
116
118
  }
117
119
 
118
120
  @media (min-width: 640px) {
@@ -12,4 +12,8 @@
12
12
 
13
13
  .u-border {
14
14
  border: 1px solid color('petrol', 'step-2');
15
+ }
16
+
17
+ .o-prose hr {
18
+ @extend .u-hr
15
19
  }
@@ -1,3 +1,5 @@
1
+ html body {
2
+
1
3
  @import './typography.scss';
2
4
  @import './link.scss';
3
5
  @import './colour.scss';
@@ -9,3 +11,5 @@
9
11
  @import './hr.scss';
10
12
  @import './ellipsis.scss';
11
13
  @import './scroll-shadows.scss';
14
+
15
+ }
@@ -63,17 +63,60 @@ More typography utility classes are documented on the [typography page](/compone
63
63
  ```
64
64
 
65
65
  ```html
66
- <div class="u-sticky">Sticky positioning at the top of the viewport</div>
66
+ <p class="u-sticky">This will "stick" to the top of the screen while scrolling</p>
67
67
  ```
68
68
 
69
69
  ```html
70
- <div class="u-sticky--gutter">Sticky positioning with gutter spacing</div>
70
+ <div class="u-sticky--gutter">Sticky positioning, with a gap above</div>
71
71
  ```
72
72
 
73
73
  ```html
74
74
  <div class="u-split">
75
- <h2>Webinars and events</h2>
76
- <a href>View all</a>
75
+ <p>Split: aligned left</p>
76
+ <a class="u-link">Aligned right</a>
77
77
  </div>
78
78
  The two child items will be aligned in a horizontal row
79
+ ```
80
+ <div class="u-split u-pad-s u-border">
81
+ <p>Split: aligned left</p>
82
+ <a class="u-link">Aligned right</a>
83
+ </div>
84
+
85
+ ## Padding and margins
86
+
87
+ More padding and margin utility classes are documented on the [space page](/components/space).
88
+
89
+ #### Syntax:
90
+ `u`-`(pad or margin)`-`(optional direction)`-`(size)`-`(optional flex size)`
91
+
92
+ Sizes | Directions
93
+ ------|-----------
94
+ 3xs | top
95
+ 2xs | bottom
96
+ xs | left
97
+ s | right
98
+ m | y
99
+ l | x
100
+ xl |
101
+ 2xl |
102
+ 3xl |
103
+ 4xl |
104
+
105
+ N.B. Not all permutations are available in the existing CSS, as that would amount to over 4800 extra lines of code. Currently we've only implemented a handful - but we can add more as needed.
106
+
107
+ ```html
108
+ <div class="u-pad-s">Small padding on all sides</div>
109
+ ```
110
+
111
+ ```html
112
+ <div class="u-margin-y-xl">Extra large margin on top and bottom</div>
113
+ ```
114
+
115
+ ```html
116
+ <div class="u-margin-left-m">Medium margin on left side only</div>
117
+ ```
118
+
119
+ ```html
120
+ <div class="u-pad-x-s-xl">Flexible (small to XL) padding on left and right</div>
121
+ Grows from small padding on small screens, to xl padding on large screens
79
122
  ```
@@ -6,25 +6,61 @@ layout: patterns-page
6
6
  {% from "components/card/macro.njk" import card %}
7
7
 
8
8
  <div class="o-grid o-grid--of-three o-grid--swipeable">
9
- {% for _ in [0, 1, 2] %}
10
- {{ card({
11
- theme: {
12
- layout: 'single',
13
- size: 'medium',
14
- name: 'alt'
15
- },
16
- image: {
17
- src: '/static/img/blog-page-image-1.jpg',
18
- alt: ''
19
- },
20
- header: {
21
- title: 'Mixing it with the Mastersizer!'
22
- },
23
- body: {
24
- content: '<p>At a major leading manufacturer of mixing equipment, the Mastersizer particle size analyzer is one of the analytical instruments used by customers during process simulations.</p>'
25
- },
26
- link: '/prototype/blog-post',
27
- tag: 'News'
28
- }) }}
29
- {% endfor %}
9
+ {{ card({
10
+ theme: {
11
+ layout: 'single',
12
+ size: 'medium',
13
+ name: 'alt'
14
+ },
15
+ image: {
16
+ src: '/static/img/blog-page-image-1.jpg',
17
+ alt: ''
18
+ },
19
+ header: {
20
+ title: 'Mixing it with the Mastersizer!'
21
+ },
22
+ body: {
23
+ content: '<p>At a major leading manufacturer of mixing equipment, the Mastersizer particle size analyzer is one of the analytical instruments used by customers during process simulations.</p>'
24
+ },
25
+ link: '/prototype/blog-post',
26
+ tag: 'News'
27
+ }) }}
28
+ {{ card({
29
+ theme: {
30
+ layout: 'single',
31
+ size: 'medium',
32
+ name: 'alt'
33
+ },
34
+ image: {
35
+ src: '/static/img/blog-page-image-1.jpg',
36
+ alt: ''
37
+ },
38
+ header: {
39
+ title: 'GPC/SEC standards: making them last'
40
+ },
41
+ body: {
42
+ content: '<p>Earlier this year I highlighted the different types of GPC/SEC standards available and where to find them on our eStore. In this post, I’m going to share some tips and tricks about preparing your standards and making them last. But first, what standard should you be using? In my previous post, I discussed how the […]</p>'
43
+ },
44
+ link: '/prototype/blog-post',
45
+ tag: 'News'
46
+ }) }}
47
+ {{ card({
48
+ theme: {
49
+ layout: 'single',
50
+ size: 'medium',
51
+ name: 'alt'
52
+ },
53
+ image: {
54
+ src: '/static/img/blog-page-image-1.jpg',
55
+ alt: ''
56
+ },
57
+ header: {
58
+ title: 'Viral Vector Vaccines: A Borrowed Technology from Gene Therapy Advancements'
59
+ },
60
+ body: {
61
+ content: '<p>Advances in recombinant DNA technology, genomics, and immunology have greatly influenced the vaccine development process. The genetic manipulation of viruses makes them suitable as vectors for gene delivery, providing a novel and unique opportunity for vaccine design. Viruses survive and replicate by invading their host’s cells and hijacking their protein-making machinery. These virus particles contain […]</p>'
62
+ },
63
+ link: '/prototype/blog-post',
64
+ tag: 'News'
65
+ }) }}
30
66
  </div>
@@ -445,7 +445,7 @@ tags: prototype
445
445
  </div>
446
446
 
447
447
  <div id="tab-events" class="c-tab">
448
- <div class="o-grid o-grid--of-three">
448
+ <div class="o-grid o-grid--of-three o-grid--swipeable">
449
449
  {{ card({
450
450
  theme: {
451
451
  layout: 'single',