@financial-times/n-myft-ui 29.0.1 → 29.0.4
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.
- package/mixins/lozenge/_themes.scss +3 -2
- package/mixins/lozenge/main.scss +10 -1
- package/myft/ui/lists.js +16 -12
- package/package.json +1 -1
@@ -9,11 +9,12 @@ $myft-lozenge-themes: (
|
|
9
9
|
),
|
10
10
|
inverse: (
|
11
11
|
background: oColorsByName('white'),
|
12
|
-
text: oColorsByName('
|
12
|
+
text: oColorsByName('black'),
|
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'),
|
package/mixins/lozenge/main.scss
CHANGED
@@ -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©=true&contentId=${contentId}&excludeList=${excludeList}`, contentId);
|
178
|
+
function showCopyToListOverlay (contentId, excludeList, trigger) {
|
179
|
+
showListsOverlay('Copy to list', `/myft/list?fragment=true©=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"]',
|
319
|
-
|
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);
|