@financial-times/n-myft-ui 37.0.0 → 38.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.
Files changed (37) hide show
  1. package/.pa11yci.js +2 -1
  2. package/.toolkitstate/ci.json +2 -2
  3. package/components/button/main.scss +49 -62
  4. package/components/collections/collections.html +1 -1
  5. package/components/collections/main.scss +54 -25
  6. package/components/concept-list/concept-list.html +1 -1
  7. package/components/concept-list/main.scss +33 -28
  8. package/components/digest-promo/generic-promo-message.html +1 -1
  9. package/components/digest-promo/main.scss +96 -98
  10. package/components/digest-promo/promo-message.html +1 -1
  11. package/components/follow-button/follow-button.html +1 -1
  12. package/components/instant-alert/index.js +4 -5
  13. package/components/instant-alert/instant-alert.html +1 -5
  14. package/components/instant-alert/main.scss +69 -46
  15. package/components/jsx/follow-plus-instant-alerts/follow-plus-instant-alerts.jsx +1 -1
  16. package/components/jsx/follow-plus-instant-alerts/main.scss +36 -46
  17. package/components/jsx/preferences-modal/main.scss +38 -19
  18. package/components/pin-button/main.scss +63 -54
  19. package/components/pin-button/pin-button.html +1 -1
  20. package/components/save-for-later/save-for-later.html +2 -2
  21. package/demos/app.js +1 -23
  22. package/demos/src/demo.scss +19 -15
  23. package/demos/templates/demo.html +6 -4
  24. package/dist/follow-plus-instant-alerts/follow-plus-instant-alerts.js +1 -1
  25. package/mixins/lozenge/_themes.scss +70 -64
  26. package/mixins/lozenge/_toggle-icon.scss +39 -38
  27. package/mixins/lozenge/main.scss +80 -65
  28. package/myft/main.scss +376 -336
  29. package/myft/ui/lists.js +4 -4
  30. package/myft/ui/lists.scss +2 -20
  31. package/myft/ui/myft-buttons/main.scss +1 -1
  32. package/myft/ui/personalise-links.js +1 -2
  33. package/package.json +14 -12
  34. package/scripts/build-demo.sh +1 -1
  35. package/components/onboarding-cta/main.scss +0 -10
  36. package/mixins/buttons.scss +0 -23
  37. package/styles.css +0 -1
@@ -1,77 +1,83 @@
1
1
  $myft-lozenge-themes: (
2
- standard: (
3
- toggle-button-theme: ('color': 'claret'),
4
- background: oColorsByName('claret'),
5
- text: oColorsByName('white'),
6
- highlight: oColorsByName('claret-50'),
7
- pressed-highlight: rgba(oColorsByName('black'), 0.05),
8
- disabled: rgba(oColorsByName('black'), 0.5),
9
- ),
10
- inverse: (
11
- toggle-button-theme: 'inverse',
12
- background: oColorsByName('white'),
13
- text: oColorsByName('black'),
14
- highlight: rgba(white, 0.8),
15
- pressed-highlight: rgba(white, 0.2),
16
- disabled: rgba(oColorsByName('white'), 0.5),
17
- mix-blend-mode: lighten
18
- ),
19
- opinion: (
20
- toggle-button-theme: ('color': 'oxford-40'),
21
- background: oColorsByName('oxford-40'),
22
- text: oColorsByName('white'),
23
- highlight: oColorsByName('oxford-30'),
24
- pressed-highlight: rgba(oColorsByName('oxford-40'), 0.2),
25
- disabled: rgba(oColorsByName('black'), 0.5),
26
- ),
27
- monochrome: (
28
- toggle-button-theme: 'inverse',
29
- background: oColorsByName('white'),
30
- text: oColorsByName('black'),
31
- highlight: oColorsByName('white-80'),
32
- pressed-highlight: rgba(oColorsByName('white'), 0.2),
33
- disabled: rgba(oColorsByName('white'), 0.5),
34
- ),
35
- inverse-monochrome: (
36
- toggle-button-theme: ('color': 'black'),
37
- background: oColorsByName('black'),
38
- text: oColorsByName('white'),
39
- highlight: oColorsByName('black-80'),
40
- pressed-highlight: rgba(oColorsByName('black'), 0.2),
41
- disabled: rgba(oColorsByName('black'), 0.5),
42
- ),
43
- alphaville: (
44
- toggle-button-theme: 'inverse',
45
- background: oColorsByName('white'),
46
- text: oColorsByName('matisse'),
47
- highlight: rgba(white, 0.8),
48
- pressed-highlight: rgba(white, 0.2),
49
- disabled: rgba(oColorsByName('white'), 0.5),
50
- )
2
+ standard: (
3
+ toggle-button-theme: (
4
+ 'color': 'claret',
5
+ ),
6
+ background: var(--o3-color-palette-claret),
7
+ text: var(--o3-color-palette-white),
8
+ highlight: var(--o3-color-palette-claret-50),
9
+ pressed-highlight: color-mix(in srgb, var(--o3-color-palette-black) 5%, transparent),
10
+ disabled: color-mix(in srgb, var(--o3-color-palette-black) 50%, transparent),
11
+ ),
12
+ inverse: (
13
+ toggle-button-theme: 'inverse',
14
+ background: var(--o3-color-palette-white),
15
+ text: var(--o3-color-palette-black),
16
+ highlight: color-mix(in srgb, white 80%, transparent),
17
+ pressed-highlight: color-mix(in srgb, var(--o3-color-palette-white) 20%, transparent),
18
+ disabled: color-mix(in srgb, var(--o3-color-palette-white) 50%, transparent),
19
+ mix-blend-mode: lighten,
20
+ ),
21
+ opinion: (
22
+ toggle-button-theme: (
23
+ 'color': 'oxford-40',
24
+ ),
25
+ background: var(--o3-color-palette-oxford-40),
26
+ text: var(--o3-color-palette-white),
27
+ highlight: var(--o3-color-palette-oxford-30),
28
+ pressed-highlight: color-mix(in srgb, var(--o3-color-palette-oxford-40) 20%, transparent),
29
+ disabled: color-mix(in srgb, var(--o3-color-palette-black) 50%, transparent),
30
+ ),
31
+ monochrome: (
32
+ toggle-button-theme: 'inverse',
33
+ background: var(--o3-color-palette-white),
34
+ text: var(--o3-color-palette-black),
35
+ highlight: var(--o3-color-palette-white-80),
36
+ pressed-highlight: color-mix(in srgb, var(--o3-color-palette-white) 20%, transparent),
37
+ disabled: color-mix(in srgb, var(--o3-color-palette-white) 50%, transparent),
38
+ ),
39
+ inverse-monochrome: (
40
+ toggle-button-theme: (
41
+ 'color': 'black',
42
+ ),
43
+ background: var(--o3-color-palette-black),
44
+ text: var(--o3-color-palette-white),
45
+ highlight: var(--o3-color-palette-black-80),
46
+ pressed-highlight: color-mix(in srgb, var(--o3-color-palette-black) 20%, transparent),
47
+ disabled: color-mix(in srgb, var(--o3-color-palette-black) 50%, transparent),
48
+ ),
49
+ alphaville: (
50
+ toggle-button-theme: 'inverse',
51
+ background: var(--o3-color-palette-white),
52
+ text: var(--o3-color-palette-matisse-blue),
53
+ highlight: color-mix(in srgb, var(--o3-color-palette-white) 80%, transparent),
54
+ pressed-highlight: color-mix(in srgb, var(--o3-color-palette-white) 20%, transparent),
55
+ disabled: color-mix(in srgb, var(--o3-color-palette-white) 50%, transparent),
56
+ ),
51
57
  );
52
58
 
53
59
  @function getThemeColor($key) {
54
- @return map-get($theme-map, $key);
60
+ @return map-get($theme-map, $key);
55
61
  }
56
62
 
57
63
  // to avoid creating --standard styles
58
- @function getThemeModifier ($theme) {
59
- @if $theme == 'standard' {
60
- @return '';
61
- } @else {
62
- @return '--#{$theme}';
63
- }
64
+ @function getThemeModifier($theme) {
65
+ @if $theme == 'standard' {
66
+ @return '';
67
+ } @else {
68
+ @return '--#{$theme}';
69
+ }
64
70
  }
65
71
 
66
72
  @mixin withTheme($theme) {
67
- @if type-of($theme) == 'map' {
68
- $theme-map: $theme !global;
69
- } @else {
70
- $theme-map: map-get($myft-lozenge-themes, $theme) !global;
71
- }
73
+ @if type-of($theme) == 'map' {
74
+ $theme-map: $theme !global;
75
+ } @else {
76
+ $theme-map: map-get($myft-lozenge-themes, $theme) !global;
77
+ }
72
78
 
73
- @content;
79
+ @content;
74
80
 
75
- // stylelint-disable order/order
76
- $theme-map: null !global;
81
+ // stylelint-disable order/order
82
+ $theme-map: null !global;
77
83
  }
@@ -1,50 +1,51 @@
1
- @import "./themes";
1
+ @import './themes';
2
2
 
3
3
  @mixin getIcon($name, $color) {
4
- @include oIconsContent(
5
- $icon-name: $name,
6
- $size: 10,
7
- $color: $color,
8
- $iconset-version: 1
9
- );
10
- content: "";
4
+ --icon-size: 12px;
5
+ content: '';
6
+ display: inline-block;
7
+ mask-image: var($name);
8
+ mask-repeat: no-repeat;
9
+ mask-size: contain;
10
+ width: var(--icon-size);
11
+ height: var(--icon-size);
12
+ background-color: $color;
13
+ background-size: 25px;
14
+ margin: 0 6px -1px 0;
11
15
  }
12
16
 
13
17
  @mixin plusIcon($color) {
14
- @include getIcon("plus", $color);
15
- background-size: 25px;
16
- margin: 0 6px -1px 0;
18
+ @include getIcon(--o3-icon-plus, $color);
17
19
  }
18
20
 
19
21
  @mixin tickIcon($color) {
20
- @include getIcon("tick", $color);
21
- background-size: 21px;
22
+ @include getIcon(--o3-icon-tick, $color);
22
23
  }
23
24
 
24
25
  @mixin myftToggleIcon($theme: standard) {
25
- @include withTheme($theme) {
26
- &::before {
27
- @include plusIcon(getThemeColor(background));
28
- }
29
-
30
- &[aria-pressed="true"] {
31
- &::before {
32
- @include tickIcon(getThemeColor(text));
33
- }
34
- }
35
-
36
- &[disabled],
37
- &[disabled]:hover {
38
- background: transparent;
39
-
40
- &::before {
41
- @include plusIcon(getThemeColor(disabled));
42
- opacity: 0.5;
43
- }
44
-
45
- &[aria-pressed="true"]::before {
46
- @include tickIcon(getThemeColor(disabled));
47
- }
48
- }
49
- }
26
+ @include withTheme($theme) {
27
+ &::before {
28
+ @include getIcon(--o3-icon-plus, getThemeColor(background));
29
+ }
30
+
31
+ &[aria-pressed='true'] {
32
+ &::before {
33
+ @include getIcon(--o3-icon-tick, getThemeColor(text));
34
+ }
35
+ }
36
+
37
+ &[disabled],
38
+ &[disabled]:hover {
39
+ background: transparent;
40
+
41
+ &::before {
42
+ @include getIcon(--o3-icon-plus, getThemeColor(disabled));
43
+ opacity: 0.5;
44
+ }
45
+
46
+ &[aria-pressed='true']::before {
47
+ @include getIcon(--o3-icon-tick, getThemeColor(disabled));
48
+ }
49
+ }
50
+ }
50
51
  }
@@ -1,85 +1,100 @@
1
1
  @import './themes';
2
2
  @import './toggle-icon';
3
3
 
4
- @include oNormalise($opts: (
5
- 'elements': ('forms', 'text', 'links')
6
- ));
7
-
8
4
  @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;
21
-
22
- &[disabled]:hover,
23
- &[disabled] {
24
- background: transparent;
25
- border: 1px solid getThemeColor(disabled);
26
- color: getThemeColor(disabled);
27
- opacity: unset;
28
- }
5
+ border-radius: 100px;
6
+ box-sizing: content-box;
7
+ display: block;
8
+ margin: 6px 4px 6px 2px;
9
+ max-width: 200px;
10
+ outline-offset: 2px;
11
+ overflow: hidden;
12
+ text-align: left;
13
+ text-overflow: ellipsis;
14
+ transition: border-color, background-color 0.5s ease;
15
+ white-space: nowrap;
16
+ align-items: center;
17
+ justify-content: center;
18
+ vertical-align: middle;
19
+ font-family: var(--o3-font-family-metric);
20
+ text-decoration: none;
21
+ appearance: none;
22
+ color: getThemeColor(background);
23
+ border: 1px solid getThemeColor(background);
24
+ background-color: transparent;
25
+ &[disabled]:hover,
26
+ &[disabled] {
27
+ background: transparent;
28
+ border: 1px solid getThemeColor(disabled);
29
+ color: getThemeColor(disabled);
30
+ opacity: unset;
31
+ }
29
32
  }
30
33
 
31
34
  @mixin myftLozengeTheme($theme: standard) {
32
- @include withTheme($theme) {
33
- background-color: transparent;
34
- border: 1px solid getThemeColor(background);
35
- color: getThemeColor(background);
35
+ @include withTheme($theme) {
36
+ background-color: transparent;
37
+ border: 1px solid getThemeColor(background);
38
+ color: getThemeColor(background);
36
39
 
37
- &:hover,
38
- &:focus {
39
- background-color: getThemeColor(pressed-highlight);
40
- border-color: getThemeColor(background);
41
- color: getThemeColor(background);
42
- }
40
+ &:hover,
41
+ &:focus {
42
+ background-color: getThemeColor(pressed-highlight);
43
+ border-color: getThemeColor(background);
44
+ color: getThemeColor(background);
45
+ }
43
46
 
44
- @include commonMyftLozengeStyles;
45
- padding: 5px 12px;
46
- }
47
+ @include commonMyftLozengeStyles;
48
+ }
47
49
  }
48
50
 
49
51
  @mixin myftLozenge($theme: standard) {
50
- @include myftLozengeTheme($theme);
51
- @include oTypographySans($weight: 'semibold', $scale: -1);
52
+ @include myftLozengeTheme($theme);
53
+ font-size: var(--o3-font-size-metric2-negative-1);
54
+ line-height: var(--o3-font-lineheight-metric2-negative-1);
55
+ font-weight: var(--o3-font-weight-semibold);
56
+ padding: 5px 12px;
57
+ min-height: 20px;
52
58
  }
53
59
 
54
60
  @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
+ @include myftToggleIcon($theme);
62
+ @include withTheme($theme) {
63
+ font-size: var(--o3-font-size-negative-1);
64
+ line-height: var(--o3-font-lineheight-negative-2);
65
+ font-weight: var(--o3-font-weight-semibold);
66
+ min-height: 28px;
67
+ min-width: 60px;
61
68
 
62
- &[aria-pressed="true"] {
63
- color: getThemeColor(text);
64
- @if getThemeColor(mix-blend-mode) {
65
- mix-blend-mode: getThemeColor(mix-blend-mode);
66
- }
69
+ &[aria-pressed="true"] {
70
+ color: getThemeColor(text);
71
+ background-color: getThemeColor(background);
72
+ border-color: getThemeColor(background);
73
+ @if getThemeColor(mix-blend-mode) {
74
+ mix-blend-mode: getThemeColor(mix-blend-mode);
75
+ }
67
76
 
68
- &:hover,
69
- &:focus {
70
- border-color: getThemeColor(highlight);
71
- color: getThemeColor(text);
77
+ &:hover,
78
+ &:focus {
79
+ border-color: getThemeColor(highlight);
80
+ color: getThemeColor(text);
72
81
 
73
- @if getThemeColor(mix-blend-mode) {
74
- mix-blend-mode: getThemeColor(mix-blend-mode);
75
- background-color: rgba(getThemeColor(highlight), 0.85);
76
- } @else {
77
- background-color: getThemeColor(highlight);
78
- }
79
- }
80
- }
82
+ @if getThemeColor(mix-blend-mode) {
83
+ mix-blend-mode: getThemeColor(mix-blend-mode);
84
+ background-color: color-mix(in srgb, getThemeColor(highlight) 85%, transparent);
85
+ } @else {
86
+ background-color: getThemeColor(highlight);
87
+ }
88
+ }
89
+ }
90
+ &:hover,
91
+ &:focus {
92
+ background-color: getThemeColor(pressed-highlight);
93
+ border-color: getThemeColor(background);
94
+ color: getThemeColor(background);
95
+ }
81
96
 
82
- @include commonMyftLozengeStyles;
83
- padding: 0 12px;
84
- }
97
+ @include commonMyftLozengeStyles;
98
+ padding: 0 var(--o3-spacing-3xs);
99
+ }
85
100
  }