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,9 +1,179 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = {}));
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
+
function isInitialised($root, moduleName) {
|
|
8
|
+
return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Checks if GOV.UK Frontend is supported on this page
|
|
13
|
+
*
|
|
14
|
+
* Some browsers will load and run our JavaScript but GOV.UK Frontend
|
|
15
|
+
* won't be supported.
|
|
16
|
+
*
|
|
17
|
+
* @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
|
|
18
|
+
* @returns {boolean} Whether GOV.UK Frontend is supported on this page
|
|
19
|
+
*/
|
|
20
|
+
function isSupported($scope = document.body) {
|
|
21
|
+
if (!$scope) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return $scope.classList.contains('govuk-frontend-supported');
|
|
25
|
+
}
|
|
26
|
+
function isArray(option) {
|
|
27
|
+
return Array.isArray(option);
|
|
28
|
+
}
|
|
29
|
+
function isObject(option) {
|
|
30
|
+
return !!option && typeof option === 'object' && !isArray(option);
|
|
31
|
+
}
|
|
32
|
+
function formatErrorMessage(Component, message) {
|
|
33
|
+
return `${Component.moduleName}: ${message}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @typedef ComponentWithModuleName
|
|
37
|
+
* @property {string} moduleName - Name of the component
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* @import { ObjectNested } from './configuration.mjs'
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
class GOVUKFrontendError extends Error {
|
|
44
|
+
constructor(...args) {
|
|
45
|
+
super(...args);
|
|
46
|
+
this.name = 'GOVUKFrontendError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class SupportError extends GOVUKFrontendError {
|
|
50
|
+
/**
|
|
51
|
+
* Checks if GOV.UK Frontend is supported on this page
|
|
52
|
+
*
|
|
53
|
+
* @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
|
|
54
|
+
*/
|
|
55
|
+
constructor($scope = document.body) {
|
|
56
|
+
const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';
|
|
57
|
+
super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`');
|
|
58
|
+
this.name = 'SupportError';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class ConfigError extends GOVUKFrontendError {
|
|
62
|
+
constructor(...args) {
|
|
63
|
+
super(...args);
|
|
64
|
+
this.name = 'ConfigError';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class ElementError extends GOVUKFrontendError {
|
|
68
|
+
constructor(messageOrOptions) {
|
|
69
|
+
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
70
|
+
if (typeof messageOrOptions === 'object') {
|
|
71
|
+
const {
|
|
72
|
+
component,
|
|
73
|
+
identifier,
|
|
74
|
+
element,
|
|
75
|
+
expectedType
|
|
76
|
+
} = messageOrOptions;
|
|
77
|
+
message = identifier;
|
|
78
|
+
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
79
|
+
message = formatErrorMessage(component, message);
|
|
80
|
+
}
|
|
81
|
+
super(message);
|
|
82
|
+
this.name = 'ElementError';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
class InitError extends GOVUKFrontendError {
|
|
86
|
+
constructor(componentOrMessage) {
|
|
87
|
+
const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\`$root\`) already initialised`);
|
|
88
|
+
super(message);
|
|
89
|
+
this.name = 'InitError';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @import { ComponentWithModuleName } from '../common/index.mjs'
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
class Component {
|
|
97
|
+
/**
|
|
98
|
+
* Returns the root element of the component
|
|
99
|
+
*
|
|
100
|
+
* @protected
|
|
101
|
+
* @returns {RootElementType} - the root element of component
|
|
102
|
+
*/
|
|
103
|
+
get $root() {
|
|
104
|
+
return this._$root;
|
|
105
|
+
}
|
|
106
|
+
constructor($root) {
|
|
107
|
+
this._$root = void 0;
|
|
108
|
+
const childConstructor = this.constructor;
|
|
109
|
+
if (typeof childConstructor.moduleName !== 'string') {
|
|
110
|
+
throw new InitError(`\`moduleName\` not defined in component`);
|
|
111
|
+
}
|
|
112
|
+
if (!($root instanceof childConstructor.elementType)) {
|
|
113
|
+
throw new ElementError({
|
|
114
|
+
element: $root,
|
|
115
|
+
component: childConstructor,
|
|
116
|
+
identifier: 'Root element (`$root`)',
|
|
117
|
+
expectedType: childConstructor.elementType.name
|
|
118
|
+
});
|
|
119
|
+
} else {
|
|
120
|
+
this._$root = $root;
|
|
121
|
+
}
|
|
122
|
+
childConstructor.checkSupport();
|
|
123
|
+
this.checkInitialised();
|
|
124
|
+
const moduleName = childConstructor.moduleName;
|
|
125
|
+
this.$root.setAttribute(`data-${moduleName}-init`, '');
|
|
126
|
+
}
|
|
127
|
+
checkInitialised() {
|
|
128
|
+
const constructor = this.constructor;
|
|
129
|
+
const moduleName = constructor.moduleName;
|
|
130
|
+
if (moduleName && isInitialised(this.$root, moduleName)) {
|
|
131
|
+
throw new InitError(constructor);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
static checkSupport() {
|
|
135
|
+
if (!isSupported()) {
|
|
136
|
+
throw new SupportError();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @typedef ChildClass
|
|
143
|
+
* @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @typedef {typeof Component & ChildClass} ChildClassConstructor
|
|
148
|
+
*/
|
|
149
|
+
Component.elementType = HTMLElement;
|
|
150
|
+
|
|
151
|
+
const configOverride = Symbol.for('configOverride');
|
|
152
|
+
class ConfigurableComponent extends Component {
|
|
153
|
+
[configOverride](param) {
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Returns the root element of the component
|
|
159
|
+
*
|
|
160
|
+
* @protected
|
|
161
|
+
* @returns {ConfigurationType} - the root element of component
|
|
162
|
+
*/
|
|
163
|
+
get config() {
|
|
164
|
+
return this._config;
|
|
165
|
+
}
|
|
166
|
+
constructor($root, config) {
|
|
167
|
+
super($root);
|
|
168
|
+
this._config = void 0;
|
|
169
|
+
const childConstructor = this.constructor;
|
|
170
|
+
if (!isObject(childConstructor.defaults)) {
|
|
171
|
+
throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
|
|
172
|
+
}
|
|
173
|
+
const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
|
|
174
|
+
this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
7
177
|
function normaliseString(value, property) {
|
|
8
178
|
const trimmedValue = value ? value.trim() : '';
|
|
9
179
|
let output;
|
|
@@ -28,11 +198,24 @@
|
|
|
28
198
|
}
|
|
29
199
|
return output;
|
|
30
200
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
201
|
+
function normaliseDataset(Component, dataset) {
|
|
202
|
+
if (!isObject(Component.schema)) {
|
|
203
|
+
throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));
|
|
204
|
+
}
|
|
205
|
+
const out = {};
|
|
206
|
+
const entries = Object.entries(Component.schema.properties);
|
|
207
|
+
for (const entry of entries) {
|
|
208
|
+
const [namespace, property] = entry;
|
|
209
|
+
const field = namespace.toString();
|
|
210
|
+
if (field in dataset) {
|
|
211
|
+
out[field] = normaliseString(dataset[field], property);
|
|
212
|
+
}
|
|
213
|
+
if ((property == null ? void 0 : property.type) === 'object') {
|
|
214
|
+
out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
36
219
|
function mergeConfigs(...configObjects) {
|
|
37
220
|
const formattedConfigObject = {};
|
|
38
221
|
for (const configObject of configObjects) {
|
|
@@ -48,19 +231,19 @@
|
|
|
48
231
|
}
|
|
49
232
|
return formattedConfigObject;
|
|
50
233
|
}
|
|
51
|
-
function extractConfigByNamespace(
|
|
52
|
-
const property =
|
|
234
|
+
function extractConfigByNamespace(schema, dataset, namespace) {
|
|
235
|
+
const property = schema.properties[namespace];
|
|
53
236
|
if ((property == null ? void 0 : property.type) !== 'object') {
|
|
54
237
|
return;
|
|
55
238
|
}
|
|
56
239
|
const newObject = {
|
|
57
|
-
[namespace]:
|
|
240
|
+
[namespace]: {}
|
|
58
241
|
};
|
|
59
242
|
for (const [key, value] of Object.entries(dataset)) {
|
|
60
243
|
let current = newObject;
|
|
61
244
|
const keyParts = key.split('.');
|
|
62
245
|
for (const [index, name] of keyParts.entries()) {
|
|
63
|
-
if (
|
|
246
|
+
if (isObject(current)) {
|
|
64
247
|
if (index < keyParts.length - 1) {
|
|
65
248
|
if (!isObject(current[name])) {
|
|
66
249
|
current[name] = {};
|
|
@@ -74,101 +257,39 @@
|
|
|
74
257
|
}
|
|
75
258
|
return newObject[namespace];
|
|
76
259
|
}
|
|
77
|
-
function isSupported($scope = document.body) {
|
|
78
|
-
if (!$scope) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
return $scope.classList.contains('govuk-frontend-supported');
|
|
82
|
-
}
|
|
83
|
-
function isArray(option) {
|
|
84
|
-
return Array.isArray(option);
|
|
85
|
-
}
|
|
86
|
-
function isObject(option) {
|
|
87
|
-
return !!option && typeof option === 'object' && !isArray(option);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
260
|
/**
|
|
91
261
|
* Schema for component config
|
|
92
262
|
*
|
|
263
|
+
* @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
|
|
93
264
|
* @typedef {object} Schema
|
|
94
|
-
* @property {
|
|
95
|
-
* @property {SchemaCondition[]} [anyOf] - List of schema conditions
|
|
265
|
+
* @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties
|
|
266
|
+
* @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions
|
|
96
267
|
*/
|
|
97
|
-
|
|
98
268
|
/**
|
|
99
269
|
* Schema property for component config
|
|
100
270
|
*
|
|
101
271
|
* @typedef {object} SchemaProperty
|
|
102
272
|
* @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
|
|
103
273
|
*/
|
|
104
|
-
|
|
105
274
|
/**
|
|
106
275
|
* Schema condition for component config
|
|
107
276
|
*
|
|
277
|
+
* @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
|
|
108
278
|
* @typedef {object} SchemaCondition
|
|
109
|
-
* @property {
|
|
279
|
+
* @property {(keyof ConfigurationType)[]} required - List of required config fields
|
|
110
280
|
* @property {string} errorMessage - Error message when required config fields not provided
|
|
111
281
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return out;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
class GOVUKFrontendError extends Error {
|
|
127
|
-
constructor(...args) {
|
|
128
|
-
super(...args);
|
|
129
|
-
this.name = 'GOVUKFrontendError';
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
class SupportError extends GOVUKFrontendError {
|
|
133
|
-
/**
|
|
134
|
-
* Checks if GOV.UK Frontend is supported on this page
|
|
135
|
-
*
|
|
136
|
-
* @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
|
|
137
|
-
*/
|
|
138
|
-
constructor($scope = document.body) {
|
|
139
|
-
const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';
|
|
140
|
-
super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`');
|
|
141
|
-
this.name = 'SupportError';
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
class ElementError extends GOVUKFrontendError {
|
|
145
|
-
constructor(messageOrOptions) {
|
|
146
|
-
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
147
|
-
if (typeof messageOrOptions === 'object') {
|
|
148
|
-
const {
|
|
149
|
-
componentName,
|
|
150
|
-
identifier,
|
|
151
|
-
element,
|
|
152
|
-
expectedType
|
|
153
|
-
} = messageOrOptions;
|
|
154
|
-
message = `${componentName}: ${identifier}`;
|
|
155
|
-
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
156
|
-
}
|
|
157
|
-
super(message);
|
|
158
|
-
this.name = 'ElementError';
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
class GOVUKFrontendComponent {
|
|
163
|
-
constructor() {
|
|
164
|
-
this.checkSupport();
|
|
165
|
-
}
|
|
166
|
-
checkSupport() {
|
|
167
|
-
if (!isSupported()) {
|
|
168
|
-
throw new SupportError();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
282
|
+
/**
|
|
283
|
+
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
284
|
+
* @typedef ChildClass
|
|
285
|
+
* @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
|
|
286
|
+
* @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration
|
|
287
|
+
* @property {ConfigurationType} [defaults] - The default values of the configuration of the component
|
|
288
|
+
*/
|
|
289
|
+
/**
|
|
290
|
+
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
291
|
+
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
292
|
+
*/
|
|
172
293
|
|
|
173
294
|
class I18n {
|
|
174
295
|
constructor(translations = {}, config = {}) {
|
|
@@ -376,16 +497,15 @@
|
|
|
376
497
|
* attribute, which also provides accessibility.
|
|
377
498
|
*
|
|
378
499
|
* @preserve
|
|
500
|
+
* @augments ConfigurableComponent<AccordionConfig>
|
|
379
501
|
*/
|
|
380
|
-
class Accordion extends
|
|
502
|
+
class Accordion extends ConfigurableComponent {
|
|
381
503
|
/**
|
|
382
|
-
* @param {Element | null} $
|
|
504
|
+
* @param {Element | null} $root - HTML element to use for accordion
|
|
383
505
|
* @param {AccordionConfig} [config] - Accordion config
|
|
384
506
|
*/
|
|
385
|
-
constructor($
|
|
386
|
-
super();
|
|
387
|
-
this.$module = void 0;
|
|
388
|
-
this.config = void 0;
|
|
507
|
+
constructor($root, config = {}) {
|
|
508
|
+
super($root, config);
|
|
389
509
|
this.i18n = void 0;
|
|
390
510
|
this.controlsClass = 'govuk-accordion__controls';
|
|
391
511
|
this.showAllClass = 'govuk-accordion__show-all';
|
|
@@ -407,33 +527,21 @@
|
|
|
407
527
|
this.sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus';
|
|
408
528
|
this.sectionContentClass = 'govuk-accordion__section-content';
|
|
409
529
|
this.$sections = void 0;
|
|
410
|
-
this.browserSupportsSessionStorage = false;
|
|
411
530
|
this.$showAllButton = null;
|
|
412
531
|
this.$showAllIcon = null;
|
|
413
532
|
this.$showAllText = null;
|
|
414
|
-
if (!($module instanceof HTMLElement)) {
|
|
415
|
-
throw new ElementError({
|
|
416
|
-
componentName: 'Accordion',
|
|
417
|
-
element: $module,
|
|
418
|
-
identifier: 'Root element (`$module`)'
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
this.$module = $module;
|
|
422
|
-
this.config = mergeConfigs(Accordion.defaults, config, normaliseDataset(Accordion, $module.dataset));
|
|
423
533
|
this.i18n = new I18n(this.config.i18n);
|
|
424
|
-
const $sections = this.$
|
|
534
|
+
const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`);
|
|
425
535
|
if (!$sections.length) {
|
|
426
536
|
throw new ElementError({
|
|
427
|
-
|
|
537
|
+
component: Accordion,
|
|
428
538
|
identifier: `Sections (\`<div class="${this.sectionClass}">\`)`
|
|
429
539
|
});
|
|
430
540
|
}
|
|
431
541
|
this.$sections = $sections;
|
|
432
|
-
this.browserSupportsSessionStorage = helper.checkForSessionStorage();
|
|
433
542
|
this.initControls();
|
|
434
543
|
this.initSectionHeaders();
|
|
435
|
-
|
|
436
|
-
this.updateShowAllButton(areAllSectionsOpen);
|
|
544
|
+
this.updateShowAllButton(this.areAllSectionsOpen());
|
|
437
545
|
}
|
|
438
546
|
initControls() {
|
|
439
547
|
this.$showAllButton = document.createElement('button');
|
|
@@ -446,7 +554,7 @@
|
|
|
446
554
|
const $accordionControls = document.createElement('div');
|
|
447
555
|
$accordionControls.setAttribute('class', this.controlsClass);
|
|
448
556
|
$accordionControls.appendChild(this.$showAllButton);
|
|
449
|
-
this.$
|
|
557
|
+
this.$root.insertBefore($accordionControls, this.$root.firstChild);
|
|
450
558
|
this.$showAllText = document.createElement('span');
|
|
451
559
|
this.$showAllText.classList.add(this.showAllTextClass);
|
|
452
560
|
this.$showAllButton.appendChild(this.$showAllText);
|
|
@@ -460,7 +568,7 @@
|
|
|
460
568
|
const $header = $section.querySelector(`.${this.sectionHeaderClass}`);
|
|
461
569
|
if (!$header) {
|
|
462
570
|
throw new ElementError({
|
|
463
|
-
|
|
571
|
+
component: Accordion,
|
|
464
572
|
identifier: `Section headers (\`<div class="${this.sectionHeaderClass}">\`)`
|
|
465
573
|
});
|
|
466
574
|
}
|
|
@@ -476,22 +584,22 @@
|
|
|
476
584
|
const $summary = $header.querySelector(`.${this.sectionSummaryClass}`);
|
|
477
585
|
if (!$heading) {
|
|
478
586
|
throw new ElementError({
|
|
479
|
-
|
|
587
|
+
component: Accordion,
|
|
480
588
|
identifier: `Section heading (\`.${this.sectionHeadingClass}\`)`
|
|
481
589
|
});
|
|
482
590
|
}
|
|
483
591
|
if (!$span) {
|
|
484
592
|
throw new ElementError({
|
|
485
|
-
|
|
593
|
+
component: Accordion,
|
|
486
594
|
identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
|
|
487
595
|
});
|
|
488
596
|
}
|
|
489
597
|
const $button = document.createElement('button');
|
|
490
598
|
$button.setAttribute('type', 'button');
|
|
491
|
-
$button.setAttribute('aria-controls', `${this.$
|
|
599
|
+
$button.setAttribute('aria-controls', `${this.$root.id}-content-${index + 1}`);
|
|
492
600
|
for (const attr of Array.from($span.attributes)) {
|
|
493
|
-
if (attr.
|
|
494
|
-
$button.setAttribute(attr.
|
|
601
|
+
if (attr.name !== 'id') {
|
|
602
|
+
$button.setAttribute(attr.name, attr.value);
|
|
495
603
|
}
|
|
496
604
|
}
|
|
497
605
|
const $headingText = document.createElement('span');
|
|
@@ -500,7 +608,7 @@
|
|
|
500
608
|
const $headingTextFocus = document.createElement('span');
|
|
501
609
|
$headingTextFocus.classList.add(this.sectionHeadingTextFocusClass);
|
|
502
610
|
$headingText.appendChild($headingTextFocus);
|
|
503
|
-
$
|
|
611
|
+
Array.from($span.childNodes).forEach($child => $headingTextFocus.appendChild($child));
|
|
504
612
|
const $showHideToggle = document.createElement('span');
|
|
505
613
|
$showHideToggle.classList.add(this.sectionShowHideToggleClass);
|
|
506
614
|
$showHideToggle.setAttribute('data-nosnippet', '');
|
|
@@ -515,16 +623,16 @@
|
|
|
515
623
|
$showHideToggleFocus.appendChild($showHideText);
|
|
516
624
|
$button.appendChild($headingText);
|
|
517
625
|
$button.appendChild(this.getButtonPunctuationEl());
|
|
518
|
-
if ($summary
|
|
626
|
+
if ($summary) {
|
|
519
627
|
const $summarySpan = document.createElement('span');
|
|
520
628
|
const $summarySpanFocus = document.createElement('span');
|
|
521
629
|
$summarySpanFocus.classList.add(this.sectionSummaryFocusClass);
|
|
522
630
|
$summarySpan.appendChild($summarySpanFocus);
|
|
523
631
|
for (const attr of Array.from($summary.attributes)) {
|
|
524
|
-
$summarySpan.setAttribute(attr.
|
|
632
|
+
$summarySpan.setAttribute(attr.name, attr.value);
|
|
525
633
|
}
|
|
526
|
-
$
|
|
527
|
-
$summary.
|
|
634
|
+
Array.from($summary.childNodes).forEach($child => $summarySpanFocus.appendChild($child));
|
|
635
|
+
$summary.remove();
|
|
528
636
|
$button.appendChild($summarySpan);
|
|
529
637
|
$button.appendChild(this.getButtonPunctuationEl());
|
|
530
638
|
}
|
|
@@ -543,15 +651,15 @@
|
|
|
543
651
|
}
|
|
544
652
|
}
|
|
545
653
|
onSectionToggle($section) {
|
|
546
|
-
const
|
|
547
|
-
this.setExpanded(
|
|
548
|
-
this.storeState($section);
|
|
654
|
+
const nowExpanded = !this.isExpanded($section);
|
|
655
|
+
this.setExpanded(nowExpanded, $section);
|
|
656
|
+
this.storeState($section, nowExpanded);
|
|
549
657
|
}
|
|
550
658
|
onShowOrHideAllToggle() {
|
|
551
|
-
const nowExpanded = !this.
|
|
659
|
+
const nowExpanded = !this.areAllSectionsOpen();
|
|
552
660
|
this.$sections.forEach($section => {
|
|
553
661
|
this.setExpanded(nowExpanded, $section);
|
|
554
|
-
this.storeState($section);
|
|
662
|
+
this.storeState($section, nowExpanded);
|
|
555
663
|
});
|
|
556
664
|
this.updateShowAllButton(nowExpanded);
|
|
557
665
|
}
|
|
@@ -562,7 +670,7 @@
|
|
|
562
670
|
const $content = $section.querySelector(`.${this.sectionContentClass}`);
|
|
563
671
|
if (!$content) {
|
|
564
672
|
throw new ElementError({
|
|
565
|
-
|
|
673
|
+
component: Accordion,
|
|
566
674
|
identifier: `Section content (\`<div class="${this.sectionContentClass}">\`)`
|
|
567
675
|
});
|
|
568
676
|
}
|
|
@@ -593,17 +701,13 @@
|
|
|
593
701
|
$section.classList.remove(this.sectionExpandedClass);
|
|
594
702
|
$showHideIcon.classList.add(this.downChevronIconClass);
|
|
595
703
|
}
|
|
596
|
-
|
|
597
|
-
this.updateShowAllButton(areAllSectionsOpen);
|
|
704
|
+
this.updateShowAllButton(this.areAllSectionsOpen());
|
|
598
705
|
}
|
|
599
706
|
isExpanded($section) {
|
|
600
707
|
return $section.classList.contains(this.sectionExpandedClass);
|
|
601
708
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
const expandedSectionCount = this.$module.querySelectorAll(`.${this.sectionExpandedClass}`).length;
|
|
605
|
-
const areAllSectionsOpen = sectionsCount === expandedSectionCount;
|
|
606
|
-
return areAllSectionsOpen;
|
|
709
|
+
areAllSectionsOpen() {
|
|
710
|
+
return Array.from(this.$sections).every($section => this.isExpanded($section));
|
|
607
711
|
}
|
|
608
712
|
updateShowAllButton(expanded) {
|
|
609
713
|
if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {
|
|
@@ -613,78 +717,53 @@
|
|
|
613
717
|
this.$showAllText.textContent = expanded ? this.i18n.t('hideAllSections') : this.i18n.t('showAllSections');
|
|
614
718
|
this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded);
|
|
615
719
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Get the identifier for a section
|
|
723
|
+
*
|
|
724
|
+
* We need a unique way of identifying each content in the Accordion.
|
|
725
|
+
* Since an `#id` should be unique and an `id` is required for `aria-`
|
|
726
|
+
* attributes `id` can be safely used.
|
|
727
|
+
*
|
|
728
|
+
* @param {Element} $section - Section element
|
|
729
|
+
* @returns {string | undefined | null} Identifier for section
|
|
730
|
+
*/
|
|
731
|
+
getIdentifier($section) {
|
|
732
|
+
const $button = $section.querySelector(`.${this.sectionButtonClass}`);
|
|
733
|
+
return $button == null ? void 0 : $button.getAttribute('aria-controls');
|
|
734
|
+
}
|
|
735
|
+
storeState($section, isExpanded) {
|
|
736
|
+
if (!this.config.rememberExpanded) {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const id = this.getIdentifier($section);
|
|
740
|
+
if (id) {
|
|
741
|
+
try {
|
|
742
|
+
window.sessionStorage.setItem(id, isExpanded.toString());
|
|
743
|
+
} catch (exception) {}
|
|
626
744
|
}
|
|
627
745
|
}
|
|
628
746
|
setInitialState($section) {
|
|
629
|
-
if (this.
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
747
|
+
if (!this.config.rememberExpanded) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
const id = this.getIdentifier($section);
|
|
751
|
+
if (id) {
|
|
752
|
+
try {
|
|
753
|
+
const state = window.sessionStorage.getItem(id);
|
|
754
|
+
if (state !== null) {
|
|
755
|
+
this.setExpanded(state === 'true', $section);
|
|
636
756
|
}
|
|
637
|
-
}
|
|
757
|
+
} catch (exception) {}
|
|
638
758
|
}
|
|
639
759
|
}
|
|
640
760
|
getButtonPunctuationEl() {
|
|
641
761
|
const $punctuationEl = document.createElement('span');
|
|
642
762
|
$punctuationEl.classList.add('govuk-visually-hidden', this.sectionHeadingDividerClass);
|
|
643
|
-
$punctuationEl.
|
|
763
|
+
$punctuationEl.textContent = ', ';
|
|
644
764
|
return $punctuationEl;
|
|
645
765
|
}
|
|
646
766
|
}
|
|
647
|
-
Accordion.moduleName = 'govuk-accordion';
|
|
648
|
-
Accordion.defaults = Object.freeze({
|
|
649
|
-
i18n: {
|
|
650
|
-
hideAllSections: 'Hide all sections',
|
|
651
|
-
hideSection: 'Hide',
|
|
652
|
-
hideSectionAriaLabel: 'Hide this section',
|
|
653
|
-
showAllSections: 'Show all sections',
|
|
654
|
-
showSection: 'Show',
|
|
655
|
-
showSectionAriaLabel: 'Show this section'
|
|
656
|
-
},
|
|
657
|
-
rememberExpanded: true
|
|
658
|
-
});
|
|
659
|
-
Accordion.schema = Object.freeze({
|
|
660
|
-
properties: {
|
|
661
|
-
i18n: {
|
|
662
|
-
type: 'object'
|
|
663
|
-
},
|
|
664
|
-
rememberExpanded: {
|
|
665
|
-
type: 'boolean'
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
});
|
|
669
|
-
const helper = {
|
|
670
|
-
/**
|
|
671
|
-
* Check for `window.sessionStorage`, and that it actually works.
|
|
672
|
-
*
|
|
673
|
-
* @returns {boolean} True if session storage is available
|
|
674
|
-
*/
|
|
675
|
-
checkForSessionStorage: function () {
|
|
676
|
-
const testString = 'this is the test string';
|
|
677
|
-
let result;
|
|
678
|
-
try {
|
|
679
|
-
window.sessionStorage.setItem(testString, testString);
|
|
680
|
-
result = window.sessionStorage.getItem(testString) === testString.toString();
|
|
681
|
-
window.sessionStorage.removeItem(testString);
|
|
682
|
-
return result;
|
|
683
|
-
} catch (exception) {
|
|
684
|
-
return false;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
767
|
|
|
689
768
|
/**
|
|
690
769
|
* Accordion config
|
|
@@ -720,8 +799,30 @@
|
|
|
720
799
|
*/
|
|
721
800
|
|
|
722
801
|
/**
|
|
723
|
-
* @
|
|
802
|
+
* @import { Schema } from '../../common/configuration.mjs'
|
|
724
803
|
*/
|
|
804
|
+
Accordion.moduleName = 'govuk-accordion';
|
|
805
|
+
Accordion.defaults = Object.freeze({
|
|
806
|
+
i18n: {
|
|
807
|
+
hideAllSections: 'Hide all sections',
|
|
808
|
+
hideSection: 'Hide',
|
|
809
|
+
hideSectionAriaLabel: 'Hide this section',
|
|
810
|
+
showAllSections: 'Show all sections',
|
|
811
|
+
showSection: 'Show',
|
|
812
|
+
showSectionAriaLabel: 'Show this section'
|
|
813
|
+
},
|
|
814
|
+
rememberExpanded: true
|
|
815
|
+
});
|
|
816
|
+
Accordion.schema = Object.freeze({
|
|
817
|
+
properties: {
|
|
818
|
+
i18n: {
|
|
819
|
+
type: 'object'
|
|
820
|
+
},
|
|
821
|
+
rememberExpanded: {
|
|
822
|
+
type: 'boolean'
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
});
|
|
725
826
|
|
|
726
827
|
exports.Accordion = Accordion;
|
|
727
828
|
|