govuk_publishing_components 35.3.3 → 35.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +4 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/init-ga4.js +1 -1
- 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/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +0 -24
- 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/_related_navigation.html.erb +3 -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/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -1
- data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -0
- data/config/locales/en.yml +2 -2
- 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 +44 -7
- /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,249 +1,313 @@
|
|
1
|
-
|
1
|
+
import { nodeListForEach } from '../../common/index.mjs';
|
2
|
+
import '../../vendor/polyfills/Element/prototype/classList.mjs';
|
3
|
+
import '../../vendor/polyfills/Element/prototype/nextElementSibling.mjs';
|
4
|
+
import '../../vendor/polyfills/Element/prototype/previousElementSibling.mjs';
|
5
|
+
import '../../vendor/polyfills/Event.mjs';
|
6
|
+
import '../../vendor/polyfills/Function/prototype/bind.mjs';
|
2
7
|
|
3
|
-
|
4
|
-
import '../../vendor/polyfills/Element/prototype/classList.mjs'
|
5
|
-
import '../../vendor/polyfills/Element/prototype/nextElementSibling.mjs'
|
6
|
-
import '../../vendor/polyfills/Element/prototype/previousElementSibling.mjs'
|
7
|
-
import '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded
|
8
|
-
import '../../vendor/polyfills/Function/prototype/bind.mjs'
|
8
|
+
/* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */
|
9
9
|
|
10
10
|
/**
|
11
11
|
* Tabs component
|
12
12
|
*
|
13
13
|
* @class
|
14
|
-
* @param {
|
14
|
+
* @param {Element} $module - HTML element to use for tabs
|
15
15
|
*/
|
16
16
|
function Tabs ($module) {
|
17
|
-
|
18
|
-
|
17
|
+
if (!($module instanceof HTMLElement)) {
|
18
|
+
return this
|
19
|
+
}
|
20
|
+
|
21
|
+
var $tabs = $module.querySelectorAll('a.govuk-tabs__tab');
|
22
|
+
if (!$tabs.length) {
|
23
|
+
return this
|
24
|
+
}
|
25
|
+
|
26
|
+
/** @deprecated Will be made private in v5.0 */
|
27
|
+
this.$module = $module;
|
28
|
+
|
29
|
+
/** @deprecated Will be made private in v5.0 */
|
30
|
+
this.$tabs = $tabs;
|
31
|
+
|
32
|
+
/** @deprecated Will be made private in v5.0 */
|
33
|
+
this.keys = { left: 37, right: 39, up: 38, down: 40 };
|
34
|
+
|
35
|
+
/** @deprecated Will be made private in v5.0 */
|
36
|
+
this.jsHiddenClass = 'govuk-tabs__panel--hidden';
|
37
|
+
|
38
|
+
// Save bounded functions to use when removing event listeners during teardown
|
19
39
|
|
20
|
-
|
21
|
-
this.
|
40
|
+
/** @deprecated Will be made private in v5.0 */
|
41
|
+
this.boundTabClick = this.onTabClick.bind(this);
|
42
|
+
|
43
|
+
/** @deprecated Will be made private in v5.0 */
|
44
|
+
this.boundTabKeydown = this.onTabKeydown.bind(this);
|
45
|
+
|
46
|
+
/** @deprecated Will be made private in v5.0 */
|
47
|
+
this.boundOnHashChange = this.onHashChange.bind(this);
|
48
|
+
|
49
|
+
/** @deprecated Will be made private in v5.0 */
|
50
|
+
this.changingHash = false;
|
22
51
|
}
|
23
52
|
|
24
53
|
/**
|
25
54
|
* Initialise component
|
26
55
|
*/
|
27
56
|
Tabs.prototype.init = function () {
|
57
|
+
// Check that required elements are present
|
58
|
+
if (!this.$module || !this.$tabs) {
|
59
|
+
return
|
60
|
+
}
|
61
|
+
|
28
62
|
if (typeof window.matchMedia === 'function') {
|
29
|
-
this.setupResponsiveChecks()
|
63
|
+
this.setupResponsiveChecks();
|
30
64
|
} else {
|
31
|
-
this.setup()
|
65
|
+
this.setup();
|
32
66
|
}
|
33
|
-
}
|
67
|
+
};
|
34
68
|
|
35
69
|
/**
|
36
70
|
* Setup viewport resize check
|
71
|
+
*
|
72
|
+
* @deprecated Will be made private in v5.0
|
37
73
|
*/
|
38
74
|
Tabs.prototype.setupResponsiveChecks = function () {
|
39
|
-
|
40
|
-
this.mql.
|
41
|
-
this.checkMode()
|
42
|
-
|
75
|
+
/** @deprecated Will be made private in v5.0 */
|
76
|
+
this.mql = window.matchMedia('(min-width: 40.0625em)');
|
77
|
+
this.mql.addListener(this.checkMode.bind(this));
|
78
|
+
this.checkMode();
|
79
|
+
};
|
43
80
|
|
44
81
|
/**
|
45
82
|
* Setup or teardown handler for viewport resize check
|
83
|
+
*
|
84
|
+
* @deprecated Will be made private in v5.0
|
46
85
|
*/
|
47
86
|
Tabs.prototype.checkMode = function () {
|
48
87
|
if (this.mql.matches) {
|
49
|
-
this.setup()
|
88
|
+
this.setup();
|
50
89
|
} else {
|
51
|
-
this.teardown()
|
90
|
+
this.teardown();
|
52
91
|
}
|
53
|
-
}
|
92
|
+
};
|
54
93
|
|
55
94
|
/**
|
56
95
|
* Setup tab component
|
96
|
+
*
|
97
|
+
* @deprecated Will be made private in v5.0
|
57
98
|
*/
|
58
99
|
Tabs.prototype.setup = function () {
|
59
|
-
var $
|
60
|
-
var $
|
61
|
-
var $
|
62
|
-
var $
|
100
|
+
var $component = this;
|
101
|
+
var $module = this.$module;
|
102
|
+
var $tabs = this.$tabs;
|
103
|
+
var $tabList = $module.querySelector('.govuk-tabs__list');
|
104
|
+
var $tabListItems = $module.querySelectorAll('.govuk-tabs__list-item');
|
63
105
|
|
64
106
|
if (!$tabs || !$tabList || !$tabListItems) {
|
65
107
|
return
|
66
108
|
}
|
67
109
|
|
68
|
-
$tabList.setAttribute('role', 'tablist')
|
110
|
+
$tabList.setAttribute('role', 'tablist');
|
69
111
|
|
70
112
|
nodeListForEach($tabListItems, function ($item) {
|
71
|
-
$item.setAttribute('role', 'presentation')
|
72
|
-
})
|
113
|
+
$item.setAttribute('role', 'presentation');
|
114
|
+
});
|
73
115
|
|
74
116
|
nodeListForEach($tabs, function ($tab) {
|
75
117
|
// Set HTML attributes
|
76
|
-
|
77
|
-
|
78
|
-
// Save bounded functions to use when removing event listeners during teardown
|
79
|
-
$tab.boundTabClick = this.onTabClick.bind(this)
|
80
|
-
$tab.boundTabKeydown = this.onTabKeydown.bind(this)
|
118
|
+
$component.setAttributes($tab);
|
81
119
|
|
82
120
|
// Handle events
|
83
|
-
$tab.addEventListener('click', $
|
84
|
-
$tab.addEventListener('keydown', $
|
121
|
+
$tab.addEventListener('click', $component.boundTabClick, true);
|
122
|
+
$tab.addEventListener('keydown', $component.boundTabKeydown, true);
|
85
123
|
|
86
124
|
// Remove old active panels
|
87
|
-
|
88
|
-
}
|
125
|
+
$component.hideTab($tab);
|
126
|
+
});
|
89
127
|
|
90
128
|
// Show either the active tab according to the URL's hash or the first tab
|
91
|
-
var $activeTab = this.getTab(window.location.hash) || this.$tabs[0]
|
92
|
-
|
129
|
+
var $activeTab = this.getTab(window.location.hash) || this.$tabs[0];
|
130
|
+
if (!$activeTab) {
|
131
|
+
return
|
132
|
+
}
|
133
|
+
|
134
|
+
this.showTab($activeTab);
|
93
135
|
|
94
136
|
// Handle hashchange events
|
95
|
-
|
96
|
-
|
97
|
-
}
|
137
|
+
window.addEventListener('hashchange', this.boundOnHashChange, true);
|
138
|
+
};
|
98
139
|
|
99
140
|
/**
|
100
141
|
* Teardown tab component
|
142
|
+
*
|
143
|
+
* @deprecated Will be made private in v5.0
|
101
144
|
*/
|
102
145
|
Tabs.prototype.teardown = function () {
|
103
|
-
var $
|
104
|
-
var $
|
105
|
-
var $
|
106
|
-
var $
|
146
|
+
var $component = this;
|
147
|
+
var $module = this.$module;
|
148
|
+
var $tabs = this.$tabs;
|
149
|
+
var $tabList = $module.querySelector('.govuk-tabs__list');
|
150
|
+
var $tabListItems = $module.querySelectorAll('a.govuk-tabs__list-item');
|
107
151
|
|
108
152
|
if (!$tabs || !$tabList || !$tabListItems) {
|
109
153
|
return
|
110
154
|
}
|
111
155
|
|
112
|
-
$tabList.removeAttribute('role')
|
156
|
+
$tabList.removeAttribute('role');
|
113
157
|
|
114
158
|
nodeListForEach($tabListItems, function ($item) {
|
115
|
-
$item.removeAttribute('role'
|
116
|
-
})
|
159
|
+
$item.removeAttribute('role');
|
160
|
+
});
|
117
161
|
|
118
162
|
nodeListForEach($tabs, function ($tab) {
|
119
163
|
// Remove events
|
120
|
-
$tab.removeEventListener('click', $
|
121
|
-
$tab.removeEventListener('keydown', $
|
164
|
+
$tab.removeEventListener('click', $component.boundTabClick, true);
|
165
|
+
$tab.removeEventListener('keydown', $component.boundTabKeydown, true);
|
122
166
|
|
123
167
|
// Unset HTML attributes
|
124
|
-
|
125
|
-
}
|
168
|
+
$component.unsetAttributes($tab);
|
169
|
+
});
|
126
170
|
|
127
171
|
// Remove hashchange event handler
|
128
|
-
window.removeEventListener('hashchange',
|
129
|
-
}
|
172
|
+
window.removeEventListener('hashchange', this.boundOnHashChange, true);
|
173
|
+
};
|
130
174
|
|
131
175
|
/**
|
132
176
|
* Handle hashchange event
|
133
177
|
*
|
134
|
-
* @
|
178
|
+
* @deprecated Will be made private in v5.0
|
135
179
|
* @returns {void | undefined} Returns void, or undefined when prevented
|
136
180
|
*/
|
137
|
-
Tabs.prototype.onHashChange = function (
|
138
|
-
var hash = window.location.hash
|
139
|
-
var $tabWithHash = this.getTab(hash)
|
181
|
+
Tabs.prototype.onHashChange = function () {
|
182
|
+
var hash = window.location.hash;
|
183
|
+
var $tabWithHash = this.getTab(hash);
|
140
184
|
if (!$tabWithHash) {
|
141
185
|
return
|
142
186
|
}
|
143
187
|
|
144
188
|
// Prevent changing the hash
|
145
189
|
if (this.changingHash) {
|
146
|
-
this.changingHash = false
|
190
|
+
this.changingHash = false;
|
147
191
|
return
|
148
192
|
}
|
149
193
|
|
150
194
|
// Show either the active tab according to the URL's hash or the first tab
|
151
|
-
var $previousTab = this.getCurrentTab()
|
195
|
+
var $previousTab = this.getCurrentTab();
|
196
|
+
if (!$previousTab) {
|
197
|
+
return
|
198
|
+
}
|
152
199
|
|
153
|
-
this.hideTab($previousTab)
|
154
|
-
this.showTab($tabWithHash)
|
155
|
-
$tabWithHash.focus()
|
156
|
-
}
|
200
|
+
this.hideTab($previousTab);
|
201
|
+
this.showTab($tabWithHash);
|
202
|
+
$tabWithHash.focus();
|
203
|
+
};
|
157
204
|
|
158
205
|
/**
|
159
206
|
* Hide panel for tab link
|
160
207
|
*
|
208
|
+
* @deprecated Will be made private in v5.0
|
161
209
|
* @param {HTMLAnchorElement} $tab - Tab link
|
162
210
|
*/
|
163
211
|
Tabs.prototype.hideTab = function ($tab) {
|
164
|
-
this.unhighlightTab($tab)
|
165
|
-
this.hidePanel($tab)
|
166
|
-
}
|
212
|
+
this.unhighlightTab($tab);
|
213
|
+
this.hidePanel($tab);
|
214
|
+
};
|
167
215
|
|
168
216
|
/**
|
169
217
|
* Show panel for tab link
|
170
218
|
*
|
219
|
+
* @deprecated Will be made private in v5.0
|
171
220
|
* @param {HTMLAnchorElement} $tab - Tab link
|
172
221
|
*/
|
173
222
|
Tabs.prototype.showTab = function ($tab) {
|
174
|
-
this.highlightTab($tab)
|
175
|
-
this.showPanel($tab)
|
176
|
-
}
|
223
|
+
this.highlightTab($tab);
|
224
|
+
this.showPanel($tab);
|
225
|
+
};
|
177
226
|
|
178
227
|
/**
|
179
228
|
* Get tab link by hash
|
180
229
|
*
|
230
|
+
* @deprecated Will be made private in v5.0
|
181
231
|
* @param {string} hash - Hash fragment including #
|
182
232
|
* @returns {HTMLAnchorElement | null} Tab link
|
183
233
|
*/
|
184
234
|
Tabs.prototype.getTab = function (hash) {
|
185
|
-
|
186
|
-
|
235
|
+
// @ts-expect-error `HTMLAnchorElement` type expected
|
236
|
+
return this.$module.querySelector('a.govuk-tabs__tab[href="' + hash + '"]')
|
237
|
+
};
|
187
238
|
|
188
239
|
/**
|
189
240
|
* Set tab link and panel attributes
|
190
241
|
*
|
242
|
+
* @deprecated Will be made private in v5.0
|
191
243
|
* @param {HTMLAnchorElement} $tab - Tab link
|
192
244
|
*/
|
193
245
|
Tabs.prototype.setAttributes = function ($tab) {
|
194
246
|
// set tab attributes
|
195
|
-
var panelId = this.getHref($tab).slice(1)
|
196
|
-
$tab.setAttribute('id', 'tab_' + panelId)
|
197
|
-
$tab.setAttribute('role', 'tab')
|
198
|
-
$tab.setAttribute('aria-controls', panelId)
|
199
|
-
$tab.setAttribute('aria-selected', 'false')
|
200
|
-
$tab.setAttribute('tabindex', '-1')
|
247
|
+
var panelId = this.getHref($tab).slice(1);
|
248
|
+
$tab.setAttribute('id', 'tab_' + panelId);
|
249
|
+
$tab.setAttribute('role', 'tab');
|
250
|
+
$tab.setAttribute('aria-controls', panelId);
|
251
|
+
$tab.setAttribute('aria-selected', 'false');
|
252
|
+
$tab.setAttribute('tabindex', '-1');
|
201
253
|
|
202
254
|
// set panel attributes
|
203
|
-
var $panel = this.getPanel($tab)
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
255
|
+
var $panel = this.getPanel($tab);
|
256
|
+
if (!$panel) {
|
257
|
+
return
|
258
|
+
}
|
259
|
+
|
260
|
+
$panel.setAttribute('role', 'tabpanel');
|
261
|
+
$panel.setAttribute('aria-labelledby', $tab.id);
|
262
|
+
$panel.classList.add(this.jsHiddenClass);
|
263
|
+
};
|
208
264
|
|
209
265
|
/**
|
210
266
|
* Unset tab link and panel attributes
|
211
267
|
*
|
268
|
+
* @deprecated Will be made private in v5.0
|
212
269
|
* @param {HTMLAnchorElement} $tab - Tab link
|
213
270
|
*/
|
214
271
|
Tabs.prototype.unsetAttributes = function ($tab) {
|
215
272
|
// unset tab attributes
|
216
|
-
$tab.removeAttribute('id')
|
217
|
-
$tab.removeAttribute('role')
|
218
|
-
$tab.removeAttribute('aria-controls')
|
219
|
-
$tab.removeAttribute('aria-selected')
|
220
|
-
$tab.removeAttribute('tabindex')
|
273
|
+
$tab.removeAttribute('id');
|
274
|
+
$tab.removeAttribute('role');
|
275
|
+
$tab.removeAttribute('aria-controls');
|
276
|
+
$tab.removeAttribute('aria-selected');
|
277
|
+
$tab.removeAttribute('tabindex');
|
221
278
|
|
222
279
|
// unset panel attributes
|
223
|
-
var $panel = this.getPanel($tab)
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
280
|
+
var $panel = this.getPanel($tab);
|
281
|
+
if (!$panel) {
|
282
|
+
return
|
283
|
+
}
|
284
|
+
|
285
|
+
$panel.removeAttribute('role');
|
286
|
+
$panel.removeAttribute('aria-labelledby');
|
287
|
+
$panel.classList.remove(this.jsHiddenClass);
|
288
|
+
};
|
228
289
|
|
229
290
|
/**
|
230
291
|
* Handle tab link clicks
|
231
292
|
*
|
293
|
+
* @deprecated Will be made private in v5.0
|
232
294
|
* @param {MouseEvent} event - Mouse click event
|
233
|
-
* @returns {void
|
295
|
+
* @returns {void} Returns void
|
234
296
|
*/
|
235
297
|
Tabs.prototype.onTabClick = function (event) {
|
236
|
-
|
237
|
-
|
238
|
-
|
298
|
+
var $currentTab = this.getCurrentTab();
|
299
|
+
var $nextTab = event.currentTarget;
|
300
|
+
|
301
|
+
if (!$currentTab || !($nextTab instanceof HTMLAnchorElement)) {
|
302
|
+
return
|
239
303
|
}
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
this.hideTab($currentTab)
|
244
|
-
this.showTab($
|
245
|
-
this.createHistoryEntry($
|
246
|
-
}
|
304
|
+
|
305
|
+
event.preventDefault();
|
306
|
+
|
307
|
+
this.hideTab($currentTab);
|
308
|
+
this.showTab($nextTab);
|
309
|
+
this.createHistoryEntry($nextTab);
|
310
|
+
};
|
247
311
|
|
248
312
|
/**
|
249
313
|
* Update browser URL hash fragment for tab
|
@@ -251,19 +315,23 @@ Tabs.prototype.onTabClick = function (event) {
|
|
251
315
|
* - Allows back/forward to navigate tabs
|
252
316
|
* - Avoids page jump when hash changes
|
253
317
|
*
|
318
|
+
* @deprecated Will be made private in v5.0
|
254
319
|
* @param {HTMLAnchorElement} $tab - Tab link
|
255
320
|
*/
|
256
321
|
Tabs.prototype.createHistoryEntry = function ($tab) {
|
257
|
-
var $panel = this.getPanel($tab)
|
322
|
+
var $panel = this.getPanel($tab);
|
323
|
+
if (!$panel) {
|
324
|
+
return
|
325
|
+
}
|
258
326
|
|
259
327
|
// Save and restore the id
|
260
328
|
// so the page doesn't jump when a user clicks a tab (which changes the hash)
|
261
|
-
var panelId = $panel.id
|
262
|
-
$panel.id = ''
|
263
|
-
this.changingHash = true
|
264
|
-
window.location.hash = this.getHref($tab).slice(1)
|
265
|
-
$panel.id = panelId
|
266
|
-
}
|
329
|
+
var panelId = $panel.id;
|
330
|
+
$panel.id = '';
|
331
|
+
this.changingHash = true;
|
332
|
+
window.location.hash = this.getHref($tab).slice(1);
|
333
|
+
$panel.id = panelId;
|
334
|
+
};
|
267
335
|
|
268
336
|
/**
|
269
337
|
* Handle tab keydown event
|
@@ -271,130 +339,160 @@ Tabs.prototype.createHistoryEntry = function ($tab) {
|
|
271
339
|
* - Press right/down arrow for next tab
|
272
340
|
* - Press left/up arrow for previous tab
|
273
341
|
*
|
342
|
+
* @deprecated Will be made private in v5.0
|
274
343
|
* @param {KeyboardEvent} event - Keydown event
|
275
344
|
*/
|
276
345
|
Tabs.prototype.onTabKeydown = function (event) {
|
277
346
|
switch (event.keyCode) {
|
278
347
|
case this.keys.left:
|
279
348
|
case this.keys.up:
|
280
|
-
this.activatePreviousTab()
|
281
|
-
event.preventDefault()
|
349
|
+
this.activatePreviousTab();
|
350
|
+
event.preventDefault();
|
282
351
|
break
|
283
352
|
case this.keys.right:
|
284
353
|
case this.keys.down:
|
285
|
-
this.activateNextTab()
|
286
|
-
event.preventDefault()
|
354
|
+
this.activateNextTab();
|
355
|
+
event.preventDefault();
|
287
356
|
break
|
288
357
|
}
|
289
|
-
}
|
358
|
+
};
|
290
359
|
|
291
360
|
/**
|
292
361
|
* Activate next tab
|
362
|
+
*
|
363
|
+
* @deprecated Will be made private in v5.0
|
293
364
|
*/
|
294
365
|
Tabs.prototype.activateNextTab = function () {
|
295
|
-
var $currentTab = this.getCurrentTab()
|
296
|
-
if (!$currentTab) {
|
366
|
+
var $currentTab = this.getCurrentTab();
|
367
|
+
if (!$currentTab || !$currentTab.parentElement) {
|
297
368
|
return
|
298
369
|
}
|
299
370
|
|
300
|
-
var $nextTabListItem = $currentTab.parentElement.nextElementSibling
|
371
|
+
var $nextTabListItem = $currentTab.parentElement.nextElementSibling;
|
301
372
|
if (!$nextTabListItem) {
|
302
373
|
return
|
303
374
|
}
|
304
375
|
|
305
|
-
var $nextTab = $nextTabListItem.querySelector('.govuk-tabs__tab')
|
306
|
-
if (
|
307
|
-
|
308
|
-
this.showTab($nextTab)
|
309
|
-
$nextTab.focus()
|
310
|
-
this.createHistoryEntry($nextTab)
|
376
|
+
var $nextTab = $nextTabListItem.querySelector('a.govuk-tabs__tab');
|
377
|
+
if (!$nextTab) {
|
378
|
+
return
|
311
379
|
}
|
312
|
-
|
380
|
+
|
381
|
+
this.hideTab($currentTab);
|
382
|
+
this.showTab($nextTab);
|
383
|
+
$nextTab.focus();
|
384
|
+
this.createHistoryEntry($nextTab);
|
385
|
+
};
|
313
386
|
|
314
387
|
/**
|
315
388
|
* Activate previous tab
|
389
|
+
*
|
390
|
+
* @deprecated Will be made private in v5.0
|
316
391
|
*/
|
317
392
|
Tabs.prototype.activatePreviousTab = function () {
|
318
|
-
var $currentTab = this.getCurrentTab()
|
319
|
-
if (!$currentTab) {
|
393
|
+
var $currentTab = this.getCurrentTab();
|
394
|
+
if (!$currentTab || !$currentTab.parentElement) {
|
320
395
|
return
|
321
396
|
}
|
322
397
|
|
323
|
-
var $previousTabListItem = $currentTab.parentElement.previousElementSibling
|
398
|
+
var $previousTabListItem = $currentTab.parentElement.previousElementSibling;
|
324
399
|
if (!$previousTabListItem) {
|
325
400
|
return
|
326
401
|
}
|
327
402
|
|
328
|
-
var $previousTab = $previousTabListItem.querySelector('.govuk-tabs__tab')
|
329
|
-
if (
|
330
|
-
|
331
|
-
this.showTab($previousTab)
|
332
|
-
$previousTab.focus()
|
333
|
-
this.createHistoryEntry($previousTab)
|
403
|
+
var $previousTab = $previousTabListItem.querySelector('a.govuk-tabs__tab');
|
404
|
+
if (!$previousTab) {
|
405
|
+
return
|
334
406
|
}
|
335
|
-
|
407
|
+
|
408
|
+
this.hideTab($currentTab);
|
409
|
+
this.showTab($previousTab);
|
410
|
+
$previousTab.focus();
|
411
|
+
this.createHistoryEntry($previousTab);
|
412
|
+
};
|
336
413
|
|
337
414
|
/**
|
338
415
|
* Get tab panel for tab link
|
339
416
|
*
|
417
|
+
* @deprecated Will be made private in v5.0
|
340
418
|
* @param {HTMLAnchorElement} $tab - Tab link
|
341
|
-
* @returns {
|
419
|
+
* @returns {Element | null} Tab panel
|
342
420
|
*/
|
343
421
|
Tabs.prototype.getPanel = function ($tab) {
|
344
|
-
|
345
|
-
|
346
|
-
}
|
422
|
+
return this.$module.querySelector(this.getHref($tab))
|
423
|
+
};
|
347
424
|
|
348
425
|
/**
|
349
426
|
* Show tab panel for tab link
|
350
427
|
*
|
428
|
+
* @deprecated Will be made private in v5.0
|
351
429
|
* @param {HTMLAnchorElement} $tab - Tab link
|
352
430
|
*/
|
353
431
|
Tabs.prototype.showPanel = function ($tab) {
|
354
|
-
var $panel = this.getPanel($tab)
|
355
|
-
|
356
|
-
|
432
|
+
var $panel = this.getPanel($tab);
|
433
|
+
if (!$panel) {
|
434
|
+
return
|
435
|
+
}
|
436
|
+
|
437
|
+
$panel.classList.remove(this.jsHiddenClass);
|
438
|
+
};
|
357
439
|
|
358
440
|
/**
|
359
441
|
* Hide tab panel for tab link
|
360
442
|
*
|
443
|
+
* @deprecated Will be made private in v5.0
|
361
444
|
* @param {HTMLAnchorElement} $tab - Tab link
|
362
445
|
*/
|
363
446
|
Tabs.prototype.hidePanel = function ($tab) {
|
364
|
-
var $panel = this.getPanel($tab)
|
365
|
-
|
366
|
-
|
447
|
+
var $panel = this.getPanel($tab);
|
448
|
+
if (!$panel) {
|
449
|
+
return
|
450
|
+
}
|
451
|
+
|
452
|
+
$panel.classList.add(this.jsHiddenClass);
|
453
|
+
};
|
367
454
|
|
368
455
|
/**
|
369
456
|
* Unset 'selected' state for tab link
|
370
457
|
*
|
458
|
+
* @deprecated Will be made private in v5.0
|
371
459
|
* @param {HTMLAnchorElement} $tab - Tab link
|
372
460
|
*/
|
373
461
|
Tabs.prototype.unhighlightTab = function ($tab) {
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
462
|
+
if (!$tab.parentElement) {
|
463
|
+
return
|
464
|
+
}
|
465
|
+
|
466
|
+
$tab.setAttribute('aria-selected', 'false');
|
467
|
+
$tab.parentElement.classList.remove('govuk-tabs__list-item--selected');
|
468
|
+
$tab.setAttribute('tabindex', '-1');
|
469
|
+
};
|
378
470
|
|
379
471
|
/**
|
380
472
|
* Set 'selected' state for tab link
|
381
473
|
*
|
474
|
+
* @deprecated Will be made private in v5.0
|
382
475
|
* @param {HTMLAnchorElement} $tab - Tab link
|
383
476
|
*/
|
384
477
|
Tabs.prototype.highlightTab = function ($tab) {
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
478
|
+
if (!$tab.parentElement) {
|
479
|
+
return
|
480
|
+
}
|
481
|
+
|
482
|
+
$tab.setAttribute('aria-selected', 'true');
|
483
|
+
$tab.parentElement.classList.add('govuk-tabs__list-item--selected');
|
484
|
+
$tab.setAttribute('tabindex', '0');
|
485
|
+
};
|
389
486
|
|
390
487
|
/**
|
391
488
|
* Get current tab link
|
392
489
|
*
|
393
|
-
* @
|
490
|
+
* @deprecated Will be made private in v5.0
|
491
|
+
* @returns {HTMLAnchorElement | null} Tab link
|
394
492
|
*/
|
395
493
|
Tabs.prototype.getCurrentTab = function () {
|
396
|
-
return this.$module.querySelector('.govuk-tabs__list-item--selected .govuk-tabs__tab')
|
397
|
-
}
|
494
|
+
return this.$module.querySelector('.govuk-tabs__list-item--selected a.govuk-tabs__tab')
|
495
|
+
};
|
398
496
|
|
399
497
|
/**
|
400
498
|
* Get link hash fragment for href attribute
|
@@ -403,13 +501,15 @@ Tabs.prototype.getCurrentTab = function () {
|
|
403
501
|
* should be a utility function most prob
|
404
502
|
* {@link http://labs.thesedays.com/blog/2010/01/08/getting-the-href-value-with-jquery-in-ie/}
|
405
503
|
*
|
504
|
+
* @deprecated Will be made private in v5.0
|
406
505
|
* @param {HTMLAnchorElement} $tab - Tab link
|
407
506
|
* @returns {string} Hash fragment including #
|
408
507
|
*/
|
409
508
|
Tabs.prototype.getHref = function ($tab) {
|
410
|
-
var href = $tab.getAttribute('href')
|
411
|
-
var hash = href.slice(href.indexOf('#'), href.length)
|
509
|
+
var href = $tab.getAttribute('href');
|
510
|
+
var hash = href.slice(href.indexOf('#'), href.length);
|
412
511
|
return hash
|
413
|
-
}
|
512
|
+
};
|
414
513
|
|
415
|
-
export default Tabs
|
514
|
+
export default Tabs;
|
515
|
+
//# sourceMappingURL=components/tabs/tabs.mjs.map
|