mp-design-system 1.2.34 → 1.2.36

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-design-system",
3
- "version": "1.2.34",
3
+ "version": "1.2.36",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm-run-all --parallel bundle:*",
@@ -44,7 +44,7 @@
44
44
  height: 100%;
45
45
  width: 100%;
46
46
  aspect-ratio: 16/9;
47
- object-fit: cover;
47
+ object-fit: contain;
48
48
  }
49
49
  }
50
50
  }
@@ -0,0 +1,5 @@
1
+ <div class="o-grid o-grid--layout o-grid--3/8 o-grid--push u-pad-m">
2
+ <aside>
3
+ {{ comp | safe }}
4
+ </aside>
5
+ </div>
@@ -50,6 +50,21 @@ module.exports = {
50
50
  colour: 'utility-blue'
51
51
  }
52
52
  },
53
+ {
54
+ title: 'Utility blue step 3',
55
+ context: {
56
+ text: 'Product range',
57
+ colour: 'utility-blue-step-3'
58
+ }
59
+ },
60
+ {
61
+ title: 'Utility blue step 3 with icon',
62
+ context: {
63
+ text: 'Product range',
64
+ colour: 'utility-blue-step-3',
65
+ icon: 'cross'
66
+ }
67
+ },
53
68
  {
54
69
  title: 'Utility orange',
55
70
  context: {
@@ -1,7 +1,24 @@
1
+ {%- from "components/icon/macro.njk" import icon -%}
2
+
1
3
  {%- set classNames = "mp c-eyebrow" -%}
2
4
 
3
5
  {%- if params.colour -%}
4
6
  {% set classNames = classNames + " c-eyebrow--" + params.colour %}
5
7
  {% endif -%}
6
8
 
7
- <span class="{{ classNames }}">{{ params.text }}</span>
9
+ {%- if params.icon -%}
10
+ <button class="{{ classNames }}">
11
+ {%- else -%}
12
+ <span class="{{ classNames }}">
13
+ {% endif -%}
14
+ {%- if params.text -%}
15
+ {{ params.text }}
16
+ {% endif -%}
17
+ {%- if params.icon -%}
18
+ {{ icon({ id: params.icon }) }}
19
+ {% endif -%}
20
+ {%- if params.icon -%}
21
+ </button>
22
+ {%- else -%}
23
+ </span>
24
+ {% endif -%}
@@ -2,38 +2,63 @@
2
2
  background-color: color('green');
3
3
  color: color('white');
4
4
  @include padding('3xs', 'xs');
5
+ border: 1px solid color('green');
5
6
  border-radius: 2em;
6
- display: inline-block;
7
+ display: inline-flex;
8
+ align-items: center;
7
9
  @include step(-1);
8
10
  letter-spacing: -.01em;
9
11
 
10
12
  &--blue {
11
13
  background-color: color('blue');
14
+ border-color: color('blue');
12
15
  }
13
16
 
14
17
  &--blue-step-2 {
15
18
  background-color: color('blue', 'step-2');
16
19
  color: color('petrol');
20
+ border-color: color('blue', 'step-2');
17
21
  }
18
22
 
19
23
  &--grey {
20
24
  background-color: color('grey');
25
+ border-color: color('grey');
21
26
  }
22
27
 
23
28
  &--petrol {
24
29
  background-color: color('petrol');
30
+ border-color: color('petrol');
25
31
  }
26
32
 
27
33
  &--red {
28
34
  background-color: color('red');
35
+ border-color: color('red');
29
36
  }
30
37
 
31
38
  &--utility-blue {
32
39
  background-color: color('utility-blue');
40
+ border-color: color('utility-blue');
41
+ }
42
+
43
+ &--utility-blue-step-3 {
44
+ background-color: color('utility-blue', 'step-3');
45
+ color: color('utility-blue');
46
+ border-color: color('utility-blue', 'step-2');
33
47
  }
34
48
 
35
49
  &--utility-orange {
36
50
  background-color: color('utility-orange', 'step-1');
37
51
  color: color('grey');
52
+ border-color: color('utility-orange', 'step-1');
53
+ }
54
+ }
55
+
56
+ button.c-eyebrow {
57
+ &--utility-blue-step-3:where(:hover, :focus) {
58
+ border-color: color('utility-blue', 'step-1');
59
+ }
60
+
61
+ svg {
62
+ @include margin-left('2xs');
38
63
  }
39
64
  }
@@ -0,0 +1,110 @@
1
+ module.exports = {
2
+ title: 'Facet',
3
+ component: {
4
+ name: 'facet'
5
+ },
6
+ figma: '',
7
+ preview: 'sidebar',
8
+ context: {
9
+ facets: [
10
+ {
11
+ id: 'products',
12
+ heading: 'Products',
13
+ options: [
14
+ {
15
+ id: 'mastersizer-3000-lab',
16
+ value: 'Mastersizer 3000+ Lab',
17
+ label: 'Mastersizer 3000+ Lab (20)',
18
+ },
19
+ {
20
+ id: 'mastersizer-3000-pro',
21
+ value: 'Mastersizer 3000+ Pro',
22
+ label: 'Mastersizer 3000+ Pro (5)',
23
+ },
24
+ {
25
+ id: 'mastersizer-3000-ultra',
26
+ value: 'Mastersizer 3000+ Ultra',
27
+ label: 'Mastersizer 3000+ Ultra (1)',
28
+ }
29
+ ]
30
+ }
31
+ ]
32
+ },
33
+ variants: [
34
+ {
35
+ title: 'Multiple',
36
+ context: {
37
+ facets: [
38
+ {
39
+ id: 'products',
40
+ heading: 'Products',
41
+ options: [
42
+ {
43
+ id: 'mastersizer-3000-lab',
44
+ value: 'Mastersizer 3000+ Lab',
45
+ label: 'Mastersizer 3000+ Lab (20)',
46
+ },
47
+ {
48
+ id: 'mastersizer-3000-pro',
49
+ value: 'Mastersizer 3000+ Pro',
50
+ label: 'Mastersizer 3000+ Pro (5)',
51
+ },
52
+ {
53
+ id: 'mastersizer-3000-ultra',
54
+ value: 'Mastersizer 3000+ Ultra',
55
+ label: 'Mastersizer 3000+ Ultra (1)',
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ id: 'technologies',
61
+ heading: 'Technologies',
62
+ options: [
63
+ {
64
+ id: 'borate-fusion',
65
+ value: 'Borate fusion',
66
+ label: 'Borate fusion (16)',
67
+ },
68
+ {
69
+ id: 'differential-scanning-calorimetry',
70
+ value: 'Differential Scanning Calorimetry (DSC)',
71
+ label: 'Differential Scanning Calorimetry (DSC) (18)',
72
+ },
73
+ {
74
+ id: 'dynamic-light-scattering',
75
+ value: 'Dynamic Light Scattering',
76
+ label: 'Dynamic Light Scattering (72)',
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ id: 'measurementTypes',
82
+ heading: 'Measurement types',
83
+ options: [
84
+ {
85
+ id: 'structure-imaging',
86
+ value: '3D structure / imaging',
87
+ label: '3D structure / imaging (2)',
88
+ },
89
+ {
90
+ id: 'binding-affinity',
91
+ value: 'Binding affinity',
92
+ label: 'Binding affinity (10)',
93
+ },
94
+ {
95
+ id: 'binding-kinetics',
96
+ value: 'Binding kinetics',
97
+ label: 'Binding kinetics (11)',
98
+ }
99
+ ]
100
+ }
101
+ ]
102
+ }
103
+ }
104
+ ],
105
+ props: [
106
+ {
107
+ table: []
108
+ }
109
+ ]
110
+ }
@@ -0,0 +1,25 @@
1
+ {% from "components/icon/macro.njk" import icon %}
2
+ {% from "components/input/macro.njk" import checkbox %}
3
+
4
+ <ul class="u-remove-bullets">
5
+ {% for facet in params.facets %}
6
+ <li class="c-facet">
7
+ <button class="c-facet__toggle" aria-expanded="false" aria-controls="{{ facet.id }}">
8
+ {{ facet.heading }}
9
+ {{ icon({ id: 'chevron-down' }) }}
10
+ </button>
11
+ <ul id="{{ facet.id }}" class="c-facet__list">
12
+ {% for option in facet.options %}
13
+ <li>
14
+ {{ checkbox({
15
+ name: facet.id,
16
+ id: option.id,
17
+ value: option.value,
18
+ label: option.label
19
+ }) }}
20
+ </li>
21
+ {% endfor %}
22
+ </ul>
23
+ </li>
24
+ {% endfor %}
25
+ </ul>
@@ -0,0 +1,47 @@
1
+ .c-facet {
2
+ border-top: 1px solid color('petrol', 'step-2');
3
+
4
+ &:last-child {
5
+ border-bottom: 1px solid color('petrol', 'step-2');
6
+ }
7
+
8
+ &__toggle {
9
+ width: 100%;
10
+ @include padding('s', 0);
11
+ display: inline-flex;
12
+ justify-content: space-between;
13
+ align-items: center;
14
+ @include step(-1);
15
+ font-weight: bold;
16
+ text-transform: uppercase;
17
+
18
+ svg {
19
+ color: color('utility-blue');
20
+ line-height: 1;
21
+ font-size: 1rem;
22
+ }
23
+ }
24
+
25
+ &__list {
26
+ @extend .u-remove-bullets, .u-flow--s;
27
+ @include padding('s');
28
+ display: none;
29
+ }
30
+
31
+ &--open {
32
+ .c-facet {
33
+ &__toggle {
34
+ color: color('utility-blue');
35
+ border-bottom: 1px solid color('petrol', 'step-2');
36
+
37
+ svg {
38
+ transform: rotate(180deg);
39
+ }
40
+ }
41
+
42
+ &__list {
43
+ display: block;
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,5 @@
1
+ {% from "components/component/component.njk" import c %}
2
+
3
+ {% macro facet(params) %}
4
+ {{ c({ name: 'facet' }, params) }}
5
+ {% endmacro %}
@@ -1,9 +1,17 @@
1
1
  {% from "components/component/component.njk" import c %}
2
2
 
3
+ {% macro checkbox(params, type = 'checkbox') %}
4
+ {{ c({ name: 'checkbox', folder: 'input' }, params) }}
5
+ {% endmacro %}
6
+
3
7
  {% macro input(params) %}
4
8
  {{ c({ name: 'input' }, params) }}
5
9
  {% endmacro %}
6
10
 
11
+ {% macro radio(params) %}
12
+ {{ c({ name: 'radio', folder: 'input' }, params) }}
13
+ {% endmacro %}
14
+
7
15
  {% macro select(params) %}
8
16
  {{ c({ name: 'select', folder: 'input' }, params) }}
9
17
  {% endmacro %}
@@ -12,14 +20,6 @@
12
20
  {{ c({ name: 'textarea', folder: 'input' }, params) }}
13
21
  {% endmacro %}
14
22
 
15
- {% macro checkbox(params, type = 'checkbox') %}
16
- {{ c({ name: 'checkbox', folder: 'input' }, params) }}
17
- {% endmacro %}
18
-
19
- {% macro radio(params) %}
20
- {{ c({ name: 'radio', folder: 'input' }, params) }}
21
- {% endmacro %}
22
-
23
23
  {% macro toggle(params, type='toggle') %}
24
24
  {{ c({ name: 'toggle', folder: 'input' }, params) }}
25
25
  {% endmacro %}
@@ -17,7 +17,7 @@ module.exports = {
17
17
  {
18
18
  title: 'Sticky on scroll',
19
19
  context: {
20
- classes: 'u-sticky',
20
+ classes: 'c-internal-nav--sticky',
21
21
  title: 'Mastersizer range',
22
22
  links: [
23
23
  { link: '#overview', label: 'Overview' },
@@ -10,12 +10,14 @@
10
10
  <li><a href="{{ item.link }}">{{ item.label }}</a></li>
11
11
  {% endfor %}
12
12
  {% if params.button %}
13
- {{ button({
14
- link: params.button.link,
15
- label: params.button.label,
16
- colour: 'green',
17
- classes: 'c-button--small'
18
- }) }}
13
+ <li>
14
+ {{ button({
15
+ link: params.button.link,
16
+ label: params.button.label,
17
+ colour: 'green',
18
+ classes: 'c-button--small'
19
+ }) }}
20
+ </li>
19
21
  {% endif %}
20
22
  </ul>
21
23
  </div>
@@ -4,8 +4,8 @@
4
4
  transition: 200ms all;
5
5
 
6
6
  &--sticky {
7
- @extend .u-sticky;
8
- top: -1;
7
+ position: sticky;
8
+ top: -1px;
9
9
  }
10
10
 
11
11
  &--stuck {
@@ -48,7 +48,7 @@
48
48
  }
49
49
 
50
50
  li {
51
- a {
51
+ a:not(.c-button) {
52
52
  @extend .u-link;
53
53
  }
54
54
  }
@@ -100,11 +100,31 @@
100
100
  name: 'MP Rubine',
101
101
  key: 'Red',
102
102
  steps: [
103
+ {
104
+ name: '-1',
105
+ hex: '9b0042',
106
+ cmyk: ''
107
+ },
103
108
  {
104
109
  name: 0,
105
110
  hex: 'ce0058',
106
111
  cmyk: '14.100.50.2',
107
112
  pantone: 'PAN Rubine Red'
113
+ },
114
+ {
115
+ name: 1,
116
+ hex: 'dc4787',
117
+ cmyk: ''
118
+ },
119
+ {
120
+ name: 2,
121
+ hex: 'f3c2d7',
122
+ cmyk: ''
123
+ },
124
+ {
125
+ name: 3,
126
+ hex: 'fbebf2',
127
+ cmyk: ''
108
128
  }
109
129
  ]
110
130
  },
@@ -114,7 +134,7 @@
114
134
  steps: [
115
135
 
116
136
  {
117
- name: "-1",
137
+ name: '-1',
118
138
  hex: '1c1c1c',
119
139
  cmyk: '00.00.00.95'
120
140
  },
@@ -177,10 +197,30 @@
177
197
  name: 'MP Utility Blue',
178
198
  key: 'Utility-Blue',
179
199
  steps: [
200
+ {
201
+ name: '-1',
202
+ hex: '004e7e',
203
+ cmyk: ''
204
+ },
180
205
  {
181
206
  name: 0,
182
207
  hex: '006daf',
183
208
  cmyk: '86.48.3.5'
209
+ },
210
+ {
211
+ name: 1,
212
+ hex: '4796c5',
213
+ cmyk: ''
214
+ },
215
+ {
216
+ name: 2,
217
+ hex: 'c2dcec',
218
+ cmyk: ''
219
+ },
220
+ {
221
+ name: 3,
222
+ hex: 'ebf3f9',
223
+ cmyk: ''
184
224
  }
185
225
  ]
186
226
  }
@@ -2,6 +2,7 @@ import Accordion from './imports/accordion';
2
2
  import Carousel from './imports/carousel';
3
3
  import ClearForm from './imports/clear-form';
4
4
  import Comparison from './imports/comparison';
5
+ import Facet from './imports/facet';
5
6
  import Gallery from './imports/gallery';
6
7
  import HeroPattern from './imports/hero-pattern';
7
8
  import HeroVideo from './imports/hero-video';
@@ -24,6 +25,7 @@ import Tabs from './imports/tabs';
24
25
  Carousel();
25
26
  ClearForm();
26
27
  Comparison();
28
+ Facet();
27
29
  Gallery();
28
30
  HeroPattern();
29
31
  HeroVideo();
@@ -0,0 +1,23 @@
1
+ function Facet() {
2
+ const facetAccordions = Array.from(document.querySelectorAll('.c-facet__toggle'));
3
+ facetAccordions.forEach(setupFacetAccordions);
4
+ }
5
+
6
+ function setupFacetAccordions(toggle) {
7
+ toggle.addEventListener('click', titleClick())
8
+ }
9
+
10
+ function titleClick() {
11
+ return (event) => {
12
+ event.preventDefault();
13
+
14
+ var toggle = event.currentTarget;
15
+ var facet = toggle.parentElement;
16
+
17
+ facet.classList.toggle('c-facet--open');
18
+ const expanded = facet.classList.contains('c-facet--open') ? 'true' : 'false';
19
+ toggle.setAttribute('aria-expanded', expanded);
20
+ }
21
+ }
22
+
23
+ export default Facet;
@@ -38,4 +38,4 @@ function InternalNav() {
38
38
  updateInternalNavHeight();
39
39
  }
40
40
 
41
- export default InternalNav;
41
+ export default InternalNav;
@@ -1,5 +1,5 @@
1
1
  function ScrollSpy() {
2
- const internalNav = document.querySelector('.c-internal-nav');
2
+ const internalNav = document.querySelector('.c-internal-nav--sticky');
3
3
  const internalNavHeight = internalNav ? internalNav.offsetHeight : 0;
4
4
 
5
5
  const spies = Array.from(document.querySelectorAll('.c-scroll-spy'));
@@ -13,6 +13,7 @@
13
13
  @import '~comp/comparison-table/comparison-table.scss';
14
14
  @import '~comp/embed/embed.scss';
15
15
  @import '~comp/eyebrow/eyebrow.scss';
16
+ @import '~comp/facet/facet.scss';
16
17
  @import '~comp/featured-article-card/featured-article-card.scss';
17
18
  @import '~comp/features-table/features-table.scss';
18
19
  @import '~comp/filter-search/filter-search.scss';
@@ -15,7 +15,7 @@ A limited set of color tints and shades are available for element backgrounds, b
15
15
 
16
16
  <div class="u-flow--l">
17
17
  {{ alert({
18
- content: "<p>This page explains how to use color on the web. For print or other uses, see the <a href='/brand/visual/colors'>Brand ➝ colors</a> page.</p>",
18
+ content: "<p>This page explains how to use color on the web. For print or other uses, see the <a href='/brand/colors'>Brand ➝ colors</a> page.</p>",
19
19
  type: "info"
20
20
  })}}
21
21
 
@@ -40,7 +40,7 @@ tagTitle: Range
40
40
  }) }}
41
41
 
42
42
  {{ internalNav({
43
- classes: 'u-sticky',
43
+ classes: 'c-internal-nav--sticky',
44
44
  title: 'Mastersizer range',
45
45
  links: [
46
46
  { link: '#overview', label: 'Overview' },