@govuk-one-login/frontend-ui 4.0.0 → 4.1.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.
package/build/all.css CHANGED
@@ -1 +1 @@
1
- @media(max-width: 640px){.govuk-header__navigation-item{border-left:none !important}.govuk-template--rebranded .govuk-header__navigation-list{padding-bottom:0px !important}.govuk-header__navigation-item{padding-top:8px !important}}.frontendUi_header_signOut-item{padding:5px 0px 5px 30px;border-left:1px solid #b1b4b6;margin-left:auto}.frontendUi_header_signOut-item--rebrand{border-left:none;padding:5px 0px 5px 0px;margin-left:auto;font-weight:700 !important}.frontendUi_header__signOut{display:flex;flex-wrap:wrap}.frontendUi-header__content{margin-left:auto}.govuk-header__navigation--signOut{padding:15px 0 15px !important}.govuk-template--rebranded .govuk-header__navigation{padding:15px 0 15px !important}@media(max-width: 640px){.govuk-header__navigation--signOut{padding:18px 0 8px !important}.govuk-template--rebranded .govuk-header__navigation{padding:18px 0 8px !important}}.govuk-template--rebranded .govuk-header__navigation-item a{font-weight:700 !important}.govuk-template--rebranded .govuk-header__navigation-item{padding-top:5px !important}@media(min-width: 20em)and (max-width: 48.0525em){.govuk-template--rebranded .govuk-header__navigation-list{padding-bottom:0px}}@media(max-width: 323px){.govuk-header__logo{padding-right:5px}.frontendUi_header_signOut-item{padding-left:0px}}@media(max-width: 261px){.frontendUi-header__content{margin-left:unset}.govuk-template--rebranded .govuk-header__navigation{padding:0px 0 8px !important}.govuk-header__logotype{max-width:100%;max-height:auto}.govuk-template--rebranded .govuk-header__logo{padding-top:5% !important;padding-bottom:5% !important}}.govuk-tag{font-size:16px;font-weight:bold;line-height:1;display:inline-block;padding-top:5px;padding-right:8px;padding-bottom:4px;padding-left:8px;outline:2px solid rgba(0,0,0,0);outline-offset:-2px;color:#fff !important;background-color:#1d70b8 !important;letter-spacing:1px !important;text-decoration:none !important;text-transform:uppercase !important}@media(max-width: 256px){.govuk-phase-banner__content{display:block}}.language-select{margin:15px 0 15px 0}.language-select__list{margin-top:1em;text-align:right}.language-select__list-item{display:inline-block}.language-select__list-item:first-child::after{content:"";display:inline-block;position:relative;top:.1875em;height:1em;border-right:.09375em solid #000}.language-select__list-item a,.language-select__list-item [aria-current]{padding:.3125em}@media screen and (max-width: 641px){.language-select__list{float:none;text-align:left;padding-bottom:10px;border-bottom:1px solid #b1b4b6}}.spinner{width:80px;height:80px;border-radius:50%;border-width:12px;border-style:solid;border-color:#dee0e2;border-top-color:#005ea5;margin-bottom:15px}@media(forced-colors: active){.spinner{forced-color-adjust:none;border-top-color:rgba(0,0,0,0) !important}}@media not (prefers-reduced-motion){.spinner{-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}}@media(prefers-reduced-motion){.spinner{transform:rotate(0.125turn)}}.spinner__finished{border-color:#005ea5;-webkit-animation:none;animation:none}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.centre{margin-left:auto;margin-right:auto;text-align:center;display:block}@media(max-width: 256px){.govuk-footer__crown{max-width:100%;max-height:auto}}.govuk-footer{padding-top:25px;padding-bottom:15px;border-top:1px solid #b1b4b6;color:#0b0c0c;background:#f3f2f1}.govuk-template--rebranded .govuk-footer{border-top:10px solid #1d70b8;background:#f4f8fb}.govuk-footer__copyright-logo::before{background:#6e777a}.govuk-template--rebranded .govuk-footer__copyright-logo::before{background:currentcolor}.govuk-button--progress{border-bottom:8px;position:relative}.govuk-button--progress-loading{background-color:#505a5f !important;color:#fff !important;pointer-events:none !important;padding-left:40px !important}@keyframes rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.govuk-button--progress-loading::before{content:"";border:3px solid hsla(0,0%,100%,.35);border-top:3px solid #fff;border-radius:50%;width:20px;height:20px;animation:rotate 1s infinite linear;position:absolute;top:12% !important;left:8px}@media(prefers-reduced-motion: reduce){.govuk-button--progress-loading{animation:none}}
1
+ @media(max-width: 640px){.govuk-header__navigation-item{border-left:none !important}.govuk-template--rebranded .govuk-header__navigation-list{padding-bottom:0px !important}.govuk-header__navigation-item{padding-top:8px !important}}.frontendUi_header_signOut-item{padding:5px 0px 5px 30px;border-left:1px solid #b1b4b6;margin-left:auto}.frontendUi_header_signOut-item--rebrand{border-left:none;padding:5px 0px 5px 0px;margin-left:auto;font-weight:700 !important}.frontendUi_header__signOut{display:flex;flex-wrap:wrap}.frontendUi-header__content{margin-left:auto}.govuk-header__navigation--signOut{padding:15px 0 15px !important}.govuk-template--rebranded .govuk-header__navigation{padding:15px 0 15px !important}@media(max-width: 640px){.govuk-header__navigation--signOut{padding:18px 0 8px !important}.govuk-template--rebranded .govuk-header__navigation{padding:18px 0 8px !important}}.govuk-template--rebranded .govuk-header__navigation-item a{font-weight:700 !important}.govuk-template--rebranded .govuk-header__navigation-item{padding-top:5px !important}@media(min-width: 20em)and (max-width: 48.0525em){.govuk-template--rebranded .govuk-header__navigation-list{padding-bottom:0px}}@media(max-width: 323px){.govuk-header__logo{padding-right:5px}.frontendUi_header_signOut-item{padding-left:0px}}@media(max-width: 261px){.frontendUi-header__content{margin-left:unset}.govuk-template--rebranded .govuk-header__navigation{padding:0px 0 8px !important}.govuk-header__logotype{max-width:100%;max-height:auto}.govuk-template--rebranded .govuk-header__logo{padding-top:5% !important;padding-bottom:5% !important}}.govuk-tag{font-size:16px;font-weight:bold;line-height:1;display:inline-block;padding-top:5px;padding-right:8px;padding-bottom:4px;padding-left:8px;outline:2px solid rgba(0,0,0,0);outline-offset:-2px;color:#fff !important;background-color:#1d70b8 !important;letter-spacing:1px !important;text-decoration:none !important;text-transform:uppercase !important}@media(max-width: 256px){.govuk-phase-banner__content{display:block}}.language-select{margin:15px 0 15px 0}.language-select__list{margin-top:1em;text-align:right}.language-select__list-item{display:inline-block}.language-select__list-item:first-child::after{content:"";display:inline-block;position:relative;top:.1875em;height:1em;border-right:.09375em solid #000}.language-select__list-item a,.language-select__list-item [aria-current]{padding:.3125em}@media screen and (max-width: 641px){.language-select__list{float:none;text-align:left;padding-bottom:10px;border-bottom:1px solid #b1b4b6}}.spinner{width:80px;height:80px;border-radius:50%;border-width:12px;border-style:solid;border-color:#dee0e2;border-top-color:#005ea5;margin-bottom:15px}@media(forced-colors: active){.spinner{forced-color-adjust:none;border-top-color:rgba(0,0,0,0) !important}}@media not (prefers-reduced-motion){.spinner{-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}}@media(prefers-reduced-motion){.spinner{transform:rotate(0.125turn)}}.spinner__finished{border-color:#005ea5;-webkit-animation:none;animation:none}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.centre{margin-left:auto;margin-right:auto;text-align:center;display:block}@media(max-width: 256px){.govuk-footer__crown{max-width:100%;max-height:auto}}.govuk-footer{padding-top:25px;padding-bottom:15px;border-top:1px solid #b1b4b6;color:#0b0c0c;background:#f3f2f1}.govuk-template--rebranded .govuk-footer{border-top:10px solid #1d70b8;background:#f4f8fb}.govuk-footer__copyright-logo::before{background:#6e777a}.govuk-template--rebranded .govuk-footer__copyright-logo::before{background:currentcolor}.govuk-button--progress{position:relative}.govuk-button--progress-loading{background-color:#505a5f !important;color:#fff !important;pointer-events:none !important;padding-left:40px !important}@keyframes rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.govuk-button--progress-loading::before{content:"";border:3px solid hsla(0,0%,100%,.35);border-top:3px solid #fff;border-radius:50%;width:20px;height:20px;animation:rotate 1s infinite linear;position:absolute;top:12% !important;left:8px}@media(prefers-reduced-motion: reduce){.govuk-button--progress-loading{padding-left:10px !important}.govuk-button--progress-loading::before{display:none}}
@@ -290,6 +290,12 @@ class Spinner {
290
290
  }
291
291
 
292
292
  function initialiseProgressButtons(document = window.document) {
293
+ // Create a single live region for button status announcements
294
+ const statusRegion = document.createElement('div');
295
+ statusRegion.setAttribute('aria-live', 'assertive');
296
+ statusRegion.setAttribute('role', 'status');
297
+ statusRegion.className = 'govuk-visually-hidden';
298
+ document.body.appendChild(statusRegion);
293
299
  const progressButtons = Array.prototype.slice.call(document.querySelectorAll('[data-frontendui="di-progress-button"]'));
294
300
  function findClosestForm(element) {
295
301
  let el = element;
@@ -301,6 +307,15 @@ function initialiseProgressButtons(document = window.document) {
301
307
  progressButtons.forEach(function (button) {
302
308
  const form = findClosestForm(button);
303
309
  let isSubmitting = false;
310
+ // Handle spacebar press for anchor tags
311
+ if (button.tagName.toLowerCase() === 'a') {
312
+ button.addEventListener('keydown', function (event) {
313
+ if (event.code === 'Space') {
314
+ event.preventDefault();
315
+ button.click();
316
+ }
317
+ });
318
+ }
304
319
  button.addEventListener('click', function (event) {
305
320
  if (isSubmitting) {
306
321
  event.preventDefault();
@@ -343,6 +358,7 @@ function initialiseProgressButtons(document = window.document) {
343
358
  }
344
359
  function handleProgressButtonClick(element, waitingText, longWaitingText, errorPage, isInput) {
345
360
  var originalText = isInput && element instanceof HTMLInputElement ? element.value : element.innerText;
361
+ const statusRegion = document.querySelector('.govuk-visually-hidden[role="status"]');
346
362
  if (typeof element.blur === 'function') {
347
363
  element.blur();
348
364
  }
@@ -358,7 +374,10 @@ function handleProgressButtonClick(element, waitingText, longWaitingText, errorP
358
374
  else {
359
375
  element.innerText = waitingText;
360
376
  }
361
- element.setAttribute('aria-label', waitingText);
377
+ // Announce the initial waiting state
378
+ if (statusRegion) {
379
+ statusRegion.textContent = waitingText;
380
+ }
362
381
  var longWaitTimeout = window.setTimeout(function () {
363
382
  if (isInput && element instanceof HTMLInputElement) {
364
383
  element.value = longWaitingText;
@@ -366,7 +385,10 @@ function handleProgressButtonClick(element, waitingText, longWaitingText, errorP
366
385
  else {
367
386
  element.innerText = longWaitingText;
368
387
  }
369
- element.setAttribute('aria-label', longWaitingText);
388
+ // Announce the long wait state
389
+ if (statusRegion) {
390
+ statusRegion.textContent = longWaitingText;
391
+ }
370
392
  }, 5000);
371
393
  var errorTimeout = window.setTimeout(function () {
372
394
  window.location.href = errorPage;
@@ -385,7 +407,11 @@ function handleProgressButtonClick(element, waitingText, longWaitingText, errorP
385
407
  else {
386
408
  element.innerText = originalText;
387
409
  }
388
- element.setAttribute('aria-label', originalText);
410
+ // Clear status region without announcement
411
+ const statusRegion = document.querySelector('.govuk-visually-hidden[role="status"]');
412
+ if (statusRegion) {
413
+ statusRegion.textContent = '';
414
+ }
389
415
  window.clearTimeout(errorTimeout);
390
416
  window.clearTimeout(longWaitTimeout);
391
417
  }
@@ -1 +1 @@
1
- {"version":3,"file":"progress-button.d.ts","sourceRoot":"","sources":["../../../../frontend-src/progress-button/progress-button.ts"],"names":[],"mappings":"AAAA,wBAAgB,yBAAyB,CAAC,QAAQ,GAAE,QAA0B,QAgE7E"}
1
+ {"version":3,"file":"progress-button.d.ts","sourceRoot":"","sources":["../../../../frontend-src/progress-button/progress-button.ts"],"names":[],"mappings":"AAAA,wBAAgB,yBAAyB,CAAC,QAAQ,GAAE,QAA0B,QAiF7E"}
@@ -3,7 +3,9 @@
3
3
  {% set assetPath = "/public/rebrand"%}
4
4
  {% endif %}
5
5
 
6
- {% set isPageDataSensitive = true %}
6
+ {% if isPageDataSensitive is not defined %}
7
+ {% set isPageDataSensitive = true %}
8
+ {% endif %}
7
9
  {% set taxLevel1 = 'web cri' %}
8
10
 
9
11
  {% extends "form-template.njk" %}
@@ -3,7 +3,9 @@
3
3
  {% set assetPath = "/public/rebrand"%}
4
4
  {% endif %}
5
5
 
6
- {% set isPageDataSensitive = true %}
6
+ {% if isPageDataSensitive is not defined %}
7
+ {% set isPageDataSensitive = true %}
8
+ {% endif %}
7
9
  {% set taxLevel1 = 'web cri' %}
8
10
 
9
11
  {% extends "hmpo-template.njk" %}
@@ -2,7 +2,9 @@
2
2
  {% set govukRebrand = true %}
3
3
  {% endif %}
4
4
 
5
- {% set isPageDataSensitive = true %}
5
+ {% if isPageDataSensitive is not defined %}
6
+ {% set isPageDataSensitive = true %}
7
+ {% endif %}
6
8
  {% set taxLevel1 = 'web cri' %}
7
9
  {% set taxLevel2 = 'pre cri' %}
8
10
 
@@ -1,5 +1,4 @@
1
1
  .govuk-button--progress{
2
- border-bottom: 8px;
3
2
  position: relative;
4
3
  }
5
4
 
@@ -35,8 +34,12 @@
35
34
  }
36
35
 
37
36
  @media (prefers-reduced-motion: reduce) {
38
- .govuk-button--progress-loading {
39
- animation: none;
37
+ .govuk-button--progress-loading {
38
+ padding-left: 10px !important;
39
+
40
+ &::before {
41
+ display: none;
42
+ }
40
43
  }
41
44
  }
42
45
 
@@ -65,8 +65,7 @@ treat it as an interactive element - without this it will be
65
65
  </div>
66
66
  </noscript>
67
67
 
68
- <a href="{{ params.href if params.href else '#' }}" role="button" draggable="false" {{- commonAttributes | safe }} class = "{{ classNames }}"
69
- aria-live="assertive" data-frontendui="di-progress-button" data-waiting-text="{{ progressButton.waitingText }}" data-long-waiting-text="{{ progressButton.longWaitingText }}" data-error-page="{{ params.errorPage | default('#') }}" >
68
+ <a href="{{ params.href if params.href else '#' }}" role="button" draggable="false" {{- commonAttributes | safe }} class = "{{ classNames }}" data-frontendui="di-progress-button" data-waiting-text="{{ progressButton.waitingText }}" data-long-waiting-text="{{ progressButton.longWaitingText }}" data-error-page="{{ params.errorPage | default('#') }}" >
70
69
  {% if params.html %}
71
70
  {{ params.html | safe }}
72
71
  {% elseif params.text %}
@@ -86,8 +85,7 @@ aria-live="assertive" data-frontendui="di-progress-button" data-waiting-text="{{
86
85
  </div>
87
86
  </noscript>
88
87
 
89
- <button {%- if params.value %} value="{{ params.value }}"{% endif %}{%- if params.type %} type="{{ params.type }}"{% endif %} {{- buttonAttributes | safe }} {{- commonAttributes | safe }} class = "{{ classNames }}"
90
- aria-live="assertive" data-frontendui="di-progress-button" data-waiting-text="{{ progressButton.waitingText }}" data-long-waiting-text="{{ progressButton.longWaitingText }}" data-error-page="{{ params.errorPage | default('#') }}" >
88
+ <button {%- if params.value %} value="{{ params.value }}"{% endif %}{%- if params.type %} type="{{ params.type }}"{% endif %} {{- buttonAttributes | safe }} {{- commonAttributes | safe }} class = "{{ classNames }}" data-frontendui="di-progress-button" data-waiting-text="{{ progressButton.waitingText }}" data-long-waiting-text="{{ progressButton.longWaitingText }}" data-error-page="{{ params.errorPage | default('#') }}" >
91
89
  {% if params.html %}
92
90
  {{ params.html | safe }}
93
91
  {% elseif params.text %}
@@ -107,8 +105,7 @@ aria-live="assertive" data-frontendui="di-progress-button" data-waiting-text="{{
107
105
  {{ progressButton.noJavascriptMessage }}
108
106
  </div>
109
107
  </noscript>
110
- <input value="{{ params.value }}" type="{{ params.type if params.type else 'submit'}}"{{- buttonAttributes | safe }} {{- commonAttributes | safe }} class = "{{ classNames }}"
111
- aria-live="assertive" data-frontendui="di-progress-button" data-waiting-text="{{ progressButton.waitingText }}" data-long-waiting-text="{{ progressButton.longWaitingText }}" data-error-page="{{ params.errorPage | default('#') }}" >
108
+ <input value="{{ params.value }}" type="{{ params.type if params.type else 'submit'}}"{{- buttonAttributes | safe }} {{- commonAttributes | safe }} class = "{{ classNames }}" data-frontendui="di-progress-button" data-waiting-text="{{ progressButton.waitingText }}" data-long-waiting-text="{{ progressButton.longWaitingText }}" data-error-page="{{ params.errorPage | default('#') }}" >
112
109
  {{- iconHtml | safe | trim | indent(2, true) if iconHtml -}}
113
110
  </div>
114
111
 
@@ -288,6 +288,12 @@ class Spinner {
288
288
  }
289
289
 
290
290
  function initialiseProgressButtons(document = window.document) {
291
+ // Create a single live region for button status announcements
292
+ const statusRegion = document.createElement('div');
293
+ statusRegion.setAttribute('aria-live', 'assertive');
294
+ statusRegion.setAttribute('role', 'status');
295
+ statusRegion.className = 'govuk-visually-hidden';
296
+ document.body.appendChild(statusRegion);
291
297
  const progressButtons = Array.prototype.slice.call(document.querySelectorAll('[data-frontendui="di-progress-button"]'));
292
298
  function findClosestForm(element) {
293
299
  let el = element;
@@ -299,6 +305,15 @@ function initialiseProgressButtons(document = window.document) {
299
305
  progressButtons.forEach(function (button) {
300
306
  const form = findClosestForm(button);
301
307
  let isSubmitting = false;
308
+ // Handle spacebar press for anchor tags
309
+ if (button.tagName.toLowerCase() === 'a') {
310
+ button.addEventListener('keydown', function (event) {
311
+ if (event.code === 'Space') {
312
+ event.preventDefault();
313
+ button.click();
314
+ }
315
+ });
316
+ }
302
317
  button.addEventListener('click', function (event) {
303
318
  if (isSubmitting) {
304
319
  event.preventDefault();
@@ -341,6 +356,7 @@ function initialiseProgressButtons(document = window.document) {
341
356
  }
342
357
  function handleProgressButtonClick(element, waitingText, longWaitingText, errorPage, isInput) {
343
358
  var originalText = isInput && element instanceof HTMLInputElement ? element.value : element.innerText;
359
+ const statusRegion = document.querySelector('.govuk-visually-hidden[role="status"]');
344
360
  if (typeof element.blur === 'function') {
345
361
  element.blur();
346
362
  }
@@ -356,7 +372,10 @@ function handleProgressButtonClick(element, waitingText, longWaitingText, errorP
356
372
  else {
357
373
  element.innerText = waitingText;
358
374
  }
359
- element.setAttribute('aria-label', waitingText);
375
+ // Announce the initial waiting state
376
+ if (statusRegion) {
377
+ statusRegion.textContent = waitingText;
378
+ }
360
379
  var longWaitTimeout = window.setTimeout(function () {
361
380
  if (isInput && element instanceof HTMLInputElement) {
362
381
  element.value = longWaitingText;
@@ -364,7 +383,10 @@ function handleProgressButtonClick(element, waitingText, longWaitingText, errorP
364
383
  else {
365
384
  element.innerText = longWaitingText;
366
385
  }
367
- element.setAttribute('aria-label', longWaitingText);
386
+ // Announce the long wait state
387
+ if (statusRegion) {
388
+ statusRegion.textContent = longWaitingText;
389
+ }
368
390
  }, 5000);
369
391
  var errorTimeout = window.setTimeout(function () {
370
392
  window.location.href = errorPage;
@@ -383,7 +405,11 @@ function handleProgressButtonClick(element, waitingText, longWaitingText, errorP
383
405
  else {
384
406
  element.innerText = originalText;
385
407
  }
386
- element.setAttribute('aria-label', originalText);
408
+ // Clear status region without announcement
409
+ const statusRegion = document.querySelector('.govuk-visually-hidden[role="status"]');
410
+ if (statusRegion) {
411
+ statusRegion.textContent = '';
412
+ }
387
413
  window.clearTimeout(errorTimeout);
388
414
  window.clearTimeout(longWaitTimeout);
389
415
  }
@@ -1 +1 @@
1
- {"version":3,"file":"progress-button.d.ts","sourceRoot":"","sources":["../../../../frontend-src/progress-button/progress-button.ts"],"names":[],"mappings":"AAAA,wBAAgB,yBAAyB,CAAC,QAAQ,GAAE,QAA0B,QAgE7E"}
1
+ {"version":3,"file":"progress-button.d.ts","sourceRoot":"","sources":["../../../../frontend-src/progress-button/progress-button.ts"],"names":[],"mappings":"AAAA,wBAAgB,yBAAyB,CAAC,QAAQ,GAAE,QAA0B,QAiF7E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-one-login/frontend-ui",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "",
5
5
  "main": "build/cjs/backend/index.cjs",
6
6
  "module": "build/esm/backend/index.js",
@@ -59,6 +59,6 @@
59
59
  "types": "./build/esm/backend/index.d.ts",
60
60
  "optionalDependencies": {
61
61
  "hmpo-components": "^7.1.0",
62
- "@govuk-one-login/frontend-analytics": "^4.0.3"
62
+ "@govuk-one-login/frontend-analytics": "^4.0.5"
63
63
  }
64
64
  }