defra_ruby_template 5.4.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/views/layouts/defra_ruby_template.html.erb +43 -23
- data/lib/defra_ruby_template/version.rb +1 -1
- data/lib/defra_ruby_template.rb +3 -8
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +882 -492
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +877 -492
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.mjs +5 -0
- data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/all.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.svg +1 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +1 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +1 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +1 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +39 -0
- data/node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +169 -0
- data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +20 -83
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/component.mjs +60 -0
- data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +35 -31
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +296 -195
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +295 -194
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +88 -110
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +16 -3
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +25 -15
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-link.html +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/template.njk +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +53 -15
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro-options.json +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-inverse.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-collapse-on-mobile.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-last-breadcrumb-as-current-page.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-multiple-levels.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-one-level.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-without-the-home-section.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template.njk +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +217 -106
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +216 -105
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +9 -22
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +38 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +2 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +12 -4
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +256 -145
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +255 -144
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +29 -34
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +80 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +6 -6
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-error.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint-and-error.html +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +5 -4
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +6 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +96 -50
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +95 -49
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +9 -18
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +88 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +34 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +23 -14
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +23 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +7 -2
- data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +238 -127
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +237 -126
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +10 -22
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +218 -107
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +217 -106
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +10 -22
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +4 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -5
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +18 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +175 -9
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +744 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +736 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +257 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +220 -16
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +52 -3
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +13 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +16 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +42 -5
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +61 -19
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +34 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/macro-options.json +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template.njk +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +223 -21
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +78 -32
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +90 -43
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +89 -42
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +10 -18
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +31 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-default.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width-with-navigation.html +21 -15
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +21 -15
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-html.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-text-without-link.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-label.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-text.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-navigation-label.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-full-width-border.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-large-navigation.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-navigation.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-product-name.html +21 -15
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-and-navigation.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-but-no-service-url.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name.html +20 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-st-edwards-crown.html +10 -12
- data/node_modules/govuk-frontend/dist/govuk/components/header/template.njk +11 -41
- data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -4
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +97 -27
- data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +6 -6
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-disabled.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-and-hint.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-message.html +2 -5
- data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +5 -4
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +3 -2
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +238 -127
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +237 -126
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +10 -22
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +24 -37
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro-options.json +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +13 -9
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +12 -9
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +27 -2
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +3 -3
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +220 -110
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +219 -109
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +12 -25
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +3 -3
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +4 -2
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +0 -8
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +51 -5
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +96 -50
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +95 -49
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +9 -18
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +5 -5
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +43 -9
- data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +6 -4
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +187 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +515 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +138 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +229 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +221 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +85 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-default.html +57 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-html-navigation-items.html +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-large-navigation.html +153 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-long-service-name.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-a-current-item.html +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-an-active-item.html +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-non-link-navigation-items.html +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-link.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name-and-navigation.html +63 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name.html +18 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +103 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +6 -4
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +95 -48
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +94 -47
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +15 -23
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +14 -22
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +174 -1
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +22 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +15 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +95 -53
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +94 -52
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +15 -28
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +11 -8
- data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +14 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +12 -10
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +44 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-empty-values.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +3 -3
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +32 -1
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +3 -3
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +6 -4
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +6 -5
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +8 -0
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +16 -3
- data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +55 -8
- data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +14 -4
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +18 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +30 -62
- data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +90 -24
- data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/macros/logo.njk +78 -0
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +5 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +5 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +39 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +244 -10
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
- data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/template.njk +20 -9
- data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
- data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +65 -0
- data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +25 -0
- data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss.map +1 -1
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +8 -1
- data/node_modules/govuk-frontend/package.json +16 -16
- data/spec/spec_helper.rb +98 -0
- data/spec/tasks/assets_spec.rb +53 -0
- data/vendor/assets/assets/fonts/bold-affa96571d-v2.woff +0 -0
- data/vendor/assets/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
- data/vendor/assets/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
- data/vendor/assets/assets/fonts/light-f591b13f7d-v2.woff +0 -0
- data/vendor/assets/assets/images/favicon.ico +0 -0
- data/vendor/assets/assets/images/favicon.svg +1 -0
- data/vendor/assets/assets/images/govuk-crest.svg +1 -0
- data/vendor/assets/assets/images/govuk-icon-180.png +0 -0
- data/vendor/assets/assets/images/govuk-icon-192.png +0 -0
- data/vendor/assets/assets/images/govuk-icon-512.png +0 -0
- data/vendor/assets/assets/images/govuk-icon-mask.svg +1 -0
- data/vendor/assets/assets/images/govuk-opengraph-image.png +0 -0
- data/vendor/assets/assets/manifest.json +39 -0
- data/vendor/assets/assets/rebrand/images/favicon.ico +0 -0
- data/vendor/assets/assets/rebrand/images/favicon.svg +1 -0
- data/vendor/assets/assets/rebrand/images/govuk-crest.svg +1 -0
- data/vendor/assets/assets/rebrand/images/govuk-icon-180.png +0 -0
- data/vendor/assets/assets/rebrand/images/govuk-icon-192.png +0 -0
- data/vendor/assets/assets/rebrand/images/govuk-icon-512.png +0 -0
- data/vendor/assets/assets/rebrand/images/govuk-icon-mask.svg +1 -0
- data/vendor/assets/assets/rebrand/images/govuk-opengraph-image.png +0 -0
- data/vendor/assets/assets/rebrand/manifest.json +39 -0
- data/vendor/assets/images/govuk-crest.svg +1 -0
- data/vendor/assets/javascripts/defra_ruby_template.js +882 -492
- data/vendor/assets/stylesheets/all.scss +6 -0
- data/vendor/assets/stylesheets/components/_index.scss +1 -0
- data/vendor/assets/stylesheets/components/accordion/_index.scss +35 -31
- data/vendor/assets/stylesheets/components/character-count/_index.scss +12 -4
- data/vendor/assets/stylesheets/components/checkboxes/_index.scss +6 -1
- data/vendor/assets/stylesheets/components/cookie-banner/_index.scss +23 -14
- data/vendor/assets/stylesheets/components/date-input/_index.scss +2 -2
- data/vendor/assets/stylesheets/components/details/_index.scss +7 -2
- data/vendor/assets/stylesheets/components/error-summary/_index.scss +4 -0
- data/vendor/assets/stylesheets/components/fieldset/_index.scss +3 -5
- data/vendor/assets/stylesheets/components/file-upload/_index.scss +175 -9
- data/vendor/assets/stylesheets/components/footer/_index.scss +61 -19
- data/vendor/assets/stylesheets/components/header/_index.scss +223 -21
- data/vendor/assets/stylesheets/components/input/_index.scss +7 -4
- data/vendor/assets/stylesheets/components/notification-banner/_index.scss +3 -2
- data/vendor/assets/stylesheets/components/pagination/_index.scss +24 -37
- data/vendor/assets/stylesheets/components/panel/_index.scss +13 -9
- data/vendor/assets/stylesheets/components/password-input/_index.scss +12 -9
- data/vendor/assets/stylesheets/components/phase-banner/_index.scss +0 -8
- data/vendor/assets/stylesheets/components/radios/_index.scss +7 -5
- data/vendor/assets/stylesheets/components/select/_index.scss +5 -5
- data/vendor/assets/stylesheets/components/service-navigation/_index.scss +187 -0
- data/vendor/assets/stylesheets/components/service-navigation/_service-navigation.scss +4 -0
- data/vendor/assets/stylesheets/components/skip-link/_index.scss +6 -4
- data/vendor/assets/stylesheets/components/summary-list/_index.scss +14 -22
- data/vendor/assets/stylesheets/components/tag/_index.scss +11 -8
- data/vendor/assets/stylesheets/components/task-list/_index.scss +12 -10
- data/vendor/assets/stylesheets/components/textarea/_index.scss +3 -3
- data/vendor/assets/stylesheets/components/warning-text/_index.scss +6 -5
- data/vendor/assets/stylesheets/core/_govuk-frontend-properties.scss +1 -1
- data/vendor/assets/stylesheets/defra_ruby_template.scss +6 -0
- data/vendor/assets/stylesheets/govuk-frontend.min.css +2 -2
- data/vendor/assets/stylesheets/helpers/_colour.scss +55 -8
- data/vendor/assets/stylesheets/helpers/_focused.scss +14 -4
- data/vendor/assets/stylesheets/helpers/_grid.scss +1 -1
- data/vendor/assets/stylesheets/helpers/_links.scss +2 -2
- data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +1 -1
- data/vendor/assets/stylesheets/helpers/_typography.scss +18 -1
- data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +30 -62
- data/vendor/assets/stylesheets/objects/_template.scss +5 -1
- data/vendor/assets/stylesheets/overrides/_typography.scss +5 -1
- data/vendor/assets/stylesheets/settings/_colours-applied.scss +39 -1
- data/vendor/assets/stylesheets/settings/_colours-organisations.scss +244 -10
- data/vendor/assets/stylesheets/settings/_typography-responsive.scss +5 -10
- data/vendor/assets/stylesheets/tools/_index.scss +1 -0
- data/vendor/assets/stylesheets/tools/_rebrand.scss +65 -0
- metadata +100 -24
- data/.github/dependabot.yml +0 -14
- data/.github/workflows/ci.yml +0 -31
- data/.gitignore +0 -8
- data/.rspec +0 -1
- data/.rubocop.yml +0 -3
- data/.ruby-version +0 -1
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -58
- data/defra_ruby_template.gemspec +0 -35
- data/node_modules/.package-lock.json +0 -16
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest-2x.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs.map +0 -1
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs.map +0 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-value.html +0 -6
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs +0 -16
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +0 -1
- data/package-lock.json +0 -24
- data/package.json +0 -29
@@ -1,7 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import { normaliseDataset } from '../../common/normalise-dataset.mjs';
|
1
|
+
import { ConfigurableComponent } from '../../common/configuration.mjs';
|
3
2
|
import { ElementError } from '../../errors/index.mjs';
|
4
|
-
import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
|
5
3
|
import { I18n } from '../../i18n.mjs';
|
6
4
|
|
7
5
|
/**
|
@@ -17,16 +15,15 @@ import { I18n } from '../../i18n.mjs';
|
|
17
15
|
* attribute, which also provides accessibility.
|
18
16
|
*
|
19
17
|
* @preserve
|
18
|
+
* @augments ConfigurableComponent<AccordionConfig>
|
20
19
|
*/
|
21
|
-
class Accordion extends
|
20
|
+
class Accordion extends ConfigurableComponent {
|
22
21
|
/**
|
23
|
-
* @param {Element | null} $
|
22
|
+
* @param {Element | null} $root - HTML element to use for accordion
|
24
23
|
* @param {AccordionConfig} [config] - Accordion config
|
25
24
|
*/
|
26
|
-
constructor($
|
27
|
-
super();
|
28
|
-
this.$module = void 0;
|
29
|
-
this.config = void 0;
|
25
|
+
constructor($root, config = {}) {
|
26
|
+
super($root, config);
|
30
27
|
this.i18n = void 0;
|
31
28
|
this.controlsClass = 'govuk-accordion__controls';
|
32
29
|
this.showAllClass = 'govuk-accordion__show-all';
|
@@ -48,33 +45,21 @@ class Accordion extends GOVUKFrontendComponent {
|
|
48
45
|
this.sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus';
|
49
46
|
this.sectionContentClass = 'govuk-accordion__section-content';
|
50
47
|
this.$sections = void 0;
|
51
|
-
this.browserSupportsSessionStorage = false;
|
52
48
|
this.$showAllButton = null;
|
53
49
|
this.$showAllIcon = null;
|
54
50
|
this.$showAllText = null;
|
55
|
-
if (!($module instanceof HTMLElement)) {
|
56
|
-
throw new ElementError({
|
57
|
-
componentName: 'Accordion',
|
58
|
-
element: $module,
|
59
|
-
identifier: 'Root element (`$module`)'
|
60
|
-
});
|
61
|
-
}
|
62
|
-
this.$module = $module;
|
63
|
-
this.config = mergeConfigs(Accordion.defaults, config, normaliseDataset(Accordion, $module.dataset));
|
64
51
|
this.i18n = new I18n(this.config.i18n);
|
65
|
-
const $sections = this.$
|
52
|
+
const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`);
|
66
53
|
if (!$sections.length) {
|
67
54
|
throw new ElementError({
|
68
|
-
|
55
|
+
component: Accordion,
|
69
56
|
identifier: `Sections (\`<div class="${this.sectionClass}">\`)`
|
70
57
|
});
|
71
58
|
}
|
72
59
|
this.$sections = $sections;
|
73
|
-
this.browserSupportsSessionStorage = helper.checkForSessionStorage();
|
74
60
|
this.initControls();
|
75
61
|
this.initSectionHeaders();
|
76
|
-
|
77
|
-
this.updateShowAllButton(areAllSectionsOpen);
|
62
|
+
this.updateShowAllButton(this.areAllSectionsOpen());
|
78
63
|
}
|
79
64
|
initControls() {
|
80
65
|
this.$showAllButton = document.createElement('button');
|
@@ -87,7 +72,7 @@ class Accordion extends GOVUKFrontendComponent {
|
|
87
72
|
const $accordionControls = document.createElement('div');
|
88
73
|
$accordionControls.setAttribute('class', this.controlsClass);
|
89
74
|
$accordionControls.appendChild(this.$showAllButton);
|
90
|
-
this.$
|
75
|
+
this.$root.insertBefore($accordionControls, this.$root.firstChild);
|
91
76
|
this.$showAllText = document.createElement('span');
|
92
77
|
this.$showAllText.classList.add(this.showAllTextClass);
|
93
78
|
this.$showAllButton.appendChild(this.$showAllText);
|
@@ -101,7 +86,7 @@ class Accordion extends GOVUKFrontendComponent {
|
|
101
86
|
const $header = $section.querySelector(`.${this.sectionHeaderClass}`);
|
102
87
|
if (!$header) {
|
103
88
|
throw new ElementError({
|
104
|
-
|
89
|
+
component: Accordion,
|
105
90
|
identifier: `Section headers (\`<div class="${this.sectionHeaderClass}">\`)`
|
106
91
|
});
|
107
92
|
}
|
@@ -117,22 +102,22 @@ class Accordion extends GOVUKFrontendComponent {
|
|
117
102
|
const $summary = $header.querySelector(`.${this.sectionSummaryClass}`);
|
118
103
|
if (!$heading) {
|
119
104
|
throw new ElementError({
|
120
|
-
|
105
|
+
component: Accordion,
|
121
106
|
identifier: `Section heading (\`.${this.sectionHeadingClass}\`)`
|
122
107
|
});
|
123
108
|
}
|
124
109
|
if (!$span) {
|
125
110
|
throw new ElementError({
|
126
|
-
|
111
|
+
component: Accordion,
|
127
112
|
identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
|
128
113
|
});
|
129
114
|
}
|
130
115
|
const $button = document.createElement('button');
|
131
116
|
$button.setAttribute('type', 'button');
|
132
|
-
$button.setAttribute('aria-controls', `${this.$
|
117
|
+
$button.setAttribute('aria-controls', `${this.$root.id}-content-${index + 1}`);
|
133
118
|
for (const attr of Array.from($span.attributes)) {
|
134
|
-
if (attr.
|
135
|
-
$button.setAttribute(attr.
|
119
|
+
if (attr.name !== 'id') {
|
120
|
+
$button.setAttribute(attr.name, attr.value);
|
136
121
|
}
|
137
122
|
}
|
138
123
|
const $headingText = document.createElement('span');
|
@@ -141,7 +126,7 @@ class Accordion extends GOVUKFrontendComponent {
|
|
141
126
|
const $headingTextFocus = document.createElement('span');
|
142
127
|
$headingTextFocus.classList.add(this.sectionHeadingTextFocusClass);
|
143
128
|
$headingText.appendChild($headingTextFocus);
|
144
|
-
$
|
129
|
+
Array.from($span.childNodes).forEach($child => $headingTextFocus.appendChild($child));
|
145
130
|
const $showHideToggle = document.createElement('span');
|
146
131
|
$showHideToggle.classList.add(this.sectionShowHideToggleClass);
|
147
132
|
$showHideToggle.setAttribute('data-nosnippet', '');
|
@@ -156,16 +141,16 @@ class Accordion extends GOVUKFrontendComponent {
|
|
156
141
|
$showHideToggleFocus.appendChild($showHideText);
|
157
142
|
$button.appendChild($headingText);
|
158
143
|
$button.appendChild(this.getButtonPunctuationEl());
|
159
|
-
if ($summary
|
144
|
+
if ($summary) {
|
160
145
|
const $summarySpan = document.createElement('span');
|
161
146
|
const $summarySpanFocus = document.createElement('span');
|
162
147
|
$summarySpanFocus.classList.add(this.sectionSummaryFocusClass);
|
163
148
|
$summarySpan.appendChild($summarySpanFocus);
|
164
149
|
for (const attr of Array.from($summary.attributes)) {
|
165
|
-
$summarySpan.setAttribute(attr.
|
150
|
+
$summarySpan.setAttribute(attr.name, attr.value);
|
166
151
|
}
|
167
|
-
$
|
168
|
-
$summary.
|
152
|
+
Array.from($summary.childNodes).forEach($child => $summarySpanFocus.appendChild($child));
|
153
|
+
$summary.remove();
|
169
154
|
$button.appendChild($summarySpan);
|
170
155
|
$button.appendChild(this.getButtonPunctuationEl());
|
171
156
|
}
|
@@ -184,15 +169,15 @@ class Accordion extends GOVUKFrontendComponent {
|
|
184
169
|
}
|
185
170
|
}
|
186
171
|
onSectionToggle($section) {
|
187
|
-
const
|
188
|
-
this.setExpanded(
|
189
|
-
this.storeState($section);
|
172
|
+
const nowExpanded = !this.isExpanded($section);
|
173
|
+
this.setExpanded(nowExpanded, $section);
|
174
|
+
this.storeState($section, nowExpanded);
|
190
175
|
}
|
191
176
|
onShowOrHideAllToggle() {
|
192
|
-
const nowExpanded = !this.
|
177
|
+
const nowExpanded = !this.areAllSectionsOpen();
|
193
178
|
this.$sections.forEach($section => {
|
194
179
|
this.setExpanded(nowExpanded, $section);
|
195
|
-
this.storeState($section);
|
180
|
+
this.storeState($section, nowExpanded);
|
196
181
|
});
|
197
182
|
this.updateShowAllButton(nowExpanded);
|
198
183
|
}
|
@@ -203,7 +188,7 @@ class Accordion extends GOVUKFrontendComponent {
|
|
203
188
|
const $content = $section.querySelector(`.${this.sectionContentClass}`);
|
204
189
|
if (!$content) {
|
205
190
|
throw new ElementError({
|
206
|
-
|
191
|
+
component: Accordion,
|
207
192
|
identifier: `Section content (\`<div class="${this.sectionContentClass}">\`)`
|
208
193
|
});
|
209
194
|
}
|
@@ -234,17 +219,13 @@ class Accordion extends GOVUKFrontendComponent {
|
|
234
219
|
$section.classList.remove(this.sectionExpandedClass);
|
235
220
|
$showHideIcon.classList.add(this.downChevronIconClass);
|
236
221
|
}
|
237
|
-
|
238
|
-
this.updateShowAllButton(areAllSectionsOpen);
|
222
|
+
this.updateShowAllButton(this.areAllSectionsOpen());
|
239
223
|
}
|
240
224
|
isExpanded($section) {
|
241
225
|
return $section.classList.contains(this.sectionExpandedClass);
|
242
226
|
}
|
243
|
-
|
244
|
-
|
245
|
-
const expandedSectionCount = this.$module.querySelectorAll(`.${this.sectionExpandedClass}`).length;
|
246
|
-
const areAllSectionsOpen = sectionsCount === expandedSectionCount;
|
247
|
-
return areAllSectionsOpen;
|
227
|
+
areAllSectionsOpen() {
|
228
|
+
return Array.from(this.$sections).every($section => this.isExpanded($section));
|
248
229
|
}
|
249
230
|
updateShowAllButton(expanded) {
|
250
231
|
if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {
|
@@ -254,78 +235,53 @@ class Accordion extends GOVUKFrontendComponent {
|
|
254
235
|
this.$showAllText.textContent = expanded ? this.i18n.t('hideAllSections') : this.i18n.t('showAllSections');
|
255
236
|
this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded);
|
256
237
|
}
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Get the identifier for a section
|
241
|
+
*
|
242
|
+
* We need a unique way of identifying each content in the Accordion.
|
243
|
+
* Since an `#id` should be unique and an `id` is required for `aria-`
|
244
|
+
* attributes `id` can be safely used.
|
245
|
+
*
|
246
|
+
* @param {Element} $section - Section element
|
247
|
+
* @returns {string | undefined | null} Identifier for section
|
248
|
+
*/
|
249
|
+
getIdentifier($section) {
|
250
|
+
const $button = $section.querySelector(`.${this.sectionButtonClass}`);
|
251
|
+
return $button == null ? void 0 : $button.getAttribute('aria-controls');
|
252
|
+
}
|
253
|
+
storeState($section, isExpanded) {
|
254
|
+
if (!this.config.rememberExpanded) {
|
255
|
+
return;
|
256
|
+
}
|
257
|
+
const id = this.getIdentifier($section);
|
258
|
+
if (id) {
|
259
|
+
try {
|
260
|
+
window.sessionStorage.setItem(id, isExpanded.toString());
|
261
|
+
} catch (exception) {}
|
267
262
|
}
|
268
263
|
}
|
269
264
|
setInitialState($section) {
|
270
|
-
if (this.
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
265
|
+
if (!this.config.rememberExpanded) {
|
266
|
+
return;
|
267
|
+
}
|
268
|
+
const id = this.getIdentifier($section);
|
269
|
+
if (id) {
|
270
|
+
try {
|
271
|
+
const state = window.sessionStorage.getItem(id);
|
272
|
+
if (state !== null) {
|
273
|
+
this.setExpanded(state === 'true', $section);
|
277
274
|
}
|
278
|
-
}
|
275
|
+
} catch (exception) {}
|
279
276
|
}
|
280
277
|
}
|
281
278
|
getButtonPunctuationEl() {
|
282
279
|
const $punctuationEl = document.createElement('span');
|
283
280
|
$punctuationEl.classList.add('govuk-visually-hidden', this.sectionHeadingDividerClass);
|
284
|
-
$punctuationEl.
|
281
|
+
$punctuationEl.textContent = ', ';
|
285
282
|
return $punctuationEl;
|
286
283
|
}
|
287
284
|
}
|
288
|
-
Accordion.moduleName = 'govuk-accordion';
|
289
|
-
Accordion.defaults = Object.freeze({
|
290
|
-
i18n: {
|
291
|
-
hideAllSections: 'Hide all sections',
|
292
|
-
hideSection: 'Hide',
|
293
|
-
hideSectionAriaLabel: 'Hide this section',
|
294
|
-
showAllSections: 'Show all sections',
|
295
|
-
showSection: 'Show',
|
296
|
-
showSectionAriaLabel: 'Show this section'
|
297
|
-
},
|
298
|
-
rememberExpanded: true
|
299
|
-
});
|
300
|
-
Accordion.schema = Object.freeze({
|
301
|
-
properties: {
|
302
|
-
i18n: {
|
303
|
-
type: 'object'
|
304
|
-
},
|
305
|
-
rememberExpanded: {
|
306
|
-
type: 'boolean'
|
307
|
-
}
|
308
|
-
}
|
309
|
-
});
|
310
|
-
const helper = {
|
311
|
-
/**
|
312
|
-
* Check for `window.sessionStorage`, and that it actually works.
|
313
|
-
*
|
314
|
-
* @returns {boolean} True if session storage is available
|
315
|
-
*/
|
316
|
-
checkForSessionStorage: function () {
|
317
|
-
const testString = 'this is the test string';
|
318
|
-
let result;
|
319
|
-
try {
|
320
|
-
window.sessionStorage.setItem(testString, testString);
|
321
|
-
result = window.sessionStorage.getItem(testString) === testString.toString();
|
322
|
-
window.sessionStorage.removeItem(testString);
|
323
|
-
return result;
|
324
|
-
} catch (exception) {
|
325
|
-
return false;
|
326
|
-
}
|
327
|
-
}
|
328
|
-
};
|
329
285
|
|
330
286
|
/**
|
331
287
|
* Accordion config
|
@@ -361,8 +317,30 @@ const helper = {
|
|
361
317
|
*/
|
362
318
|
|
363
319
|
/**
|
364
|
-
* @
|
320
|
+
* @import { Schema } from '../../common/configuration.mjs'
|
365
321
|
*/
|
322
|
+
Accordion.moduleName = 'govuk-accordion';
|
323
|
+
Accordion.defaults = Object.freeze({
|
324
|
+
i18n: {
|
325
|
+
hideAllSections: 'Hide all sections',
|
326
|
+
hideSection: 'Hide',
|
327
|
+
hideSectionAriaLabel: 'Hide this section',
|
328
|
+
showAllSections: 'Show all sections',
|
329
|
+
showSection: 'Show',
|
330
|
+
showSectionAriaLabel: 'Show this section'
|
331
|
+
},
|
332
|
+
rememberExpanded: true
|
333
|
+
});
|
334
|
+
Accordion.schema = Object.freeze({
|
335
|
+
properties: {
|
336
|
+
i18n: {
|
337
|
+
type: 'object'
|
338
|
+
},
|
339
|
+
rememberExpanded: {
|
340
|
+
type: 'boolean'
|
341
|
+
}
|
342
|
+
}
|
343
|
+
});
|
366
344
|
|
367
345
|
export { Accordion };
|
368
346
|
//# sourceMappingURL=accordion.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"accordion.mjs","sources":["../../../../src/govuk/components/accordion/accordion.mjs"],"sourcesContent":["import { mergeConfigs } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * Accordion component\n *\n * This allows a collection of sections to be collapsed by default, showing only\n * their headers. Sections can be expanded or collapsed individually by clicking\n * their headers. A \"Show all sections\" button is also added to the top of the\n * accordion, which switches to \"Hide all sections\" when all the sections are\n * expanded.\n *\n * The state of each section is saved to the DOM via the `aria-expanded`\n * attribute, which also provides accessibility.\n *\n * @preserve\n */\nexport class Accordion extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /**\n * @private\n * @type {AccordionConfig}\n */\n config\n\n /** @private */\n i18n\n\n /** @private */\n controlsClass = 'govuk-accordion__controls'\n\n /** @private */\n showAllClass = 'govuk-accordion__show-all'\n\n /** @private */\n showAllTextClass = 'govuk-accordion__show-all-text'\n\n /** @private */\n sectionClass = 'govuk-accordion__section'\n\n /** @private */\n sectionExpandedClass = 'govuk-accordion__section--expanded'\n\n /** @private */\n sectionButtonClass = 'govuk-accordion__section-button'\n\n /** @private */\n sectionHeaderClass = 'govuk-accordion__section-header'\n\n /** @private */\n sectionHeadingClass = 'govuk-accordion__section-heading'\n\n /** @private */\n sectionHeadingDividerClass = 'govuk-accordion__section-heading-divider'\n\n /** @private */\n sectionHeadingTextClass = 'govuk-accordion__section-heading-text'\n\n /** @private */\n sectionHeadingTextFocusClass = 'govuk-accordion__section-heading-text-focus'\n\n /** @private */\n sectionShowHideToggleClass = 'govuk-accordion__section-toggle'\n\n /** @private */\n sectionShowHideToggleFocusClass = 'govuk-accordion__section-toggle-focus'\n\n /** @private */\n sectionShowHideTextClass = 'govuk-accordion__section-toggle-text'\n\n /** @private */\n upChevronIconClass = 'govuk-accordion-nav__chevron'\n\n /** @private */\n downChevronIconClass = 'govuk-accordion-nav__chevron--down'\n\n /** @private */\n sectionSummaryClass = 'govuk-accordion__section-summary'\n\n /** @private */\n sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus'\n\n /** @private */\n sectionContentClass = 'govuk-accordion__section-content'\n\n /** @private */\n $sections\n\n /** @private */\n browserSupportsSessionStorage = false\n\n /**\n * @private\n * @type {HTMLButtonElement | null}\n */\n $showAllButton = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllIcon = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllText = null\n\n /**\n * @param {Element | null} $module - HTML element to use for accordion\n * @param {AccordionConfig} [config] - Accordion config\n */\n constructor($module, config = {}) {\n super()\n\n if (!($module instanceof HTMLElement)) {\n throw new ElementError({\n componentName: 'Accordion',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n this.$module = $module\n\n this.config = mergeConfigs(\n Accordion.defaults,\n config,\n normaliseDataset(Accordion, $module.dataset)\n )\n\n this.i18n = new I18n(this.config.i18n)\n\n const $sections = this.$module.querySelectorAll(`.${this.sectionClass}`)\n if (!$sections.length) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Sections (\\`<div class=\"${this.sectionClass}\">\\`)`\n })\n }\n\n this.$sections = $sections\n this.browserSupportsSessionStorage = helper.checkForSessionStorage()\n\n this.initControls()\n this.initSectionHeaders()\n\n // See if \"Show all sections\" button text should be updated\n const areAllSectionsOpen = this.checkIfAllSectionsOpen()\n this.updateShowAllButton(areAllSectionsOpen)\n }\n\n /**\n * Initialise controls and set attributes\n *\n * @private\n */\n initControls() {\n // Create \"Show all\" button and set attributes\n this.$showAllButton = document.createElement('button')\n this.$showAllButton.setAttribute('type', 'button')\n this.$showAllButton.setAttribute('class', this.showAllClass)\n this.$showAllButton.setAttribute('aria-expanded', 'false')\n\n // Create icon, add to element\n this.$showAllIcon = document.createElement('span')\n this.$showAllIcon.classList.add(this.upChevronIconClass)\n this.$showAllButton.appendChild(this.$showAllIcon)\n\n // Create control wrapper and add controls to it\n const $accordionControls = document.createElement('div')\n $accordionControls.setAttribute('class', this.controlsClass)\n $accordionControls.appendChild(this.$showAllButton)\n this.$module.insertBefore($accordionControls, this.$module.firstChild)\n\n // Build additional wrapper for Show all toggle text and place after icon\n this.$showAllText = document.createElement('span')\n this.$showAllText.classList.add(this.showAllTextClass)\n this.$showAllButton.appendChild(this.$showAllText)\n\n // Handle click events on the show/hide all button\n this.$showAllButton.addEventListener('click', () =>\n this.onShowOrHideAllToggle()\n )\n\n // Handle 'beforematch' events, if the user agent supports them\n if ('onbeforematch' in document) {\n document.addEventListener('beforematch', (event) =>\n this.onBeforeMatch(event)\n )\n }\n }\n\n /**\n * Initialise section headers\n *\n * @private\n */\n initSectionHeaders() {\n this.$sections.forEach(($section, i) => {\n const $header = $section.querySelector(`.${this.sectionHeaderClass}`)\n if (!$header) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section headers (\\`<div class=\"${this.sectionHeaderClass}\">\\`)`\n })\n }\n\n // Set header attributes\n this.constructHeaderMarkup($header, i)\n this.setExpanded(this.isExpanded($section), $section)\n\n // Handle events\n $header.addEventListener('click', () => this.onSectionToggle($section))\n\n // See if there is any state stored in sessionStorage and set the sections\n // to open or closed.\n this.setInitialState($section)\n })\n }\n\n /**\n * Construct section header\n *\n * @private\n * @param {Element} $header - Section header\n * @param {number} index - Section index\n */\n constructHeaderMarkup($header, index) {\n const $span = $header.querySelector(`.${this.sectionButtonClass}`)\n const $heading = $header.querySelector(`.${this.sectionHeadingClass}`)\n const $summary = $header.querySelector(`.${this.sectionSummaryClass}`)\n\n if (!$heading) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section heading (\\`.${this.sectionHeadingClass}\\`)`\n })\n }\n\n if (!$span) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section button placeholder (\\`<span class=\"${this.sectionButtonClass}\">\\`)`\n })\n }\n\n // Create a button element that will replace the\n // '.govuk-accordion__section-button' span\n const $button = document.createElement('button')\n $button.setAttribute('type', 'button')\n $button.setAttribute(\n 'aria-controls',\n `${this.$module.id}-content-${index + 1}`\n )\n\n // Copy all attributes from $span to $button (except `id`, which gets added\n // to the `$headingText` element)\n for (const attr of Array.from($span.attributes)) {\n if (attr.nodeName !== 'id') {\n $button.setAttribute(attr.nodeName, `${attr.nodeValue}`)\n }\n }\n\n // Create container for heading text so it can be styled\n const $headingText = document.createElement('span')\n $headingText.classList.add(this.sectionHeadingTextClass)\n // Copy the span ID to the heading text to allow it to be referenced by\n // `aria-labelledby` on the hidden content area without \"Show this section\"\n $headingText.id = $span.id\n\n // Create an inner heading text container to limit the width of the focus\n // state\n const $headingTextFocus = document.createElement('span')\n $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass)\n $headingText.appendChild($headingTextFocus)\n // span could contain HTML elements\n // (see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content)\n $headingTextFocus.innerHTML = $span.innerHTML\n\n // Create container for show / hide icons and text.\n const $showHideToggle = document.createElement('span')\n $showHideToggle.classList.add(this.sectionShowHideToggleClass)\n // Tell Google not to index the 'show' text as part of the heading. Must be\n // set on the element before it's added to the DOM.\n // See https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#data-nosnippet-attr\n $showHideToggle.setAttribute('data-nosnippet', '')\n // Create an inner container to limit the width of the focus state\n const $showHideToggleFocus = document.createElement('span')\n $showHideToggleFocus.classList.add(this.sectionShowHideToggleFocusClass)\n $showHideToggle.appendChild($showHideToggleFocus)\n // Create wrapper for the show / hide text. Append text after the show/hide icon\n const $showHideText = document.createElement('span')\n const $showHideIcon = document.createElement('span')\n $showHideIcon.classList.add(this.upChevronIconClass)\n $showHideToggleFocus.appendChild($showHideIcon)\n $showHideText.classList.add(this.sectionShowHideTextClass)\n $showHideToggleFocus.appendChild($showHideText)\n\n // Append elements to the button:\n // 1. Heading text\n // 2. Punctuation\n // 3. (Optional: Summary line followed by punctuation)\n // 4. Show / hide toggle\n $button.appendChild($headingText)\n $button.appendChild(this.getButtonPunctuationEl())\n\n // If summary content exists add to DOM in correct order\n if ($summary?.parentNode) {\n // Create a new `span` element and copy the summary line content from the\n // original `div` to the new `span`. This is because the summary line text\n // is now inside a button element, which can only contain phrasing\n // content.\n const $summarySpan = document.createElement('span')\n // Create an inner summary container to limit the width of the summary\n // focus state\n const $summarySpanFocus = document.createElement('span')\n $summarySpanFocus.classList.add(this.sectionSummaryFocusClass)\n $summarySpan.appendChild($summarySpanFocus)\n\n // Get original attributes, and pass them to the replacement\n for (const attr of Array.from($summary.attributes)) {\n $summarySpan.setAttribute(attr.nodeName, `${attr.nodeValue}`)\n }\n\n // Copy original contents of summary to the new summary span\n $summarySpanFocus.innerHTML = $summary.innerHTML\n\n // Replace the original summary `div` with the new summary `span`\n $summary.parentNode.replaceChild($summarySpan, $summary)\n\n $button.appendChild($summarySpan)\n $button.appendChild(this.getButtonPunctuationEl())\n }\n\n $button.appendChild($showHideToggle)\n\n $heading.removeChild($span)\n $heading.appendChild($button)\n }\n\n /**\n * When a section is opened by the user agent via the 'beforematch' event\n *\n * @private\n * @param {Event} event - Generic event\n */\n onBeforeMatch(event) {\n const $fragment = event.target\n\n // Handle elements with `.closest()` support only\n if (!($fragment instanceof Element)) {\n return\n }\n\n // Handle when fragment is inside section\n const $section = $fragment.closest(`.${this.sectionClass}`)\n if ($section) {\n this.setExpanded(true, $section)\n }\n }\n\n /**\n * When section toggled, set and store state\n *\n * @private\n * @param {Element} $section - Section element\n */\n onSectionToggle($section) {\n const expanded = this.isExpanded($section)\n this.setExpanded(!expanded, $section)\n\n // Store the state in sessionStorage when a change is triggered\n this.storeState($section)\n }\n\n /**\n * When Open/Close All toggled, set and store state\n *\n * @private\n */\n onShowOrHideAllToggle() {\n const nowExpanded = !this.checkIfAllSectionsOpen()\n\n this.$sections.forEach(($section) => {\n this.setExpanded(nowExpanded, $section)\n this.storeState($section)\n })\n\n this.updateShowAllButton(nowExpanded)\n }\n\n /**\n * Set section attributes when opened/closed\n *\n * @private\n * @param {boolean} expanded - Section expanded\n * @param {Element} $section - Section element\n */\n setExpanded(expanded, $section) {\n const $showHideIcon = $section.querySelector(`.${this.upChevronIconClass}`)\n const $showHideText = $section.querySelector(\n `.${this.sectionShowHideTextClass}`\n )\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n const $content = $section.querySelector(`.${this.sectionContentClass}`)\n\n if (!$content) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section content (\\`<div class=\"${this.sectionContentClass}\">\\`)`\n })\n }\n\n if (!$showHideIcon || !$showHideText || !$button) {\n // Return early for elements we create\n return\n }\n\n const newButtonText = expanded\n ? this.i18n.t('hideSection')\n : this.i18n.t('showSection')\n\n $showHideText.textContent = newButtonText\n $button.setAttribute('aria-expanded', `${expanded}`)\n\n // Update aria-label combining\n const ariaLabelParts = []\n\n const $headingText = $section.querySelector(\n `.${this.sectionHeadingTextClass}`\n )\n if ($headingText) {\n ariaLabelParts.push(`${$headingText.textContent}`.trim())\n }\n\n const $summary = $section.querySelector(`.${this.sectionSummaryClass}`)\n if ($summary) {\n ariaLabelParts.push(`${$summary.textContent}`.trim())\n }\n\n const ariaLabelMessage = expanded\n ? this.i18n.t('hideSectionAriaLabel')\n : this.i18n.t('showSectionAriaLabel')\n ariaLabelParts.push(ariaLabelMessage)\n\n /*\n * Join with a comma to add pause for assistive technology.\n * Example: [heading]Section A ,[pause] Show this section.\n * https://accessibility.blog.gov.uk/2017/12/18/what-working-on-gov-uk-navigation-taught-us-about-accessibility/\n */\n $button.setAttribute('aria-label', ariaLabelParts.join(' , '))\n\n // Swap icon, change class\n if (expanded) {\n $content.removeAttribute('hidden')\n $section.classList.add(this.sectionExpandedClass)\n $showHideIcon.classList.remove(this.downChevronIconClass)\n } else {\n $content.setAttribute('hidden', 'until-found')\n $section.classList.remove(this.sectionExpandedClass)\n $showHideIcon.classList.add(this.downChevronIconClass)\n }\n\n // See if \"Show all sections\" button text should be updated\n const areAllSectionsOpen = this.checkIfAllSectionsOpen()\n this.updateShowAllButton(areAllSectionsOpen)\n }\n\n /**\n * Get state of section\n *\n * @private\n * @param {Element} $section - Section element\n * @returns {boolean} True if expanded\n */\n isExpanded($section) {\n return $section.classList.contains(this.sectionExpandedClass)\n }\n\n /**\n * Check if all sections are open\n *\n * @private\n * @returns {boolean} True if all sections are open\n */\n checkIfAllSectionsOpen() {\n const sectionsCount = this.$sections.length\n const expandedSectionCount = this.$module.querySelectorAll(\n `.${this.sectionExpandedClass}`\n ).length\n const areAllSectionsOpen = sectionsCount === expandedSectionCount\n\n return areAllSectionsOpen\n }\n\n /**\n * Update \"Show all sections\" button\n *\n * @private\n * @param {boolean} expanded - Section expanded\n */\n updateShowAllButton(expanded) {\n if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {\n return\n }\n\n this.$showAllButton.setAttribute('aria-expanded', expanded.toString())\n this.$showAllText.textContent = expanded\n ? this.i18n.t('hideAllSections')\n : this.i18n.t('showAllSections')\n this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded)\n }\n\n /**\n * Set the state of the accordions in sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n */\n storeState($section) {\n if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {\n // We need a unique way of identifying each content in the Accordion.\n // Since an `#id` should be unique and an `id` is required for `aria-`\n // attributes `id` can be safely used.\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n if ($button) {\n const contentId = $button.getAttribute('aria-controls')\n const contentState = $button.getAttribute('aria-expanded')\n\n // Only set the state when both `contentId` and `contentState` are taken\n // from the DOM.\n if (contentId && contentState) {\n window.sessionStorage.setItem(contentId, contentState)\n }\n }\n }\n }\n\n /**\n * Read the state of the accordions from sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n */\n setInitialState($section) {\n if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n if ($button) {\n const contentId = $button.getAttribute('aria-controls')\n const contentState = contentId\n ? window.sessionStorage.getItem(contentId)\n : null\n\n if (contentState !== null) {\n this.setExpanded(contentState === 'true', $section)\n }\n }\n }\n }\n\n /**\n * Create an element to improve semantics of the section button with\n * punctuation\n *\n * Adding punctuation to the button can also improve its general semantics by\n * dividing its contents into thematic chunks. See\n * https://github.com/alphagov/govuk-frontend/issues/2327#issuecomment-922957442\n *\n * @private\n * @returns {Element} DOM element\n */\n getButtonPunctuationEl() {\n const $punctuationEl = document.createElement('span')\n $punctuationEl.classList.add(\n 'govuk-visually-hidden',\n this.sectionHeadingDividerClass\n )\n $punctuationEl.innerHTML = ', '\n return $punctuationEl\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-accordion'\n\n /**\n * Accordion default config\n *\n * @see {@link AccordionConfig}\n * @constant\n * @type {AccordionConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n hideAllSections: 'Hide all sections',\n hideSection: 'Hide',\n hideSectionAriaLabel: 'Hide this section',\n showAllSections: 'Show all sections',\n showSection: 'Show',\n showSectionAriaLabel: 'Show this section'\n },\n rememberExpanded: true\n })\n\n /**\n * Accordion config schema\n *\n * @constant\n * @satisfies {Schema}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' },\n rememberExpanded: { type: 'boolean' }\n }\n })\n}\n\nconst helper = {\n /**\n * Check for `window.sessionStorage`, and that it actually works.\n *\n * @returns {boolean} True if session storage is available\n */\n checkForSessionStorage: function () {\n const testString = 'this is the test string'\n let result\n try {\n window.sessionStorage.setItem(testString, testString)\n result =\n window.sessionStorage.getItem(testString) === testString.toString()\n window.sessionStorage.removeItem(testString)\n return result\n } catch (exception) {\n return false\n }\n }\n}\n\n/**\n * Accordion config\n *\n * @see {@link Accordion.defaults}\n * @typedef {object} AccordionConfig\n * @property {AccordionTranslations} [i18n=Accordion.defaults.i18n] - Accordion translations\n * @property {boolean} [rememberExpanded] - Whether the expanded and collapsed\n * state of each section is remembered and restored when navigating.\n */\n\n/**\n * Accordion translations\n *\n * @see {@link Accordion.defaults.i18n}\n * @typedef {object} AccordionTranslations\n *\n * Messages used by the component for the labels of its buttons. This includes\n * the visible text shown on screen, and text to help assistive technology users\n * for the buttons toggling each section.\n * @property {string} [hideAllSections] - The text content for the 'Hide all\n * sections' button, used when at least one section is expanded.\n * @property {string} [hideSection] - The text content for the 'Hide'\n * button, used when a section is expanded.\n * @property {string} [hideSectionAriaLabel] - The text content appended to the\n * 'Hide' button's accessible name when a section is expanded.\n * @property {string} [showAllSections] - The text content for the 'Show all\n * sections' button, used when all sections are collapsed.\n * @property {string} [showSection] - The text content for the 'Show'\n * button, used when a section is collapsed.\n * @property {string} [showSectionAriaLabel] - The text content appended to the\n * 'Show' button's accessible name when a section is expanded.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n"],"names":["Accordion","GOVUKFrontendComponent","constructor","$module","config","i18n","controlsClass","showAllClass","showAllTextClass","sectionClass","sectionExpandedClass","sectionButtonClass","sectionHeaderClass","sectionHeadingClass","sectionHeadingDividerClass","sectionHeadingTextClass","sectionHeadingTextFocusClass","sectionShowHideToggleClass","sectionShowHideToggleFocusClass","sectionShowHideTextClass","upChevronIconClass","downChevronIconClass","sectionSummaryClass","sectionSummaryFocusClass","sectionContentClass","$sections","browserSupportsSessionStorage","$showAllButton","$showAllIcon","$showAllText","HTMLElement","ElementError","componentName","element","identifier","mergeConfigs","defaults","normaliseDataset","dataset","I18n","querySelectorAll","length","helper","checkForSessionStorage","initControls","initSectionHeaders","areAllSectionsOpen","checkIfAllSectionsOpen","updateShowAllButton","document","createElement","setAttribute","classList","add","appendChild","$accordionControls","insertBefore","firstChild","addEventListener","onShowOrHideAllToggle","event","onBeforeMatch","forEach","$section","i","$header","querySelector","constructHeaderMarkup","setExpanded","isExpanded","onSectionToggle","setInitialState","index","$span","$heading","$summary","$button","id","attr","Array","from","attributes","nodeName","nodeValue","$headingText","$headingTextFocus","innerHTML","$showHideToggle","$showHideToggleFocus","$showHideText","$showHideIcon","getButtonPunctuationEl","parentNode","$summarySpan","$summarySpanFocus","replaceChild","removeChild","$fragment","target","Element","closest","expanded","storeState","nowExpanded","$content","newButtonText","t","textContent","ariaLabelParts","push","trim","ariaLabelMessage","join","removeAttribute","remove","contains","sectionsCount","expandedSectionCount","toString","toggle","rememberExpanded","contentId","getAttribute","contentState","window","sessionStorage","setItem","getItem","$punctuationEl","moduleName","Object","freeze","hideAllSections","hideSection","hideSectionAriaLabel","showAllSections","showSection","showSectionAriaLabel","schema","properties","type","testString","result","removeItem","exception"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,SAASC,sBAAsB,CAAC;AA8FpD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,OAAO,EAAEC,MAAM,GAAG,EAAE,EAAE;AAChC,IAAA,KAAK,EAAE,CAAA;AAAA,IAAA,IAAA,CAjGTD,OAAO,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAMPC,MAAM,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGNC,IAAI,GAAA,KAAA,CAAA,CAAA;IAAA,IAGJC,CAAAA,aAAa,GAAG,2BAA2B,CAAA;IAAA,IAG3CC,CAAAA,YAAY,GAAG,2BAA2B,CAAA;IAAA,IAG1CC,CAAAA,gBAAgB,GAAG,gCAAgC,CAAA;IAAA,IAGnDC,CAAAA,YAAY,GAAG,0BAA0B,CAAA;IAAA,IAGzCC,CAAAA,oBAAoB,GAAG,oCAAoC,CAAA;IAAA,IAG3DC,CAAAA,kBAAkB,GAAG,iCAAiC,CAAA;IAAA,IAGtDC,CAAAA,kBAAkB,GAAG,iCAAiC,CAAA;IAAA,IAGtDC,CAAAA,mBAAmB,GAAG,kCAAkC,CAAA;IAAA,IAGxDC,CAAAA,0BAA0B,GAAG,0CAA0C,CAAA;IAAA,IAGvEC,CAAAA,uBAAuB,GAAG,uCAAuC,CAAA;IAAA,IAGjEC,CAAAA,4BAA4B,GAAG,6CAA6C,CAAA;IAAA,IAG5EC,CAAAA,0BAA0B,GAAG,iCAAiC,CAAA;IAAA,IAG9DC,CAAAA,+BAA+B,GAAG,uCAAuC,CAAA;IAAA,IAGzEC,CAAAA,wBAAwB,GAAG,sCAAsC,CAAA;IAAA,IAGjEC,CAAAA,kBAAkB,GAAG,8BAA8B,CAAA;I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,oBAAoB,EAAE,mBAAA;GACvB;AACDjB,EAAAA,gBAAgB,EAAE,IAAA;AACpB,CAAC,CAAC,CAAA;AAhlBSxH,SAAS,CAwlBb0I,MAAM,GAAGR,MAAM,CAACC,MAAM,CAAC;AAC5BQ,EAAAA,UAAU,EAAE;AACVtI,IAAAA,IAAI,EAAE;AAAEuI,MAAAA,IAAI,EAAE,QAAA;KAAU;AACxBpB,IAAAA,gBAAgB,EAAE;AAAEoB,MAAAA,IAAI,EAAE,SAAA;AAAU,KAAA;AACtC,GAAA;AACF,CAAC,CAAC,CAAA;AAGJ,MAAMlG,MAAM,GAAG;AACb;AACF;AACA;AACA;AACA;EACEC,sBAAsB,EAAE,YAAY;IAClC,MAAMkG,UAAU,GAAG,yBAAyB,CAAA;AAC5C,IAAA,IAAIC,MAAM,CAAA;IACV,IAAI;MACFlB,MAAM,CAACC,cAAc,CAACC,OAAO,CAACe,UAAU,EAAEA,UAAU,CAAC,CAAA;AACrDC,MAAAA,MAAM,GACJlB,MAAM,CAACC,cAAc,CAACE,OAAO,CAACc,UAAU,CAAC,KAAKA,UAAU,CAACvB,QAAQ,EAAE,CAAA;AACrEM,MAAAA,MAAM,CAACC,cAAc,CAACkB,UAAU,CAACF,UAAU,CAAC,CAAA;AAC5C,MAAA,OAAOC,MAAM,CAAA;KACd,CAAC,OAAOE,SAAS,EAAE;AAClB,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AACF,GAAA;AACF,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;"}
|
1
|
+
{"version":3,"file":"accordion.mjs","sources":["../../../../src/govuk/components/accordion/accordion.mjs"],"sourcesContent":["import { ConfigurableComponent } from '../../common/configuration.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * Accordion component\n *\n * This allows a collection of sections to be collapsed by default, showing only\n * their headers. Sections can be expanded or collapsed individually by clicking\n * their headers. A \"Show all sections\" button is also added to the top of the\n * accordion, which switches to \"Hide all sections\" when all the sections are\n * expanded.\n *\n * The state of each section is saved to the DOM via the `aria-expanded`\n * attribute, which also provides accessibility.\n *\n * @preserve\n * @augments ConfigurableComponent<AccordionConfig>\n */\nexport class Accordion extends ConfigurableComponent {\n /** @private */\n i18n\n\n /** @private */\n controlsClass = 'govuk-accordion__controls'\n\n /** @private */\n showAllClass = 'govuk-accordion__show-all'\n\n /** @private */\n showAllTextClass = 'govuk-accordion__show-all-text'\n\n /** @private */\n sectionClass = 'govuk-accordion__section'\n\n /** @private */\n sectionExpandedClass = 'govuk-accordion__section--expanded'\n\n /** @private */\n sectionButtonClass = 'govuk-accordion__section-button'\n\n /** @private */\n sectionHeaderClass = 'govuk-accordion__section-header'\n\n /** @private */\n sectionHeadingClass = 'govuk-accordion__section-heading'\n\n /** @private */\n sectionHeadingDividerClass = 'govuk-accordion__section-heading-divider'\n\n /** @private */\n sectionHeadingTextClass = 'govuk-accordion__section-heading-text'\n\n /** @private */\n sectionHeadingTextFocusClass = 'govuk-accordion__section-heading-text-focus'\n\n /** @private */\n sectionShowHideToggleClass = 'govuk-accordion__section-toggle'\n\n /** @private */\n sectionShowHideToggleFocusClass = 'govuk-accordion__section-toggle-focus'\n\n /** @private */\n sectionShowHideTextClass = 'govuk-accordion__section-toggle-text'\n\n /** @private */\n upChevronIconClass = 'govuk-accordion-nav__chevron'\n\n /** @private */\n downChevronIconClass = 'govuk-accordion-nav__chevron--down'\n\n /** @private */\n sectionSummaryClass = 'govuk-accordion__section-summary'\n\n /** @private */\n sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus'\n\n /** @private */\n sectionContentClass = 'govuk-accordion__section-content'\n\n /** @private */\n $sections\n\n /**\n * @private\n * @type {HTMLButtonElement | null}\n */\n $showAllButton = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllIcon = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllText = null\n\n /**\n * @param {Element | null} $root - HTML element to use for accordion\n * @param {AccordionConfig} [config] - Accordion config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n this.i18n = new I18n(this.config.i18n)\n\n const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`)\n if (!$sections.length) {\n throw new ElementError({\n component: Accordion,\n identifier: `Sections (\\`<div class=\"${this.sectionClass}\">\\`)`\n })\n }\n\n this.$sections = $sections\n\n this.initControls()\n this.initSectionHeaders()\n\n this.updateShowAllButton(this.areAllSectionsOpen())\n }\n\n /**\n * Initialise controls and set attributes\n *\n * @private\n */\n initControls() {\n // Create \"Show all\" button and set attributes\n this.$showAllButton = document.createElement('button')\n this.$showAllButton.setAttribute('type', 'button')\n this.$showAllButton.setAttribute('class', this.showAllClass)\n this.$showAllButton.setAttribute('aria-expanded', 'false')\n\n // Create icon, add to element\n this.$showAllIcon = document.createElement('span')\n this.$showAllIcon.classList.add(this.upChevronIconClass)\n this.$showAllButton.appendChild(this.$showAllIcon)\n\n // Create control wrapper and add controls to it\n const $accordionControls = document.createElement('div')\n $accordionControls.setAttribute('class', this.controlsClass)\n $accordionControls.appendChild(this.$showAllButton)\n this.$root.insertBefore($accordionControls, this.$root.firstChild)\n\n // Build additional wrapper for Show all toggle text and place after icon\n this.$showAllText = document.createElement('span')\n this.$showAllText.classList.add(this.showAllTextClass)\n this.$showAllButton.appendChild(this.$showAllText)\n\n // Handle click events on the show/hide all button\n this.$showAllButton.addEventListener('click', () =>\n this.onShowOrHideAllToggle()\n )\n\n // Handle 'beforematch' events, if the user agent supports them\n if ('onbeforematch' in document) {\n document.addEventListener('beforematch', (event) =>\n this.onBeforeMatch(event)\n )\n }\n }\n\n /**\n * Initialise section headers\n *\n * @private\n */\n initSectionHeaders() {\n this.$sections.forEach(($section, i) => {\n const $header = $section.querySelector(`.${this.sectionHeaderClass}`)\n if (!$header) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section headers (\\`<div class=\"${this.sectionHeaderClass}\">\\`)`\n })\n }\n\n // Set header attributes\n this.constructHeaderMarkup($header, i)\n this.setExpanded(this.isExpanded($section), $section)\n\n // Handle events\n $header.addEventListener('click', () => this.onSectionToggle($section))\n\n // See if there is any state stored in sessionStorage and set the sections\n // to open or closed.\n this.setInitialState($section)\n })\n }\n\n /**\n * Construct section header\n *\n * @private\n * @param {Element} $header - Section header\n * @param {number} index - Section index\n */\n constructHeaderMarkup($header, index) {\n const $span = $header.querySelector(`.${this.sectionButtonClass}`)\n const $heading = $header.querySelector(`.${this.sectionHeadingClass}`)\n const $summary = $header.querySelector(`.${this.sectionSummaryClass}`)\n\n if (!$heading) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section heading (\\`.${this.sectionHeadingClass}\\`)`\n })\n }\n\n if (!$span) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section button placeholder (\\`<span class=\"${this.sectionButtonClass}\">\\`)`\n })\n }\n\n // Create a button element that will replace the\n // '.govuk-accordion__section-button' span\n const $button = document.createElement('button')\n $button.setAttribute('type', 'button')\n $button.setAttribute(\n 'aria-controls',\n `${this.$root.id}-content-${index + 1}`\n )\n\n // Copy all attributes from $span to $button (except `id`, which gets added\n // to the `$headingText` element)\n for (const attr of Array.from($span.attributes)) {\n if (attr.name !== 'id') {\n $button.setAttribute(attr.name, attr.value)\n }\n }\n\n // Create container for heading text so it can be styled\n const $headingText = document.createElement('span')\n $headingText.classList.add(this.sectionHeadingTextClass)\n // Copy the span ID to the heading text to allow it to be referenced by\n // `aria-labelledby` on the hidden content area without \"Show this section\"\n $headingText.id = $span.id\n\n // Create an inner heading text container to limit the width of the focus\n // state\n const $headingTextFocus = document.createElement('span')\n $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass)\n $headingText.appendChild($headingTextFocus)\n // span could contain HTML elements\n // (see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content)\n Array.from($span.childNodes).forEach(($child) =>\n $headingTextFocus.appendChild($child)\n )\n\n // Create container for show / hide icons and text.\n const $showHideToggle = document.createElement('span')\n $showHideToggle.classList.add(this.sectionShowHideToggleClass)\n // Tell Google not to index the 'show' text as part of the heading. Must be\n // set on the element before it's added to the DOM.\n // See https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#data-nosnippet-attr\n $showHideToggle.setAttribute('data-nosnippet', '')\n // Create an inner container to limit the width of the focus state\n const $showHideToggleFocus = document.createElement('span')\n $showHideToggleFocus.classList.add(this.sectionShowHideToggleFocusClass)\n $showHideToggle.appendChild($showHideToggleFocus)\n // Create wrapper for the show / hide text. Append text after the show/hide icon\n const $showHideText = document.createElement('span')\n const $showHideIcon = document.createElement('span')\n $showHideIcon.classList.add(this.upChevronIconClass)\n $showHideToggleFocus.appendChild($showHideIcon)\n $showHideText.classList.add(this.sectionShowHideTextClass)\n $showHideToggleFocus.appendChild($showHideText)\n\n // Append elements to the button:\n // 1. Heading text\n // 2. Punctuation\n // 3. (Optional: Summary line followed by punctuation)\n // 4. Show / hide toggle\n $button.appendChild($headingText)\n $button.appendChild(this.getButtonPunctuationEl())\n\n // If summary content exists add to DOM in correct order\n if ($summary) {\n // Create a new `span` element and copy the summary line content from the\n // original `div` to the new `span`. This is because the summary line text\n // is now inside a button element, which can only contain phrasing\n // content.\n const $summarySpan = document.createElement('span')\n // Create an inner summary container to limit the width of the summary\n // focus state\n const $summarySpanFocus = document.createElement('span')\n $summarySpanFocus.classList.add(this.sectionSummaryFocusClass)\n $summarySpan.appendChild($summarySpanFocus)\n\n // Get original attributes, and pass them to the replacement\n for (const attr of Array.from($summary.attributes)) {\n $summarySpan.setAttribute(attr.name, attr.value)\n }\n\n // Copy original contents of summary to the new summary span\n Array.from($summary.childNodes).forEach(($child) =>\n $summarySpanFocus.appendChild($child)\n )\n\n // Replace the original summary `div` with the new summary `span`\n $summary.remove()\n\n $button.appendChild($summarySpan)\n $button.appendChild(this.getButtonPunctuationEl())\n }\n\n $button.appendChild($showHideToggle)\n\n $heading.removeChild($span)\n $heading.appendChild($button)\n }\n\n /**\n * When a section is opened by the user agent via the 'beforematch' event\n *\n * @private\n * @param {Event} event - Generic event\n */\n onBeforeMatch(event) {\n const $fragment = event.target\n\n // Handle elements with `.closest()` support only\n if (!($fragment instanceof Element)) {\n return\n }\n\n // Handle when fragment is inside section\n const $section = $fragment.closest(`.${this.sectionClass}`)\n if ($section) {\n this.setExpanded(true, $section)\n }\n }\n\n /**\n * When section toggled, set and store state\n *\n * @private\n * @param {Element} $section - Section element\n */\n onSectionToggle($section) {\n const nowExpanded = !this.isExpanded($section)\n this.setExpanded(nowExpanded, $section)\n\n // Store the state in sessionStorage when a change is triggered\n this.storeState($section, nowExpanded)\n }\n\n /**\n * When Open/Close All toggled, set and store state\n *\n * @private\n */\n onShowOrHideAllToggle() {\n const nowExpanded = !this.areAllSectionsOpen()\n\n this.$sections.forEach(($section) => {\n this.setExpanded(nowExpanded, $section)\n this.storeState($section, nowExpanded)\n })\n\n this.updateShowAllButton(nowExpanded)\n }\n\n /**\n * Set section attributes when opened/closed\n *\n * @private\n * @param {boolean} expanded - Section expanded\n * @param {Element} $section - Section element\n */\n setExpanded(expanded, $section) {\n const $showHideIcon = $section.querySelector(`.${this.upChevronIconClass}`)\n const $showHideText = $section.querySelector(\n `.${this.sectionShowHideTextClass}`\n )\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n const $content = $section.querySelector(`.${this.sectionContentClass}`)\n\n if (!$content) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section content (\\`<div class=\"${this.sectionContentClass}\">\\`)`\n })\n }\n\n if (!$showHideIcon || !$showHideText || !$button) {\n // Return early for elements we create\n return\n }\n\n const newButtonText = expanded\n ? this.i18n.t('hideSection')\n : this.i18n.t('showSection')\n\n $showHideText.textContent = newButtonText\n $button.setAttribute('aria-expanded', `${expanded}`)\n\n // Update aria-label combining\n const ariaLabelParts = []\n\n const $headingText = $section.querySelector(\n `.${this.sectionHeadingTextClass}`\n )\n if ($headingText) {\n ariaLabelParts.push(`${$headingText.textContent}`.trim())\n }\n\n const $summary = $section.querySelector(`.${this.sectionSummaryClass}`)\n if ($summary) {\n ariaLabelParts.push(`${$summary.textContent}`.trim())\n }\n\n const ariaLabelMessage = expanded\n ? this.i18n.t('hideSectionAriaLabel')\n : this.i18n.t('showSectionAriaLabel')\n ariaLabelParts.push(ariaLabelMessage)\n\n /*\n * Join with a comma to add pause for assistive technology.\n * Example: [heading]Section A ,[pause] Show this section.\n * https://accessibility.blog.gov.uk/2017/12/18/what-working-on-gov-uk-navigation-taught-us-about-accessibility/\n */\n $button.setAttribute('aria-label', ariaLabelParts.join(' , '))\n\n // Swap icon, change class\n if (expanded) {\n $content.removeAttribute('hidden')\n $section.classList.add(this.sectionExpandedClass)\n $showHideIcon.classList.remove(this.downChevronIconClass)\n } else {\n $content.setAttribute('hidden', 'until-found')\n $section.classList.remove(this.sectionExpandedClass)\n $showHideIcon.classList.add(this.downChevronIconClass)\n }\n\n // See if \"Show all sections\" button text should be updated\n this.updateShowAllButton(this.areAllSectionsOpen())\n }\n\n /**\n * Get state of section\n *\n * @private\n * @param {Element} $section - Section element\n * @returns {boolean} True if expanded\n */\n isExpanded($section) {\n return $section.classList.contains(this.sectionExpandedClass)\n }\n\n /**\n * Check if all sections are open\n *\n * @private\n * @returns {boolean} True if all sections are open\n */\n areAllSectionsOpen() {\n return Array.from(this.$sections).every(($section) =>\n this.isExpanded($section)\n )\n }\n\n /**\n * Update \"Show all sections\" button\n *\n * @private\n * @param {boolean} expanded - Section expanded\n */\n updateShowAllButton(expanded) {\n if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {\n return\n }\n\n this.$showAllButton.setAttribute('aria-expanded', expanded.toString())\n this.$showAllText.textContent = expanded\n ? this.i18n.t('hideAllSections')\n : this.i18n.t('showAllSections')\n this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded)\n }\n\n /**\n * Get the identifier for a section\n *\n * We need a unique way of identifying each content in the Accordion.\n * Since an `#id` should be unique and an `id` is required for `aria-`\n * attributes `id` can be safely used.\n *\n * @param {Element} $section - Section element\n * @returns {string | undefined | null} Identifier for section\n */\n getIdentifier($section) {\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n return $button?.getAttribute('aria-controls')\n }\n\n /**\n * Set the state of the accordions in sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n * @param {boolean} isExpanded - Whether the section is expanded\n */\n storeState($section, isExpanded) {\n if (!this.config.rememberExpanded) {\n return\n }\n\n const id = this.getIdentifier($section)\n\n if (id) {\n try {\n window.sessionStorage.setItem(id, isExpanded.toString())\n } catch (exception) {}\n }\n }\n\n /**\n * Read the state of the accordions from sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n */\n setInitialState($section) {\n if (!this.config.rememberExpanded) {\n return\n }\n\n const id = this.getIdentifier($section)\n\n if (id) {\n try {\n const state = window.sessionStorage.getItem(id)\n\n if (state !== null) {\n this.setExpanded(state === 'true', $section)\n }\n } catch (exception) {}\n }\n }\n\n /**\n * Create an element to improve semantics of the section button with\n * punctuation\n *\n * Adding punctuation to the button can also improve its general semantics by\n * dividing its contents into thematic chunks. See\n * https://github.com/alphagov/govuk-frontend/issues/2327#issuecomment-922957442\n *\n * @private\n * @returns {Element} DOM element\n */\n getButtonPunctuationEl() {\n const $punctuationEl = document.createElement('span')\n $punctuationEl.classList.add(\n 'govuk-visually-hidden',\n this.sectionHeadingDividerClass\n )\n $punctuationEl.textContent = ', '\n return $punctuationEl\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-accordion'\n\n /**\n * Accordion default config\n *\n * @see {@link AccordionConfig}\n * @constant\n * @type {AccordionConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n hideAllSections: 'Hide all sections',\n hideSection: 'Hide',\n hideSectionAriaLabel: 'Hide this section',\n showAllSections: 'Show all sections',\n showSection: 'Show',\n showSectionAriaLabel: 'Show this section'\n },\n rememberExpanded: true\n })\n\n /**\n * Accordion config schema\n *\n * @constant\n * @satisfies {Schema<AccordionConfig>}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' },\n rememberExpanded: { type: 'boolean' }\n }\n })\n}\n\n/**\n * Accordion config\n *\n * @see {@link Accordion.defaults}\n * @typedef {object} AccordionConfig\n * @property {AccordionTranslations} [i18n=Accordion.defaults.i18n] - Accordion translations\n * @property {boolean} [rememberExpanded] - Whether the expanded and collapsed\n * state of each section is remembered and restored when navigating.\n */\n\n/**\n * Accordion translations\n *\n * @see {@link Accordion.defaults.i18n}\n * @typedef {object} AccordionTranslations\n *\n * Messages used by the component for the labels of its buttons. This includes\n * the visible text shown on screen, and text to help assistive technology users\n * for the buttons toggling each section.\n * @property {string} [hideAllSections] - The text content for the 'Hide all\n * sections' button, used when at least one section is expanded.\n * @property {string} [hideSection] - The text content for the 'Hide'\n * button, used when a section is expanded.\n * @property {string} [hideSectionAriaLabel] - The text content appended to the\n * 'Hide' button's accessible name when a section is expanded.\n * @property {string} [showAllSections] - The text content for the 'Show all\n * sections' button, used when all sections are collapsed.\n * @property {string} [showSection] - The text content for the 'Show'\n * button, used when a section is collapsed.\n * @property {string} [showSectionAriaLabel] - The text content appended to the\n * 'Show' button's accessible name when a section is expanded.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\n"],"names":["Accordion","ConfigurableComponent","constructor","$root","config","i18n","controlsClass","showAllClass","showAllTextClass","sectionClass","sectionExpandedClass","sectionButtonClass","sectionHeaderClass","sectionHeadingClass","sectionHeadingDividerClass","sectionHeadingTextClass","sectionHeadingTextFocusClass","sectionShowHideToggleClass","sectionShowHideToggleFocusClass","sectionShowHideTextClass","upChevronIconClass","downChevronIconClass","sectionSummaryClass","sectionSummaryFocusClass","sectionContentClass","$sections","$showAllButton","$showAllIcon","$showAllText","I18n","querySelectorAll","length","ElementError","component","identifier","initControls","initSectionHeaders","updateShowAllButton","areAllSectionsOpen","document","createElement","setAttribute","classList","add","appendChild","$accordionControls","insertBefore","firstChild","addEventListener","onShowOrHideAllToggle","event","onBeforeMatch","forEach","$section","i","$header","querySelector","constructHeaderMarkup","setExpanded","isExpanded","onSectionToggle","setInitialState","index","$span","$heading","$summary","$button","id","attr","Array","from","attributes","name","value","$headingText","$headingTextFocus","childNodes","$child","$showHideToggle","$showHideToggleFocus","$showHideText","$showHideIcon","getButtonPunctuationEl","$summarySpan","$summarySpanFocus","remove","removeChild","$fragment","target","Element","closest","nowExpanded","storeState","expanded","$content","newButtonText","t","textContent","ariaLabelParts","push","trim","ariaLabelMessage","join","removeAttribute","contains","every","toString","toggle","getIdentifier","getAttribute","rememberExpanded","window","sessionStorage","setItem","exception","state","getItem","$punctuationEl","moduleName","defaults","Object","freeze","hideAllSections","hideSection","hideSectionAriaLabel","showAllSections","showSection","showSectionAriaLabel","schema","properties","type"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,SAASC,qBAAqB,CAAC;AAkFnD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;AAC9B,IAAA,KAAK,CAACD,KAAK,EAAEC,MAAM,CAAC;AAAA,IAAA,IAAA,CArFtBC,IAAI,GAAA,MAAA;IAAA,IAGJC,CAAAA,aAAa,GAAG,2BAA2B;IAAA,IAG3CC,CAAAA,YAAY,GAAG,2BAA2B;IAAA,IAG1CC,CAAAA,gBAAgB,GAAG,gCAAgC;IAAA,IAGnDC,CAAAA,YAAY,GAAG,0BAA0B;IAAA,IAGzCC,CAAAA,oBAAoB,GAAG,oCAAoC;IAAA,IAG3DC,CAAAA,kBAAkB,GAAG,iCAAiC;IAAA,IAGtDC,CAAAA,kBAAkB,GAAG,iCAAiC;IAAA,IAGtDC,CAAAA,mBAAmB,GAAG,kCAAkC;IAAA,IAGxDC,CAAAA,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