@govuk-one-login/frontend-ui 2.0.0 → 3.0.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.
Files changed (34) hide show
  1. package/README.md +37 -0
  2. package/build/all.css +1 -1
  3. package/build/cjs/backend/index.cjs +14 -2
  4. package/build/cjs/backend/index.d.cts +10 -0
  5. package/build/cjs/backend/index.d.ts +10 -0
  6. package/build/cjs/backend/index.d.ts.map +1 -1
  7. package/build/cjs/frontend/index.cjs +225 -268
  8. package/build/cjs/frontend/index.d.cts +2 -1
  9. package/build/cjs/frontend/index.d.ts +2 -1
  10. package/build/cjs/frontend/index.d.ts.map +1 -1
  11. package/build/cjs/frontend/spinner/__tests__/spinner.test.d.ts +0 -4
  12. package/build/cjs/frontend/spinner/__tests__/spinner.test.d.ts.map +1 -1
  13. package/build/cjs/frontend/spinner/spinner.d.ts +54 -84
  14. package/build/cjs/frontend/spinner/spinner.d.ts.map +1 -1
  15. package/build/components/_all.scss +1 -0
  16. package/build/components/progress-button/_index.scss +44 -0
  17. package/build/components/progress-button/macro.njk +2 -0
  18. package/build/components/progress-button/progress-button.yaml +13 -0
  19. package/build/components/progress-button/template.njk +120 -0
  20. package/build/components/spinner/README.md +70 -52
  21. package/build/components/spinner/_index.scss +2 -11
  22. package/build/components/spinner/template.njk +15 -8
  23. package/build/esm/backend/index.d.ts +10 -0
  24. package/build/esm/backend/index.d.ts.map +1 -1
  25. package/build/esm/backend/index.js +14 -2
  26. package/build/esm/frontend/index.d.ts +2 -1
  27. package/build/esm/frontend/index.d.ts.map +1 -1
  28. package/build/esm/frontend/index.js +226 -269
  29. package/build/esm/frontend/spinner/__tests__/spinner.test.d.ts +0 -4
  30. package/build/esm/frontend/spinner/__tests__/spinner.test.d.ts.map +1 -1
  31. package/build/esm/frontend/spinner/spinner.d.ts +54 -84
  32. package/build/esm/frontend/spinner/spinner.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. 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:govuk-spacing(3)}@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__ready{border-color:#005ea5;-webkit-animation:none;animation:none}#spinner-container__error .spinner,#spinner-container__error .spinner-state-text{display: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}
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,19 @@ 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
+ };
76
81
  var translationCy = {
77
82
  cookieBanner: cookieBanner$1,
78
83
  footer: footer$1,
79
84
  header: header$1,
80
85
  languageSelect: languageSelect$1,
81
86
  phaseBanner: phaseBanner$1,
82
- skipLink: skipLink$1
87
+ skipLink: skipLink$1,
88
+ progressButton: progressButton$1
83
89
  };
84
90
 
85
91
  var cookieBanner = {
@@ -152,13 +158,19 @@ var phaseBanner = {
152
158
  var skipLink = {
153
159
  title: "Skip to main content"
154
160
  };
161
+ var progressButton = {
162
+ text: "Continue",
163
+ waitingText: "Wait",
164
+ longWaitingText: "Keep waiting"
165
+ };
155
166
  var translationEn = {
156
167
  cookieBanner: cookieBanner,
157
168
  footer: footer,
158
169
  header: header,
159
170
  languageSelect: languageSelect,
160
171
  phaseBanner: phaseBanner,
161
- skipLink: skipLink
172
+ skipLink: skipLink,
173
+ progressButton: progressButton
162
174
  };
163
175
 
164
176
  // Implementation
@@ -91,6 +91,11 @@ 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
+ };
94
99
  };
95
100
  export declare const frontendUiTranslationCy: {
96
101
  cookieBanner: {
@@ -149,6 +154,11 @@ export declare const frontendUiTranslationCy: {
149
154
  skipLink: {
150
155
  title: string;
151
156
  };
157
+ progressButton: {
158
+ text: string;
159
+ waitingText: string;
160
+ longWaitingText: string;
161
+ };
152
162
  };
153
163
  export {};
154
164
  //# sourceMappingURL=index.d.ts.map
@@ -91,6 +91,11 @@ 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
+ };
94
99
  };
95
100
  export declare const frontendUiTranslationCy: {
96
101
  cookieBanner: {
@@ -149,6 +154,11 @@ export declare const frontendUiTranslationCy: {
149
154
  skipLink: {
150
155
  title: string;
151
156
  };
157
+ progressButton: {
158
+ text: string;
159
+ waitingText: string;
160
+ longWaitingText: string;
161
+ };
152
162
  };
153
163
  export {};
154
164
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,UAAU,eAAgB,SAAQ,QAAQ;IACxC,MAAM,EAAE;QACN,YAAY,EAAE,OAAO,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,QAAQ,CAAC;C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