govuk_publishing_components 35.3.3 → 35.3.4
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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/component_guide/application.scss +37 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +10 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -2
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -3
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +5 -5
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +1 -0
- data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -0
- data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +4 -0
- data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/axe.d.ts +77 -6
- data/node_modules/axe-core/axe.js +955 -600
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/locales/_template.json +6 -6
- data/node_modules/axe-core/locales/ja.json +91 -11
- data/node_modules/axe-core/package.json +5 -5
- data/node_modules/axe-core/sri-history.json +4 -0
- data/node_modules/govuk-frontend/README.md +4 -5
- data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
- data/node_modules/govuk-frontend/govuk/all.js +738 -258
- data/node_modules/govuk-frontend/govuk/all.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +11 -7
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
- data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/common/index.js +16 -4
- data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +20 -10
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common.js +16 -4
- data/node_modules/govuk-frontend/govuk/common.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +3 -3
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +234 -86
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +32 -13
- data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +8 -2
- data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +12 -12
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +8 -6
- data/node_modules/govuk-frontend/govuk/components/button/button.js +54 -19
- data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +11 -1
- data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/button/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +170 -76
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +3 -3
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +75 -24
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +47 -47
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +3 -3
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +26 -26
- data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/details.js +39 -13
- data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +10 -10
- data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +67 -27
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +19 -19
- data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +19 -19
- data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +14 -14
- data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
- data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +22 -22
- data/node_modules/govuk-frontend/govuk/components/header/header.js +46 -14
- data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
- data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +54 -41
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/input/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +6 -6
- data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +49 -22
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +16 -16
- data/node_modules/govuk-frontend/govuk/components/pagination/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +10 -10
- data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
- data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +46 -46
- data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +65 -22
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -2
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
- data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +19 -20
- data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/select/template.njk +5 -2
- data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +41 -13
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +34 -34
- data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +21 -21
- data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +15 -15
- data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +178 -60
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
- data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +18 -18
- data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +9 -5
- data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +3 -3
- data/node_modules/govuk-frontend/govuk/components/warning-text/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
- data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
- data/node_modules/govuk-frontend/govuk/i18n.js +38 -30
- data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/macros/i18n.njk +12 -11
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
- data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
- data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
- data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +10 -3
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +13 -7
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +8 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +8 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +10 -3
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +3 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -1
- data/node_modules/govuk-frontend/govuk-esm/all.mjs +81 -60
- data/node_modules/govuk-frontend/govuk-esm/all.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs +12 -8
- data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs +9 -0
- data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +44 -29
- data/node_modules/govuk-frontend/govuk-esm/common/index.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +15 -9
- data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common.mjs +3 -5
- data/node_modules/govuk-frontend/govuk-esm/common.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +319 -211
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +47 -30
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +169 -115
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +88 -51
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +64 -54
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +69 -50
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +59 -35
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +36 -25
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +67 -38
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +49 -32
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +263 -163
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +68 -57
- data/node_modules/govuk-frontend/govuk-esm/i18n.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs +5 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs +7 -4
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs +13 -10
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs +6 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs +6 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs +7 -4
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs +5 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +2 -1
- data/node_modules/govuk-frontend/package.json +3 -2
- metadata +43 -6
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px.png → dbt_crest_13px.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px_x2.png → dbt_crest_13px_x2.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px.png → dbt_crest_18px.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px_x2.png → dbt_crest_18px_x2.png} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { mergeConfigs } from '../../common/index.mjs';
|
|
2
|
+
import { normaliseDataset } from '../../common/normalise-dataset.mjs';
|
|
3
|
+
import '../../vendor/polyfills/Element/prototype/closest.mjs';
|
|
4
|
+
import '../../vendor/polyfills/Event.mjs';
|
|
5
|
+
import '../../vendor/polyfills/Function/prototype/bind.mjs';
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
import { normaliseDataset } from '../../common/normalise-dataset.mjs'
|
|
5
|
-
import '../../vendor/polyfills/Element/prototype/closest.mjs'
|
|
6
|
-
import '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded
|
|
7
|
-
import '../../vendor/polyfills/Function/prototype/bind.mjs'
|
|
7
|
+
/* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* JavaScript enhancements for the ErrorSummary
|
|
@@ -12,7 +12,7 @@ import '../../vendor/polyfills/Function/prototype/bind.mjs'
|
|
|
12
12
|
* Takes focus on initialisation for accessible announcement, unless disabled in configuration.
|
|
13
13
|
*
|
|
14
14
|
* @class
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {Element} $module - HTML element to use for error summary
|
|
16
16
|
* @param {ErrorSummaryConfig} [config] - Error summary config
|
|
17
17
|
*/
|
|
18
18
|
function ErrorSummary ($module, config) {
|
|
@@ -23,42 +23,52 @@ function ErrorSummary ($module, config) {
|
|
|
23
23
|
// To avoid breaking further JavaScript initialisation
|
|
24
24
|
// we need to safeguard against this so things keep
|
|
25
25
|
// working the same now we read the elements data attributes
|
|
26
|
-
if (
|
|
26
|
+
if (!($module instanceof HTMLElement)) {
|
|
27
27
|
// Little safety in case code gets ported as-is
|
|
28
28
|
// into and ES6 class constructor, where the return value matters
|
|
29
29
|
return this
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/** @deprecated Will be made private in v5.0 */
|
|
33
|
+
this.$module = $module;
|
|
33
34
|
|
|
34
35
|
var defaultConfig = {
|
|
35
36
|
disableAutoFocus: false
|
|
36
|
-
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Will be made private in v5.0
|
|
41
|
+
* @type {ErrorSummaryConfig}
|
|
42
|
+
*/
|
|
37
43
|
this.config = mergeConfigs(
|
|
38
44
|
defaultConfig,
|
|
39
45
|
config || {},
|
|
40
46
|
normaliseDataset($module.dataset)
|
|
41
|
-
)
|
|
47
|
+
);
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
/**
|
|
45
51
|
* Initialise component
|
|
46
52
|
*/
|
|
47
53
|
ErrorSummary.prototype.init = function () {
|
|
48
|
-
|
|
49
|
-
if (
|
|
54
|
+
// Check that required elements are present
|
|
55
|
+
if (!this.$module) {
|
|
50
56
|
return
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
this
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
var $module = this.$module;
|
|
60
|
+
|
|
61
|
+
this.setFocus();
|
|
62
|
+
$module.addEventListener('click', this.handleClick.bind(this));
|
|
63
|
+
};
|
|
56
64
|
|
|
57
65
|
/**
|
|
58
66
|
* Focus the error summary
|
|
67
|
+
*
|
|
68
|
+
* @deprecated Will be made private in v5.0
|
|
59
69
|
*/
|
|
60
70
|
ErrorSummary.prototype.setFocus = function () {
|
|
61
|
-
var $module = this.$module
|
|
71
|
+
var $module = this.$module;
|
|
62
72
|
|
|
63
73
|
if (this.config.disableAutoFocus) {
|
|
64
74
|
return
|
|
@@ -66,26 +76,27 @@ ErrorSummary.prototype.setFocus = function () {
|
|
|
66
76
|
|
|
67
77
|
// Set tabindex to -1 to make the element programmatically focusable, but
|
|
68
78
|
// remove it on blur as the error summary doesn't need to be focused again.
|
|
69
|
-
$module.setAttribute('tabindex', '-1')
|
|
79
|
+
$module.setAttribute('tabindex', '-1');
|
|
70
80
|
|
|
71
81
|
$module.addEventListener('blur', function () {
|
|
72
|
-
$module.removeAttribute('tabindex')
|
|
73
|
-
})
|
|
82
|
+
$module.removeAttribute('tabindex');
|
|
83
|
+
});
|
|
74
84
|
|
|
75
|
-
$module.focus()
|
|
76
|
-
}
|
|
85
|
+
$module.focus();
|
|
86
|
+
};
|
|
77
87
|
|
|
78
88
|
/**
|
|
79
89
|
* Click event handler
|
|
80
90
|
*
|
|
91
|
+
* @deprecated Will be made private in v5.0
|
|
81
92
|
* @param {MouseEvent} event - Click event
|
|
82
93
|
*/
|
|
83
94
|
ErrorSummary.prototype.handleClick = function (event) {
|
|
84
|
-
var $target = event.target
|
|
95
|
+
var $target = event.target;
|
|
85
96
|
if (this.focusTarget($target)) {
|
|
86
|
-
event.preventDefault()
|
|
97
|
+
event.preventDefault();
|
|
87
98
|
}
|
|
88
|
-
}
|
|
99
|
+
};
|
|
89
100
|
|
|
90
101
|
/**
|
|
91
102
|
* Focus the target element
|
|
@@ -102,22 +113,27 @@ ErrorSummary.prototype.handleClick = function (event) {
|
|
|
102
113
|
* NVDA (as tested in 2018.3.2) - without this only the field type is announced
|
|
103
114
|
* (e.g. "Edit, has autocomplete").
|
|
104
115
|
*
|
|
116
|
+
* @deprecated Will be made private in v5.0
|
|
105
117
|
* @param {EventTarget} $target - Event target
|
|
106
118
|
* @returns {boolean} True if the target was able to be focussed
|
|
107
119
|
*/
|
|
108
120
|
ErrorSummary.prototype.focusTarget = function ($target) {
|
|
109
121
|
// If the element that was clicked was not a link, return early
|
|
110
|
-
if ($target
|
|
122
|
+
if (!($target instanceof HTMLAnchorElement)) {
|
|
111
123
|
return false
|
|
112
124
|
}
|
|
113
125
|
|
|
114
|
-
var inputId = this.getFragmentFromUrl($target.href)
|
|
115
|
-
|
|
126
|
+
var inputId = this.getFragmentFromUrl($target.href);
|
|
127
|
+
if (!inputId) {
|
|
128
|
+
return false
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var $input = document.getElementById(inputId);
|
|
116
132
|
if (!$input) {
|
|
117
133
|
return false
|
|
118
134
|
}
|
|
119
135
|
|
|
120
|
-
var $legendOrLabel = this.getAssociatedLegendOrLabel($input)
|
|
136
|
+
var $legendOrLabel = this.getAssociatedLegendOrLabel($input);
|
|
121
137
|
if (!$legendOrLabel) {
|
|
122
138
|
return false
|
|
123
139
|
}
|
|
@@ -125,11 +141,11 @@ ErrorSummary.prototype.focusTarget = function ($target) {
|
|
|
125
141
|
// Scroll the legend or label into view *before* calling focus on the input to
|
|
126
142
|
// avoid extra scrolling in browsers that don't support `preventScroll` (which
|
|
127
143
|
// at time of writing is most of them...)
|
|
128
|
-
$legendOrLabel.scrollIntoView()
|
|
129
|
-
$input.focus({ preventScroll: true })
|
|
144
|
+
$legendOrLabel.scrollIntoView();
|
|
145
|
+
$input.focus({ preventScroll: true });
|
|
130
146
|
|
|
131
147
|
return true
|
|
132
|
-
}
|
|
148
|
+
};
|
|
133
149
|
|
|
134
150
|
/**
|
|
135
151
|
* Get fragment from URL
|
|
@@ -137,16 +153,17 @@ ErrorSummary.prototype.focusTarget = function ($target) {
|
|
|
137
153
|
* Extract the fragment (everything after the hash) from a URL, but not including
|
|
138
154
|
* the hash.
|
|
139
155
|
*
|
|
156
|
+
* @deprecated Will be made private in v5.0
|
|
140
157
|
* @param {string} url - URL
|
|
141
|
-
* @returns {string} Fragment from URL, without the hash
|
|
158
|
+
* @returns {string | undefined} Fragment from URL, without the hash
|
|
142
159
|
*/
|
|
143
160
|
ErrorSummary.prototype.getFragmentFromUrl = function (url) {
|
|
144
161
|
if (url.indexOf('#') === -1) {
|
|
145
|
-
return
|
|
162
|
+
return undefined
|
|
146
163
|
}
|
|
147
164
|
|
|
148
165
|
return url.split('#').pop()
|
|
149
|
-
}
|
|
166
|
+
};
|
|
150
167
|
|
|
151
168
|
/**
|
|
152
169
|
* Get associated legend or label
|
|
@@ -159,22 +176,23 @@ ErrorSummary.prototype.getFragmentFromUrl = function (url) {
|
|
|
159
176
|
* - The first `<label>` that is associated with the input using for="inputId"
|
|
160
177
|
* - The closest parent `<label>`
|
|
161
178
|
*
|
|
162
|
-
* @
|
|
163
|
-
* @
|
|
164
|
-
*
|
|
179
|
+
* @deprecated Will be made private in v5.0
|
|
180
|
+
* @param {Element} $input - The input
|
|
181
|
+
* @returns {Element | null} Associated legend or label, or null if no associated
|
|
182
|
+
* legend or label can be found
|
|
165
183
|
*/
|
|
166
184
|
ErrorSummary.prototype.getAssociatedLegendOrLabel = function ($input) {
|
|
167
|
-
var $fieldset = $input.closest('fieldset')
|
|
185
|
+
var $fieldset = $input.closest('fieldset');
|
|
168
186
|
|
|
169
187
|
if ($fieldset) {
|
|
170
|
-
var $legends = $fieldset.getElementsByTagName('legend')
|
|
188
|
+
var $legends = $fieldset.getElementsByTagName('legend');
|
|
171
189
|
|
|
172
190
|
if ($legends.length) {
|
|
173
|
-
var $candidateLegend = $legends[0]
|
|
191
|
+
var $candidateLegend = $legends[0];
|
|
174
192
|
|
|
175
193
|
// If the input type is radio or checkbox, always use the legend if there
|
|
176
194
|
// is one.
|
|
177
|
-
if ($input.type === 'checkbox' || $input.type === 'radio') {
|
|
195
|
+
if ($input instanceof HTMLInputElement && ($input.type === 'checkbox' || $input.type === 'radio')) {
|
|
178
196
|
return $candidateLegend
|
|
179
197
|
}
|
|
180
198
|
|
|
@@ -184,13 +202,13 @@ ErrorSummary.prototype.getAssociatedLegendOrLabel = function ($input) {
|
|
|
184
202
|
//
|
|
185
203
|
// This should avoid situations where the input either ends up off the
|
|
186
204
|
// screen, or obscured by a software keyboard.
|
|
187
|
-
var legendTop = $candidateLegend.getBoundingClientRect().top
|
|
188
|
-
var inputRect = $input.getBoundingClientRect()
|
|
205
|
+
var legendTop = $candidateLegend.getBoundingClientRect().top;
|
|
206
|
+
var inputRect = $input.getBoundingClientRect();
|
|
189
207
|
|
|
190
208
|
// If the browser doesn't support Element.getBoundingClientRect().height
|
|
191
209
|
// or window.innerHeight (like IE8), bail and just link to the label.
|
|
192
210
|
if (inputRect.height && window.innerHeight) {
|
|
193
|
-
var inputBottom = inputRect.top + inputRect.height
|
|
211
|
+
var inputBottom = inputRect.top + inputRect.height;
|
|
194
212
|
|
|
195
213
|
if (inputBottom - legendTop < window.innerHeight / 2) {
|
|
196
214
|
return $candidateLegend
|
|
@@ -201,14 +219,15 @@ ErrorSummary.prototype.getAssociatedLegendOrLabel = function ($input) {
|
|
|
201
219
|
|
|
202
220
|
return document.querySelector("label[for='" + $input.getAttribute('id') + "']") ||
|
|
203
221
|
$input.closest('label')
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export default ErrorSummary
|
|
222
|
+
};
|
|
207
223
|
|
|
208
224
|
/**
|
|
209
225
|
* Error summary config
|
|
210
226
|
*
|
|
211
227
|
* @typedef {object} ErrorSummaryConfig
|
|
212
|
-
* @property {boolean} [disableAutoFocus = false] -
|
|
213
|
-
*
|
|
228
|
+
* @property {boolean} [disableAutoFocus = false] - If set to `true` the error
|
|
229
|
+
* summary will not be focussed when the page loads.
|
|
214
230
|
*/
|
|
231
|
+
|
|
232
|
+
export default ErrorSummary;
|
|
233
|
+
//# sourceMappingURL=components/error-summary/error-summary.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-summary.mjs","sources":["../../../../src/govuk/components/error-summary/error-summary.mjs"],"sourcesContent":["/* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */\n\nimport { mergeConfigs } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport '../../vendor/polyfills/Element/prototype/closest.mjs'\nimport '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded\nimport '../../vendor/polyfills/Function/prototype/bind.mjs'\n\n/**\n * JavaScript enhancements for the ErrorSummary\n *\n * Takes focus on initialisation for accessible announcement, unless disabled in configuration.\n *\n * @class\n * @param {Element} $module - HTML element to use for error summary\n * @param {ErrorSummaryConfig} [config] - Error summary config\n */\nfunction ErrorSummary ($module, config) {\n // Some consuming code may not be passing a module,\n // for example if they initialise the component\n // on their own by directly passing the result\n // of `document.querySelector`.\n // To avoid breaking further JavaScript initialisation\n // we need to safeguard against this so things keep\n // working the same now we read the elements data attributes\n if (!($module instanceof HTMLElement)) {\n // Little safety in case code gets ported as-is\n // into and ES6 class constructor, where the return value matters\n return this\n }\n\n /** @deprecated Will be made private in v5.0 */\n this.$module = $module\n\n var defaultConfig = {\n disableAutoFocus: false\n }\n\n /**\n * @deprecated Will be made private in v5.0\n * @type {ErrorSummaryConfig}\n */\n this.config = mergeConfigs(\n defaultConfig,\n config || {},\n normaliseDataset($module.dataset)\n )\n}\n\n/**\n * Initialise component\n */\nErrorSummary.prototype.init = function () {\n // Check that required elements are present\n if (!this.$module) {\n return\n }\n\n var $module = this.$module\n\n this.setFocus()\n $module.addEventListener('click', this.handleClick.bind(this))\n}\n\n/**\n * Focus the error summary\n *\n * @deprecated Will be made private in v5.0\n */\nErrorSummary.prototype.setFocus = function () {\n var $module = this.$module\n\n if (this.config.disableAutoFocus) {\n return\n }\n\n // Set tabindex to -1 to make the element programmatically focusable, but\n // remove it on blur as the error summary doesn't need to be focused again.\n $module.setAttribute('tabindex', '-1')\n\n $module.addEventListener('blur', function () {\n $module.removeAttribute('tabindex')\n })\n\n $module.focus()\n}\n\n/**\n * Click event handler\n *\n * @deprecated Will be made private in v5.0\n * @param {MouseEvent} event - Click event\n */\nErrorSummary.prototype.handleClick = function (event) {\n var $target = event.target\n if (this.focusTarget($target)) {\n event.preventDefault()\n }\n}\n\n/**\n * Focus the target element\n *\n * By default, the browser will scroll the target into view. Because our labels\n * or legends appear above the input, this means the user will be presented with\n * an input without any context, as the label or legend will be off the top of\n * the screen.\n *\n * Manually handling the click event, scrolling the question into view and then\n * focussing the element solves this.\n *\n * This also results in the label and/or legend being announced correctly in\n * NVDA (as tested in 2018.3.2) - without this only the field type is announced\n * (e.g. \"Edit, has autocomplete\").\n *\n * @deprecated Will be made private in v5.0\n * @param {EventTarget} $target - Event target\n * @returns {boolean} True if the target was able to be focussed\n */\nErrorSummary.prototype.focusTarget = function ($target) {\n // If the element that was clicked was not a link, return early\n if (!($target instanceof HTMLAnchorElement)) {\n return false\n }\n\n var inputId = this.getFragmentFromUrl($target.href)\n if (!inputId) {\n return false\n }\n\n var $input = document.getElementById(inputId)\n if (!$input) {\n return false\n }\n\n var $legendOrLabel = this.getAssociatedLegendOrLabel($input)\n if (!$legendOrLabel) {\n return false\n }\n\n // Scroll the legend or label into view *before* calling focus on the input to\n // avoid extra scrolling in browsers that don't support `preventScroll` (which\n // at time of writing is most of them...)\n $legendOrLabel.scrollIntoView()\n $input.focus({ preventScroll: true })\n\n return true\n}\n\n/**\n * Get fragment from URL\n *\n * Extract the fragment (everything after the hash) from a URL, but not including\n * the hash.\n *\n * @deprecated Will be made private in v5.0\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nErrorSummary.prototype.getFragmentFromUrl = function (url) {\n if (url.indexOf('#') === -1) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get associated legend or label\n *\n * Returns the first element that exists from this list:\n *\n * - The `<legend>` associated with the closest `<fieldset>` ancestor, as long\n * as the top of it is no more than half a viewport height away from the\n * bottom of the input\n * - The first `<label>` that is associated with the input using for=\"inputId\"\n * - The closest parent `<label>`\n *\n * @deprecated Will be made private in v5.0\n * @param {Element} $input - The input\n * @returns {Element | null} Associated legend or label, or null if no associated\n * legend or label can be found\n */\nErrorSummary.prototype.getAssociatedLegendOrLabel = function ($input) {\n var $fieldset = $input.closest('fieldset')\n\n if ($fieldset) {\n var $legends = $fieldset.getElementsByTagName('legend')\n\n if ($legends.length) {\n var $candidateLegend = $legends[0]\n\n // If the input type is radio or checkbox, always use the legend if there\n // is one.\n if ($input instanceof HTMLInputElement && ($input.type === 'checkbox' || $input.type === 'radio')) {\n return $candidateLegend\n }\n\n // For other input types, only scroll to the fieldset’s legend (instead of\n // the label associated with the input) if the input would end up in the\n // top half of the screen.\n //\n // This should avoid situations where the input either ends up off the\n // screen, or obscured by a software keyboard.\n var legendTop = $candidateLegend.getBoundingClientRect().top\n var inputRect = $input.getBoundingClientRect()\n\n // If the browser doesn't support Element.getBoundingClientRect().height\n // or window.innerHeight (like IE8), bail and just link to the label.\n if (inputRect.height && window.innerHeight) {\n var inputBottom = inputRect.top + inputRect.height\n\n if (inputBottom - legendTop < window.innerHeight / 2) {\n return $candidateLegend\n }\n }\n }\n }\n\n return document.querySelector(\"label[for='\" + $input.getAttribute('id') + \"']\") ||\n $input.closest('label')\n}\n\nexport default ErrorSummary\n\n/**\n * Error summary config\n *\n * @typedef {object} ErrorSummaryConfig\n * @property {boolean} [disableAutoFocus = false] - If set to `true` the error\n * summary will not be focussed when the page loads.\n */\n"],"names":[],"mappings":"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"}
|
|
@@ -1,31 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
import '../../vendor/polyfills/Event.mjs';
|
|
2
|
+
import '../../vendor/polyfills/Function/prototype/bind.mjs';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
import '../../vendor/polyfills/Function/prototype/bind.mjs'
|
|
4
|
+
/* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Header component
|
|
8
8
|
*
|
|
9
9
|
* @class
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {Element} $module - HTML element to use for header
|
|
11
11
|
*/
|
|
12
12
|
function Header ($module) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if (!($module instanceof HTMLElement)) {
|
|
14
|
+
return this
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @deprecated Will be made private in v5.0 */
|
|
18
|
+
this.$module = $module;
|
|
19
|
+
|
|
20
|
+
/** @deprecated Will be made private in v5.0 */
|
|
21
|
+
this.$menuButton = $module.querySelector('.govuk-js-header-toggle');
|
|
22
|
+
|
|
23
|
+
/** @deprecated Will be made private in v5.0 */
|
|
15
24
|
this.$menu = this.$menuButton && $module.querySelector(
|
|
16
25
|
'#' + this.$menuButton.getAttribute('aria-controls')
|
|
17
|
-
)
|
|
26
|
+
);
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Save the opened/closed state for the nav in memory so that we can
|
|
30
|
+
* accurately maintain state when the screen is changed from small to
|
|
31
|
+
* big and back to small
|
|
32
|
+
*
|
|
33
|
+
* @deprecated Will be made private in v5.0
|
|
34
|
+
*/
|
|
35
|
+
this.menuIsOpen = false;
|
|
23
36
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A global const for storing a matchMedia instance which we'll use to
|
|
39
|
+
* detect when a screen size change happens. We set this later during the
|
|
40
|
+
* init function and rely on it being null if the feature isn't available
|
|
41
|
+
* to initially apply hidden attributes
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Will be made private in v5.0
|
|
44
|
+
*/
|
|
45
|
+
this.mql = null;
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
/**
|
|
@@ -39,29 +56,31 @@ function Header ($module) {
|
|
|
39
56
|
* version of the menu to the user.
|
|
40
57
|
*/
|
|
41
58
|
Header.prototype.init = function () {
|
|
59
|
+
// Check that required elements are present
|
|
42
60
|
if (!this.$module || !this.$menuButton || !this.$menu) {
|
|
43
61
|
return
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
if ('matchMedia' in window) {
|
|
47
65
|
// Set the matchMedia to the govuk-frontend desktop breakpoint
|
|
48
|
-
this.mql = window.matchMedia('(min-width: 48.0625em)')
|
|
66
|
+
this.mql = window.matchMedia('(min-width: 48.0625em)');
|
|
49
67
|
|
|
50
68
|
if ('addEventListener' in this.mql) {
|
|
51
|
-
this.mql.addEventListener('change', this.syncState.bind(this))
|
|
69
|
+
this.mql.addEventListener('change', this.syncState.bind(this));
|
|
52
70
|
} else {
|
|
53
71
|
// addListener is a deprecated function, however addEventListener
|
|
54
|
-
// isn't supported by IE or Safari. We therefore add this in as
|
|
72
|
+
// isn't supported by IE or Safari < 14. We therefore add this in as
|
|
55
73
|
// a fallback for those browsers
|
|
56
|
-
|
|
74
|
+
// @ts-expect-error Property 'addListener' does not exist
|
|
75
|
+
this.mql.addListener(this.syncState.bind(this));
|
|
57
76
|
}
|
|
58
77
|
|
|
59
|
-
this.syncState()
|
|
60
|
-
this.$menuButton.addEventListener('click', this.handleMenuButtonClick.bind(this))
|
|
78
|
+
this.syncState();
|
|
79
|
+
this.$menuButton.addEventListener('click', this.handleMenuButtonClick.bind(this));
|
|
61
80
|
} else {
|
|
62
|
-
this.$menuButton.setAttribute('hidden', '')
|
|
81
|
+
this.$menuButton.setAttribute('hidden', '');
|
|
63
82
|
}
|
|
64
|
-
}
|
|
83
|
+
};
|
|
65
84
|
|
|
66
85
|
/**
|
|
67
86
|
* Sync menu state
|
|
@@ -70,32 +89,37 @@ Header.prototype.init = function () {
|
|
|
70
89
|
* visual states of the menu and the menu button.
|
|
71
90
|
* Additionally will force the menu to be visible and the menu button to be
|
|
72
91
|
* hidden if the matchMedia is triggered to desktop.
|
|
92
|
+
*
|
|
93
|
+
* @deprecated Will be made private in v5.0
|
|
73
94
|
*/
|
|
74
95
|
Header.prototype.syncState = function () {
|
|
75
96
|
if (this.mql.matches) {
|
|
76
|
-
this.$menu.removeAttribute('hidden')
|
|
77
|
-
this.$menuButton.setAttribute('hidden', '')
|
|
97
|
+
this.$menu.removeAttribute('hidden');
|
|
98
|
+
this.$menuButton.setAttribute('hidden', '');
|
|
78
99
|
} else {
|
|
79
|
-
this.$menuButton.removeAttribute('hidden')
|
|
80
|
-
this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen)
|
|
100
|
+
this.$menuButton.removeAttribute('hidden');
|
|
101
|
+
this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString());
|
|
81
102
|
|
|
82
103
|
if (this.menuIsOpen) {
|
|
83
|
-
this.$menu.removeAttribute('hidden')
|
|
104
|
+
this.$menu.removeAttribute('hidden');
|
|
84
105
|
} else {
|
|
85
|
-
this.$menu.setAttribute('hidden', '')
|
|
106
|
+
this.$menu.setAttribute('hidden', '');
|
|
86
107
|
}
|
|
87
108
|
}
|
|
88
|
-
}
|
|
109
|
+
};
|
|
89
110
|
|
|
90
111
|
/**
|
|
91
112
|
* Handle menu button click
|
|
92
113
|
*
|
|
93
114
|
* When the menu button is clicked, change the visibility of the menu and then
|
|
94
115
|
* sync the accessibility state and menu button state
|
|
116
|
+
*
|
|
117
|
+
* @deprecated Will be made private in v5.0
|
|
95
118
|
*/
|
|
96
119
|
Header.prototype.handleMenuButtonClick = function () {
|
|
97
|
-
this.menuIsOpen = !this.menuIsOpen
|
|
98
|
-
this.syncState()
|
|
99
|
-
}
|
|
120
|
+
this.menuIsOpen = !this.menuIsOpen;
|
|
121
|
+
this.syncState();
|
|
122
|
+
};
|
|
100
123
|
|
|
101
|
-
export default Header
|
|
124
|
+
export default Header;
|
|
125
|
+
//# sourceMappingURL=components/header/header.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.mjs","sources":["../../../../src/govuk/components/header/header.mjs"],"sourcesContent":["/* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */\n\nimport '../../vendor/polyfills/Event.mjs'\nimport '../../vendor/polyfills/Function/prototype/bind.mjs'\n\n/**\n * Header component\n *\n * @class\n * @param {Element} $module - HTML element to use for header\n */\nfunction Header ($module) {\n if (!($module instanceof HTMLElement)) {\n return this\n }\n\n /** @deprecated Will be made private in v5.0 */\n this.$module = $module\n\n /** @deprecated Will be made private in v5.0 */\n this.$menuButton = $module.querySelector('.govuk-js-header-toggle')\n\n /** @deprecated Will be made private in v5.0 */\n this.$menu = this.$menuButton && $module.querySelector(\n '#' + this.$menuButton.getAttribute('aria-controls')\n )\n\n /**\n * Save the opened/closed state for the nav in memory so that we can\n * accurately maintain state when the screen is changed from small to\n * big and back to small\n *\n * @deprecated Will be made private in v5.0\n */\n this.menuIsOpen = false\n\n /**\n * A global const for storing a matchMedia instance which we'll use to\n * detect when a screen size change happens. We set this later during the\n * init function and rely on it being null if the feature isn't available\n * to initially apply hidden attributes\n *\n * @deprecated Will be made private in v5.0\n */\n this.mql = null\n}\n\n/**\n * Initialise component\n *\n * Check for the presence of the header, menu and menu button – if any are\n * missing then there's nothing to do so return early.\n * Feature sniff for and apply a matchMedia for desktop which will\n * trigger a state sync if the browser viewport moves between states. If\n * matchMedia isn't available, hide the menu button and present the \"no js\"\n * version of the menu to the user.\n */\nHeader.prototype.init = function () {\n // Check that required elements are present\n if (!this.$module || !this.$menuButton || !this.$menu) {\n return\n }\n\n if ('matchMedia' in window) {\n // Set the matchMedia to the govuk-frontend desktop breakpoint\n this.mql = window.matchMedia('(min-width: 48.0625em)')\n\n if ('addEventListener' in this.mql) {\n this.mql.addEventListener('change', this.syncState.bind(this))\n } else {\n // addListener is a deprecated function, however addEventListener\n // isn't supported by IE or Safari < 14. We therefore add this in as\n // a fallback for those browsers\n // @ts-expect-error Property 'addListener' does not exist\n this.mql.addListener(this.syncState.bind(this))\n }\n\n this.syncState()\n this.$menuButton.addEventListener('click', this.handleMenuButtonClick.bind(this))\n } else {\n this.$menuButton.setAttribute('hidden', '')\n }\n}\n\n/**\n * Sync menu state\n *\n * Uses the global variable menuIsOpen to correctly set the accessible and\n * visual states of the menu and the menu button.\n * Additionally will force the menu to be visible and the menu button to be\n * hidden if the matchMedia is triggered to desktop.\n *\n * @deprecated Will be made private in v5.0\n */\nHeader.prototype.syncState = function () {\n if (this.mql.matches) {\n this.$menu.removeAttribute('hidden')\n this.$menuButton.setAttribute('hidden', '')\n } else {\n this.$menuButton.removeAttribute('hidden')\n this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())\n\n if (this.menuIsOpen) {\n this.$menu.removeAttribute('hidden')\n } else {\n this.$menu.setAttribute('hidden', '')\n }\n }\n}\n\n/**\n * Handle menu button click\n *\n * When the menu button is clicked, change the visibility of the menu and then\n * sync the accessibility state and menu button state\n *\n * @deprecated Will be made private in v5.0\n */\nHeader.prototype.handleMenuButtonClick = function () {\n this.menuIsOpen = !this.menuIsOpen\n this.syncState()\n}\n\nexport default Header\n"],"names":[],"mappings":";;;AAAA;AACA,AAGA;;;;;;;AAOA,SAAS,MAAM,EAAE,OAAO,EAAE;EACxB,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC,EAAE;IACrC,OAAO,IAAI;GACZ;;;EAGD,IAAI,CAAC,OAAO,GAAG,QAAO;;;EAGtB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,yBAAyB,EAAC;;;EAGnE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,aAAa;IACpD,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC;IACrD;;;;;;;;;EASD,IAAI,CAAC,UAAU,GAAG,MAAK;;;;;;;;;;EAUvB,IAAI,CAAC,GAAG,GAAG,KAAI;CAChB;;;;;;;;;;;;AAYD,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,YAAY;;EAElC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;IACrD,MAAM;GACP;;EAED,IAAI,YAAY,IAAI,MAAM,EAAE;;IAE1B,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,wBAAwB,EAAC;;IAEtD,IAAI,kBAAkB,IAAI,IAAI,CAAC,GAAG,EAAE;MAClC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;KAC/D,MAAM;;;;;MAKL,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;KAChD;;IAED,IAAI,CAAC,SAAS,GAAE;IAChB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;GAClF,MAAM;IACL,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAC;GAC5C;EACF;;;;;;;;;;;;AAYD,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,YAAY;EACvC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;IACpB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAC;IACpC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAC;GAC5C,MAAM;IACL,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,QAAQ,EAAC;IAC1C,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAC;;IAE1E,IAAI,IAAI,CAAC,UAAU,EAAE;MACnB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAC;KACrC,MAAM;MACL,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAC;KACtC;GACF;EACF;;;;;;;;;;AAUD,MAAM,CAAC,SAAS,CAAC,qBAAqB,GAAG,YAAY;EACnD,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,WAAU;EAClC,IAAI,CAAC,SAAS,GAAE;CACjB;;;;"}
|
data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs
CHANGED
|
@@ -1,39 +1,48 @@
|
|
|
1
|
-
import { mergeConfigs } from '../../common/index.mjs'
|
|
2
|
-
import { normaliseDataset } from '../../common/normalise-dataset.mjs'
|
|
3
|
-
import '../../vendor/polyfills/Event.mjs'
|
|
1
|
+
import { mergeConfigs } from '../../common/index.mjs';
|
|
2
|
+
import { normaliseDataset } from '../../common/normalise-dataset.mjs';
|
|
3
|
+
import '../../vendor/polyfills/Event.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Notification Banner component
|
|
7
7
|
*
|
|
8
8
|
* @class
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {Element} $module - HTML element to use for notification banner
|
|
10
10
|
* @param {NotificationBannerConfig} [config] - Notification banner config
|
|
11
11
|
*/
|
|
12
12
|
function NotificationBanner ($module, config) {
|
|
13
|
-
|
|
13
|
+
if (!($module instanceof HTMLElement)) {
|
|
14
|
+
return this
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @deprecated Will be made private in v5.0 */
|
|
18
|
+
this.$module = $module;
|
|
14
19
|
|
|
15
20
|
var defaultConfig = {
|
|
16
21
|
disableAutoFocus: false
|
|
17
|
-
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Will be made private in v5.0
|
|
26
|
+
* @type {NotificationBannerConfig}
|
|
27
|
+
*/
|
|
18
28
|
this.config = mergeConfigs(
|
|
19
29
|
defaultConfig,
|
|
20
30
|
config || {},
|
|
21
31
|
normaliseDataset($module.dataset)
|
|
22
|
-
)
|
|
32
|
+
);
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
/**
|
|
26
36
|
* Initialise component
|
|
27
37
|
*/
|
|
28
38
|
NotificationBanner.prototype.init = function () {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!$module) {
|
|
39
|
+
// Check that required elements are present
|
|
40
|
+
if (!this.$module) {
|
|
32
41
|
return
|
|
33
42
|
}
|
|
34
43
|
|
|
35
|
-
this.setFocus()
|
|
36
|
-
}
|
|
44
|
+
this.setFocus();
|
|
45
|
+
};
|
|
37
46
|
|
|
38
47
|
/**
|
|
39
48
|
* Focus the element
|
|
@@ -44,9 +53,11 @@ NotificationBanner.prototype.init = function () {
|
|
|
44
53
|
* You can turn off the auto-focus functionality by setting `data-disable-auto-focus="true"` in the
|
|
45
54
|
* component HTML. You might wish to do this based on user research findings, or to avoid a clash
|
|
46
55
|
* with another element which should be focused when the page loads.
|
|
56
|
+
*
|
|
57
|
+
* @deprecated Will be made private in v5.0
|
|
47
58
|
*/
|
|
48
59
|
NotificationBanner.prototype.setFocus = function () {
|
|
49
|
-
var $module = this.$module
|
|
60
|
+
var $module = this.$module;
|
|
50
61
|
|
|
51
62
|
if (this.config.disableAutoFocus) {
|
|
52
63
|
return
|
|
@@ -60,25 +71,25 @@ NotificationBanner.prototype.setFocus = function () {
|
|
|
60
71
|
// Remove the tabindex on blur as the component doesn't need to be focusable after the page has
|
|
61
72
|
// loaded.
|
|
62
73
|
if (!$module.getAttribute('tabindex')) {
|
|
63
|
-
$module.setAttribute('tabindex', '-1')
|
|
74
|
+
$module.setAttribute('tabindex', '-1');
|
|
64
75
|
|
|
65
76
|
$module.addEventListener('blur', function () {
|
|
66
|
-
$module.removeAttribute('tabindex')
|
|
67
|
-
})
|
|
77
|
+
$module.removeAttribute('tabindex');
|
|
78
|
+
});
|
|
68
79
|
}
|
|
69
80
|
|
|
70
|
-
$module.focus()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default NotificationBanner
|
|
81
|
+
$module.focus();
|
|
82
|
+
};
|
|
74
83
|
|
|
75
84
|
/**
|
|
76
85
|
* Notification banner config
|
|
77
86
|
*
|
|
78
87
|
* @typedef {object} NotificationBannerConfig
|
|
79
|
-
* @property {boolean} [disableAutoFocus = false] -
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* this option.
|
|
88
|
+
* @property {boolean} [disableAutoFocus = false] - If set to `true` the
|
|
89
|
+
* notification banner will not be focussed when the page loads. This only
|
|
90
|
+
* applies if the component has a `role` of `alert` – in other cases the
|
|
91
|
+
* component will not be focused on page load, regardless of this option.
|
|
84
92
|
*/
|
|
93
|
+
|
|
94
|
+
export default NotificationBanner;
|
|
95
|
+
//# sourceMappingURL=components/notification-banner/notification-banner.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-banner.mjs","sources":["../../../../src/govuk/components/notification-banner/notification-banner.mjs"],"sourcesContent":["import { mergeConfigs } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded\n\n/**\n * Notification Banner component\n *\n * @class\n * @param {Element} $module - HTML element to use for notification banner\n * @param {NotificationBannerConfig} [config] - Notification banner config\n */\nfunction NotificationBanner ($module, config) {\n if (!($module instanceof HTMLElement)) {\n return this\n }\n\n /** @deprecated Will be made private in v5.0 */\n this.$module = $module\n\n var defaultConfig = {\n disableAutoFocus: false\n }\n\n /**\n * @deprecated Will be made private in v5.0\n * @type {NotificationBannerConfig}\n */\n this.config = mergeConfigs(\n defaultConfig,\n config || {},\n normaliseDataset($module.dataset)\n )\n}\n\n/**\n * Initialise component\n */\nNotificationBanner.prototype.init = function () {\n // Check that required elements are present\n if (!this.$module) {\n return\n }\n\n this.setFocus()\n}\n\n/**\n * Focus the element\n *\n * If `role=\"alert\"` is set, focus the element to help some assistive technologies\n * prioritise announcing it.\n *\n * You can turn off the auto-focus functionality by setting `data-disable-auto-focus=\"true\"` in the\n * component HTML. You might wish to do this based on user research findings, or to avoid a clash\n * with another element which should be focused when the page loads.\n *\n * @deprecated Will be made private in v5.0\n */\nNotificationBanner.prototype.setFocus = function () {\n var $module = this.$module\n\n if (this.config.disableAutoFocus) {\n return\n }\n\n if ($module.getAttribute('role') !== 'alert') {\n return\n }\n\n // Set tabindex to -1 to make the element focusable with JavaScript.\n // Remove the tabindex on blur as the component doesn't need to be focusable after the page has\n // loaded.\n if (!$module.getAttribute('tabindex')) {\n $module.setAttribute('tabindex', '-1')\n\n $module.addEventListener('blur', function () {\n $module.removeAttribute('tabindex')\n })\n }\n\n $module.focus()\n}\n\nexport default NotificationBanner\n\n/**\n * Notification banner config\n *\n * @typedef {object} NotificationBannerConfig\n * @property {boolean} [disableAutoFocus = false] - If set to `true` the\n * notification banner will not be focussed when the page loads. This only\n * applies if the component has a `role` of `alert` – in other cases the\n * component will not be focused on page load, regardless of this option.\n */\n"],"names":[],"mappings":";;;;AAIA;;;;;;;AAOA,SAAS,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAE;EAC5C,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC,EAAE;IACrC,OAAO,IAAI;GACZ;;;EAGD,IAAI,CAAC,OAAO,GAAG,QAAO;;EAEtB,IAAI,aAAa,GAAG;IAClB,gBAAgB,EAAE,KAAK;IACxB;;;;;;EAMD,IAAI,CAAC,MAAM,GAAG,YAAY;IACxB,aAAa;IACb,MAAM,IAAI,EAAE;IACZ,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC;IAClC;CACF;;;;;AAKD,kBAAkB,CAAC,SAAS,CAAC,IAAI,GAAG,YAAY;;EAE9C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;IACjB,MAAM;GACP;;EAED,IAAI,CAAC,QAAQ,GAAE;EAChB;;;;;;;;;;;;;;AAcD,kBAAkB,CAAC,SAAS,CAAC,QAAQ,GAAG,YAAY;EAClD,IAAI,OAAO,GAAG,IAAI,CAAC,QAAO;;EAE1B,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAChC,MAAM;GACP;;EAED,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,EAAE;IAC5C,MAAM;GACP;;;;;EAKD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;IACrC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,EAAC;;IAEtC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,YAAY;MAC3C,OAAO,CAAC,eAAe,CAAC,UAAU,EAAC;KACpC,EAAC;GACH;;EAED,OAAO,CAAC,KAAK,GAAE;EAChB;AACD,AAEA;;;;;;;;;GASG;;;;"}
|