@govuk-one-login/frontend-ui 2.0.0 → 3.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/README.md +37 -0
- package/build/all.css +1 -1
- package/build/cjs/backend/index.cjs +16 -2
- package/build/cjs/backend/index.d.cts +12 -0
- package/build/cjs/backend/index.d.ts +12 -0
- package/build/cjs/backend/index.d.ts.map +1 -1
- package/build/cjs/frontend/index.cjs +288 -268
- package/build/cjs/frontend/index.d.cts +3 -1
- package/build/cjs/frontend/index.d.ts +3 -1
- package/build/cjs/frontend/index.d.ts.map +1 -1
- 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 +0 -4
- package/build/cjs/frontend/spinner/__tests__/spinner.test.d.ts.map +1 -1
- package/build/cjs/frontend/spinner/spinner.d.ts +58 -84
- package/build/cjs/frontend/spinner/spinner.d.ts.map +1 -1
- package/build/components/_all.scss +1 -0
- package/build/components/progress-button/_index.scss +44 -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 +115 -0
- package/build/components/spinner/README.md +75 -52
- package/build/components/spinner/_index.scss +2 -11
- package/build/components/spinner/template.njk +15 -8
- package/build/esm/backend/index.d.ts +12 -0
- package/build/esm/backend/index.d.ts.map +1 -1
- package/build/esm/backend/index.js +16 -2
- package/build/esm/frontend/index.d.ts +3 -1
- package/build/esm/frontend/index.d.ts.map +1 -1
- package/build/esm/frontend/index.js +288 -269
- 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 +0 -4
- package/build/esm/frontend/spinner/__tests__/spinner.test.d.ts.map +1 -1
- package/build/esm/frontend/spinner/spinner.d.ts +58 -84
- package/build/esm/frontend/spinner/spinner.d.ts.map +1 -1
- package/package.json +3 -2
- package/build/components/spinner/api.njk +0 -27
package/README.md
CHANGED
|
@@ -170,3 +170,40 @@ If you need to use a component that incorporates frontend (ie. in-browser) code
|
|
|
170
170
|
|
|
171
171
|
## On Page Load has now been added to basefiles
|
|
172
172
|
When upgrading to major version 2, GA4 on page load will be within the idenity and core basefiles, this will be a breaking change and implement some duplication on pages if GA4OPL is already being used on them
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# Implementation Guide - Progress Button
|
|
176
|
+
|
|
177
|
+
# When to use the Progress Button
|
|
178
|
+
|
|
179
|
+
The progress button has veen designed for implementation in use cases such as when the user has clicked to submit a form and the request is in progress.
|
|
180
|
+
|
|
181
|
+
The aim is to prevent multiple submissions of forms and provide a visual cue whilst the page is loading.
|
|
182
|
+
|
|
183
|
+
It should be used when there is more than a 2 second delay and less than a 10 second delay between the user clicking the button and seeing the result.
|
|
184
|
+
|
|
185
|
+
It is best suited to actions which trigger submission of information to an external API or performing short Back End processes.
|
|
186
|
+
|
|
187
|
+
# When not to use the Progress Button
|
|
188
|
+
|
|
189
|
+
This should not be used when a user needs to take further action for example when checking their email, opening another app, or retrieving a security code.
|
|
190
|
+
|
|
191
|
+
The Progress button should not be used when there is less than a 2 second delay between clicking the button and seeing the outcome.
|
|
192
|
+
|
|
193
|
+
Similarly the button should not be used when there is a delay of more than 10 seconds.
|
|
194
|
+
|
|
195
|
+
when is it applicable and when is it not?
|
|
196
|
+
|
|
197
|
+
# How to implement the progress button.
|
|
198
|
+
|
|
199
|
+
### 1. Render component in the progress button template and pass in the necessary data
|
|
200
|
+
|
|
201
|
+
Provided the above integration steps have been followed (Frontend UI Component Integration Guide) it should be possible to utilise the progress button by adding to the template as below.
|
|
202
|
+
|
|
203
|
+
```html
|
|
204
|
+
{{ frontendUiProgressButton({
|
|
205
|
+
translations: translations.translation.progressButton,
|
|
206
|
+
href: "#",
|
|
207
|
+
errorPage: '/404'
|
|
208
|
+
}) }}
|
|
209
|
+
```
|
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:
|
|
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}}
|
|
@@ -73,13 +73,20 @@ var phaseBanner$1 = {
|
|
|
73
73
|
var skipLink$1 = {
|
|
74
74
|
title: "Neidio i'r prif gynnwys"
|
|
75
75
|
};
|
|
76
|
+
var progressButton$1 = {
|
|
77
|
+
text: "Parhau",
|
|
78
|
+
waitingText: "Aros",
|
|
79
|
+
longWaitingText: "Parhau i aros",
|
|
80
|
+
noJavascriptMessage: "Gall gymryd hyd at 10 eiliad i barhau i'r dudalen nesaf. Ar ôl i chi barhau, peidiwch ag ail-lwytho na chau'r dudalen hon."
|
|
81
|
+
};
|
|
76
82
|
var translationCy = {
|
|
77
83
|
cookieBanner: cookieBanner$1,
|
|
78
84
|
footer: footer$1,
|
|
79
85
|
header: header$1,
|
|
80
86
|
languageSelect: languageSelect$1,
|
|
81
87
|
phaseBanner: phaseBanner$1,
|
|
82
|
-
skipLink: skipLink$1
|
|
88
|
+
skipLink: skipLink$1,
|
|
89
|
+
progressButton: progressButton$1
|
|
83
90
|
};
|
|
84
91
|
|
|
85
92
|
var cookieBanner = {
|
|
@@ -152,13 +159,20 @@ var phaseBanner = {
|
|
|
152
159
|
var skipLink = {
|
|
153
160
|
title: "Skip to main content"
|
|
154
161
|
};
|
|
162
|
+
var progressButton = {
|
|
163
|
+
text: "Continue",
|
|
164
|
+
waitingText: "Wait",
|
|
165
|
+
longWaitingText: "Keep waiting",
|
|
166
|
+
noJavascriptMessage: "It can take up to 10 seconds to continue to the next page. After you continue, do not reload or close this page."
|
|
167
|
+
};
|
|
155
168
|
var translationEn = {
|
|
156
169
|
cookieBanner: cookieBanner,
|
|
157
170
|
footer: footer,
|
|
158
171
|
header: header,
|
|
159
172
|
languageSelect: languageSelect,
|
|
160
173
|
phaseBanner: phaseBanner,
|
|
161
|
-
skipLink: skipLink
|
|
174
|
+
skipLink: skipLink,
|
|
175
|
+
progressButton: progressButton
|
|
162
176
|
};
|
|
163
177
|
|
|
164
178
|
// Implementation
|
|
@@ -91,6 +91,12 @@ export declare const frontendUiTranslationEn: {
|
|
|
91
91
|
skipLink: {
|
|
92
92
|
title: string;
|
|
93
93
|
};
|
|
94
|
+
progressButton: {
|
|
95
|
+
text: string;
|
|
96
|
+
waitingText: string;
|
|
97
|
+
longWaitingText: string;
|
|
98
|
+
noJavascriptMessage: string;
|
|
99
|
+
};
|
|
94
100
|
};
|
|
95
101
|
export declare const frontendUiTranslationCy: {
|
|
96
102
|
cookieBanner: {
|
|
@@ -149,6 +155,12 @@ export declare const frontendUiTranslationCy: {
|
|
|
149
155
|
skipLink: {
|
|
150
156
|
title: string;
|
|
151
157
|
};
|
|
158
|
+
progressButton: {
|
|
159
|
+
text: string;
|
|
160
|
+
waitingText: string;
|
|
161
|
+
longWaitingText: string;
|
|
162
|
+
noJavascriptMessage: string;
|
|
163
|
+
};
|
|
152
164
|
};
|
|
153
165
|
export {};
|
|
154
166
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -91,6 +91,12 @@ export declare const frontendUiTranslationEn: {
|
|
|
91
91
|
skipLink: {
|
|
92
92
|
title: string;
|
|
93
93
|
};
|
|
94
|
+
progressButton: {
|
|
95
|
+
text: string;
|
|
96
|
+
waitingText: string;
|
|
97
|
+
longWaitingText: string;
|
|
98
|
+
noJavascriptMessage: string;
|
|
99
|
+
};
|
|
94
100
|
};
|
|
95
101
|
export declare const frontendUiTranslationCy: {
|
|
96
102
|
cookieBanner: {
|
|
@@ -149,6 +155,12 @@ export declare const frontendUiTranslationCy: {
|
|
|
149
155
|
skipLink: {
|
|
150
156
|
title: string;
|
|
151
157
|
};
|
|
158
|
+
progressButton: {
|
|
159
|
+
text: string;
|
|
160
|
+
waitingText: string;
|
|
161
|
+
longWaitingText: string;
|
|
162
|
+
noJavascriptMessage: string;
|
|
163
|
+
};
|
|
152
164
|
};
|
|
153
165
|
export {};
|
|
154
166
|
//# sourceMappingURL=index.d.ts.map
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