@govuk-one-login/frontend-ui 4.1.4 → 4.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/build/all.css +1 -0
- package/build/cjs/backend/index.cjs +257 -0
- package/build/cjs/backend/index.d.cts +39 -0
- package/build/cjs/backend/index.d.ts +39 -0
- package/build/cjs/backend/index.d.ts.map +1 -0
- package/build/cjs/backend/lib/helmet.d.ts +31 -0
- package/build/cjs/backend/lib/helmet.d.ts.map +1 -0
- package/build/cjs/backend/lib/index.d.ts +4 -0
- package/build/cjs/backend/lib/index.d.ts.map +1 -0
- package/build/cjs/backend/lib/locals.d.ts +11 -0
- package/build/cjs/backend/lib/locals.d.ts.map +1 -0
- package/build/cjs/backend/lib/settings.d.ts +21 -0
- package/build/cjs/backend/lib/settings.d.ts.map +1 -0
- package/build/cjs/backend/utils/logger.d.ts +9 -0
- package/build/cjs/backend/utils/logger.d.ts.map +1 -0
- package/build/cjs/frontend/index.cjs +443 -0
- package/build/cjs/frontend/index.d.cts +4 -0
- package/build/cjs/frontend/index.d.ts +4 -0
- package/build/cjs/frontend/index.d.ts.map +1 -0
- package/build/cjs/frontend/progress-button/progress-button.d.ts +2 -0
- package/build/cjs/frontend/progress-button/progress-button.d.ts.map +1 -0
- package/build/cjs/frontend/spinner/__tests__/spinner.test.d.ts +2 -0
- package/build/cjs/frontend/spinner/__tests__/spinner.test.d.ts.map +1 -0
- package/build/cjs/frontend/spinner/spinner.d.ts +64 -0
- package/build/cjs/frontend/spinner/spinner.d.ts.map +1 -0
- package/build/cjs/frontend/utils/types.d.ts +108 -0
- package/build/cjs/frontend/utils/types.d.ts.map +1 -0
- package/build/components/_all.scss +6 -0
- package/build/components/bases/auth/auth-base.njk +136 -0
- package/build/components/bases/home/home-base.njk +133 -0
- package/build/components/bases/identity/identity-base-form.njk +123 -0
- package/build/components/bases/identity/identity-base-page.njk +123 -0
- package/build/components/bases/ipv-core/ipv-core-base.njk +172 -0
- package/build/components/bases/mobile/mobile-base.njk +195 -0
- package/build/components/cookie-banner/cookie-banner.yaml +6 -0
- package/build/components/cookie-banner/macro.njk +1 -0
- package/build/components/cookie-banner/template.njk +106 -0
- package/build/components/footer/_index.scss +28 -0
- package/build/components/footer/footer.yaml +5 -0
- package/build/components/footer/macro.njk +1 -0
- package/build/components/footer/template.njk +12 -0
- package/build/components/header/README.md +34 -0
- package/build/components/header/_index.scss +102 -0
- package/build/components/header/header.yaml +16 -0
- package/build/components/header/macro.njk +3 -0
- package/build/components/header/template.njk +39 -0
- package/build/components/language-select/_index.scss +35 -0
- package/build/components/language-select/language-select.yaml +43 -0
- package/build/components/language-select/macro.njk +2 -0
- package/build/components/language-select/template.njk +38 -0
- package/build/components/macros/logo.njk +75 -0
- package/build/components/phase-banner/_index.scss +28 -0
- package/build/components/phase-banner/macro.njk +3 -0
- package/build/components/phase-banner/phase-banner.yaml +17 -0
- package/build/components/phase-banner/tag/macro.njk +3 -0
- package/build/components/phase-banner/tag/template.njk +3 -0
- package/build/components/phase-banner/template.njk +26 -0
- package/build/components/progress-button/_index.scss +51 -0
- package/build/components/progress-button/macro.njk +2 -0
- package/build/components/progress-button/progress-button.yaml +13 -0
- package/build/components/progress-button/template.njk +112 -0
- package/build/components/skip-link/README.md +10 -0
- package/build/components/skip-link/macro.njk +3 -0
- package/build/components/skip-link/skip-link.yaml +5 -0
- package/build/components/skip-link/template.njk +14 -0
- package/build/components/spinner/README.md +130 -0
- package/build/components/spinner/_index.scss +55 -0
- package/build/components/spinner/macro.njk +3 -0
- package/build/components/spinner/template.njk +18 -0
- package/build/esm/backend/index.d.ts +39 -0
- package/build/esm/backend/index.d.ts.map +1 -0
- package/build/esm/backend/index.js +247 -0
- package/build/esm/backend/lib/helmet.d.ts +31 -0
- package/build/esm/backend/lib/helmet.d.ts.map +1 -0
- package/build/esm/backend/lib/index.d.ts +4 -0
- package/build/esm/backend/lib/index.d.ts.map +1 -0
- package/build/esm/backend/lib/locals.d.ts +11 -0
- package/build/esm/backend/lib/locals.d.ts.map +1 -0
- package/build/esm/backend/lib/settings.d.ts +21 -0
- package/build/esm/backend/lib/settings.d.ts.map +1 -0
- package/build/esm/backend/utils/logger.d.ts +9 -0
- package/build/esm/backend/utils/logger.d.ts.map +1 -0
- package/build/esm/frontend/index.d.ts +4 -0
- package/build/esm/frontend/index.d.ts.map +1 -0
- package/build/esm/frontend/index.js +440 -0
- package/build/esm/frontend/progress-button/progress-button.d.ts +2 -0
- package/build/esm/frontend/progress-button/progress-button.d.ts.map +1 -0
- package/build/esm/frontend/spinner/__tests__/spinner.test.d.ts +2 -0
- package/build/esm/frontend/spinner/__tests__/spinner.test.d.ts.map +1 -0
- package/build/esm/frontend/spinner/spinner.d.ts +64 -0
- package/build/esm/frontend/spinner/spinner.d.ts.map +1 -0
- package/build/esm/frontend/utils/types.d.ts +108 -0
- package/build/esm/frontend/utils/types.d.ts.map +1 -0
- package/package.json +1 -2
|
@@ -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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-1.4,3.8-2.4,4.8-.6-1.6-.4-3,0-5.6l-5.2,1.8c3,3.8,5.6,9,7.8,18.2,7.6-1,16.4-1.8,25.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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
|
|
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 with offsetting for the
|
|
48
|
+
St. Edward's Crown. #}
|
|
49
|
+
{%- set _dotLogotype %}
|
|
50
|
+
<circle class="govuk-logo-dot" cx="227" cy="36" r="7.3"/>
|
|
51
|
+
<path d="M94.7,36.1c0,1.9.2,3.6.7,5.4.5,1.7,1.2,3.2,2.1,4.5.9,1.3,2.2,2.4,3.6,3.2,1.5.8,3.2,1.2,5.3,1.2s3.6-.3,4.9-.9c1.3-.6,2.3-1.4,3.1-2.3.8-.9,1.3-2,1.6-3,.3-1.1.5-2.1.5-3v-.4h-11v-6.6h19.5v24h-7.7v-5.4c-.5.8-1.2,1.6-2,2.3-.8.7-1.7,1.3-2.7,1.8-1,.5-2.1.9-3.3,1.2-1.2.3-2.5.4-3.8.4-3.2,0-6-.6-8.4-1.7-2.5-1.1-4.5-2.7-6.2-4.7-1.7-2-3-4.4-3.8-7.1-.9-2.7-1.3-5.6-1.3-8.7s.5-6,1.5-8.7,2.4-5.1,4.2-7.1c1.8-2,4-3.6,6.5-4.7s5.4-1.7,8.6-1.7,4,.2,5.9.7c1.8.5,3.5,1.1,5.1,2,1.5.9,2.9,1.9,4,3.2,1.2,1.2,2.1,2.6,2.8,4.1l-7.7,4.3c-.5-.9-1-1.8-1.6-2.6-.6-.8-1.3-1.5-2.2-2.1-.8-.6-1.7-1-2.8-1.4-1-.3-2.2-.5-3.5-.5-2,0-3.8.4-5.3,1.2s-2.7,1.9-3.6,3.2c-.9,1.3-1.7,2.8-2.1,4.6s-.7,3.5-.7,5.3v.3h0ZM152.9,13.7c3.2,0,6.1.6,8.7,1.7,2.6,1.2,4.7,2.7,6.5,4.7,1.8,2,3.1,4.4,4.1,7.1s1.4,5.6,1.4,8.7-.5,6-1.4,8.7c-.9,2.7-2.3,5.1-4.1,7.1s-4,3.6-6.5,4.7c-2.6,1.1-5.5,1.7-8.7,1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|
|
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 %}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import "../../../../node_modules/govuk-frontend/govuk/helpers/_colour.scss";
|
|
2
|
+
// Temporarily overwrite the tag component styling to match pre-v5 appearance.
|
|
3
|
+
// This ensures a cohesive phase banner across One Login applications during the transition.
|
|
4
|
+
.govuk-tag {
|
|
5
|
+
font-size: 16px;
|
|
6
|
+
font-weight: bold;
|
|
7
|
+
line-height: 1;
|
|
8
|
+
display: inline-block;
|
|
9
|
+
padding-top: 5px;
|
|
10
|
+
padding-right: 8px;
|
|
11
|
+
padding-bottom: 4px;
|
|
12
|
+
padding-left: 8px;
|
|
13
|
+
// Accessibility: Ensure visibility for users customizing colours.
|
|
14
|
+
outline: 2px solid transparent;
|
|
15
|
+
outline-offset: -2px;
|
|
16
|
+
// Key properties to maintain the old appearance:
|
|
17
|
+
color: govuk-colour("white") !important;
|
|
18
|
+
background-color: govuk-colour("blue") !important;
|
|
19
|
+
letter-spacing: 1px !important;
|
|
20
|
+
text-decoration: none !important;
|
|
21
|
+
text-transform: uppercase !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@media (max-width: 256px) {
|
|
25
|
+
.govuk-phase-banner__content{
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
params:
|
|
2
|
+
- name: translations
|
|
3
|
+
type: string
|
|
4
|
+
required: true
|
|
5
|
+
description: translations from middleware
|
|
6
|
+
- name: url
|
|
7
|
+
type: string
|
|
8
|
+
required: true
|
|
9
|
+
description: current page url
|
|
10
|
+
- name: tag
|
|
11
|
+
type: string
|
|
12
|
+
required: false
|
|
13
|
+
description: tag override
|
|
14
|
+
- name: contactUrl
|
|
15
|
+
type: string
|
|
16
|
+
required: false
|
|
17
|
+
description: contactUsUrl override
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{% set phaseBanner = params.translations %}
|
|
2
|
+
{% from "./tag/macro.njk" import frontendUiTag -%}
|
|
3
|
+
|
|
4
|
+
<div role="region" class="govuk-phase-banner
|
|
5
|
+
{%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
|
6
|
+
<p class="govuk-phase-banner__content">
|
|
7
|
+
{{ frontendUiTag({
|
|
8
|
+
html: params.tag or phaseBanner.tag,
|
|
9
|
+
classes: "govuk-phase-banner__content__tag" + (" " + params.tag.classes if params.tag.classes)
|
|
10
|
+
}) | indent(4) | trim }}
|
|
11
|
+
|
|
12
|
+
<span class="govuk-phase-banner__text">
|
|
13
|
+
{% if params.phaseBannerText %}
|
|
14
|
+
{{ params.phaseBannerText }}
|
|
15
|
+
{% else %}
|
|
16
|
+
{{ phaseBanner.text }}
|
|
17
|
+
{% endif %}
|
|
18
|
+
<a class="govuk-link"
|
|
19
|
+
rel="noopener"
|
|
20
|
+
target="_blank"
|
|
21
|
+
{% if params.noAppend %} href="{{ params.contactUrl }}" {% endif %}
|
|
22
|
+
{% if params.noAppend != 'true' %} href="{{ contactUsUrl(params.contactUrl, params.url) or contactUsUrl('https://signin.account.gov.uk/contact-us', params.url) }}" {% endif %}>
|
|
23
|
+
{{ phaseBanner.link}}</a>.
|
|
24
|
+
</span>
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.govuk-button--progress{
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.govuk-button--progress-loading{
|
|
6
|
+
background-color: #505A5F !important;
|
|
7
|
+
color: #fff !important;
|
|
8
|
+
pointer-events: none !important;
|
|
9
|
+
padding-left: 40px !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@keyframes rotate {
|
|
13
|
+
from {
|
|
14
|
+
transform: rotate(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
to {
|
|
18
|
+
transform: rotate(360deg);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
.govuk-button--progress-loading::before {
|
|
24
|
+
content: "";
|
|
25
|
+
border: 3px solid rgba(255, 255, 255, 0.35);
|
|
26
|
+
border-top: 3px solid #fff;
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
width: 20px;
|
|
29
|
+
height: 20px;
|
|
30
|
+
animation: rotate 1s infinite linear;
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 12% !important;
|
|
33
|
+
left: 8px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.govuk-progress-button--disabled{
|
|
37
|
+
opacity: 1 !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@media (prefers-reduced-motion: reduce) {
|
|
41
|
+
.govuk-button--progress-loading {
|
|
42
|
+
padding-left: 10px !important;
|
|
43
|
+
|
|
44
|
+
&::before {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
params:
|
|
2
|
+
- name: translations
|
|
3
|
+
type: string
|
|
4
|
+
required: true
|
|
5
|
+
description: translations from middleware
|
|
6
|
+
- name: href
|
|
7
|
+
type: string
|
|
8
|
+
required: true
|
|
9
|
+
description: URL for the button to link to
|
|
10
|
+
- name: errorPage
|
|
11
|
+
type: string
|
|
12
|
+
required: true
|
|
13
|
+
description: URL for the error help page
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{% set progressButton = params.translations %}
|
|
2
|
+
<noscript>
|
|
3
|
+
<style>
|
|
4
|
+
.noscript {
|
|
5
|
+
border: #F3F3F3 3px solid;
|
|
6
|
+
padding-top: 28px;
|
|
7
|
+
padding-left: 12px;
|
|
8
|
+
padding-right: 12px;
|
|
9
|
+
margin-bottom: 12px;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
12
|
+
</noscript>
|
|
13
|
+
|
|
14
|
+
{# Set classes for this component #}
|
|
15
|
+
{%- set classNames = "govuk-button govuk-button--progress" -%}
|
|
16
|
+
|
|
17
|
+
{%- if params.classes %}
|
|
18
|
+
{% set classNames = classNames + " " + params.classes %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
{% if params.disabled %}
|
|
21
|
+
{% set classNames = classNames + " govuk-button--disabled" %}
|
|
22
|
+
{% endif -%}
|
|
23
|
+
|
|
24
|
+
{%- if params.element %}
|
|
25
|
+
{% set element = params.element | lower %}
|
|
26
|
+
{% else %}
|
|
27
|
+
{% if params.href %}
|
|
28
|
+
{% set element = 'a' %}
|
|
29
|
+
{% else %}
|
|
30
|
+
{% set element = 'button' %}
|
|
31
|
+
{% endif %}
|
|
32
|
+
{% endif -%}
|
|
33
|
+
|
|
34
|
+
{% if params.isStartButton %}
|
|
35
|
+
{% set iconHtml %}
|
|
36
|
+
{#- The SVG needs `focusable="false"` so that Internet Explorer does not
|
|
37
|
+
treat it as an interactive element - without this it will be
|
|
38
|
+
'focusable' when using the keyboard to navigate. #}
|
|
39
|
+
<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
|
|
40
|
+
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"/>
|
|
41
|
+
</svg>
|
|
42
|
+
{% endset %}
|
|
43
|
+
{% set classNames = classNames + " govuk-button--start" %}
|
|
44
|
+
{% endif %}
|
|
45
|
+
|
|
46
|
+
{#- Define common attributes that we can use across all element types #}
|
|
47
|
+
|
|
48
|
+
{%- set commonAttributes %} data-module="govuk-button"{% for attribute, value in params.attributes %}
|
|
49
|
+
{{attribute}}="{{value}}"{% endfor %}
|
|
50
|
+
{% if params.id %} id="{{ params.id }}"{% endif %}
|
|
51
|
+
{% endset %}
|
|
52
|
+
|
|
53
|
+
{#- Define common attributes we can use for both button and input types #}
|
|
54
|
+
|
|
55
|
+
{%- set buttonAttributes %}
|
|
56
|
+
{% if params.name %} name="{{ params.name }}"{% endif %}
|
|
57
|
+
{% if params.disabled %} disabled="disabled" aria-disabled="true"{% endif %}
|
|
58
|
+
{% if params.preventDoubleClick !== undefined %} data-prevent-double-click="{{params.preventDoubleClick}}"{% endif %}{% endset %}
|
|
59
|
+
|
|
60
|
+
{%- if element == 'a' %}
|
|
61
|
+
<div class="noscript">
|
|
62
|
+
<noscript>
|
|
63
|
+
<div class="govuk-body" >
|
|
64
|
+
{{ progressButton.noJavascriptMessage }}
|
|
65
|
+
</div>
|
|
66
|
+
</noscript>
|
|
67
|
+
|
|
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('#') }}" >
|
|
69
|
+
{% if params.html %}
|
|
70
|
+
{{ params.html | safe }}
|
|
71
|
+
{% elseif params.text %}
|
|
72
|
+
{{ params.text | safe }}
|
|
73
|
+
{% else %}
|
|
74
|
+
{{ progressButton.text }}
|
|
75
|
+
{% endif %}
|
|
76
|
+
{{- iconHtml | safe | trim | indent(2, true) if iconHtml -}}
|
|
77
|
+
</a>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{%- elseif element == 'button' %}
|
|
81
|
+
<div class="noscript">
|
|
82
|
+
<noscript>
|
|
83
|
+
<div class="govuk-body" >
|
|
84
|
+
{{ progressButton.noJavascriptMessage }}
|
|
85
|
+
</div>
|
|
86
|
+
</noscript>
|
|
87
|
+
|
|
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('#') }}" >
|
|
89
|
+
{% if params.html %}
|
|
90
|
+
{{ params.html | safe }}
|
|
91
|
+
{% elseif params.text %}
|
|
92
|
+
{{ params.text | safe }}
|
|
93
|
+
{% else %}
|
|
94
|
+
{{ progressButton.text }}
|
|
95
|
+
{% endif %}
|
|
96
|
+
{{- iconHtml | safe | trim | indent(2, true) if iconHtml -}}
|
|
97
|
+
|
|
98
|
+
</button>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{%- elseif element == 'input' %}
|
|
102
|
+
<div class="noscript">
|
|
103
|
+
<noscript>
|
|
104
|
+
<div class="govuk-body" >
|
|
105
|
+
{{ progressButton.noJavascriptMessage }}
|
|
106
|
+
</div>
|
|
107
|
+
</noscript>
|
|
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('#') }}" >
|
|
109
|
+
{{- iconHtml | safe | trim | indent(2, true) if iconHtml -}}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
{% endif %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Skip Link
|
|
2
|
+
|
|
3
|
+
## Translations
|
|
4
|
+
|
|
5
|
+
For translations to be enabled, the param `skipLink: translations` should be passed into `frontendUiSkipLink` in the `skipLink` block.
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
{% block skipLink %} {{ frontendUiSkipLink({ skipLink: translations }) }} {%
|
|
9
|
+
endblock %}
|
|
10
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{% from "govuk/components/skip-link/macro.njk" import govukSkipLink %}
|
|
2
|
+
|
|
3
|
+
{% set skipLink = params.translations %}
|
|
4
|
+
|
|
5
|
+
{{ govukSkipLink({
|
|
6
|
+
href: "#main-content",
|
|
7
|
+
text: skipLink.title,
|
|
8
|
+
attributes: {
|
|
9
|
+
"role": "button",
|
|
10
|
+
"aria-label": skipLink.title
|
|
11
|
+
}
|
|
12
|
+
}) }}
|
|
13
|
+
|
|
14
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
This component:
|
|
4
|
+
- Displays an animated spinner graphic
|
|
5
|
+
- Repeatedly calls a supplied function
|
|
6
|
+
- Stops the spinner animation when the function returns success, failure, or doesn't return either after a certain amount of time
|
|
7
|
+
- Displays different HTML for the different phases of its lifecycle
|
|
8
|
+
|
|
9
|
+
It consists of code in `../../frontend-src/spinner/spinner.ts` and styling in `_index.scss`
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
For the spinner to perform correctly it requires the following:
|
|
14
|
+
- A container `div` to display within
|
|
15
|
+
- A polling function to call repeatedly until it returns success or failure
|
|
16
|
+
- An optional success function to call once if the polling function returns success
|
|
17
|
+
- An optional error function to call once if the polling function returns failure, or we reach the abort duration
|
|
18
|
+
- A div with id `no-js-content`. This should contain the HTML to display if the user has JS disabled
|
|
19
|
+
- An optional div with id `wait-content`. This should contain the default HTML to display under the spinner
|
|
20
|
+
- An optional div with id `long-wait-content`. This should contain the HTML to display under the spinner once it has been spinning for the specified long wait duration
|
|
21
|
+
- An optional div with id `success-content`. This should contain the HTML to display under the spinner once the polling function returns success
|
|
22
|
+
- An optional div with id `error-content`. This should contain the HTML to display under the spinner if the polling function returns failure, or doesn't return success before the abort duration is reached
|
|
23
|
+
- An optional data attribute `data-ms-before-informing-of-long-wait` to set the amount of time the spinner will spin before displaying the `long-wait-content`
|
|
24
|
+
- An optional data attribute `data-ms-before-abort` to set the amount of time the spinner will spin before displaying the `error-content` and calling the `errorFunction`
|
|
25
|
+
- An optional data attribute `data-ms-between-dom-update` to set the amount of time between updates to the spinner UI
|
|
26
|
+
- An optional data attribute `data-ms-between-requests` to set the amount of time between calls to the `pollingFunction`
|
|
27
|
+
- An optional data attribute `data-hide-spinner-on-error` to hide the spinner graphic on error (defaults to false)
|
|
28
|
+
- An optional data attribute `data-max-backoff-tries` to set the number of times in a row the polling function can return `backoff` before the error content is displayed (defaults to 3)
|
|
29
|
+
- An optional data attribute `aria-alert-completion-text`. If supplied this text will be set as an aria alert if the spinner completes successfully
|
|
30
|
+
|
|
31
|
+
For example:
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<div id="spinner-container"
|
|
35
|
+
data-ms-before-informing-of-long-wait="10000"
|
|
36
|
+
data-ms-before-abort="30000"
|
|
37
|
+
data-ms-between-dom-update="1000"
|
|
38
|
+
data-ms-between-requests="2000"
|
|
39
|
+
data-hide-spinner-on-error="true"
|
|
40
|
+
data-max-backoff-tries="3"
|
|
41
|
+
data-aria-alert-completion-text="Task completed successfully, you may now continue">
|
|
42
|
+
<div id="no-js-content"><p class="centre govuk-body">JS is disabled</p></div>
|
|
43
|
+
<div id="wait-content" style="display:none"><p class="centre govuk-body">Waiting</p></div>
|
|
44
|
+
<div id="long-wait-content" style="display:none"><p class="centre govuk-body">Still waiting</p></div>
|
|
45
|
+
<div id="success-content" style="display:none"><p class="centre govuk-body">Success!</p></div>
|
|
46
|
+
<div id="error-content" style="display:none"><p class="centre govuk-body">Error :(</p></div>
|
|
47
|
+
</div>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Note that the content divs (except for the no-js div) have `style="display:none"` to hide them until they are needed.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
async function pollFunction(abortSignal): PollResult {
|
|
54
|
+
// Check for success
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function successFunction(): void {
|
|
58
|
+
// Optionally do stuff, e.g. enable a button, redirect, etc
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function errorFunction(): void {
|
|
62
|
+
// Optionally do stuff, e.g. enable a button, redirect, etc
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
useSpinner("spinner-container", pollingFunction, successFunction, errorFunction);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Lifecycle
|
|
69
|
+
|
|
70
|
+
The spinner starts in the waiting state and displays the `wait` content under the animated spinner graphic content.
|
|
71
|
+
If a call to the polling function returns `success` the spinner will stop animating, display the `success-content` content, and call the `successFunction` (if specified)
|
|
72
|
+
If a call to the polling function returns `failure` the spinner will stop animating, display the `error-content` content, and call the `errorFunction` (if specified)
|
|
73
|
+
If the spinner waits past the `long-wait` duration while the polling function keeps returning `pending` the spinner will display the `long-wait-content` content
|
|
74
|
+
If the spinner waits past the `abort` duration while the polling function keeps returning `pending` the spinner will stop animating, display the `error-content` content, and call the `errorFunction` (if specified)
|
|
75
|
+
The polling function can optionally return `backoff` if it should be tried again but after a delay (e.g. to account for network instability). On receiving `backoff` the spinner will exponentially increase the time before the
|
|
76
|
+
next call to the polling function. If the polling function returns `backoff` more times than the `max-backoff-tries` value in a row then the final call is treated as if had returned `failure` instead. If a call to the polling
|
|
77
|
+
function returns `pending` then the backoff counter resets.
|
|
78
|
+
|
|
79
|
+
### Page refreshes
|
|
80
|
+
|
|
81
|
+
When the spinner starts for the first time it stores the current time in session storage. If the page is refreshed the spinner will retrieve the initial start time from session storage and update itself appropriately.
|
|
82
|
+
|
|
83
|
+
## Scripts
|
|
84
|
+
|
|
85
|
+
Within the frontend-ui package, this script is bundled within `frontend-src`, so that it can be used in the alpha-app.
|
|
86
|
+
|
|
87
|
+
Please note that in the `package.json` file of the frontend-ui repo the files needed for the spinner are exported as follows:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
"exports": {
|
|
91
|
+
".": {
|
|
92
|
+
"import": "./build/esm/index.js",
|
|
93
|
+
"require": "./build/cjs/index.cjs"
|
|
94
|
+
},
|
|
95
|
+
"./frontend": {
|
|
96
|
+
"import": "./build/esm/index-fe.js",
|
|
97
|
+
"require": "./build/cjs/index-fe.cjs"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
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.
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
106
|
+
## Manual Testing
|
|
107
|
+
|
|
108
|
+
The nunjucks files in this folder are to allow automated accessibility testing, most users of the spinner component will only need the CSS and script files.
|
|
109
|
+
|
|
110
|
+
There is a `/spinner` page in the alpha-app that will display the spinner component.
|
|
111
|
+
|
|
112
|
+
An endpoint has been created in the alpha-app at `/api` that will return a pending result for a specified number of requests before returning a success response.
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
let counter = 0;
|
|
116
|
+
|
|
117
|
+
app.get("/api", (req, res) => {
|
|
118
|
+
counter++;
|
|
119
|
+
const processingTime = req.query.processingTime || 1;
|
|
120
|
+
console.log(
|
|
121
|
+
`Elapsed processing seconds: ${counter}. Processing time limit is: ${processingTime}`,
|
|
122
|
+
);
|
|
123
|
+
if (counter >= processingTime) {
|
|
124
|
+
res.json({ status: "Clear to proceed", counter: counter });
|
|
125
|
+
counter = 0;
|
|
126
|
+
} else {
|
|
127
|
+
res.json({ status: "Still processing", counter: counter });
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
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: 15px;
|
|
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
|
+
&__finished {
|
|
26
|
+
border-color: #005ea5;
|
|
27
|
+
-webkit-animation: none;
|
|
28
|
+
animation: none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@-webkit-keyframes spin {
|
|
33
|
+
0% {
|
|
34
|
+
-webkit-transform: rotate(0deg);
|
|
35
|
+
}
|
|
36
|
+
100% {
|
|
37
|
+
-webkit-transform: rotate(360deg);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@keyframes spin {
|
|
42
|
+
0% {
|
|
43
|
+
transform: rotate(0deg);
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
transform: rotate(360deg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.centre {
|
|
51
|
+
margin-left: auto;
|
|
52
|
+
margin-right: auto;
|
|
53
|
+
text-align: center;
|
|
54
|
+
display: block;
|
|
55
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{# This template is for use in accessbility testing. #}
|
|
2
|
+
{% block content %}
|
|
3
|
+
|
|
4
|
+
<main>
|
|
5
|
+
<div id="spinner-container"
|
|
6
|
+
data-ms-before-informing-of-long-wait="4000"
|
|
7
|
+
data-ms-before-abort="9000"
|
|
8
|
+
data-ms-between-dom-update="1000"
|
|
9
|
+
data-ms-between-requests="3000">
|
|
10
|
+
<div id="no-js-content"><p class="centre govuk-body">JS is disabled</p></div>
|
|
11
|
+
<div id="wait-content" style="display:none"><p class="centre govuk-body">Waiting</p></div>
|
|
12
|
+
<div id="long-wait-content" style="display:none"><p class="centre govuk-body">Still waiting</p></div>
|
|
13
|
+
<div id="success-content" style="display:none"><p class="centre govuk-body">Success!</p></div>
|
|
14
|
+
<div id="error-content" style="display:none"><p class="centre govuk-body">Error :(</p></div>
|
|
15
|
+
</div>
|
|
16
|
+
</main>
|
|
17
|
+
|
|
18
|
+
{% endblock %}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import i18next from "i18next";
|
|
2
|
+
import { NextFunction, Request, Response } from "express";
|
|
3
|
+
interface I18nData {
|
|
4
|
+
language: string;
|
|
5
|
+
store: {
|
|
6
|
+
data: {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
interface ExpressRequest extends Request {
|
|
12
|
+
i18n: I18nData;
|
|
13
|
+
}
|
|
14
|
+
interface ExpressResponse extends Response {
|
|
15
|
+
locals: {
|
|
16
|
+
translations: unknown;
|
|
17
|
+
basePath?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface PlainRequest {
|
|
21
|
+
i18n: I18nData;
|
|
22
|
+
}
|
|
23
|
+
interface PlainResponse {
|
|
24
|
+
locals: {
|
|
25
|
+
translations: unknown;
|
|
26
|
+
basePath?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function frontendUiMiddleware(req: ExpressRequest, res: ExpressResponse, next: NextFunction): void;
|
|
30
|
+
export declare function frontendUiMiddleware(req: PlainRequest, res: PlainResponse, next: NextFunction): void;
|
|
31
|
+
export declare const setFrontendUiTranslations: (instanceI18n: typeof i18next) => void;
|
|
32
|
+
export declare const frontendUiMiddlewareIdentityBypass: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => void;
|
|
33
|
+
export declare function addLanguageParam(language: string, url?: URL): string;
|
|
34
|
+
export declare function contactUsUrl(baseUrl: string, urlToAppend: string): string | null;
|
|
35
|
+
export declare const setBaseTranslations: (instanceI18n: typeof i18next, filePath?: string) => void;
|
|
36
|
+
export declare const getTranslationObject: (locale: string, filepath?: string) => Record<string, unknown>;
|
|
37
|
+
export { default as frontendUiTranslationEn } from "../locales/en/translation.json";
|
|
38
|
+
export { default as frontendUiTranslationCy } from "../locales/cy/translation.json";
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQ1D,UAAU,QAAQ;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE;QACL,IAAI,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KAClC,CAAC;CACH;AAED,UAAU,cAAe,SAAQ,OAAO;IACtC,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED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