@govuk-one-login/frontend-ui 1.0.2 → 1.2.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/README.md +33 -7
- package/build/all.css +1 -1
- package/build/cjs/index-fe.cjs +122 -0
- package/build/cjs/index.cjs +44 -8
- package/build/cjs/index.d.cts +38 -0
- package/build/cjs/index.d.ts +25 -16
- package/build/cjs/index.d.ts.map +1 -1
- package/build/components/_all.scss +2 -0
- package/build/components/bases/auth/auth-base.njk +137 -0
- package/build/components/bases/home/home-base.njk +135 -0
- package/build/components/bases/identity/identity-base-form.njk +14 -1
- package/build/components/bases/identity/identity-base-page.njk +11 -4
- package/build/components/bases/ipv-core/ipv-core-base.njk +154 -0
- package/build/components/bases/mobile/mobile-base.njk +129 -0
- package/build/components/cookie-banner/template.njk +1 -1
- package/build/components/footer/_index.scss +8 -0
- package/build/components/footer/template.njk +7 -4
- package/build/components/header/_index.scss +54 -0
- package/build/components/header/template.njk +36 -85
- package/build/components/macros/logo.njk +75 -0
- package/build/components/phase-banner/_index.scss +16 -16
- package/build/components/phase-banner/template.njk +4 -0
- package/build/components/spinner/README.md +107 -0
- package/build/components/spinner/_index.scss +64 -0
- package/build/components/spinner/api.njk +27 -0
- package/build/components/spinner/javascript/spinner.js +118 -0
- package/build/components/spinner/macro.njk +3 -0
- package/build/components/spinner/template.njk +11 -0
- package/build/esm/index-fe.js +120 -0
- package/build/esm/index.d.ts +25 -16
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +43 -9
- package/build/frontendUiAssets/images/favicon.ico +0 -0
- package/build/frontendUiAssets/images/favicon.svg +1 -0
- package/build/frontendUiAssets/images/govuk-crest.svg +1 -0
- package/build/frontendUiAssets/images/govuk-icon-180.png +0 -0
- package/build/frontendUiAssets/images/govuk-icon-192.png +0 -0
- package/build/frontendUiAssets/images/govuk-icon-512.png +0 -0
- package/build/frontendUiAssets/images/govuk-icon-mask.svg +1 -0
- package/build/frontendUiAssets/images/govuk-opengraph-image.png +0 -0
- package/package.json +15 -5
|
@@ -1,88 +1,39 @@
|
|
|
1
|
+
{% from "../macros/logo.njk" import govukLogo %}
|
|
1
2
|
{% set header = params.translations %}
|
|
2
|
-
{#- We use an inline SVG for the crown so that we can cascade the
|
|
3
|
-
currentColor into the crown whilst continuing to support older browsers
|
|
4
|
-
which do not support external SVGs without a Javascript polyfill. This
|
|
5
|
-
adds approximately 1kb to every page load.
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{%
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class="govuk-header__logotype-crown"
|
|
42
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
43
|
-
viewBox="0 0 32 30"
|
|
44
|
-
height="30"
|
|
45
|
-
width="32"
|
|
46
|
-
>
|
|
47
|
-
<path
|
|
48
|
-
fill="currentColor" fill-rule="evenodd"
|
|
49
|
-
d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.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-1.2-.7-3.1 0-2 2.3.6-1.4 1.8-1.1 2.1.1.2.9-.3 1.9-1.5 2.1-.9.2-2.4-.5-3.5-3 .6 0 1.2.3 2 .9l-1.2-4c-.3 1.1-.7 1.9-1.1 2.3-.3-.8-.2-1.4 0-2.7l-2.9.9C1.3 23 2.6 25.5 3.7 30c3.7-.5 7.9-.8 12.3-.8"></path>
|
|
50
|
-
</svg>
|
|
51
|
-
<!--<![endif]-->
|
|
52
|
-
<!--[if IE 8]>
|
|
53
|
-
<img src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-tudor-crown.png" class="govuk-header__logotype-crown-fallback-image" width="32" height="30" alt="">
|
|
54
|
-
<![endif]-->
|
|
55
|
-
{% endset %}
|
|
56
|
-
|
|
57
|
-
<header class="govuk-header {{ params.classes if params.classes }}" role="banner" data-module="govuk-header"
|
|
58
|
-
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
|
|
59
|
-
<div class="frontendUi_header__signOut govuk-header__container {{ params.containerClasses | default('govuk-width-container') }}">
|
|
60
|
-
<div class="govuk-header__logo">
|
|
61
|
-
{% if params.isEmbeddedMobileApp %}
|
|
62
|
-
<span class="govuk-header__link govuk-header__link--homepage" style="pointer-events: none;">
|
|
63
|
-
{% else %}
|
|
64
|
-
<a href="{{ params.homepageUrl | default('https://www.gov.uk/') }}" class="govuk-header__link govuk-header__link--homepage">
|
|
65
|
-
{% endif %}
|
|
66
|
-
<span class="govuk-header__logotype">
|
|
67
|
-
{{ (_stEdwardsCrown if params.useStEdwardsCrown else _tudorCrown) | safe }}
|
|
68
|
-
<span class="govuk-header__logotype-text">
|
|
69
|
-
GOV.UK
|
|
70
|
-
</span>
|
|
71
|
-
</span>
|
|
72
|
-
</a>
|
|
73
|
-
</div>
|
|
74
|
-
{% if params.signOutLink %}
|
|
75
|
-
<div class="frontendUi-header__content govuk-header__content">
|
|
76
|
-
<nav aria-label="{{ params.navigationLabel | default(menuButtonText) }}" class="govuk-header__navigation {{ params.navigationClasses if params.navigationClasses }}">
|
|
77
|
-
<ul id="navigation" class="frontendUi_header__signOut govuk-header__navigation-list">
|
|
78
|
-
<li class="frontendUi_header_signOut-item govuk-header__navigation-item{{ ' govuk-header__navigation-item--active' if item.active }}">
|
|
79
|
-
<a aria-label="{{header.ariaLabel}}" class="govuk-header__link" href="{{params.signOutLink}}">
|
|
80
|
-
{{header.signOut}}
|
|
81
|
-
</a>
|
|
82
|
-
</li>
|
|
83
|
-
</ul>
|
|
84
|
-
</nav>
|
|
4
|
+
{%if May_2025_Rebrand%}
|
|
5
|
+
{%- set _rebrand = params.rebrand | default(govukRebrand() if govukRebrand is callable else govukRebrand) -%}
|
|
6
|
+
{% endif %}
|
|
7
|
+
<header class="govuk-header {%- if params.classes %} {{ params.classes }}{% endif %}" data-module="govuk-header">
|
|
8
|
+
<div class="frontendUi_header__signOut govuk-header__container {{ params.containerClasses | default("govuk-width-container", true) }}">
|
|
9
|
+
<div class="govuk-header__logo">
|
|
10
|
+
{% if params.isEmbeddedMobileApp %}
|
|
11
|
+
<span class="govuk-header__link govuk-header__link--homepage" style="pointer-events: none;">
|
|
12
|
+
{% else %}
|
|
13
|
+
<a href="{{ params.homepageUrl | default('https://www.gov.uk/') }}" class="govuk-header__link govuk-header__link--homepage">
|
|
14
|
+
{% endif %}
|
|
15
|
+
{{ govukLogo({
|
|
16
|
+
classes: "govuk-header__logotype",
|
|
17
|
+
ariaLabelText: "GOV.UK",
|
|
18
|
+
useTudorCrown: params.useTudorCrown,
|
|
19
|
+
rebrand: May_2025_Rebrand
|
|
20
|
+
}) | trim | indent(8) }}
|
|
21
|
+
{% if not params.isEmbeddedMobileApp %}
|
|
22
|
+
</a>
|
|
23
|
+
{% endif %}
|
|
24
|
+
</div>
|
|
25
|
+
{% if params.signOutLink %}
|
|
26
|
+
<div class="frontendUi-header__content govuk-header__content">
|
|
27
|
+
<nav aria-label="{{header.ariaLabel}}" class="govuk-header__navigation {{ govuk-header__navigation--signOut if params.May_2025_Rebrand }}">
|
|
28
|
+
<ul id="navigation" class="frontendUi_header__signOut govuk-header__navigation-list">
|
|
29
|
+
<li class="{{ 'frontendUi_header_signOut-item--rebrand' if May_2025_Rebrand }} {{'frontendUi_header_signOut-item' if not May_2025_Rebrand}} govuk-header__navigation-item{{ ' govuk-header__navigation-item--active' if item.active }}">
|
|
30
|
+
<a aria-label="{{header.signOutAriaLabel}}" class="govuk-header__link" href="{{params.signOutLink}}">
|
|
31
|
+
{{header.signOut}}
|
|
32
|
+
</a>
|
|
33
|
+
</li>
|
|
34
|
+
</ul>
|
|
35
|
+
</nav>
|
|
36
|
+
</div>
|
|
37
|
+
{% endif %}
|
|
85
38
|
</div>
|
|
86
|
-
|
|
87
|
-
</div>
|
|
88
|
-
</header>
|
|
39
|
+
</header>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{#- This macro is for interal use within GOV.UK Frontend. It isn't intended for
|
|
2
|
+
external use and may receive undocumented breaking changes in non-breaking
|
|
3
|
+
releases of Frontend. #}
|
|
4
|
+
|
|
5
|
+
{% macro govukLogo(params) %}
|
|
6
|
+
{#- Default options #}
|
|
7
|
+
{%- set rebrand = params.rebrand | default(false) %}
|
|
8
|
+
{%- set useLogotype = params.useLogotype | default(true) %}
|
|
9
|
+
{%- set useTudorCrown = params.useTudorCrown | default(true) %}
|
|
10
|
+
|
|
11
|
+
{# Force use of Tudor Crown if rebrand flag is on. #}
|
|
12
|
+
{%- set useTudorCrown = true if rebrand else useTudorCrown %}
|
|
13
|
+
|
|
14
|
+
{#- Calculate how wide the logo needs to be for the given parameters. #}
|
|
15
|
+
{%- set svgWidth = 32 if useTudorCrown else 36 %}
|
|
16
|
+
{%- set svgWidth = svgWidth + 116 if (useLogotype and not rebrand) else svgWidth %}
|
|
17
|
+
{%- set svgWidth = svgWidth + 130 if (useLogotype and rebrand) else svgWidth %}
|
|
18
|
+
|
|
19
|
+
{#- Charles III's Tudor Crown icon has been the default since February 2024. #}
|
|
20
|
+
{%- set _tudorCrown %}
|
|
21
|
+
<g>
|
|
22
|
+
<circle cx="20" cy="17.6" r="3.7"/>
|
|
23
|
+
<circle cx="10.2" cy="23.5" r="3.7"/>
|
|
24
|
+
<circle cx="3.7" cy="33.2" r="3.7"/>
|
|
25
|
+
<circle cx="31.7" cy="30.6" r="3.7"/>
|
|
26
|
+
<circle cx="43.3" cy="17.6" r="3.7"/>
|
|
27
|
+
<circle cx="53.2" cy="23.5" r="3.7"/>
|
|
28
|
+
<circle cx="59.7" cy="33.2" r="3.7"/>
|
|
29
|
+
<circle cx="31.7" cy="30.6" r="3.7"/>
|
|
30
|
+
<path d="M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z"/>
|
|
31
|
+
</g>
|
|
32
|
+
{%- endset %}
|
|
33
|
+
|
|
34
|
+
{#- St. Edward's Crown was the logo under Elizabeth II. It's included to avoid
|
|
35
|
+
a breaking change in services. It can be removed in Frontend v6. #}
|
|
36
|
+
{%- set _stEdwardsCrown %}
|
|
37
|
+
<path d="M13.4,22.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M4.8,27.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-1,2,0,4.2,2,5M2.2,36.9c2,.8,4.2-.2,5-2,.8-2-.2-4.2-2-5-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M23,25.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2s0,4.2,2,5M57.8,22.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2,1,2,0,4.2-2,5M66.4,27.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2,1,2,0,4.2-2,5M69,36.9c-2,.8-4.2-.2-5-2-.8-2,.2-4.2,2-5,2-.8,4.2.2,5,2,.8,2,0,4.2-2,5M48.2,25.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2s0,4.2-2,5M37.6,15.5l4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.4-1.8"/>
|
|
38
|
+
{%- endset %}
|
|
39
|
+
|
|
40
|
+
{#- The GOV.UK logotype with standard dot. This needs to be slightly offset if
|
|
41
|
+
using the St. Edward's Crown, as that crown is wider. #}
|
|
42
|
+
{%- set _logotype %}
|
|
43
|
+
<path {%- if not useTudorCrown %} transform="translate(8 0)"{% endif %} d="M88.6,33.2c0,1.8.2,3.4.6,5s1.2,3,2,4.4c1,1.2,2,2.2,3.4,3s3,1.2,5,1.2,3.4-.2,4.6-.8,2.2-1.4,3-2.2,1.2-1.8,1.6-3c.2-1,.4-2,.4-3v-.4h-10.6v-6.4h18.8v23h-7.4v-5c-.6.8-1.2,1.6-2,2.2-.8.6-1.6,1.2-2.6,1.8-1,.4-2,.8-3.2,1.2s-2.4.4-3.6.4c-3,0-5.8-.6-8-1.6-2.4-1.2-4.4-2.6-6-4.6s-2.8-4.2-3.6-6.8c-.6-2.8-1-5.6-1-8.6s.4-5.8,1.4-8.4,2.2-4.8,4-6.8,3.8-3.4,6.2-4.6c2.4-1.2,5.2-1.6,8.2-1.6s3.8.2,5.6.6c1.8.4,3.4,1.2,4.8,2s2.8,1.8,3.8,3c1.2,1.2,2,2.6,2.8,4l-7.4,4.2c-.4-.8-1-1.8-1.6-2.4-.6-.8-1.2-1.4-2-2s-1.6-1-2.6-1.4-2.2-.4-3.4-.4c-2,0-3.6.4-5,1.2-1.4.8-2.6,1.8-3.4,3-1,1.2-1.6,2.8-2,4.4-.6,1.6-.8,3.8-.8,5.4ZM161.4,24.6c-.8-2.6-2.2-4.8-4-6.8s-3.8-3.4-6.2-4.6c-2.4-1.2-5.2-1.6-8.4-1.6s-5.8.6-8.4,1.6c-2.2,1.2-4.4,2.8-6,4.6-1.8,2-3,4.2-4,6.8-.8,2.6-1.4,5.4-1.4,8.4s.4,5.8,1.4,8.4c.8,2.6,2.2,4.8,4,6.8s3.8,3.4,6.2,4.6c2.4,1.2,5.2,1.6,8.4,1.6s5.8-.6,8.4-1.6c2.4-1.2,4.6-2.6,6.2-4.6,1.8-2,3-4.2,4-6.8.8-2.6,1.4-5.4,1.4-8.4-.2-3-.6-5.8-1.6-8.4h0ZM154,33.2c0,2-.2,3.8-.8,5.4-.4,1.6-1.2,3.2-2.2,4.4s-2.2,2.2-3.4,2.8c-1.4.6-3,1-4.8,1s-3.4-.4-4.8-1-2.6-1.6-3.4-2.8c-1-1.2-1.6-2.6-2.2-4.4-.4-1.6-.8-3.4-.8-5.4v-.2c0-2,.2-3.8.8-5.4.4-1.6,1.2-3.2,2.2-4.4,1-1.2,2.2-2.2,3.4-2.8,1.4-.6,3-1,4.8-1s3.4.4,4.8,1,2.6,1.6,3.4,2.8c1,1.2,1.6,2.6,2.2,4.4.4,1.6.8,3.4.8,5.4v.2ZM177.8,54l-11.8-42h9.4l8,31.4h.2l8-31.4h9.4l-11.8,42h-11.4,0ZM235.4,46.7c1.2,0,2.4-.2,3.4-.6,1-.4,2-.8,2.8-1.6s1.4-1.6,1.8-2.8c.4-1.2.6-2.4.6-4V11.8h8.2v27.2c0,2.4-.4,4.4-1.2,6.2s-2,3.4-3.6,4.8c-1.4,1.4-3.2,2.4-5.4,3-2,.8-4.4,1-6.8,1s-4.8-.4-6.8-1c-2-.8-3.8-1.8-5.4-3-1.6-1.4-2.6-3-3.6-4.8-.8-1.8-1.2-4-1.2-6.2V11.7h8.4v26c0,1.6.2,2.8.6,4,.4,1.2,1,2,1.8,2.8s1.6,1.2,2.8,1.6c1.2.4,2.2.6,3.6.6h0ZM261.4,11.9h8.4v18.2l14.8-18.2h10.4l-14.4,16.8,15.4,25.2h-9.8l-11-18.8-5.4,6v12.8h-8.4V11.9h0ZM206.2,44.2c-3,0-5.4,2.4-5.4,5.4s2.4,5.4,5.4,5.4,5.4-2.4,5.4-5.4-2.4-5.4-5.4-5.4Z"/>
|
|
44
|
+
{%- endset %}
|
|
45
|
+
|
|
46
|
+
{#- The GOV.UK logotype with raised and coloured dot. This is only intended for
|
|
47
|
+
use alongide the Tudor Crown, so don't bother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6-1.4-8.7s.5-6,1.4-8.7,2.3-5.1,4.1-7.1c1.8-2,4-3.6,6.5-4.7s5.4-1.7,8.7-1.7h0ZM152.9,50.4c1.9,0,3.6-.4,5-1.1,1.4-.7,2.7-1.7,3.6-3,1-1.3,1.7-2.8,2.2-4.5.5-1.7.8-3.6.8-5.7v-.2c0-2-.3-3.9-.8-5.7-.5-1.7-1.3-3.3-2.2-4.5-1-1.3-2.2-2.3-3.6-3-1.4-.7-3.1-1.1-5-1.1s-3.6.4-5,1.1c-1.5.7-2.7,1.7-3.6,3s-1.7,2.8-2.2,4.5c-.5,1.7-.8,3.6-.8,5.7v.2c0,2.1.3,4,.8,5.7.5,1.7,1.2,3.2,2.2,4.5,1,1.3,2.2,2.3,3.6,3,1.5.7,3.1,1.1,5,1.1ZM189.1,58l-12.3-44h9.8l8.4,32.9h.3l8.2-32.9h9.7l-12.3,44M262.9,50.4c1.3,0,2.5-.2,3.6-.6,1.1-.4,2-.9,2.8-1.7.8-.8,1.4-1.7,1.9-2.9.5-1.2.7-2.5.7-4.1V14h8.6v28.5c0,2.4-.4,4.6-1.3,6.6-.9,2-2.1,3.6-3.7,5-1.6,1.4-3.4,2.4-5.6,3.2-2.2.7-4.5,1.1-7.1,1.1s-4.9-.4-7.1-1.1c-2.2-.7-4-1.8-5.6-3.2s-2.8-3-3.7-5c-.9-2-1.3-4.1-1.3-6.6V14h8.7v27.2c0,1.6.2,2.9.7,4.1.5,1.2,1.1,2.1,1.9,2.9.8.8,1.7,1.3,2.8,1.7s2.3.6,3.6.6h0ZM288.5,14h8.7v19.1l15.5-19.1h10.8l-15.1,17.6,16.1,26.4h-10.2l-11.5-19.7-5.6,6.3v13.5h-8.7"/>
|
|
52
|
+
{%- endset %}
|
|
53
|
+
|
|
54
|
+
{#- The SVG needs `focusable="false"` so that Internet Explorer does not treat
|
|
55
|
+
it as an interactive element - without this it will be 'focusable' when using
|
|
56
|
+
the keyboard to navigate. #}
|
|
57
|
+
<svg
|
|
58
|
+
focusable="false"
|
|
59
|
+
role="{{ "img" if params.ariaLabelText else "presentation" }}"
|
|
60
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
61
|
+
{#- The viewbox is 2x the actual display dimensions #}
|
|
62
|
+
viewBox="0 0 {{ svgWidth * 2 }} 60"
|
|
63
|
+
height="30"
|
|
64
|
+
width="{{ svgWidth }}"
|
|
65
|
+
fill="currentcolor"
|
|
66
|
+
{%- if params.classes %} class="{{ params.classes }}"{% endif %}
|
|
67
|
+
{%- if params.ariaLabelText %} aria-label="{{ params.ariaLabelText }}"{% endif %}
|
|
68
|
+
>
|
|
69
|
+
{%- if params.ariaLabelText %}<title>{{ params.ariaLabelText }}</title>{% endif %}
|
|
70
|
+
{{ (_stEdwardsCrown if not useTudorCrown else _tudorCrown) | safe | trim | indent(2) }}
|
|
71
|
+
{% if useLogotype %}
|
|
72
|
+
{{ (_dotLogotype if rebrand else _logotype) | safe | trim | indent(2) }}
|
|
73
|
+
{% endif %}
|
|
74
|
+
</svg>
|
|
75
|
+
{% endmacro %}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// Temporarily overwrite the tag component styling to match pre-v5 appearance.
|
|
3
3
|
// This ensures a cohesive phase banner across One Login applications during the transition.
|
|
4
4
|
.govuk-tag {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
@include govuk-font($size: 16, $weight: bold, $line-height: 1);
|
|
6
|
+
display: inline-block;
|
|
7
|
+
padding-top: 5px;
|
|
8
|
+
padding-right: 8px;
|
|
9
|
+
padding-bottom: 4px;
|
|
10
|
+
padding-left: 8px;
|
|
11
|
+
// Accessibility: Ensure visibility for users customizing colours.
|
|
12
|
+
outline: 2px solid transparent;
|
|
13
|
+
outline-offset: -2px;
|
|
14
|
+
// Key properties to maintain the old appearance:
|
|
15
|
+
color: govuk-colour("white") !important;
|
|
16
|
+
background-color: govuk-colour("blue") !important;
|
|
17
|
+
letter-spacing: 1px !important;
|
|
18
|
+
text-decoration: none !important;
|
|
19
|
+
text-transform: uppercase !important;
|
|
20
|
+
}
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
}) | indent(4) | trim }}
|
|
11
11
|
|
|
12
12
|
<span class="govuk-phase-banner__text">
|
|
13
|
+
{% if params.phaseBannerText %}
|
|
14
|
+
{{ params.phaseBannerText }}
|
|
15
|
+
{% else %}
|
|
13
16
|
{{ phaseBanner.text }}
|
|
17
|
+
{% endif %}
|
|
14
18
|
<a class="govuk-link"
|
|
15
19
|
rel="noopener"
|
|
16
20
|
target="_blank"
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
This component can be imported to be displayed before the page loads. Currently the logic has been set up to **display** the spinner.
|
|
4
|
+
|
|
5
|
+
Should you need to ensure it displays before the page renders any data, this should be done within the app.
|
|
6
|
+
|
|
7
|
+
## Timer
|
|
8
|
+
|
|
9
|
+
The timer is set to two seconds and this is done in the route. There is a file called `api.njk` and this binds the data attributes that are needed for the script to be run.
|
|
10
|
+
|
|
11
|
+
```njk
|
|
12
|
+
{% extends "layouts/main.njk" %}
|
|
13
|
+
|
|
14
|
+
{% set url = "/api" %}
|
|
15
|
+
|
|
16
|
+
{% block content %}
|
|
17
|
+
<div id="spinner-container"
|
|
18
|
+
data-initial-heading="Initial heading text"
|
|
19
|
+
data-initial-spinnerStateText="Initial spinner state text"
|
|
20
|
+
data-initial-spinnerState="pending"
|
|
21
|
+
data-error-heading="Error heading"
|
|
22
|
+
data-error-messageText="Error message text"
|
|
23
|
+
data-error-whatYouCanDo-heading="Error what you can do heading"
|
|
24
|
+
data-error-whatYouCanDo-message-text1="Error what you can do message text1"
|
|
25
|
+
data-error-whatYouCanDo-message-link-href="Error what you can do message link href"
|
|
26
|
+
data-error-whatYouCanDo-message-link-text="Error what you can do message link text"
|
|
27
|
+
data-error-whatYouCanDo-message-text2="Error what you can do message link text2"
|
|
28
|
+
data-complete-spinnerState="complete"
|
|
29
|
+
data-longWait-spinnerStateText="Long wait spinner state">
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
{% endblock %}
|
|
33
|
+
|
|
34
|
+
{% block pageScripts %}
|
|
35
|
+
|
|
36
|
+
{% endblock %}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Scripts
|
|
42
|
+
|
|
43
|
+
The script finds the DOM element of the ID `spinner-container` and then runs the animation, it has the flexibility for an error state to be handled or for spinner to take longer/shorter.
|
|
44
|
+
|
|
45
|
+
Within the frontend-ui package, this script is bundled within `frontend-src`, so that it can be used in the alpha-app.
|
|
46
|
+
|
|
47
|
+
Please note that in the `package.json` file of the frontend-ui repo the files needed for the spinner are exported as follows:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"import": "./build/esm/index.js",
|
|
53
|
+
"require": "./build/cjs/index.cjs"
|
|
54
|
+
},
|
|
55
|
+
"./frontend": {
|
|
56
|
+
"import": "./build/esm/index-fe.js",
|
|
57
|
+
"require": "./build/cjs/index-fe.cjs"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The default import is at the top and the one at the bottom ensures, the correct script files are ported when the package is built.
|
|
63
|
+
|
|
64
|
+
Configurations to the alpha-app have also been made to ensure these script files work accordingly however this should not affect any users wanting to use the spinner component from the frontend-ui package.
|
|
65
|
+
|
|
66
|
+
## Routes
|
|
67
|
+
|
|
68
|
+
The way testing is done for visual purposes of the components within the frontend-ui package is through the alpha-app.
|
|
69
|
+
|
|
70
|
+
The routes are set with Express and it is important to note, this route setting is important within the user's application to ensure the spinner works effectively.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
let counter = 0;
|
|
74
|
+
|
|
75
|
+
app.get("/api", (req, res) => {
|
|
76
|
+
counter++;
|
|
77
|
+
const processingTime = req.query.processingTime || 1;
|
|
78
|
+
console.log(
|
|
79
|
+
`Elapsed processing seconds: ${counter}. Processing time limit is: ${processingTime}`,
|
|
80
|
+
);
|
|
81
|
+
if (counter >= processingTime) {
|
|
82
|
+
res.json({ status: "Clear to proceed", counter: counter });
|
|
83
|
+
counter = 0;
|
|
84
|
+
} else {
|
|
85
|
+
res.json({ status: "Still processing", counter: counter });
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This block of code is used **before** any middleware is set, to ensure the params at the end of the route can be captured. This is also helpful as usually the spinner is the first thing to render, whilst the page waits for data to be loaded.
|
|
91
|
+
|
|
92
|
+
There is a counter set here and within `template.njk` the url sets the processing time (defaulted to 2 currently).
|
|
93
|
+
|
|
94
|
+
```njk
|
|
95
|
+
{% block content %}
|
|
96
|
+
|
|
97
|
+
{% set url = "/api?processingTime=2" %}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<div id="spinner-container" data-api-route="{{ url }}">
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
{% endblock %}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
It is important that the url is set and the page uses the correct ID.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.spinner {
|
|
2
|
+
width: 80px;
|
|
3
|
+
height: 80px;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
border-width: 12px;
|
|
6
|
+
border-style: solid;
|
|
7
|
+
border-color: #dee0e2;
|
|
8
|
+
border-top-color: #005ea5;
|
|
9
|
+
margin-bottom: govuk-spacing(3);
|
|
10
|
+
|
|
11
|
+
@media (forced-colors: active) {
|
|
12
|
+
forced-color-adjust: none;
|
|
13
|
+
border-top-color: transparent !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@media not (prefers-reduced-motion) {
|
|
17
|
+
-webkit-animation: spin 2s linear infinite;
|
|
18
|
+
animation: spin 2s linear infinite;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (prefers-reduced-motion) {
|
|
22
|
+
transform: rotate(0.125turn);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__ready {
|
|
26
|
+
border-color: #005ea5;
|
|
27
|
+
-webkit-animation: none;
|
|
28
|
+
animation: none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#spinner-container {
|
|
33
|
+
&__error {
|
|
34
|
+
.spinner,
|
|
35
|
+
.spinner-state-text {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@-webkit-keyframes spin {
|
|
42
|
+
0% {
|
|
43
|
+
-webkit-transform: rotate(0deg);
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
-webkit-transform: rotate(360deg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@keyframes spin {
|
|
51
|
+
0% {
|
|
52
|
+
transform: rotate(0deg);
|
|
53
|
+
}
|
|
54
|
+
100% {
|
|
55
|
+
transform: rotate(360deg);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.centre {
|
|
60
|
+
margin-left: auto;
|
|
61
|
+
margin-right: auto;
|
|
62
|
+
text-align: center;
|
|
63
|
+
display: block;
|
|
64
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{% extends "layouts/main.njk" %}
|
|
2
|
+
|
|
3
|
+
{% set url = "/api" %}
|
|
4
|
+
|
|
5
|
+
{% block content %}
|
|
6
|
+
|
|
7
|
+
<div id="spinner-container"
|
|
8
|
+
data-initial-heading="Initial heading text"
|
|
9
|
+
data-initial-spinnerStateText="Initial spinner state text"
|
|
10
|
+
data-initial-spinnerState="pending"
|
|
11
|
+
data-error-heading="Error heading"
|
|
12
|
+
data-error-messageText="Error message text"
|
|
13
|
+
data-error-whatYouCanDo-heading="Error what you can do heading"
|
|
14
|
+
data-error-whatYouCanDo-message-text1="Error what you can do message text1"
|
|
15
|
+
data-error-whatYouCanDo-message-link-href="Error what you can do message link href"
|
|
16
|
+
data-error-whatYouCanDo-message-link-text="Error what you can do message link text"
|
|
17
|
+
data-error-whatYouCanDo-message-text2="Error what you can do message link text2"
|
|
18
|
+
data-complete-spinnerState="complete"
|
|
19
|
+
data-longWait-spinnerStateText="Long wait spinner state">
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
{% endblock %}
|
|
23
|
+
|
|
24
|
+
{% block pageScripts %}
|
|
25
|
+
|
|
26
|
+
{% endblock %}
|
|
27
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export const WaitInteractions = (() => {
|
|
2
|
+
const content = {
|
|
3
|
+
initial: {
|
|
4
|
+
spinnerState: "pending",
|
|
5
|
+
},
|
|
6
|
+
complete: { spinnerState: "completed" },
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const state = {
|
|
10
|
+
spinnerState: content.initial.spinnerState,
|
|
11
|
+
done: false,
|
|
12
|
+
virtualDom: [],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const timers = {};
|
|
16
|
+
|
|
17
|
+
const createVirtualDom = () => {
|
|
18
|
+
const initialState = [
|
|
19
|
+
{
|
|
20
|
+
nodeName: "div",
|
|
21
|
+
id: "spinner",
|
|
22
|
+
classes: ["spinner", "spinner__pending", "centre", state.spinnerState],
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
return initialState;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const vDomHasChanged = (currentVDom, nextVDom) => {
|
|
30
|
+
return JSON.stringify(currentVDom) !== JSON.stringify(nextVDom);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const updateDom = () => {
|
|
34
|
+
const vDomChanged = vDomHasChanged(state.virtualDom, createVirtualDom());
|
|
35
|
+
const container = document.getElementById("spinner-container");
|
|
36
|
+
|
|
37
|
+
if (vDomChanged) {
|
|
38
|
+
state.virtualDom = createVirtualDom();
|
|
39
|
+
const elements = state?.virtualDom?.map(convert);
|
|
40
|
+
container?.replaceChildren(...elements);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (state.error) {
|
|
44
|
+
container?.classList.add("spinner-container__error");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (state.done) {
|
|
48
|
+
clearInterval(timers.updateDomTimer);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const reflectCompletion = () => {
|
|
53
|
+
state.spinnerState = "spinner__ready";
|
|
54
|
+
state.spinnerStateText = content.complete.spinnerState;
|
|
55
|
+
state.done = true;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const reflectError = () => {
|
|
59
|
+
state.spinnerState = "spinner__failed";
|
|
60
|
+
state.done = true;
|
|
61
|
+
state.error = true;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const convert = (node) => {
|
|
65
|
+
const el = document.createElement(node.nodeName);
|
|
66
|
+
if (node.text) el.textContent = node.text;
|
|
67
|
+
if (node.innerHTML) el.innerHTML = node.innerHTML;
|
|
68
|
+
if (node.id) el.id = node.id;
|
|
69
|
+
if (node.classes) el.classList.add(...node.classes);
|
|
70
|
+
return el;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const notInErrorOrDoneState = () => {
|
|
74
|
+
return !(state.done || state.error);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const requestIDProcessingStatus = async () => {
|
|
78
|
+
const apiRoute =
|
|
79
|
+
document?.getElementById("spinner-container")?.dataset.apiRoute;
|
|
80
|
+
try {
|
|
81
|
+
const response = await fetch(apiRoute);
|
|
82
|
+
|
|
83
|
+
if (response.status !== 200) {
|
|
84
|
+
throw new Error(`Status code ${response.status} received`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const data = await response.json();
|
|
88
|
+
|
|
89
|
+
if (data.status === "Clear to proceed") {
|
|
90
|
+
reflectCompletion();
|
|
91
|
+
} else if (notInErrorOrDoneState()) {
|
|
92
|
+
setTimeout(async () => {
|
|
93
|
+
await requestIDProcessingStatus();
|
|
94
|
+
}, 1000);
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
console.log(e);
|
|
98
|
+
reflectError();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
state: state,
|
|
104
|
+
init: () => {
|
|
105
|
+
timers.updateDomTimer = setInterval(updateDom, 2000);
|
|
106
|
+
|
|
107
|
+
timers.abortUnresponsiveRequest = setTimeout(() => {
|
|
108
|
+
reflectError();
|
|
109
|
+
}, 15000);
|
|
110
|
+
|
|
111
|
+
updateDom();
|
|
112
|
+
|
|
113
|
+
requestIDProcessingStatus().then(() => {
|
|
114
|
+
updateDom();
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
})();
|