@ons/design-system 46.1.0 → 46.1.3
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/LICENSE +1 -1
- package/components/message-list/_message-list.scss +1 -1
- package/components/tabs/_tabs.scss +2 -1
- package/components/timeout-modal/timeout-modal.js +29 -4
- package/css/census.css +1 -1
- package/css/main.css +1 -1
- package/js/timeout.js +8 -32
- package/layout/_template.njk +2 -2
- package/package.json +5 -7
- package/scripts/main.es5.js +2 -2
- package/scripts/main.js +1 -1
package/js/timeout.js
CHANGED
|
@@ -51,14 +51,8 @@ export default class Timeout {
|
|
|
51
51
|
async startUiCountdown() {
|
|
52
52
|
this.clearTimers();
|
|
53
53
|
this.countdownStarted = true;
|
|
54
|
-
|
|
55
|
-
if (this.enableTimeoutReset) {
|
|
56
|
-
this.shouldRestartCheck = setInterval(async () => {
|
|
57
|
-
await this.hasExpiryTimeResetInAnotherTab();
|
|
58
|
-
}, 20000);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
54
|
let milliseconds = this.convertTimeToMilliSeconds(this.expiryTime);
|
|
55
|
+
|
|
62
56
|
let seconds = milliseconds / 1000;
|
|
63
57
|
let timers = this.timers;
|
|
64
58
|
let $this = this;
|
|
@@ -83,13 +77,9 @@ export default class Timeout {
|
|
|
83
77
|
($this.endWithFullStop ? '.' : '');
|
|
84
78
|
|
|
85
79
|
if (timerExpired) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
$this.countdown.innerHTML = '<span class="ons-u-fw-b">' + $this.countdownExpiredText + '</span>';
|
|
90
|
-
$this.accessibleCountdown.innerHTML = $this.countdownExpiredText;
|
|
91
|
-
setTimeout($this.redirect.bind($this), 2000);
|
|
92
|
-
}
|
|
80
|
+
$this.countdown.innerHTML = '<span class="ons-u-fw-b">' + $this.countdownExpiredText + '</span>';
|
|
81
|
+
$this.accessibleCountdown.innerHTML = $this.countdownExpiredText;
|
|
82
|
+
setTimeout($this.redirect.bind($this), 2000);
|
|
93
83
|
} else {
|
|
94
84
|
seconds--;
|
|
95
85
|
$this.expiryTimeInMilliseconds = seconds * 1000;
|
|
@@ -111,24 +101,10 @@ export default class Timeout {
|
|
|
111
101
|
})();
|
|
112
102
|
}
|
|
113
103
|
|
|
114
|
-
async hasExpiryTimeResetInAnotherTab() {
|
|
115
|
-
const checkExpiryTime = await this.getExpiryTime();
|
|
116
|
-
|
|
117
|
-
if (checkExpiryTime != this.expiryTime) {
|
|
118
|
-
this.expiryTime = checkExpiryTime;
|
|
119
|
-
this.expiryTimeInMilliseconds = this.convertTimeToMilliSeconds(checkExpiryTime);
|
|
120
|
-
this.restartTimeout(this.expiryTimeInMilliseconds);
|
|
121
|
-
} else {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
104
|
async restartTimeout(timeInMilliSeconds) {
|
|
127
105
|
this.clearTimers();
|
|
128
|
-
clearInterval(this.shouldRestartCheck);
|
|
129
106
|
this.countdownStarted = false;
|
|
130
|
-
|
|
131
|
-
if (timeInMilliSeconds) {
|
|
107
|
+
if (timeInMilliSeconds !== false) {
|
|
132
108
|
this.expiryTimeInMilliseconds = timeInMilliSeconds;
|
|
133
109
|
} else {
|
|
134
110
|
const createNewExpiryTime = await this.setNewExpiryTime();
|
|
@@ -138,10 +114,10 @@ export default class Timeout {
|
|
|
138
114
|
}
|
|
139
115
|
|
|
140
116
|
async handleWindowFocus() {
|
|
141
|
-
this.expiryTime = await this.getExpiryTime();
|
|
142
117
|
this.clearTimers();
|
|
143
|
-
|
|
144
|
-
|
|
118
|
+
if (this.countdownStarted) {
|
|
119
|
+
this.startUiCountdown();
|
|
120
|
+
}
|
|
145
121
|
}
|
|
146
122
|
|
|
147
123
|
async setNewExpiryTime() {
|
package/layout/_template.njk
CHANGED
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
</div>
|
|
192
192
|
{% endset %}
|
|
193
193
|
{% endif %}
|
|
194
|
-
{% if pageConfig.asideCol.position is defined and pageConfig.asideCol.position == "before" %}
|
|
194
|
+
{% if pageConfig.asideCol is defined and pageConfig.asideCol and pageConfig.asideCol.position is defined and pageConfig.asideCol.position == "before" %}
|
|
195
195
|
{{ aside | safe }}
|
|
196
196
|
{% endif %}
|
|
197
197
|
<div class="ons-grid__col ons-col-{{ mainColNumber }}@m{{ mainColClasses }}">
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
{% block main %}{% endblock %}
|
|
200
200
|
</main>
|
|
201
201
|
</div>
|
|
202
|
-
{% if pageConfig.asideCol.position is defined and pageConfig.asideCol.position == "after" %}
|
|
202
|
+
{% if pageConfig.asideCol is defined and pageConfig.asideCol and pageConfig.asideCol.position is defined and pageConfig.asideCol.position == "after" %}
|
|
203
203
|
{{ aside | safe }}
|
|
204
204
|
{% endif %}
|
|
205
205
|
</div>
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ons/design-system",
|
|
3
3
|
"description": "ONS Design System built CSS, JS, and Nunjucks templates",
|
|
4
|
-
"version": "46.1.
|
|
4
|
+
"version": "46.1.3",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
8
|
-
"name": "
|
|
9
|
-
"email": "bameyrick@gmail.com",
|
|
10
|
-
"url": "https://github.com/bameyrick"
|
|
8
|
+
"name": "ONS Digital"
|
|
11
9
|
},
|
|
12
10
|
"scripts": {
|
|
13
11
|
"start": "gulp start",
|
|
@@ -80,8 +78,8 @@
|
|
|
80
78
|
"chai": "^4.3.4",
|
|
81
79
|
"chai-as-promised": "^7.1.1",
|
|
82
80
|
"chai-spies": "^1.0.0",
|
|
83
|
-
"codecov": "3.
|
|
84
|
-
"core-js": "^3.
|
|
81
|
+
"codecov": "^3.8.3",
|
|
82
|
+
"core-js": "^3.21.1",
|
|
85
83
|
"cssnano": "^4.1.11",
|
|
86
84
|
"dialog-polyfill": "^0.5.6",
|
|
87
85
|
"eslint": "^5.9.0",
|
|
@@ -121,7 +119,7 @@
|
|
|
121
119
|
"karma-mocha-reporter": "^2.2.5",
|
|
122
120
|
"lighthouse": "^7.5.0",
|
|
123
121
|
"lint-staged": "^8.1.0",
|
|
124
|
-
"lodash": "^4.17.
|
|
122
|
+
"lodash": "^4.17.21",
|
|
125
123
|
"marked": "^2.1.3",
|
|
126
124
|
"mdn-polyfills": "^5.14.0",
|
|
127
125
|
"minimist": "^1.2.5",
|