@govuk-one-login/frontend-ui 0.0.2 → 1.0.2

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 (65) hide show
  1. package/README.md +155 -1
  2. package/build/all.css +1 -0
  3. package/build/cjs/__tests__/index.spec.d.ts +2 -0
  4. package/build/cjs/__tests__/index.spec.d.ts.map +1 -0
  5. package/build/cjs/__tests__/logger.spec.d.ts +2 -0
  6. package/build/cjs/__tests__/logger.spec.d.ts.map +1 -0
  7. package/build/cjs/index.cjs +193 -0
  8. package/build/cjs/index.d.ts +29 -0
  9. package/build/cjs/index.d.ts.map +1 -0
  10. package/build/cjs/lib/helmet.d.ts +31 -0
  11. package/build/cjs/lib/helmet.d.ts.map +1 -0
  12. package/build/cjs/lib/index.d.ts +4 -0
  13. package/build/cjs/lib/index.d.ts.map +1 -0
  14. package/build/cjs/lib/locals.d.ts +11 -0
  15. package/build/cjs/lib/locals.d.ts.map +1 -0
  16. package/build/cjs/lib/settings.d.ts +21 -0
  17. package/build/cjs/lib/settings.d.ts.map +1 -0
  18. package/build/cjs/utils/logger.d.ts +9 -0
  19. package/build/cjs/utils/logger.d.ts.map +1 -0
  20. package/build/components/_all.scss +3 -0
  21. package/build/components/bases/identity/identity-base-form.njk +82 -0
  22. package/build/components/bases/identity/identity-base-page.njk +82 -0
  23. package/build/components/cookie-banner/cookie-banner.yaml +6 -0
  24. package/build/components/cookie-banner/macro.njk +1 -0
  25. package/build/components/cookie-banner/template.njk +97 -0
  26. package/build/components/footer/footer.yaml +5 -0
  27. package/build/components/footer/macro.njk +1 -0
  28. package/build/components/footer/template.njk +9 -0
  29. package/build/components/header/README.md +34 -0
  30. package/build/components/header/_index.scss +19 -0
  31. package/build/components/header/header.yaml +16 -0
  32. package/build/components/header/macro.njk +3 -0
  33. package/build/components/header/template.njk +88 -0
  34. package/build/components/language-select/_index.scss +35 -0
  35. package/build/components/language-select/language-select.yaml +43 -0
  36. package/build/components/language-select/macro.njk +2 -0
  37. package/build/components/language-select/template.njk +38 -0
  38. package/build/components/phase-banner/_index.scss +20 -0
  39. package/build/components/phase-banner/macro.njk +3 -0
  40. package/build/components/phase-banner/phase-banner.yaml +17 -0
  41. package/build/components/phase-banner/tag/macro.njk +3 -0
  42. package/build/components/phase-banner/tag/template.njk +3 -0
  43. package/build/components/phase-banner/template.njk +22 -0
  44. package/build/components/skip-link/README.md +10 -0
  45. package/build/components/skip-link/macro.njk +3 -0
  46. package/build/components/skip-link/skip-link.yaml +5 -0
  47. package/build/components/skip-link/template.njk +10 -0
  48. package/build/esm/__tests__/index.spec.d.ts +2 -0
  49. package/build/esm/__tests__/index.spec.d.ts.map +1 -0
  50. package/build/esm/__tests__/logger.spec.d.ts +2 -0
  51. package/build/esm/__tests__/logger.spec.d.ts.map +1 -0
  52. package/build/esm/index.d.ts +29 -0
  53. package/build/esm/index.d.ts.map +1 -0
  54. package/build/esm/index.js +188 -0
  55. package/build/esm/lib/helmet.d.ts +31 -0
  56. package/build/esm/lib/helmet.d.ts.map +1 -0
  57. package/build/esm/lib/index.d.ts +4 -0
  58. package/build/esm/lib/index.d.ts.map +1 -0
  59. package/build/esm/lib/locals.d.ts +11 -0
  60. package/build/esm/lib/locals.d.ts.map +1 -0
  61. package/build/esm/lib/settings.d.ts +21 -0
  62. package/build/esm/lib/settings.d.ts.map +1 -0
  63. package/build/esm/utils/logger.d.ts +9 -0
  64. package/build/esm/utils/logger.d.ts.map +1 -0
  65. package/package.json +31 -14
@@ -0,0 +1,82 @@
1
+ {% extends "hmpo-template.njk" %}
2
+
3
+ {% from "frontend-ui/build/components/cookie-banner/macro.njk" import frontendUiCookieBanner %}
4
+ {% from "frontend-ui/build/components/phase-banner/macro.njk" import frontendUiPhaseBanner %}
5
+ {% from "frontend-ui/build/components/header/macro.njk" import frontendUiHeader %}
6
+ {% from "frontend-ui/build/components/footer/macro.njk" import frontendUiFooter %}
7
+ {% from "frontend-ui/build/components/language-select/macro.njk" import frontendUiLanguageSelect %}
8
+
9
+ {%- block pageTitle %}
10
+ {{- (translate("govuk.error", { default: "Error" }) + ": ") if errorlist.length }}{{ hmpoTitle | safe }}{{ " – " + govukServiceName | safe if govukServiceName !== " " }} – GOV.UK One Login
11
+ {%- endblock %}
12
+
13
+ {% block header %}
14
+
15
+ {% block frontendUiCookieBanner %}
16
+ {{ frontendUiCookieBanner({
17
+ translations: translations.cookieBanner
18
+ }
19
+ )}}
20
+ {% endblock %}
21
+
22
+ {% block frontendUiHeader %}
23
+ {{ frontendUiHeader({
24
+ translations: translations.header,
25
+ homepageUrl: "https://www.gov.uk"
26
+ }) }}
27
+ {% endblock %}
28
+ {% endblock %}
29
+
30
+ {% block beforeContent %}
31
+ {{ frontendUiPhaseBanner({
32
+ translations: translations.phaseBanner,
33
+ url: currentUrl,
34
+ contactUrl: 'https://signin.account.gov.uk/contact-us'
35
+ }) }}
36
+ {% block backLink %}
37
+ {{ frontendUiLanguageSelect({
38
+ translations: translations.languageSelect,
39
+ url: currentUrl,
40
+ activeLanguage: htmlLang
41
+ }) }}
42
+ {% if backLink %}
43
+ {% from "govuk/components/back-link/macro.njk" import govukBackLink %}
44
+ <span id="back">{{ govukBackLink({
45
+ text: translate("govuk.backLink"),
46
+ href: backLink}) }}
47
+ </span>
48
+ {% endif %}
49
+
50
+ {% endblock %}
51
+ {% endblock %}
52
+
53
+ {% block footer %}
54
+ {{ frontendUiFooter({
55
+ translations: translations.footer
56
+ }) }}
57
+ {% endblock %}
58
+
59
+ {% block bodyEnd %}
60
+ {% block scripts %}
61
+ <script type="text/javascript" src="/public/javascripts/all.js"></script>
62
+ <script type="text/javascript" src="/public/javascripts/analytics.js"></script>
63
+ <script type="text/javascript" {% if cspNonce %} nonce="{{ cspNonce }}"{% endif %}>
64
+ window.GOVUKFrontend.initAll()
65
+ window.DI.appInit({
66
+ ga4ContainerId: "{{ga4ContainerId}}",
67
+ uaContainerId:"{{uaContainerId}}"
68
+ },{
69
+ enableGa4Tracking:{{ga4Enabled}},
70
+ enableUaTracking:{{uaEnabled}},
71
+ enablePageViewTracking:{{ga4PageViewEnabled}},
72
+ enableFormErrorTracking:{{ga4FormErrorEnabled}},
73
+ enableFormChangeTracking:{{ga4FormChangeEnabled}},
74
+ enableFormResponseTracking:{{ga4FormResponseEnabled}},
75
+ enableNavigationTracking:{{ga4NavigationEnabled}},
76
+ enableSelectContentTracking:{{ga4SelectContentEnabled}},
77
+ cookieDomain:"{{analyticsCookieDomain}}",
78
+ isDataSensitive:{{analyticsDataSensitive}}
79
+ });
80
+ </script>
81
+ {% endblock %}
82
+ {% endblock %}
@@ -0,0 +1,6 @@
1
+ params:
2
+ - name: translations
3
+ type: string
4
+ required: true
5
+ description: translations from middleware
6
+
@@ -0,0 +1 @@
1
+ {% macro frontendUiCookieBanner(params) %} {%- include "./template.njk" -%} {% endmacro %}
@@ -0,0 +1,97 @@
1
+ {% from "govuk/components/cookie-banner/macro.njk" import govukCookieBanner %}
2
+
3
+ {% set lng = params.activeLanguage %}
4
+ {% set cookieBanner = params.translations %}
5
+
6
+ {% set html %}
7
+ <p class="govuk-body">{{ cookieBanner.body1 }}</p>
8
+ <p class="govuk-body">{{ cookieBanner.body2 }}</p>
9
+ {% endset %}
10
+
11
+ {% set acceptHtml %}
12
+ <p class="govuk-body">
13
+ {{ cookieBanner.cookieBannerAccept.body1 }}
14
+ <a class="govuk-link" href="https://signin.account.gov.uk/cookies">
15
+ {{ cookieBanner.changeCookiePreferencesLink }}
16
+ </a>
17
+ {{ cookieBanner.cookieBannerAccept.body2 }}
18
+ </p>
19
+ {% endset %}
20
+
21
+ {% set rejectedHtml %}
22
+ <p class="govuk-body">
23
+ {{ cookieBanner.cookieBannerReject.body1 }}
24
+ <a class="govuk-link" href="https://signin.account.gov.uk/cookies">
25
+ {{ cookieBanner.changeCookiePreferencesLink }}
26
+ </a>
27
+ {{ cookieBanner.cookieBannerReject.body2 }}
28
+ </p>
29
+ {% endset %}
30
+
31
+ {{ govukCookieBanner({
32
+ ariaLabel: 'cookieBanner.ariaLabel',
33
+ name: "gov-uk-cookie-banner",
34
+ messages: [
35
+ {
36
+ headingText: cookieBanner.headingText,
37
+ html: html,
38
+ attributes: {
39
+ "id": "cookies-banner-main"
40
+ },
41
+ actions: [
42
+ {
43
+ text: cookieBanner.acceptAdditionalCookies,
44
+ type: "button",
45
+ name: "cookiesAccept",
46
+ value: "accept"
47
+ },
48
+ {
49
+ text: cookieBanner.rejectAdditionalCookies,
50
+ type: "button",
51
+ name: "cookiesReject",
52
+ value: "reject"
53
+ },
54
+ {
55
+ text: cookieBanner.viewCookies,
56
+ href: "https://signin.account.gov.uk/cookies"
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ html: acceptHtml,
62
+ attributes: {
63
+ "id": "cookies-accepted"
64
+ },
65
+ actions: [
66
+ {
67
+ text: cookieBanner.hideCookieMessage,
68
+ href: "#",
69
+ type: "button",
70
+ classes:"cookie-hide-button",
71
+ attributes: {
72
+ "aria-label": cookieBanner.hideCookieMessage
73
+ }
74
+ }
75
+ ],
76
+ hidden: true
77
+ },
78
+ {
79
+ html: rejectedHtml,
80
+ attributes: {
81
+ "id": "cookies-rejected"
82
+ },
83
+ actions: [
84
+ {
85
+ text: cookieBanner.hideCookieMessage,
86
+ href: "#",
87
+ type: "button",
88
+ classes:"cookie-hide-button",
89
+ attributes: {
90
+ "aria-label": cookieBanner.hideCookieMessage
91
+ }
92
+ }
93
+ ],
94
+ hidden: true
95
+ }
96
+ ], hidden: false
97
+ }) }}
@@ -0,0 +1,5 @@
1
+ params:
2
+ - name: translations
3
+ type: string
4
+ required: true
5
+ description: translations from middleware
@@ -0,0 +1 @@
1
+ {% macro frontendUiFooter(params) %} {%- include "./template.njk" -%} {% endmacro %}
@@ -0,0 +1,9 @@
1
+ {% set footer = params.translations %}
2
+
3
+ {% from "govuk/components/footer/macro.njk" import govukFooter %}
4
+
5
+ {{ govukFooter({
6
+ meta: { items: footer.footerNavItems },
7
+ contentLicence: { html: footer.contentLicence.html },
8
+ copyright: { text: footer.copyright.text }
9
+ }) }}
@@ -0,0 +1,34 @@
1
+ # Header
2
+
3
+ ###### For translations to work you __must__ pass in the `header: translations` varible
4
+ ```html
5
+ {% block header %}
6
+ {{ frontendUiHeader
7
+ ({
8
+ header: translations
9
+ })
10
+ }}
11
+ {% endblock %}
12
+ ```
13
+
14
+ ###### In order to remove the linking capability of the header logo and text include the `isEmbeddedMobileApp = true` variable within your repos basefile when you are calling the header
15
+ ```html
16
+ {% block header %}
17
+ {{ frontendUiHeader
18
+ ({
19
+ isEmbeddedMobileApp = true
20
+ })
21
+ }}
22
+ {% endblock %}
23
+ ```
24
+
25
+ ###### To enable the sign out functionality of the heade include the `signOutLink` variable within your repos basefile when calling the header
26
+ ```html
27
+ {% block header %}
28
+ {{ frontendUiHeader
29
+ ({
30
+ signOutLink: 'https://signin.account.gov.uk/signed-out'
31
+ })
32
+ }}
33
+ {% endblock %}
34
+ ```
@@ -0,0 +1,19 @@
1
+ @media (max-width: 640px) {
2
+ .govuk-header__navigation-item {
3
+ border-left: none !important;
4
+ }
5
+ }
6
+
7
+ .frontendUi_header_signOut-item{
8
+ padding: 5px 0px 5px 30px;
9
+ border-left: 1px solid #b1b4b6;
10
+ margin-left: auto;
11
+ }
12
+
13
+ .frontendUi_header__signOut{
14
+ display: flex;
15
+ }
16
+
17
+ .frontendUi-header__content{
18
+ margin-left: auto;
19
+ }
@@ -0,0 +1,16 @@
1
+ params:
2
+ - name: translations
3
+ type: string
4
+ required: true
5
+ description: translations from middleware
6
+ - name: isEmbeddedMobileApp
7
+ type: boolean
8
+ required: false
9
+ description: disables the gov.uk link in the header
10
+ - name: signOutLink
11
+ type: string
12
+ required: false
13
+ description: where the signout button will direct the user
14
+
15
+
16
+
@@ -0,0 +1,3 @@
1
+ {% macro frontendUiHeader(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,88 @@
1
+ {% 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
+
7
+ We use currentColour so that we can easily invert it when printing and
8
+ when the focus state is applied. This also benefits users who override
9
+ colours in their browser as they will still see the crown.
10
+
11
+ The SVG needs `focusable="false"` so that Internet Explorer does not
12
+ treat it as an interactive element - without this it will be
13
+ 'focusable' when using the keyboard to navigate. #}
14
+
15
+ {% set _stEdwardsCrown %}
16
+ <!--[if gt E 8]><!-->
17
+ <svg
18
+ aria-hidden="true"
19
+ focusable="false"
20
+ class="govuk-header__logotype-crown"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ viewBox="0 0 132 97"
23
+ height="30"
24
+ width="36"
25
+ >
26
+ <path
27
+ fill="currentColor" fill-rule="evenodd"
28
+ d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1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-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
29
+ </svg>
30
+ <!--<![endif]-->
31
+ <!--[if IE 8]>
32
+ <img src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-crown.png" class="govuk-header__logotype-crown-fallback-image" width="36" height="32" alt="">
33
+ <![endif]-->
34
+ {% endset %}
35
+
36
+ {% set _tudorCrown %}
37
+ <!--[if gt IE 8]><!-->
38
+ <svg
39
+ aria-hidden="true"
40
+ focusable="false"
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-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.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.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>
85
+ </div>
86
+ {% endif %}
87
+ </div>
88
+ </header>
@@ -0,0 +1,35 @@
1
+ .language-select {
2
+ margin: 15px 0 15px 0;
3
+ }
4
+
5
+ .language-select__list {
6
+ margin-top: 1em;
7
+ text-align: right;
8
+ }
9
+
10
+ .language-select__list-item {
11
+ display: inline-block;
12
+ }
13
+
14
+ .language-select__list-item:first-child::after {
15
+ content: "";
16
+ display: inline-block;
17
+ position: relative;
18
+ top: 0.1875em;
19
+ height: 1em;
20
+ border-right: 0.09375em solid black;
21
+ }
22
+
23
+ .language-select__list-item a,
24
+ .language-select__list-item [aria-current] {
25
+ padding: 0.3125em;
26
+ }
27
+
28
+ @media screen and (max-width: 641px) {
29
+ .language-select__list {
30
+ float: none;
31
+ text-align: left;
32
+ padding-bottom: 10px;
33
+ border-bottom: 1px solid #b1b4b6;
34
+ }
35
+ }
@@ -0,0 +1,43 @@
1
+ params:
2
+ - name: translations
3
+ type: string
4
+ required: true
5
+ description: translations from middleware
6
+ - name: activeLanguage
7
+ type: string
8
+ required: true
9
+ description: currently selected language
10
+ - name: currentUrl
11
+ type: string
12
+ required: true
13
+ description: current url to be used to append langauge variable
14
+ - name: ariaLabel
15
+ type: string
16
+ required: false
17
+ description: aria label for the nav tag
18
+ - name: class
19
+ type: string
20
+ required: false
21
+ description: css class you can add
22
+ - name: languages
23
+ type: array
24
+ required: false
25
+ description: array of languages object
26
+ params:
27
+ - name: language
28
+ type: object
29
+ required: false
30
+ description: language object
31
+ params:
32
+ - name: code
33
+ type: string
34
+ required: true
35
+ description: language code
36
+ - name: text
37
+ type: string
38
+ required: true
39
+ description: language text
40
+ - name: visuallyHidden
41
+ type: string
42
+ required: false
43
+ description: language text
@@ -0,0 +1,2 @@
1
+ {% macro frontendUiLanguageSelect(params) %} {%- include "./template.njk" -%} {% endmacro
2
+ %}
@@ -0,0 +1,38 @@
1
+ {% set languageSelect = params.translations %}
2
+ {% if params.languages %}
3
+ {% set languages = params.languages %}
4
+ {% else %}
5
+ {% set languages = [
6
+ { code: "en", text: "English", visuallyHidden: "Change to English" },
7
+ { code: "cy", text: "Cymraeg", visuallyHidden: "Newid yr iaith ir Gymraeg" }
8
+ ] %}
9
+ {% endif %}
10
+
11
+ <nav
12
+ class="language-select {{params.class}}"
13
+ aria-label="{{languageSelect.ariaLabel}}"
14
+ role="navigation"
15
+ >
16
+ <ul
17
+ class="govuk-list language-select__list govuk-body-s govuk-!-margin-0"
18
+ role="list"
19
+ >
20
+ {% for lang in languages %}
21
+ <li class="language-select__list-item" role="listitem">
22
+ {% if params.activeLanguage == lang.code %}
23
+ <span aria-current="true">{{ lang.text }}</span>
24
+ {% else %}
25
+ <a
26
+ class="govuk-link govuk-link--no-visited-state"
27
+ href="{{ addLanguageParam(lang.code, params.url)}}"
28
+ data-journey-click="link - click:lang-select:{{ lang.code }}"
29
+ rel="alternate"
30
+ hreflang="{{ lang.code }}"
31
+ lang="{{lang.code}}"
32
+ role="link"
33
+ >{{ lang.text }}<div class="govuk-visually-hidden">{{ lang.visuallyHidden }}</div></a>
34
+ {% endif %}
35
+ </li>
36
+ {% endfor %}
37
+ </ul>
38
+ </nav>
@@ -0,0 +1,20 @@
1
+ @import "../../../../node_modules/govuk-frontend/govuk/base.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
+ @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
+ }
@@ -0,0 +1,3 @@
1
+ {% macro frontendUiPhaseBanner(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -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,3 @@
1
+ {% macro frontendUiTag(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ <strong class="govuk-tag{% if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
2
+ {{ params.html | safe if params.html}}
3
+ </strong>
@@ -0,0 +1,22 @@
1
+ {% set phaseBanner = params.translations %}
2
+ {% from "./tag/macro.njk" import frontendUiTag -%}
3
+
4
+ <div 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
+ {{ phaseBanner.text }}
14
+ <a class="govuk-link"
15
+ rel="noopener"
16
+ target="_blank"
17
+ href="{{ contactUsUrl(params.contactUrl, params.url) or contactUsUrl('https://signin.account.gov.uk/contact-us', params.url) }}">
18
+ {{ phaseBanner.link }}
19
+ </a>
20
+ </span>
21
+ </p>
22
+ </div>
@@ -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,3 @@
1
+ {% macro frontendUiSkipLink(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,5 @@
1
+ params:
2
+ - name: translations
3
+ type: string
4
+ required: true
5
+ description: translations from middleware
@@ -0,0 +1,10 @@
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
+ }) }}
9
+
10
+
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/index.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=logger.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/logger.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import i18next from "i18next";
2
+ import { NextFunction, Request, Response } from "express";
3
+ export declare const setFrontendUiTranslations: (instanceI18n: typeof i18next) => void;
4
+ export declare const frontendUiMiddleware: (req: Request & {
5
+ i18n: {
6
+ language: string;
7
+ store: {
8
+ data: {
9
+ [key: string]: unknown;
10
+ };
11
+ };
12
+ };
13
+ }, res: Response & {
14
+ locals: {
15
+ translations: unknown;
16
+ };
17
+ }, next: NextFunction) => void;
18
+ export declare const frontendUiMiddlewareIdentityBypass: (req: Request & {
19
+ i18n: {
20
+ language: "en" | "cy";
21
+ };
22
+ }, res: Response & {
23
+ locals: {
24
+ translations: unknown;
25
+ };
26
+ }, next: NextFunction) => void;
27
+ export declare function addLanguageParam(language: string, url?: URL): string;
28
+ export declare function contactUsUrl(baseUrl: string, urlToAppend: string): string | null;
29
+ //# sourceMappingURL=index.d.ts.map