@financial-times/n-myft-ui 29.0.1 → 29.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,8 @@ $myft-lozenge-themes: (
13
13
  highlight: rgba(white, 0.8),
14
14
  pressed-highlight: rgba(white, 0.2),
15
15
  disabled: rgba(oColorsByName('white'), 0.5),
16
- focus-outline: oColorsByName('white')
16
+ focus-outline: oColorsByName('white'),
17
+ mix-blend-mode: lighten
17
18
  ),
18
19
  opinion: (
19
20
  background: oColorsByName('oxford-40'),
@@ -73,11 +73,20 @@
73
73
  border: 1px solid getThemeColor(background);
74
74
  color: getThemeColor(text);
75
75
 
76
+ @if getThemeColor(mix-blend-mode) {
77
+ mix-blend-mode: lighten;
78
+ }
76
79
  &:hover,
77
80
  &:focus {
78
- background-color: getThemeColor(highlight);
79
81
  border-color: getThemeColor(highlight);
80
82
  color: getThemeColor(text);
83
+
84
+ @if getThemeColor(mix-blend-mode) {
85
+ mix-blend-mode: getThemeColor(mix-blend-mode);
86
+ background-color: rgba(getThemeColor(highlight), 0.85);
87
+ } @else {
88
+ background-color: getThemeColor(highlight);
89
+ }
81
90
  }
82
91
  }
83
92
 
package/myft/ui/lists.js CHANGED
@@ -14,7 +14,7 @@ const delegate = new Delegate(document.body);
14
14
  const csrfToken = getToken();
15
15
 
16
16
 
17
- function openOverlay (html, { name = 'myft-ui', title = ' ', shaded = false }) {
17
+ function openOverlay (html, { name = 'myft-ui', title = ' ', shaded = false, trigger = false }) {
18
18
  // If an overlay already exists of the same name destroy it.
19
19
  const overlays = Overlay.getOverlays();
20
20
  const existingOverlay = overlays[name];
@@ -24,11 +24,15 @@ function openOverlay (html, { name = 'myft-ui', title = ' ', shaded = false
24
24
  // Create a new overlay.
25
25
  const overlay = new Overlay(name, {
26
26
  heading: { title, shaded },
27
- html
27
+ html,
28
28
  });
29
29
 
30
30
  overlay.open();
31
31
 
32
+ if (trigger) {
33
+ document.body.addEventListener('oOverlay.destroy', () => trigger.focus(), true);
34
+ }
35
+
32
36
  return new Promise(resolve => {
33
37
  document.body.addEventListener('oOverlay.ready', () => resolve(overlay));
34
38
  });
@@ -143,7 +147,7 @@ function setUpCreateListListeners (overlay, contentId) {
143
147
  }
144
148
 
145
149
 
146
- function showListsOverlay (overlayTitle, formHtmlUrl, contentId) {
150
+ function showListsOverlay (overlayTitle, formHtmlUrl, contentId, trigger) {
147
151
  myFtClient.personaliseUrl(formHtmlUrl)
148
152
  .then(url => fetch(url, {
149
153
  credentials: 'same-origin'
@@ -155,7 +159,7 @@ function showListsOverlay (overlayTitle, formHtmlUrl, contentId) {
155
159
  throw new Error(`Unexpected response: ${res.statusText}`);
156
160
  }
157
161
  })
158
- .then(html => openOverlay(html, { name: 'myft-lists', title: overlayTitle }))
162
+ .then(html => openOverlay(html, { name: 'myft-lists', title: overlayTitle, trigger }))
159
163
  .then(overlay => {
160
164
  oForms.init(overlay.content);
161
165
  setUpSaveToExistingListListeners(overlay, contentId);
@@ -171,12 +175,12 @@ function showListsOverlay (overlayTitle, formHtmlUrl, contentId) {
171
175
 
172
176
  }
173
177
 
174
- function showCopyToListOverlay (contentId, excludeList) {
175
- showListsOverlay('Copy to list', `/myft/list?fragment=true&copy=true&contentId=${contentId}&excludeList=${excludeList}`, contentId);
178
+ function showCopyToListOverlay (contentId, excludeList, trigger) {
179
+ showListsOverlay('Copy to list', `/myft/list?fragment=true&copy=true&contentId=${contentId}&excludeList=${excludeList}`, contentId, trigger);
176
180
  }
177
181
 
178
- function showCreateListOverlay () {
179
- showListsOverlay('Create list', '/myft/list?fragment=true');
182
+ function showCreateListOverlay (trigger) {
183
+ showListsOverlay('Create list', '/myft/list?fragment=true', null, trigger);
180
184
  }
181
185
 
182
186
  function showArticleSavedOverlay (contentId) {
@@ -313,11 +317,11 @@ function initialEventListeners () {
313
317
 
314
318
  delegate.on('click', '[data-myft-ui="copy-to-list"]', event => {
315
319
  event.preventDefault();
316
- showCopyToListOverlay(event.target.getAttribute('data-content-id'), event.target.getAttribute('data-actor-id'));
320
+ showCopyToListOverlay(event.target.getAttribute('data-content-id'), event.target.getAttribute('data-actor-id'), event.target);
317
321
  });
318
- delegate.on('click', '[data-myft-ui="create-list"]', ev => {
319
- ev.preventDefault();
320
- showCreateListOverlay();
322
+ delegate.on('click', '[data-myft-ui="create-list"]', event => {
323
+ event.preventDefault();
324
+ showCreateListOverlay(event.target);
321
325
  });
322
326
 
323
327
  delegate.on('submit', '[data-myft-ui="contained"]', handleRemoveToggleSubmit);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-myft-ui",
3
- "version": "29.0.1",
3
+ "version": "29.0.3",
4
4
  "description": "Client side component for interaction with myft",
5
5
  "main": "server.js",
6
6
  "scripts": {