@financial-times/n-myft-ui 29.0.8 → 30.0.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.
@@ -4,11 +4,6 @@
4
4
  @include oButtonsContent($opts: (
5
5
  'type': 'secondary'
6
6
  ));
7
-
8
- &:focus {
9
- outline: 3px solid oColorsByName('teal-40');
10
- outline-offset: 3px;
11
- }
12
7
  }
13
8
 
14
9
  .n-myft-ui__button--inverse {
@@ -38,7 +33,7 @@
38
33
  color: oColorsByName('black');
39
34
  background-position: 0 0;
40
35
  border: 0;
41
- min-height: $icon-size;
36
+ min-height: $icon-size + 16px; // add line-height for 'save' text
42
37
  width: $icon-size;
43
38
  position: relative;
44
39
 
@@ -6,7 +6,7 @@
6
6
  }
7
7
 
8
8
  @each $theme in map-keys($myft-lozenge-themes) {
9
- .n-myft-concept-pill--#{$theme} {
9
+ .n-myft-concept-pill#{getThemeModifier($theme)} {
10
10
  @include myftLozengeTheme($theme);
11
11
  }
12
12
  }
@@ -110,7 +110,7 @@ $spacing-unit: 20px;
110
110
  }
111
111
 
112
112
  .n-myft-digest-promo__cta-btn {
113
- @include myftLozenge($with-toggle-icon: true);
113
+ @include myftLozengeToggleButton();
114
114
  display: inline-block;
115
115
  text-transform: none;
116
116
  min-width: 134px;
@@ -1,11 +1,7 @@
1
1
  @import '../../mixins/lozenge/main';
2
2
 
3
- .n-myft-follow-button {
4
- @include myftLozenge($with-toggle-icon: true);
5
- }
6
-
7
3
  @each $theme in map-keys($myft-lozenge-themes) {
8
- .n-myft-follow-button--#{$theme} {
9
- @include myftLozengeTheme($theme, $with-toggle-icon: true);
4
+ .n-myft-follow-button#{getThemeModifier($theme)} {
5
+ @include myftLozengeToggleButton($theme);
10
6
  }
11
7
  }
@@ -9,6 +9,11 @@ $system-code: "n-myft-ui-demo";
9
9
  @import '../../components/follow-button/main';
10
10
  @import '../../components/onboarding-cta/main';
11
11
 
12
+ @import '../../components/digest-promo/main';
13
+ .n-myft-digest-promo {
14
+ display: block;
15
+ }
16
+
12
17
  .demo-container {
13
18
  margin-bottom: 400px;
14
19
  }
@@ -541,6 +541,20 @@
541
541
  {{/each}}
542
542
  </div>
543
543
  </section>
544
+
545
+ <section
546
+ id="digest-promo"
547
+ class="demo-section">
548
+ <div class="o-grid-row">
549
+ <div data-o-grid-colspan="12">
550
+ <h2 class="demo-section__title">
551
+ Digest promo
552
+ </h2>
553
+ {{> n-myft-ui/components/digest-promo/generic-promo-message }}
554
+ {{> n-myft-ui/components/digest-promo/promo-message }}
555
+ </div>
556
+ </div>
557
+ </section>
544
558
  </div>
545
559
  </body>
546
560
 
@@ -1,44 +1,44 @@
1
1
  $myft-lozenge-themes: (
2
2
  standard: (
3
+ toggle-button-theme: ('color': 'claret'),
3
4
  background: oColorsByName('claret'),
4
5
  text: oColorsByName('white'),
5
6
  highlight: oColorsByName('claret-50'),
6
7
  pressed-highlight: rgba(oColorsByName('black'), 0.05),
7
8
  disabled: rgba(oColorsByName('black'), 0.5),
8
- focus-outline: oColorsByUsecase('focus', 'outline', $fallback: null)
9
9
  ),
10
10
  inverse: (
11
+ toggle-button-theme: 'inverse',
11
12
  background: oColorsByName('white'),
12
13
  text: oColorsByName('black'),
13
14
  highlight: rgba(white, 0.8),
14
15
  pressed-highlight: rgba(white, 0.2),
15
16
  disabled: rgba(oColorsByName('white'), 0.5),
16
- focus-outline: oColorsByName('white'),
17
17
  mix-blend-mode: lighten
18
18
  ),
19
19
  opinion: (
20
+ toggle-button-theme: ('color': 'oxford-40'),
20
21
  background: oColorsByName('oxford-40'),
21
22
  text: oColorsByName('white'),
22
23
  highlight: oColorsByName('oxford-30'),
23
24
  pressed-highlight: rgba(oColorsByName('oxford-40'), 0.2),
24
25
  disabled: rgba(oColorsByName('black'), 0.5),
25
- focus-outline: oColorsByUsecase('focus', 'outline', $fallback: null)
26
26
  ),
27
27
  monochrome: (
28
+ toggle-button-theme: 'inverse',
28
29
  background: oColorsByName('white'),
29
30
  text: oColorsByName('black'),
30
31
  highlight: oColorsByName('white-80'),
31
32
  pressed-highlight: rgba(oColorsByName('white'), 0.2),
32
33
  disabled: rgba(oColorsByName('white'), 0.5),
33
- focus-outline: oColorsByName('white')
34
34
  ),
35
35
  alphaville: (
36
+ toggle-button-theme: 'inverse',
36
37
  background: oColorsByName('white'),
37
38
  text: oColorsByName('matisse'),
38
39
  highlight: rgba(white, 0.8),
39
40
  pressed-highlight: rgba(white, 0.2),
40
41
  disabled: rgba(oColorsByName('white'), 0.5),
41
- focus-outline: oColorsByName('white')
42
42
  )
43
43
  );
44
44
 
@@ -46,6 +46,15 @@ $myft-lozenge-themes: (
46
46
  @return map-get($theme-map, $key);
47
47
  }
48
48
 
49
+ // to avoid creating --standard styles
50
+ @function getThemeModifier ($theme) {
51
+ @if $theme == 'standard' {
52
+ @return '';
53
+ } @else {
54
+ @return '--#{$theme}';
55
+ }
56
+ }
57
+
49
58
  @mixin withTheme($theme) {
50
59
  @if type-of($theme) == 'map' {
51
60
  $theme-map: $theme !global;
@@ -1,66 +1,39 @@
1
1
  @import './themes';
2
2
  @import './toggle-icon';
3
3
 
4
- @mixin focusOutlineColor($focus-color) {
5
- // Apply :focus styles as a fallback
6
- // These styles will be applied to all browsers that don't use the polyfill, this includes browsers which support the feature natively.
7
- body:not(.js-focus-visible) &,
8
- html:not(.js-focus-visible) & {
9
- // Standardise focus styles.
10
- &:focus {
11
- outline: 2px solid $focus-color;
12
- }
13
- }
14
-
15
- // When the focus-visible polyfill is applied `.js-focus-visible` is added to the html dom node
16
- // (the body node in v4 of the 3rd party polyfill)
4
+ @include oNormalise($opts: (
5
+ 'elements': ('forms', 'text', 'links')
6
+ ));
17
7
 
18
- // stylelint-disable-next-line selector-no-qualifying-type
19
- body.js-focus-visible &, // stylelint-disable-next-line selector-no-qualifying-type
20
- html.js-focus-visible & {
21
- // Standardise focus styles.
22
- // stylelint-disable-next-line selector-no-qualifying-type
23
- &.focus-visible {
24
- outline: 2px solid $focus-color;
25
- }
26
- // Disable browser default focus style.
27
- // stylelint-disable-next-line selector-no-qualifying-type
28
- &:focus:not(.focus-visible) {
29
- outline: 0;
30
- }
31
- }
32
-
33
- // These styles will be ignored by browsers which do not recognise the :focus-visible selector (as per the third bullet point in https://www.w3.org/TR/selectors-3/#Conformance)
34
- // If a browser supports :focus-visible we unset the :focus styles that were applied above
35
- // (within the html:not(.js-focus-visible) block).
36
- &:focus-visible,
37
- body:not(.js-focus-visible) &:focus,
38
- html:not(.js-focus-visible) &:focus {
39
- outline: unset;
40
- }
8
+ @mixin commonMyftLozengeStyles {
9
+ border-radius: 100px;
10
+ box-sizing: content-box;
11
+ display: block;
12
+ font-size: 14px;
13
+ margin: 6px 4px 6px 2px;
14
+ max-width: 200px;
15
+ outline-offset: 2px;
16
+ overflow: hidden;
17
+ text-align: left;
18
+ text-overflow: ellipsis;
19
+ transition: border-color, background-color 0.5s ease;
20
+ white-space: nowrap;
41
21
 
42
- // Styles given :focus-visible support. Extra selectors needed to match
43
- // previous `:focus` selector specificity.
44
- body:not(.js-focus-visible) &:focus-visible,
45
- html:not(.js-focus-visible) &:focus-visible,
46
- &:focus-visible {
47
- outline: 2px solid $focus-color;
22
+ &[disabled]:hover,
23
+ &[disabled] {
24
+ background: transparent;
25
+ border: 1px solid getThemeColor(disabled);
26
+ color: getThemeColor(disabled);
27
+ opacity: unset;
48
28
  }
49
29
  }
50
30
 
51
-
52
- @mixin myftLozengeTheme($theme: standard, $with-toggle-icon: false) {
53
- @if $with-toggle-icon != false {
54
- @include myftToggleIcon($theme);
55
- }
56
-
31
+ @mixin myftLozengeTheme($theme: standard) {
57
32
  @include withTheme($theme) {
58
33
  background-color: transparent;
59
34
  border: 1px solid getThemeColor(background);
60
35
  color: getThemeColor(background);
61
36
 
62
- @include focusOutlineColor(getThemeColor(focus-outline));
63
-
64
37
  &:hover,
65
38
  &:focus {
66
39
  background-color: getThemeColor(pressed-highlight);
@@ -68,14 +41,30 @@
68
41
  color: getThemeColor(background);
69
42
  }
70
43
 
44
+ @include commonMyftLozengeStyles;
45
+ padding: 5px 12px;
46
+ }
47
+ }
48
+
49
+ @mixin myftLozenge($theme: standard) {
50
+ @include myftLozengeTheme($theme);
51
+ @include oTypographySans($weight: 'semibold', $scale: -1);
52
+ }
53
+
54
+ @mixin myftLozengeToggleButton($theme: standard) {
55
+ @include myftToggleIcon($theme);
56
+ @include withTheme($theme) {
57
+ @include oButtonsContent($opts: (
58
+ 'type': 'secondary',
59
+ 'theme': getThemeColor(toggle-button-theme)
60
+ ));
61
+
71
62
  &[aria-pressed="true"] {
72
- background-color: getThemeColor(background);
73
- border: 1px solid getThemeColor(background);
74
63
  color: getThemeColor(text);
75
-
76
64
  @if getThemeColor(mix-blend-mode) {
77
- mix-blend-mode: lighten;
65
+ mix-blend-mode: getThemeColor(mix-blend-mode);
78
66
  }
67
+
79
68
  &:hover,
80
69
  &:focus {
81
70
  border-color: getThemeColor(highlight);
@@ -90,30 +79,7 @@
90
79
  }
91
80
  }
92
81
 
93
- &[disabled]:hover,
94
- &[disabled] {
95
- background: transparent;
96
- border: 1px solid getThemeColor(disabled);
97
- color: getThemeColor(disabled);
98
- }
82
+ @include commonMyftLozengeStyles;
83
+ padding: 0 12px;
99
84
  }
100
85
  }
101
-
102
- @mixin myftLozenge($theme: standard, $with-toggle-icon: false) {
103
- @include myftLozengeTheme($theme, $with-toggle-icon);
104
- @include oTypographySans($weight: 'semibold', $scale: -1);
105
-
106
- border-radius: 100px;
107
- box-sizing: content-box;
108
- display: block;
109
- font-size: 14px;
110
- margin: 6px 4px 6px 2px;
111
- max-width: 200px;
112
- outline-offset: 2px;
113
- overflow: hidden;
114
- padding: 5px 12px;
115
- text-align: left;
116
- text-overflow: ellipsis;
117
- transition: border-color, background-color 0.5s ease;
118
- white-space: nowrap;
119
- }
@@ -125,9 +125,10 @@ export default async function openSaveArticleToListVariant (contentId, options =
125
125
  const resizeHandler = getResizeHandler(createListOverlay.wrapper);
126
126
 
127
127
  createListOverlay.wrapper.addEventListener('oOverlay.ready', (data) => {
128
- if (lists.length) {
129
- const overlayContent = document.querySelector('.o-overlay__content');
130
- overlayContent.insertAdjacentElement('afterbegin', listElement);
128
+ const overlayContent = document.querySelector('.o-overlay__content');
129
+ overlayContent.insertAdjacentElement('afterbegin', listElement);
130
+ if (!lists.length) {
131
+ hideListElement();
131
132
  }
132
133
 
133
134
  if (!modal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-myft-ui",
3
- "version": "29.0.8",
3
+ "version": "30.0.0",
4
4
  "description": "Client side component for interaction with myft",
5
5
  "main": "server.js",
6
6
  "scripts": {
@@ -20,11 +20,11 @@
20
20
  },
21
21
  "homepage": "https://github.com/Financial-Times/n-myft-ui#readme",
22
22
  "devDependencies": {
23
- "@financial-times/dotcom-build-base": "^7.0.0",
24
- "@financial-times/dotcom-build-code-splitting": "^5.0.0",
25
- "@financial-times/dotcom-build-js": "^5.0.0",
26
- "@financial-times/dotcom-build-sass": "^5.0.0",
27
- "@financial-times/dotcom-server-handlebars": "^5.0.0",
23
+ "@financial-times/dotcom-build-base": "^7.2.7",
24
+ "@financial-times/dotcom-build-code-splitting": "^7.2.7",
25
+ "@financial-times/dotcom-build-js": "^7.2.7",
26
+ "@financial-times/dotcom-build-sass": "^7.2.7",
27
+ "@financial-times/dotcom-server-handlebars": "^7.2.7",
28
28
  "@financial-times/n-express": "^23.0.1",
29
29
  "@financial-times/n-gage": "^8.3.2",
30
30
  "ascii-table": "0.0.9",
@@ -87,11 +87,12 @@
87
87
  },
88
88
  "peerDependencies": {
89
89
  "@financial-times/n-notification": "^8.2.2",
90
+ "@financial-times/o-buttons": "^7.7.3",
90
91
  "@financial-times/o-editorial-typography": "^2.3.2",
91
92
  "@financial-times/o-errors": "^5.0.0",
92
93
  "@financial-times/o-forms": "^9.4.0",
93
94
  "@financial-times/o-grid": "^6.1.1",
94
- "@financial-times/o-normalise": "^3.0.0",
95
+ "@financial-times/o-normalise": "^3.3.0",
95
96
  "@financial-times/o-overlay": "^4.0.0",
96
97
  "@financial-times/o-spacing": "^3.0.0",
97
98
  "@financial-times/o-tooltip": "^5.2.4",