mp-design-system 0.5.14 → 0.6.2

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 (32) hide show
  1. package/dist/build/scss/library.css +1 -1
  2. package/dist/build/scss/library.css.map +1 -1
  3. package/dist/build/scss/main.css +1 -1
  4. package/dist/build/scss/main.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/_includes/components/button/button.njk +1 -9
  7. package/src/_includes/components/button/button.scss +2 -1
  8. package/src/_includes/components/campaign/campaign.scss +5 -1
  9. package/src/_includes/components/card/card.config.js +50 -48
  10. package/src/_includes/components/card/card.njk +26 -15
  11. package/src/_includes/components/card/card.scss +57 -12
  12. package/src/_includes/components/component/preview-card-example.njk +1 -1
  13. package/src/_includes/components/featured-article-card/featured-article-card.scss +1 -1
  14. package/src/_includes/components/header/header.njk +6 -4
  15. package/src/_includes/components/header/header.scss +6 -1
  16. package/src/_includes/components/product-signpost/product-signpost.njk +11 -9
  17. package/src/_includes/components/product-signpost/product-signpost.scss +1 -1
  18. package/src/_includes/components/quote/quote.scss +2 -2
  19. package/src/_includes/components/scroll-spy/scroll-spy.scss +4 -0
  20. package/src/_includes/includes/system-header.njk +1 -1
  21. package/src/_includes/includes/system-scripts.njk +13 -0
  22. package/src/assets/scss/library.scss +17 -8
  23. package/src/assets/scss/objects/grid.scss +1 -0
  24. package/src/assets/scss/tools/index.scss +2 -0
  25. package/src/assets/scss/utilities/flow.scss +3 -1
  26. package/src/components/css.md +3 -2
  27. package/src/components/utilities.md +79 -0
  28. package/src/components-pages.njk +4 -1
  29. package/src/prototype/card-test.njk +147 -0
  30. package/src/prototype/webinars-3-2-1.njk +41 -82
  31. package/src/static/svg/logo-small.svg +1 -0
  32. package/src/static/svg/logo.svg +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-design-system",
3
- "version": "0.5.14",
3
+ "version": "0.6.2",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -17,10 +17,6 @@
17
17
  {% set attrs = ' ' + params.attrs %}
18
18
  {% endif %}
19
19
 
20
- {% if params.colour == 'white' or params.colour == 'outline-white'%}
21
- <div class="u-bg-petrol-step-2 u-pad-xl">
22
- {% endif %}
23
-
24
20
  {%- if params.link -%}
25
21
  <a href="{{ params.link }}" class="{{ classNames }}" {{ attrs }}>
26
22
  {%- elseif params.type == 'span' -%}
@@ -39,8 +35,4 @@
39
35
  </span>
40
36
  {%- else -%}
41
37
  </button>
42
- {%- endif -%}
43
-
44
- {% if params.colour == 'white' or params.colour == 'outline-white'%}
45
- </div>
46
- {% endif %}
38
+ {%- endif -%}
@@ -11,7 +11,8 @@
11
11
  font-family: $font-stack;
12
12
  }
13
13
 
14
- .mp.c-button {
14
+ .mp.c-button,
15
+ .c-button {
15
16
  // Reset
16
17
  border-radius: 0;
17
18
  background: transparent;
@@ -22,6 +22,10 @@
22
22
 
23
23
  &__image {
24
24
  z-index: 0;
25
+
26
+ img {
27
+ width: 100%;
28
+ }
25
29
  }
26
30
 
27
31
  &.mp .u-link {
@@ -64,7 +68,7 @@
64
68
  }
65
69
  }
66
70
 
67
- @media (min-width:50em) {
71
+ @media (min-width:35em) {
68
72
  display: flex;
69
73
 
70
74
  &--switch &__content {
@@ -382,54 +382,6 @@ module.exports = {
382
382
  tag: 'Live webinar',
383
383
  }
384
384
  },
385
- {
386
- title: 'Featured event card - Wide',
387
- preview: 'default',
388
- context: {
389
- theme: {
390
- border: false,
391
- layout: 'wide',
392
- name: 'featured',
393
- switch: true
394
- },
395
- header: {
396
- title: 'Discover how on-line particle sizing optimises mining analytics.',
397
- date: {
398
- date: new Date(),
399
- duration: '36:01'
400
- },
401
- meta: [
402
- 'English'
403
- ]
404
- },
405
- image: {
406
- src: '/static/img/featured-event-1.jpg',
407
- alt: 'Alt'
408
- },
409
- body: {
410
- keySpecs: [
411
- {
412
- title: 'Products',
413
- term: 'Morphologi G3-ID'
414
- },
415
- {
416
- title: 'Technologies',
417
- term: 'Morphologically-Directed Raman Spectroscopy'
418
- }
419
- ],
420
- },
421
- footer: {
422
- buttons: [
423
- {
424
- link: '#',
425
- label: 'Watch now',
426
- colour: 'outline-white'
427
- }
428
- ],
429
- },
430
- tag: 'Live webinar',
431
- }
432
- },
433
385
  {
434
386
  title: 'Event card - Future (home)',
435
387
  preview: 'content-width',
@@ -729,6 +681,56 @@ module.exports = {
729
681
  },
730
682
  tag: 'Whitepaper',
731
683
  }
684
+ },
685
+ {
686
+ title: 'Career card',
687
+ preview: 'cards-three',
688
+ context: {
689
+ theme: {
690
+ layout: 'single',
691
+ name: 'alt',
692
+ metaLast: true
693
+ },
694
+ header: {
695
+ title: 'Account Manager - MX',
696
+ meta: [
697
+ 'Mexico City, MX',
698
+ 'Posted 30+ days ago'
699
+ ],
700
+ },
701
+ body: {
702
+ content: '<p>Do you want to be part of a business that genuinely values entrepreneurialism, innovation and individual accountability? We focus on our customers and are proud of the difference our technology makes. We partner with some of the biggest...</p>'
703
+ },
704
+ footer: {
705
+ buttons: [
706
+ {
707
+ link: '#',
708
+ label: 'More details',
709
+ inline: false
710
+ }
711
+ ]
712
+ }
713
+ }
714
+ },
715
+ {
716
+ title: 'Product card - single',
717
+ preview: 'cards-three',
718
+ context: {
719
+ theme: {
720
+ layout: 'single',
721
+ border: true
722
+ },
723
+ image: {
724
+ src: '/static/img/blog-page-image-1.jpg',
725
+ alt: 'Product image alt'
726
+ },
727
+ header: {
728
+ title: '凝胶渗透色谱仪OMNISEC系统'
729
+ },
730
+ body: {
731
+ content: '<p>确定聚合物材料的分子量、粒度和结构</p>'
732
+ }
733
+ }
732
734
  }
733
735
  ],
734
736
 
@@ -33,6 +33,24 @@
33
33
  {%- if tag -%}{% set classes = classes + ' c-card--has-tag' %}{%- endif -%}
34
34
  {%- if hasImage -%}{% set classes = classes + ' c-card--has-image' %}{%- endif -%}
35
35
 
36
+ {% macro meta() %}
37
+ {% if hasTime or hasTimezone or isInPast or hasMeta %}
38
+ <p class="c-card__meta">
39
+ {% if isInPast %}
40
+ {{ twi({ icon: 'play', label: header.date.duration }) }}
41
+ {% if hasDate %}<span>{{ header.date.date.getMonth() | months }} {{ header.date.date.getFullYear() }}</span>{% endif %}
42
+ {% else %}
43
+ {% if hasTime %}
44
+ <span>{{ header.date.time }} {{ header.date.timezone }}</span>
45
+ {% endif %}
46
+ {% endif %}
47
+ {% for item in header.meta %}
48
+ <span>{{ item }}</span>
49
+ {% endfor %}
50
+ </p>
51
+ {% endif %}
52
+ {% endmacro %}
53
+
36
54
  <article class="{{ classes }}">
37
55
  {% if tag %}
38
56
  <span class="c-card__tag">{{ tag }}</span>
@@ -62,24 +80,17 @@
62
80
  </time>
63
81
  {% endif %}
64
82
 
65
- {% if hasTime or hasTimezone or isInPast or hasMeta %}
66
- <p class="c-card__meta">
67
- {% if isInPast %}
68
- {{ twi({ icon: 'play', label: header.date.duration }) }}
69
- {% if hasDate %}<span>{{ header.date.date.getMonth() | months }} {{ header.date.date.getFullYear() }}</span>{% endif %}
70
- {% else %}
71
- {% if hasTime %}
72
- <span>{{ header.date.time }} {{ header.date.timezone }}</span>
73
- {% endif %}
74
- {% endif %}
75
- {% for item in header.meta %}
76
- <span>{{ item }}</span>
77
- {% endfor %}
78
- </p>
83
+ {% if not params.theme.metaLast and (hasTime or hasTimezone or isInPast or hasMeta) %}
84
+ {{ meta() }}
79
85
  {% endif %}
80
86
 
81
87
  {% if header.title %}<h2 class="c-h c-card__title"><a href="{{ link }}">{{ header.title }}</a></h2>{% endif %}
82
88
  {% if header.subtitle %}<h3 class="c-h c-h--tagline">{{ header.subtitle }}</h2>{% endif %}
89
+
90
+ {% if params.theme.metaLast and (hasTime or hasTimezone or isInPast or hasMeta) %}
91
+ {{ meta() }}
92
+ {% endif %}
93
+
83
94
  </header>
84
95
  {% endif %}
85
96
 
@@ -142,7 +153,7 @@
142
153
  </div>
143
154
 
144
155
  {% if hasFullLink %}
145
- <a class="c-card__full-link u-fill u-fill--link" href="{{ link }}">{{ header.title }}</a>
156
+ <a class="u-fill u-fill--link" href="{{ link }}">{{ header.title }}</a>
146
157
  {% endif %}
147
158
  </div>
148
159
 
@@ -43,7 +43,7 @@
43
43
 
44
44
  &--featured &__wrapper,
45
45
  &--featured &__primary {
46
- flex: 1;
46
+ flex-grow: 1;
47
47
  }
48
48
 
49
49
  &--featured {
@@ -64,10 +64,27 @@
64
64
  flex-direction: column;
65
65
  }
66
66
 
67
+ &--layout-multi .c-card__wrapper,
68
+ &__primary {
69
+ // Required for IE
70
+ flex-shrink: 0;
71
+ width: 100%;
72
+ }
73
+
67
74
  &--layout-multi {
68
75
  .c-card__wrapper {
69
76
  @include gap("s-l");
70
77
  }
78
+
79
+ &.c-card--featured.c-card--size-large.c-card--has-image {
80
+ .c-card__wrapper {
81
+ padding: 0;
82
+ }
83
+
84
+ .c-card__primary {
85
+ @include padding('s-m');
86
+ }
87
+ }
71
88
 
72
89
  @media (min-width: 55em) {
73
90
  .c-card__wrapper {
@@ -120,21 +137,27 @@
120
137
  &--layout-multi-30-70 {
121
138
  .c-card__image {
122
139
  width: calc(30% - 18px) !important;
140
+ width: calc(30% - var(--space-s-m)) !important;
123
141
  }
124
142
 
125
143
  @media (min-width: 55em) {
126
144
  .c-card__primary:nth-child(2) {
127
145
  width: calc(70% - 18px) !important;
146
+ width: calc(70% - var(--space-s-m)) !important;
128
147
  }
129
148
  }
130
149
  }
131
150
 
132
- &--layout-wide {
133
- @extend .c-card--layout-multi;
134
-
151
+ &--layout-multi-40-60 {
135
152
  @media (min-width: 55em) {
136
153
  .c-card__image {
137
- width: calc(61.8% - 18px) !important;
154
+ width: calc(60% - 18px) !important;
155
+ width: calc(60% - var(--space-s-m)) !important;
156
+ }
157
+
158
+ .c-card__primary {
159
+ width: calc(40% - 18px) !important;
160
+ width: calc(40% - var(--space-s-m)) !important;
138
161
  }
139
162
  }
140
163
  }
@@ -166,10 +189,10 @@
166
189
  }
167
190
 
168
191
  &--layout-single &__primary,
169
- &--layout-multi.c-card--size-large.c-card--featured &__primary,
170
- &--layout-multi:not(&--size-large.c-card--featured) &__wrapper {
192
+ &--layout-multi &__wrapper {
171
193
  @include padding("s-m");
172
194
  width: 100%;
195
+ justify-content: space-between;
173
196
  }
174
197
 
175
198
  &--layout-single.c-card--has-tag:not(.c-card--has-image) &__primary {
@@ -274,6 +297,23 @@
274
297
  }
275
298
  }
276
299
 
300
+ &--2-column-specs &__specs {
301
+ dl {
302
+ display: grid;
303
+ grid-template-columns: repeat(2, minmax(min-content, max-content));
304
+ @include space('gap', '3xs', '2xs');
305
+ }
306
+ dt, dd {
307
+ margin: 0;
308
+ }
309
+ dt {
310
+ grid-column: 1;
311
+ }
312
+ dd {
313
+ grid-column: 2;
314
+ }
315
+ }
316
+
277
317
  .o-prose li + li {
278
318
  @include margin-top("3xs");
279
319
  }
@@ -315,18 +355,23 @@
315
355
  }
316
356
 
317
357
  &__corner {
318
- clip-path: polygon(100% 0, 0 0, 100% 100%);
319
358
  position: absolute;
320
- background: color("green");
321
- padding: 0.625rem;
322
359
  color: color("white");
323
360
  right: 0;
324
361
  top: 0;
325
- @include space("height", "2xl");
326
- @include space("width", "2xl");
362
+ @include space("border-width", "l");
363
+ border-color: color("green") color("green") transparent transparent;
364
+ border-style: solid;
365
+ width: 0;
366
+ height: 0;
327
367
  text-align: right;
328
368
  font-size: 1.5rem;
329
369
  transition: 300ms color;
370
+
371
+ .c-icon {
372
+ position: relative;
373
+ top: -27px;
374
+ }
330
375
  }
331
376
 
332
377
  &:hover &__corner {
@@ -303,7 +303,7 @@ There are also specific types of cards which are not generated from the main car
303
303
 
304
304
  {{ card({
305
305
  theme: {
306
- layout: 'wide',
306
+ layout: 'multi c-card--layout-multi-40-60',
307
307
  name: 'featured',
308
308
  switch: true
309
309
  },
@@ -1,8 +1,8 @@
1
1
  .c-featured-article-card {
2
2
  position: relative;
3
+ background: color('petrol', 'step-3');
3
4
 
4
5
  &__content {
5
- background: color('petrol', 'step-3');
6
6
  @include padding('s-l');
7
7
  }
8
8
 
@@ -78,10 +78,12 @@
78
78
 
79
79
  <form class="c-header__search">
80
80
  <label for="site-search" class="u-hidden">Search</label>
81
- <input id="site-search" placeholder="Search" type="search" name="s" class="c-input c-input--alt c-input--with-button" />
82
- <button type="button" class="c-button--reset u-blue">
83
- {{ icon({ id: 'search' }) }}
84
- </button>
81
+ <div class="u-flex u-bg-petrol-step-3">
82
+ <input id="site-search" placeholder="Search" type="search" name="s" class="c-input c-input--alt c-input--with-button" />
83
+ <button type="button" class="c-button--reset u-blue">
84
+ {{ icon({ id: 'search' }) }}
85
+ </button>
86
+ </div>
85
87
  </form>
86
88
 
87
89
  {% set siteNav = params.siteNav %}
@@ -20,6 +20,11 @@
20
20
 
21
21
  &__search {
22
22
  position: relative;
23
+
24
+ button:hover,
25
+ button:focus {
26
+ background-color: color('petrol', 'step-2');
27
+ }
23
28
  }
24
29
 
25
30
  @media (min-width: 500px) {
@@ -218,7 +223,7 @@
218
223
  }
219
224
  }
220
225
 
221
- @media (min-width: 1410px) {
226
+ @media (min-width: 1500px) {
222
227
  &__site:after {
223
228
  clip-path: polygon(0% 101%, 78px 0%, 100% 0%, 100% 101%, 78px 101%);
224
229
  }
@@ -1,14 +1,16 @@
1
1
  <article class="mp c-product-signpost {{ params.classes }}">
2
2
  <a class="c-product-signpost__link" href="{{ params.link }}">{{ params.title }}</a>
3
- {% if params.image.src %}
4
- <figure class="c-product-signpost__image">
5
- <img src="{{ params.image.src }}" alt="{{ params.image.alt }}" />
6
- </figure>
7
- {% endif %}
8
- <div class="u-flow--3xs">
9
- <h2 class="c-h c-h--step-0">{{ params.title }}</h2>
10
- <div class="o-prose">
11
- {{ params.description | safe }}
3
+ <div class="c-product-signpost__wrapper">
4
+ {% if params.image.src %}
5
+ <figure class="c-product-signpost__image">
6
+ <img src="{{ params.image.src }}" alt="{{ params.image.alt }}" />
7
+ </figure>
8
+ {% endif %}
9
+ <div class="u-flow--3xs">
10
+ <h2 class="c-h c-h--step-0">{{ params.title }}</h2>
11
+ <div class="o-prose">
12
+ {{ params.description | safe }}
13
+ </div>
12
14
  </div>
13
15
  </div>
14
16
  </article>
@@ -5,6 +5,7 @@
5
5
  align-items: center;
6
6
  max-width: 440px;
7
7
  @include padding("2xs");
8
+ word-break: break-word;
8
9
 
9
10
  &__link {
10
11
  @extend .u-fill, .u-fill--link;
@@ -17,7 +18,6 @@
17
18
  &__image {
18
19
  margin-bottom: 0;
19
20
  @include padding-right("s");
20
- width: 100%;
21
21
  flex-shrink: 0;
22
22
  }
23
23
 
@@ -42,8 +42,8 @@
42
42
  @include padding('xl', 'xl', 'xl', '4xl');
43
43
 
44
44
  &:before {
45
- left: space('xl');
46
- top: space('l');
45
+ @include space('left', 'xl');
46
+ @include space('top', 'l');
47
47
  }
48
48
  }
49
49
  }
@@ -9,6 +9,10 @@
9
9
  display: block;
10
10
  transition: 300ms transform;
11
11
 
12
+ &:hover {
13
+ color: color("grey");
14
+ }
15
+
12
16
  &::before {
13
17
  content: "▸ ";
14
18
  position: absolute;
@@ -2,7 +2,7 @@
2
2
 
3
3
  <header class="c-library__header u-split">
4
4
  <a class="c-library__logo" href="/">
5
- <img src="/static/svg/logo.svg" alt="Home" />
5
+ <img src="/static/svg/logo-small.svg" alt="Home" />
6
6
  <span class="c-library__logo-name">
7
7
  {% for item in config.logo %}
8
8
  <span>{{ item }}</span>
@@ -58,5 +58,18 @@
58
58
  });
59
59
  }
60
60
  }
61
+
62
+ // Toggle iframe background colour
63
+ Array.from(document.querySelectorAll('.c-library__frame-background')).forEach(t => {
64
+ t.addEventListener('click', toggleBackgroundColour);
65
+ });
66
+
67
+ function toggleBackgroundColour(event) {
68
+ const iframe = event.currentTarget.parentNode.parentNode.querySelector('iframe');
69
+ if (iframe) {
70
+ iframe.classList.toggle('u-bg-petrol-step-2');
71
+ iframe.classList.toggle('u-pad-s');
72
+ }
73
+ }
61
74
  })();
62
75
  </script>
@@ -218,17 +218,25 @@
218
218
  &__frame {
219
219
  position: relative;
220
220
  width: 100%;
221
-
222
- &-link {
223
- @include step(-1);
224
- padding: 0.25em 0.666em;
225
- border-radius: 0 0 0.25em 0.25em;
226
- background: color('petrol', 'step-2');
227
- color: color('grey', 'step-1');
221
+
222
+ &-links {
228
223
  position: absolute;
229
- z-index: 1;
230
224
  right: 0;
231
225
  top: calc(-1 * (var(--space-m) + var(--space-s)));
226
+ z-index: 1;
227
+
228
+ a, button {
229
+ border-radius: 0 0 0.25em 0.25em;
230
+ @include step(-1);
231
+ padding: 0.25em 0.666em;
232
+ background: color('petrol', 'step-2');
233
+ color: color('grey', 'step-1');
234
+ }
235
+ }
236
+
237
+ &-background {
238
+ border-radius: 0 0 0 0.25em;
239
+ top: 0;
232
240
  }
233
241
 
234
242
  iframe {
@@ -237,6 +245,7 @@
237
245
  width: 100%;
238
246
  left: 0;
239
247
  top: 0;
248
+ transition: all .3s cubic-bezier(0.22, 0.61, 0.36, 1);
240
249
  }
241
250
  }
242
251
 
@@ -26,6 +26,7 @@ $grid-gutter-width: 36;
26
26
  display: flex;
27
27
  flex-wrap: wrap;
28
28
  justify-content: stretch;
29
+ align-items: flex-start;
29
30
  margin-bottom: calc(-1 * #{space-unit()});
30
31
  margin-bottom: calc(-1 * var(--gutter));
31
32
  width: 100%;
@@ -137,6 +137,7 @@
137
137
 
138
138
  @mixin hyphenated {
139
139
  @media only screen and (max-width: 28rem) {
140
+ word-break: break-word;
140
141
  -webkit-hyphens: auto;
141
142
  -ms-hyphens: auto;
142
143
  hyphens: auto;
@@ -144,6 +145,7 @@
144
145
 
145
146
  @media only screen and (max-width: 70rem) {
146
147
  [lang='de-DE'] & {
148
+ word-break: break-word;
147
149
  -webkit-hyphens: auto;
148
150
  -ms-hyphens: auto;
149
151
  hyphens: auto;
@@ -48,7 +48,9 @@
48
48
  @include flow('3xl');
49
49
  }
50
50
 
51
- &--prose > * + * {
51
+ &--prose > * + *,
52
+ // Fix for Tridion XPM markup interrupting u-flow--prose spacing
53
+ &--prose > [property='a:Content'] > * + * {
52
54
  margin-top: var(--flow, 1em);
53
55
  }
54
56
 
@@ -31,8 +31,7 @@ Most of the CSS lives in this group. Each component is an encapsulated 'block' (
31
31
  Utilities are classes that do one thing really well. For example: `.u-hidden` hides elements on the page in a non destructive way (still visible to screenreaders). There are auto-generated spacing, typography and colour classes to help compose a page (and prototype new components before refactoring them into the above groups). The `u-` prefix is used for utilities.
32
32
 
33
33
  ## BEM
34
-
35
- BEM is used as a naming methodology, with `__` used for elements, and `--` used for modifiers.
34
+ We use BEM as a naming methodology, with `__` used for elements, and `--` used for modifiers.
36
35
 
37
36
  ```scss
38
37
  /* Pattern */
@@ -57,6 +56,8 @@ BEM is used as a naming methodology, with `__` used for elements, and `--` used
57
56
  }
58
57
  ```
59
58
 
59
+ For more information about BEM see [getbem.com](http://getbem.com/)
60
+
60
61
  ### SCSS variables vs. CSS custom properties
61
62
 
62
63
  {{ config.name }} is designed to support IE11+, which leaves a large support gap for custom properties—sadly, polyfilling is patchy at best. For this reason, the design system relies more on SCSS variables than custom properties.