defra_ruby_template 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +20 -0
- data/README.md +71 -0
- data/Rakefile +50 -0
- data/app/views/layouts/defra_ruby_template.html.erb +83 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/defra_ruby_template.gemspec +24 -0
- data/lib/defra_ruby_template.rb +23 -0
- data/lib/defra_ruby_template/version.rb +3 -0
- data/node_modules/govuk-frontend/README.md +91 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +14 -0
- data/node_modules/govuk-frontend/govuk/_base.scss +3 -0
- data/node_modules/govuk-frontend/govuk/all-ie8.scss +6 -0
- data/node_modules/govuk-frontend/govuk/all.js +2616 -0
- data/node_modules/govuk-frontend/govuk/all.scss +9 -0
- data/node_modules/govuk-frontend/govuk/assets/fonts/bold-affa96571d-v2.woff +0 -0
- data/node_modules/govuk-frontend/govuk/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
- data/node_modules/govuk-frontend/govuk/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
- data/node_modules/govuk-frontend/govuk/assets/fonts/light-f591b13f7d-v2.woff +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-apple-touch-icon.png +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-crest-2x.png +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-crest.png +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-logotype-crown.png +0 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-mask-icon.svg +7 -0
- data/node_modules/govuk-frontend/govuk/assets/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/govuk/common.js +39 -0
- data/node_modules/govuk-frontend/govuk/components/_all.scss +33 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/_accordion.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +197 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +1011 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +250 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +76 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +27 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/_back-link.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +99 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +62 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +32 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/template.njk +2 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_breadcrumbs.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +138 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +193 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +52 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/template.njk +24 -0
- data/node_modules/govuk-frontend/govuk/components/button/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/button/_button.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +288 -0
- data/node_modules/govuk-frontend/govuk/components/button/button.js +724 -0
- data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +318 -0
- data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +74 -0
- data/node_modules/govuk-frontend/govuk/components/button/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/button/template.njk +60 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/_character-count.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +25 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +1194 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +240 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +111 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +37 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_checkboxes.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +320 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +1192 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +1189 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +161 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +119 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/_cookie-banner.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +51 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +443 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +132 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/template.njk +73 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/_date-input.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/_index.scss +26 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +549 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +117 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +97 -0
- data/node_modules/govuk-frontend/govuk/components/details/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/details/_details.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/details/_index.scss +87 -0
- data/node_modules/govuk-frontend/govuk/components/details/details.js +828 -0
- data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +103 -0
- data/node_modules/govuk-frontend/govuk/components/details/implementation.md +43 -0
- data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +50 -0
- data/node_modules/govuk-frontend/govuk/components/details/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/details/template.njk +10 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/_error-message.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +11 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +77 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +38 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/template.njk +6 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/_error-summary.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/_index.scss +43 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +853 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +242 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +70 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/template.njk +25 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/_fieldset.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/_index.scss +64 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +103 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +70 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/template.njk +22 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/_file-upload.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +49 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +198 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +73 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/template.njk +44 -0
- data/node_modules/govuk-frontend/govuk/components/footer/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/footer/_footer.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +241 -0
- data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +501 -0
- data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +118 -0
- data/node_modules/govuk-frontend/govuk/components/footer/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/footer/template.njk +87 -0
- data/node_modules/govuk-frontend/govuk/components/header/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/header/_header.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +331 -0
- data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +378 -0
- data/node_modules/govuk-frontend/govuk/components/header/header.js +1066 -0
- data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +106 -0
- data/node_modules/govuk-frontend/govuk/components/header/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +79 -0
- data/node_modules/govuk-frontend/govuk/components/hint/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/hint/_hint.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +44 -0
- data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +59 -0
- data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +32 -0
- data/node_modules/govuk-frontend/govuk/components/hint/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/hint/template.njk +4 -0
- data/node_modules/govuk-frontend/govuk/components/input/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +191 -0
- data/node_modules/govuk-frontend/govuk/components/input/_input.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +628 -0
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +167 -0
- data/node_modules/govuk-frontend/govuk/components/input/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/input/template.njk +65 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/_index.scss +24 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/_inset-text.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +58 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +32 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/template.njk +4 -0
- data/node_modules/govuk-frontend/govuk/components/label/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/label/_index.scss +41 -0
- data/node_modules/govuk-frontend/govuk/components/label/_label.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +84 -0
- data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +38 -0
- data/node_modules/govuk-frontend/govuk/components/label/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/label/template.njk +15 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/_index.scss +89 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/_notification-banner.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +212 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +68 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +61 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/template.njk +47 -0
- data/node_modules/govuk-frontend/govuk/components/panel/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +44 -0
- data/node_modules/govuk-frontend/govuk/components/panel/_panel.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +91 -0
- data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +44 -0
- data/node_modules/govuk-frontend/govuk/components/panel/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/panel/template.njk +13 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/_index.scss +27 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/_phase-banner.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +76 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +33 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/template.njk +15 -0
- data/node_modules/govuk-frontend/govuk/components/radios/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +342 -0
- data/node_modules/govuk-frontend/govuk/components/radios/_radios.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +1183 -0
- data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +143 -0
- data/node_modules/govuk-frontend/govuk/components/radios/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +1148 -0
- data/node_modules/govuk-frontend/govuk/components/radios/template.njk +116 -0
- data/node_modules/govuk-frontend/govuk/components/select/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +49 -0
- data/node_modules/govuk-frontend/govuk/components/select/_select.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +327 -0
- data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +105 -0
- data/node_modules/govuk-frontend/govuk/components/select/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/select/template.njk +51 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +36 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/_skip-link.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +84 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +32 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/template.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +145 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/_summary-list.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +1084 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +113 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +47 -0
- data/node_modules/govuk-frontend/govuk/components/table/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/table/_index.scss +71 -0
- data/node_modules/govuk-frontend/govuk/components/table/_table.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +538 -0
- data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +132 -0
- data/node_modules/govuk-frontend/govuk/components/table/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/table/template.njk +45 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +130 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/_tabs.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +286 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +84 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +1347 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +32 -0
- data/node_modules/govuk-frontend/govuk/components/tag/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +86 -0
- data/node_modules/govuk-frontend/govuk/components/tag/_tag.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +131 -0
- data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +26 -0
- data/node_modules/govuk-frontend/govuk/components/tag/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/tag/template.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +47 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/_textarea.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +250 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +91 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +45 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +66 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/_warning-text.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +73 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +32 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/template.njk +9 -0
- data/node_modules/govuk-frontend/govuk/core/_all.scss +6 -0
- data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +25 -0
- data/node_modules/govuk-frontend/govuk/core/_links.scss +41 -0
- data/node_modules/govuk-frontend/govuk/core/_lists.scss +72 -0
- data/node_modules/govuk-frontend/govuk/core/_section-break.scss +62 -0
- data/node_modules/govuk-frontend/govuk/core/_template.scss +36 -0
- data/node_modules/govuk-frontend/govuk/core/_typography.scss +192 -0
- data/node_modules/govuk-frontend/govuk/helpers/_all.scss +12 -0
- data/node_modules/govuk-frontend/govuk/helpers/_clearfix.scss +15 -0
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +95 -0
- data/node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss +37 -0
- data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +28 -0
- data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +41 -0
- data/node_modules/govuk-frontend/govuk/helpers/_grid.scss +61 -0
- data/node_modules/govuk-frontend/govuk/helpers/_links.scss +427 -0
- data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +91 -0
- data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +80 -0
- data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +153 -0
- data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +207 -0
- data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +84 -0
- data/node_modules/govuk-frontend/govuk/objects/_all.scss +5 -0
- data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +101 -0
- data/node_modules/govuk-frontend/govuk/objects/_form-group.scss +23 -0
- data/node_modules/govuk-frontend/govuk/objects/_grid.scss +24 -0
- data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +68 -0
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +88 -0
- data/node_modules/govuk-frontend/govuk/overrides/_all.scss +4 -0
- data/node_modules/govuk-frontend/govuk/overrides/_display.scss +30 -0
- data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +64 -0
- data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +27 -0
- data/node_modules/govuk-frontend/govuk/overrides/_width.scss +52 -0
- data/node_modules/govuk-frontend/govuk/settings/_all.scss +23 -0
- data/node_modules/govuk-frontend/govuk/settings/_assets.scss +82 -0
- data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +155 -0
- data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +139 -0
- data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +108 -0
- data/node_modules/govuk-frontend/govuk/settings/_compatibility.scss +74 -0
- data/node_modules/govuk-frontend/govuk/settings/_global-styles.scss +13 -0
- data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +18 -0
- data/node_modules/govuk-frontend/govuk/settings/_links.scss +62 -0
- data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +105 -0
- data/node_modules/govuk-frontend/govuk/settings/_media-queries.scss +23 -0
- data/node_modules/govuk-frontend/govuk/settings/_spacing.scss +80 -0
- data/node_modules/govuk-frontend/govuk/settings/_typography-font-families.scss +32 -0
- data/node_modules/govuk-frontend/govuk/settings/_typography-font.scss +89 -0
- data/node_modules/govuk-frontend/govuk/settings/_typography-responsive.scss +183 -0
- data/node_modules/govuk-frontend/govuk/template.njk +60 -0
- data/node_modules/govuk-frontend/govuk/tools/_all.scss +8 -0
- data/node_modules/govuk-frontend/govuk/tools/_compatibility.scss +36 -0
- data/node_modules/govuk-frontend/govuk/tools/_exports.scss +33 -0
- data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +25 -0
- data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +51 -0
- data/node_modules/govuk-frontend/govuk/tools/_iff.scss +17 -0
- data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +25 -0
- data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +20 -0
- data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +20 -0
- data/node_modules/govuk-frontend/govuk/utilities/_all.scss +2 -0
- data/node_modules/govuk-frontend/govuk/utilities/_clearfix.scss +5 -0
- data/node_modules/govuk-frontend/govuk/utilities/_visually-hidden.scss +9 -0
- data/node_modules/govuk-frontend/govuk/vendor/_sass-mq.scss +347 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +272 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +34 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +147 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +589 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +54 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +31 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +254 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +254 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +504 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +252 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +94 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +28 -0
- data/node_modules/govuk-frontend/package.json +56 -0
- data/package-lock.json +13 -0
- data/package.json +29 -0
- data/vendor/assets/fonts/bold-affa96571d-v2.woff +0 -0
- data/vendor/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
- data/vendor/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
- data/vendor/assets/fonts/light-f591b13f7d-v2.woff +0 -0
- data/vendor/assets/images/favicon.ico +0 -0
- data/vendor/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
- data/vendor/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
- data/vendor/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
- data/vendor/assets/images/govuk-apple-touch-icon.png +0 -0
- data/vendor/assets/images/govuk-crest-2x.png +0 -0
- data/vendor/assets/images/govuk-crest.png +0 -0
- data/vendor/assets/images/govuk-logotype-crown.png +0 -0
- data/vendor/assets/images/govuk-mask-icon.svg +7 -0
- data/vendor/assets/images/govuk-opengraph-image.png +0 -0
- data/vendor/assets/javascripts/defra_ruby_template.js +2616 -0
- data/vendor/assets/stylesheets/_base.scss +3 -0
- data/vendor/assets/stylesheets/all-ie8.scss +6 -0
- data/vendor/assets/stylesheets/all.scss +9 -0
- data/vendor/assets/stylesheets/components/_all.scss +33 -0
- data/vendor/assets/stylesheets/components/accordion/_accordion.scss +2 -0
- data/vendor/assets/stylesheets/components/accordion/_index.scss +197 -0
- data/vendor/assets/stylesheets/components/back-link/_back-link.scss +2 -0
- data/vendor/assets/stylesheets/components/back-link/_index.scss +99 -0
- data/vendor/assets/stylesheets/components/breadcrumbs/_breadcrumbs.scss +2 -0
- data/vendor/assets/stylesheets/components/breadcrumbs/_index.scss +138 -0
- data/vendor/assets/stylesheets/components/button/_button.scss +2 -0
- data/vendor/assets/stylesheets/components/button/_index.scss +288 -0
- data/vendor/assets/stylesheets/components/character-count/_character-count.scss +2 -0
- data/vendor/assets/stylesheets/components/character-count/_index.scss +25 -0
- data/vendor/assets/stylesheets/components/checkboxes/_checkboxes.scss +2 -0
- data/vendor/assets/stylesheets/components/checkboxes/_index.scss +320 -0
- data/vendor/assets/stylesheets/components/cookie-banner/_cookie-banner.scss +2 -0
- data/vendor/assets/stylesheets/components/cookie-banner/_index.scss +51 -0
- data/vendor/assets/stylesheets/components/date-input/_date-input.scss +2 -0
- data/vendor/assets/stylesheets/components/date-input/_index.scss +26 -0
- data/vendor/assets/stylesheets/components/details/_details.scss +2 -0
- data/vendor/assets/stylesheets/components/details/_index.scss +87 -0
- data/vendor/assets/stylesheets/components/error-message/_error-message.scss +2 -0
- data/vendor/assets/stylesheets/components/error-message/_index.scss +11 -0
- data/vendor/assets/stylesheets/components/error-summary/_error-summary.scss +2 -0
- data/vendor/assets/stylesheets/components/error-summary/_index.scss +43 -0
- data/vendor/assets/stylesheets/components/fieldset/_fieldset.scss +2 -0
- data/vendor/assets/stylesheets/components/fieldset/_index.scss +64 -0
- data/vendor/assets/stylesheets/components/file-upload/_file-upload.scss +2 -0
- data/vendor/assets/stylesheets/components/file-upload/_index.scss +49 -0
- data/vendor/assets/stylesheets/components/footer/_footer.scss +2 -0
- data/vendor/assets/stylesheets/components/footer/_index.scss +241 -0
- data/vendor/assets/stylesheets/components/header/_header.scss +2 -0
- data/vendor/assets/stylesheets/components/header/_index.scss +331 -0
- data/vendor/assets/stylesheets/components/hint/_hint.scss +2 -0
- data/vendor/assets/stylesheets/components/hint/_index.scss +44 -0
- data/vendor/assets/stylesheets/components/input/_index.scss +191 -0
- data/vendor/assets/stylesheets/components/input/_input.scss +2 -0
- data/vendor/assets/stylesheets/components/inset-text/_index.scss +24 -0
- data/vendor/assets/stylesheets/components/inset-text/_inset-text.scss +2 -0
- data/vendor/assets/stylesheets/components/label/_index.scss +41 -0
- data/vendor/assets/stylesheets/components/label/_label.scss +2 -0
- data/vendor/assets/stylesheets/components/notification-banner/_index.scss +89 -0
- data/vendor/assets/stylesheets/components/notification-banner/_notification-banner.scss +2 -0
- data/vendor/assets/stylesheets/components/panel/_index.scss +44 -0
- data/vendor/assets/stylesheets/components/panel/_panel.scss +2 -0
- data/vendor/assets/stylesheets/components/phase-banner/_index.scss +27 -0
- data/vendor/assets/stylesheets/components/phase-banner/_phase-banner.scss +2 -0
- data/vendor/assets/stylesheets/components/radios/_index.scss +342 -0
- data/vendor/assets/stylesheets/components/radios/_radios.scss +2 -0
- data/vendor/assets/stylesheets/components/select/_index.scss +49 -0
- data/vendor/assets/stylesheets/components/select/_select.scss +2 -0
- data/vendor/assets/stylesheets/components/skip-link/_index.scss +36 -0
- data/vendor/assets/stylesheets/components/skip-link/_skip-link.scss +2 -0
- data/vendor/assets/stylesheets/components/summary-list/_index.scss +145 -0
- data/vendor/assets/stylesheets/components/summary-list/_summary-list.scss +2 -0
- data/vendor/assets/stylesheets/components/table/_index.scss +71 -0
- data/vendor/assets/stylesheets/components/table/_table.scss +2 -0
- data/vendor/assets/stylesheets/components/tabs/_index.scss +130 -0
- data/vendor/assets/stylesheets/components/tabs/_tabs.scss +2 -0
- data/vendor/assets/stylesheets/components/tag/_index.scss +86 -0
- data/vendor/assets/stylesheets/components/tag/_tag.scss +2 -0
- data/vendor/assets/stylesheets/components/textarea/_index.scss +47 -0
- data/vendor/assets/stylesheets/components/textarea/_textarea.scss +2 -0
- data/vendor/assets/stylesheets/components/warning-text/_index.scss +66 -0
- data/vendor/assets/stylesheets/components/warning-text/_warning-text.scss +2 -0
- data/vendor/assets/stylesheets/core/_all.scss +6 -0
- data/vendor/assets/stylesheets/core/_global-styles.scss +25 -0
- data/vendor/assets/stylesheets/core/_links.scss +41 -0
- data/vendor/assets/stylesheets/core/_lists.scss +72 -0
- data/vendor/assets/stylesheets/core/_section-break.scss +62 -0
- data/vendor/assets/stylesheets/core/_template.scss +36 -0
- data/vendor/assets/stylesheets/core/_typography.scss +192 -0
- data/vendor/assets/stylesheets/defra_ruby_template.scss +16 -0
- data/vendor/assets/stylesheets/helpers/_all.scss +12 -0
- data/vendor/assets/stylesheets/helpers/_clearfix.scss +15 -0
- data/vendor/assets/stylesheets/helpers/_colour.scss +95 -0
- data/vendor/assets/stylesheets/helpers/_device-pixels.scss +37 -0
- data/vendor/assets/stylesheets/helpers/_focused.scss +28 -0
- data/vendor/assets/stylesheets/helpers/_font-faces.scss +41 -0
- data/vendor/assets/stylesheets/helpers/_grid.scss +61 -0
- data/vendor/assets/stylesheets/helpers/_links.scss +427 -0
- data/vendor/assets/stylesheets/helpers/_media-queries.scss +91 -0
- data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +80 -0
- data/vendor/assets/stylesheets/helpers/_spacing.scss +153 -0
- data/vendor/assets/stylesheets/helpers/_typography.scss +207 -0
- data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +84 -0
- data/vendor/assets/stylesheets/objects/_all.scss +5 -0
- data/vendor/assets/stylesheets/objects/_button-group.scss +101 -0
- data/vendor/assets/stylesheets/objects/_form-group.scss +23 -0
- data/vendor/assets/stylesheets/objects/_grid.scss +24 -0
- data/vendor/assets/stylesheets/objects/_main-wrapper.scss +68 -0
- data/vendor/assets/stylesheets/objects/_width-container.scss +88 -0
- data/vendor/assets/stylesheets/overrides/_all.scss +4 -0
- data/vendor/assets/stylesheets/overrides/_display.scss +30 -0
- data/vendor/assets/stylesheets/overrides/_spacing.scss +64 -0
- data/vendor/assets/stylesheets/overrides/_typography.scss +27 -0
- data/vendor/assets/stylesheets/overrides/_width.scss +52 -0
- data/vendor/assets/stylesheets/settings/_all.scss +23 -0
- data/vendor/assets/stylesheets/settings/_assets.scss +82 -0
- data/vendor/assets/stylesheets/settings/_colours-applied.scss +155 -0
- data/vendor/assets/stylesheets/settings/_colours-organisations.scss +139 -0
- data/vendor/assets/stylesheets/settings/_colours-palette.scss +108 -0
- data/vendor/assets/stylesheets/settings/_compatibility.scss +74 -0
- data/vendor/assets/stylesheets/settings/_global-styles.scss +13 -0
- data/vendor/assets/stylesheets/settings/_ie8.scss +18 -0
- data/vendor/assets/stylesheets/settings/_links.scss +62 -0
- data/vendor/assets/stylesheets/settings/_measurements.scss +105 -0
- data/vendor/assets/stylesheets/settings/_media-queries.scss +23 -0
- data/vendor/assets/stylesheets/settings/_spacing.scss +80 -0
- data/vendor/assets/stylesheets/settings/_typography-font-families.scss +32 -0
- data/vendor/assets/stylesheets/settings/_typography-font.scss +89 -0
- data/vendor/assets/stylesheets/settings/_typography-responsive.scss +183 -0
- data/vendor/assets/stylesheets/tools/_all.scss +8 -0
- data/vendor/assets/stylesheets/tools/_compatibility.scss +36 -0
- data/vendor/assets/stylesheets/tools/_exports.scss +33 -0
- data/vendor/assets/stylesheets/tools/_font-url.scss +25 -0
- data/vendor/assets/stylesheets/tools/_ie8.scss +51 -0
- data/vendor/assets/stylesheets/tools/_iff.scss +17 -0
- data/vendor/assets/stylesheets/tools/_image-url.scss +25 -0
- data/vendor/assets/stylesheets/tools/_px-to-em.scss +20 -0
- data/vendor/assets/stylesheets/tools/_px-to-rem.scss +20 -0
- data/vendor/assets/stylesheets/utilities/_all.scss +2 -0
- data/vendor/assets/stylesheets/utilities/_clearfix.scss +5 -0
- data/vendor/assets/stylesheets/utilities/_visually-hidden.scss +9 -0
- data/vendor/assets/stylesheets/vendor/_sass-mq.scss +347 -0
- metadata +520 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="132" height="97" viewBox="0 0 132 97" version="1.1">
|
2
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
3
|
+
<g fill="#000000">
|
4
|
+
<path d="M25 30.2C28.5 31.7 32.7 30 34.1 26.5 35.6 22.9 33.9 18.7 30.2 17.3 26.6 15.9 22.6 17.6 21.1 21.2 19.7 24.7 21.4 28.7 25 30.2L25 30.2ZM9 39.5C12.6 41 16.8 39.3 18.2 35.8 19.7 32.2 18 28 14.3 26.7 10.7 25.2 6.7 26.9 5.2 30.5 3.8 34 5.5 38 9 39.5L9 39.5ZM4.4 57.2C7.9 58.7 12.1 57 13.5 53.4 15 49.8 13.3 45.7 9.6 44.3 6.1 42.8 2 44.6 0.5 48.1 -0.9 51.6 0.8 55.7 4.4 57.2L4.4 57.2ZM42.7 35.8C46.2 37.3 50.4 35.6 51.8 32 53.3 28.4 51.6 24.3 47.9 22.9 44.3 21.4 40.3 23.2 38.8 26.7 37.5 30.3 39.2 34.4 42.7 35.8L42.7 35.8ZM107.1 30.2C103.5 31.7 99.3 30 98 26.5 96.5 22.9 98.2 18.7 101.8 17.3 105.4 15.9 109.5 17.6 111 21.2 112.3 24.7 110.6 28.7 107.1 30.2L107.1 30.2ZM123 39.5C119.4 41 115.3 39.3 113.9 35.8 112.4 32.2 114.1 28 117.6 26.7 121.2 25.2 125.3 26.9 126.8 30.5 128.3 34 126.5 38 123 39.5L123 39.5ZM127.7 57.2C124.1 58.7 119.9 57 118.5 53.4 117 49.8 118.7 45.7 122.4 44.3 126 42.8 130.1 44.6 131.6 48.1 132.9 51.6 131.2 55.7 127.7 57.2L127.7 57.2ZM89.3 35.8C85.7 37.3 81.5 35.6 80.1 32 78.7 28.4 80.3 24.3 84 22.9 87.6 21.4 91.7 23.2 93.2 26.7 94.6 30.3 92.9 34.4 89.3 35.8L89.3 35.8ZM69.7 17.7L69.7 17.7 78.6 22.4 78.6 9.3 69.7 12.1 69.7 12.1C69.5 11.8 69.2 11.5 68.8 11.2L68.8 11.2 72.4 0 66 0 59.6 0 63.1 11.2 63.1 11.2C62.8 11.5 62.5 11.7 62.2 12.1L62.2 12.1 53.4 9.3 53.4 22.4 62.2 17.7 62.2 17.7C62.5 18 62.8 18.4 63.1 18.6L58.1 34C58.1 34 58.1 34 58.1 34.1L58.1 34.1 58.1 34.1C57.9 34.9 57.7 35.7 57.7 36.5 57.7 40.6 60.8 44 64.7 44.6L64.9 44.6C65.2 44.6 65.6 44.7 65.9 44.7 66.3 44.7 66.6 44.7 66.9 44.6L67.1 44.6C71.1 44 74.2 40.5 74.2 36.5 74.2 35.7 74.1 34.8 73.8 34.1L73.8 34.1 73.8 34.1C73.8 34.1 73.8 34.1 73.8 34L68.7 18.6C69.1 18.4 69.4 18 69.7 17.7L69.7 17.7ZM66 92.8C82.9 92.8 98.8 93.9 113.1 96 117.1 79.1 122 69.3 127.1 62.5L117.5 59.1C118.5 64 118.6 66.3 117.5 69.3 116 67.9 114.5 65 113.3 60.6L108.6 76C111.4 74 113.6 72.8 116.1 72.7 111.7 82.1 106.1 84.6 102.5 83.9 98.2 83.1 96.2 79.3 96.9 76 97.9 71.3 102.6 70.1 104.9 75.5 109.2 66.8 101.9 64.1 97.3 66.7 104.4 59.5 105.2 53.2 99.4 45.6 91.4 51.7 91.3 57.9 94.9 66.4 90.2 61 82.8 63.9 85.4 72.6 88.8 67.4 93.3 70.6 92.6 75.7 92 80 86.2 83.5 79.1 82.9 68.8 82 68.2 74.9 67.9 69.1 70.4 68.6 75 70.9 78.9 76.4L80.2 60C76.1 64.4 72.2 65.3 67.9 65.4 69.3 61 75.9 53.8 75.9 53.8L66.4 53.8 66.4 53.8 66.4 53.8 55.5 53.8C55.5 53.8 61.9 61 63.4 65.4 59.2 65.3 55.4 64.4 51.1 60L52.5 76.4C56.4 70.9 61 68.7 63.4 69.1 63.1 74.9 62.5 81.9 52.3 82.9 45.1 83.5 39.4 80 38.8 75.7 38.1 70.7 42.6 67.4 45.9 72.6 48.6 63.9 41.3 61 36.5 66.4 40.2 57.9 40.1 51.7 31.9 45.6 26.1 53.2 26.9 59.5 34.1 66.7 29.4 64.1 22.2 66.8 26.4 75.5 28.7 70 33.5 71.3 34.5 76 35.2 79.3 33.2 83.1 28.8 83.9 25.3 84.6 19.8 82.1 15.3 72.7 17.8 72.8 20 74 22.8 76L18.1 60.6C16.9 65 15.4 67.8 13.8 69.3 12.7 66.3 12.9 64 13.8 59.1L4.3 62.5C9.3 69.4 14.2 79.2 18.3 96 33.1 93.9 49.1 92.8 66 92.8L66 92.8Z"/>
|
5
|
+
</g>
|
6
|
+
</g>
|
7
|
+
</svg>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
|
+
typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
|
4
|
+
(factory((global.GOVUKFrontend = {})));
|
5
|
+
}(this, (function (exports) { 'use strict';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* TODO: Ideally this would be a NodeList.prototype.forEach polyfill
|
9
|
+
* This seems to fail in IE8, requires more investigation.
|
10
|
+
* See: https://github.com/imagitama/nodelist-foreach-polyfill
|
11
|
+
*/
|
12
|
+
function nodeListForEach (nodes, callback) {
|
13
|
+
if (window.NodeList.prototype.forEach) {
|
14
|
+
return nodes.forEach(callback)
|
15
|
+
}
|
16
|
+
for (var i = 0; i < nodes.length; i++) {
|
17
|
+
callback.call(window, nodes[i], i, nodes);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
// Used to generate a unique string, allows multiple instances of the component without
|
22
|
+
// Them conflicting with each other.
|
23
|
+
// https://stackoverflow.com/a/8809472
|
24
|
+
function generateUniqueID () {
|
25
|
+
var d = new Date().getTime();
|
26
|
+
if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
|
27
|
+
d += window.performance.now(); // use high-precision timer if available
|
28
|
+
}
|
29
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
30
|
+
var r = (d + Math.random() * 16) % 16 | 0;
|
31
|
+
d = Math.floor(d / 16);
|
32
|
+
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
|
33
|
+
})
|
34
|
+
}
|
35
|
+
|
36
|
+
exports.nodeListForEach = nodeListForEach;
|
37
|
+
exports.generateUniqueID = generateUniqueID;
|
38
|
+
|
39
|
+
})));
|
@@ -0,0 +1,33 @@
|
|
1
|
+
@import "../base";
|
2
|
+
|
3
|
+
@import "accordion/index";
|
4
|
+
@import "back-link/index";
|
5
|
+
@import "breadcrumbs/index";
|
6
|
+
@import "button/index";
|
7
|
+
@import "checkboxes/index";
|
8
|
+
@import "character-count/index";
|
9
|
+
@import "cookie-banner/index";
|
10
|
+
@import "summary-list/index";
|
11
|
+
@import "date-input/index";
|
12
|
+
@import "details/index";
|
13
|
+
@import "error-message/index";
|
14
|
+
@import "error-summary/index";
|
15
|
+
@import "fieldset/index";
|
16
|
+
@import "file-upload/index";
|
17
|
+
@import "footer/index";
|
18
|
+
@import "hint/index";
|
19
|
+
@import "header/index";
|
20
|
+
@import "input/index";
|
21
|
+
@import "inset-text/index";
|
22
|
+
@import "label/index";
|
23
|
+
@import "notification-banner/index";
|
24
|
+
@import "panel/index";
|
25
|
+
@import "phase-banner/index";
|
26
|
+
@import "tabs/index";
|
27
|
+
@import "tag/index";
|
28
|
+
@import "radios/index";
|
29
|
+
@import "select/index";
|
30
|
+
@import "skip-link/index";
|
31
|
+
@import "table/index";
|
32
|
+
@import "textarea/index";
|
33
|
+
@import "warning-text/index";
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Accordion
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
See the [main README quick start guide](https://github.com/alphagov/govuk-frontend#quick-start) for how to install this component.
|
6
|
+
|
7
|
+
## Guidance and Examples
|
8
|
+
|
9
|
+
Find out when to use the accordion component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/accordion).
|
10
|
+
|
11
|
+
## Component options
|
12
|
+
|
13
|
+
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
14
|
+
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/accordion/#options-accordion-example) for details.
|
@@ -0,0 +1,197 @@
|
|
1
|
+
@include govuk-exports("govuk/component/accordion") {
|
2
|
+
.govuk-accordion {
|
3
|
+
@include govuk-responsive-margin(6, "bottom");
|
4
|
+
}
|
5
|
+
|
6
|
+
// Borders between accordion sections
|
7
|
+
.govuk-accordion__section {
|
8
|
+
padding-top: govuk-spacing(3);
|
9
|
+
}
|
10
|
+
|
11
|
+
.govuk-accordion__section-header {
|
12
|
+
padding-top: govuk-spacing(3);
|
13
|
+
padding-bottom: govuk-spacing(3);
|
14
|
+
}
|
15
|
+
|
16
|
+
.govuk-accordion__section-heading {
|
17
|
+
// Override browser defaults to ensure consistent element height
|
18
|
+
// Font size is set in .govuk-accordion__section-button
|
19
|
+
@include govuk-font(24);
|
20
|
+
|
21
|
+
margin-top: 0; // Override browser default
|
22
|
+
margin-bottom: 0; // Override browser default
|
23
|
+
}
|
24
|
+
|
25
|
+
// Buttons within the sections don’t need default styling
|
26
|
+
.govuk-accordion__section-button {
|
27
|
+
@include govuk-font($size: 24, $weight: bold);
|
28
|
+
display: inline-block;
|
29
|
+
margin-bottom: 0;
|
30
|
+
padding-top: govuk-spacing(3);
|
31
|
+
}
|
32
|
+
|
33
|
+
.govuk-accordion__section-summary {
|
34
|
+
margin-top: govuk-spacing(2);
|
35
|
+
margin-bottom: 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Remove the bottom margin from the last item inside the content
|
39
|
+
.govuk-accordion__section-content > :last-child {
|
40
|
+
margin-bottom: 0;
|
41
|
+
}
|
42
|
+
|
43
|
+
// JavaScript enabled
|
44
|
+
.js-enabled {
|
45
|
+
.govuk-accordion {
|
46
|
+
// Border at the bottom of the whole accordion
|
47
|
+
border-bottom: 1px solid $govuk-border-colour;
|
48
|
+
}
|
49
|
+
|
50
|
+
// Borders between accordion sections
|
51
|
+
.govuk-accordion__section {
|
52
|
+
padding-top: 0;
|
53
|
+
}
|
54
|
+
|
55
|
+
// Hide the body of collapsed sections
|
56
|
+
.govuk-accordion__section-content {
|
57
|
+
display: none;
|
58
|
+
@include govuk-responsive-padding(3, "top");
|
59
|
+
@include govuk-responsive-padding(3, "bottom");
|
60
|
+
}
|
61
|
+
|
62
|
+
// Show the body of expanded sections
|
63
|
+
.govuk-accordion__section--expanded .govuk-accordion__section-content {
|
64
|
+
display: block;
|
65
|
+
}
|
66
|
+
|
67
|
+
// This is styled to look like a link not a button
|
68
|
+
.govuk-accordion__open-all {
|
69
|
+
@include govuk-font($size: 16);
|
70
|
+
position: relative;
|
71
|
+
z-index: 1;
|
72
|
+
margin: 0;
|
73
|
+
padding: 0;
|
74
|
+
border-width: 0;
|
75
|
+
color: $govuk-link-colour;
|
76
|
+
background: none;
|
77
|
+
cursor: pointer;
|
78
|
+
-webkit-appearance: none;
|
79
|
+
|
80
|
+
@include govuk-link-common;
|
81
|
+
@include govuk-link-style-default;
|
82
|
+
|
83
|
+
// Remove default button focus outline in Firefox
|
84
|
+
&::-moz-focus-inner {
|
85
|
+
padding: 0;
|
86
|
+
border: 0;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
// Section headers have a pointer cursor as an additional affordance
|
91
|
+
.govuk-accordion__section-header {
|
92
|
+
position: relative;
|
93
|
+
// Safe area on the right to avoid clashing with icon
|
94
|
+
padding-right: 40px;
|
95
|
+
border-top: 1px solid $govuk-border-colour;
|
96
|
+
cursor: pointer;
|
97
|
+
}
|
98
|
+
|
99
|
+
// Buttons within the headers don’t need default styling
|
100
|
+
.govuk-accordion__section-button {
|
101
|
+
@include govuk-typography-common;
|
102
|
+
margin-top: 0;
|
103
|
+
margin-bottom: 0;
|
104
|
+
margin-left: 0;
|
105
|
+
padding: 0;
|
106
|
+
border-width: 0;
|
107
|
+
color: $govuk-link-colour;
|
108
|
+
background: none;
|
109
|
+
text-align: left;
|
110
|
+
cursor: pointer;
|
111
|
+
-webkit-appearance: none;
|
112
|
+
|
113
|
+
&:focus {
|
114
|
+
@include govuk-focused-text;
|
115
|
+
}
|
116
|
+
|
117
|
+
// Remove default button focus outline in Firefox
|
118
|
+
&::-moz-focus-inner {
|
119
|
+
padding: 0;
|
120
|
+
border: 0;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
// Extend the touch area of the button to span the section header
|
125
|
+
.govuk-accordion__section-button:after {
|
126
|
+
content: "";
|
127
|
+
position: absolute;
|
128
|
+
top: 0;
|
129
|
+
right: 0;
|
130
|
+
bottom: 0;
|
131
|
+
left: 0;
|
132
|
+
}
|
133
|
+
|
134
|
+
.govuk-accordion__section-button:hover:not(:focus) {
|
135
|
+
color: $govuk-link-hover-colour;
|
136
|
+
text-decoration: underline;
|
137
|
+
|
138
|
+
// This needs to come after the text-decoration property otherwise
|
139
|
+
// text-decoration, as a shorthand property, resets it to auto
|
140
|
+
@include govuk-link-hover-decoration;
|
141
|
+
text-underline-offset: $govuk-link-underline-offset;
|
142
|
+
}
|
143
|
+
|
144
|
+
// For devices that can't hover such as touch devices,
|
145
|
+
// remove hover state as it can be stuck in that state (iOS).
|
146
|
+
@media (hover: none) {
|
147
|
+
.govuk-accordion__section-button:hover {
|
148
|
+
text-decoration: none;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
.govuk-accordion__controls {
|
153
|
+
text-align: right;
|
154
|
+
}
|
155
|
+
|
156
|
+
// Display an icon to the right of each header to indicate open/closed status,
|
157
|
+
// and as an additional affordance.
|
158
|
+
.govuk-accordion__icon {
|
159
|
+
position: absolute;
|
160
|
+
top: 50%;
|
161
|
+
right: 15px;
|
162
|
+
width: 16px;
|
163
|
+
height: 16px;
|
164
|
+
margin-top: -8px;
|
165
|
+
}
|
166
|
+
|
167
|
+
.govuk-accordion__icon:after,
|
168
|
+
.govuk-accordion__icon:before {
|
169
|
+
content: "";
|
170
|
+
box-sizing: border-box;
|
171
|
+
position: absolute;
|
172
|
+
top: 0;
|
173
|
+
right: 0;
|
174
|
+
bottom: 0;
|
175
|
+
left: 0;
|
176
|
+
width: 25%;
|
177
|
+
height: 25%;
|
178
|
+
margin: auto;
|
179
|
+
border: 2px solid transparent;
|
180
|
+
background-color: govuk-colour("black");
|
181
|
+
}
|
182
|
+
|
183
|
+
.govuk-accordion__icon:before {
|
184
|
+
width: 100%;
|
185
|
+
}
|
186
|
+
|
187
|
+
.govuk-accordion__icon:after {
|
188
|
+
height: 100%;
|
189
|
+
}
|
190
|
+
|
191
|
+
// Vertical bar should be hidden when section is open, to display a '-' icon
|
192
|
+
.govuk-accordion__section--expanded .govuk-accordion__icon:after {
|
193
|
+
content: " ";
|
194
|
+
display: none;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
@@ -0,0 +1,1011 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3
|
+
typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
|
4
|
+
(global.GOVUKFrontend = factory());
|
5
|
+
}(this, (function () { 'use strict';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* TODO: Ideally this would be a NodeList.prototype.forEach polyfill
|
9
|
+
* This seems to fail in IE8, requires more investigation.
|
10
|
+
* See: https://github.com/imagitama/nodelist-foreach-polyfill
|
11
|
+
*/
|
12
|
+
function nodeListForEach (nodes, callback) {
|
13
|
+
if (window.NodeList.prototype.forEach) {
|
14
|
+
return nodes.forEach(callback)
|
15
|
+
}
|
16
|
+
for (var i = 0; i < nodes.length; i++) {
|
17
|
+
callback.call(window, nodes[i], i, nodes);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
(function(undefined) {
|
22
|
+
|
23
|
+
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
|
24
|
+
var detect = (
|
25
|
+
// In IE8, defineProperty could only act on DOM elements, so full support
|
26
|
+
// for the feature requires the ability to set a property on an arbitrary object
|
27
|
+
'defineProperty' in Object && (function() {
|
28
|
+
try {
|
29
|
+
var a = {};
|
30
|
+
Object.defineProperty(a, 'test', {value:42});
|
31
|
+
return true;
|
32
|
+
} catch(e) {
|
33
|
+
return false
|
34
|
+
}
|
35
|
+
}())
|
36
|
+
);
|
37
|
+
|
38
|
+
if (detect) return
|
39
|
+
|
40
|
+
// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
|
41
|
+
(function (nativeDefineProperty) {
|
42
|
+
|
43
|
+
var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
|
44
|
+
var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
|
45
|
+
var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
|
46
|
+
|
47
|
+
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
48
|
+
|
49
|
+
// Where native support exists, assume it
|
50
|
+
if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
|
51
|
+
return nativeDefineProperty(object, property, descriptor);
|
52
|
+
}
|
53
|
+
|
54
|
+
if (object === null || !(object instanceof Object || typeof object === 'object')) {
|
55
|
+
throw new TypeError('Object.defineProperty called on non-object');
|
56
|
+
}
|
57
|
+
|
58
|
+
if (!(descriptor instanceof Object)) {
|
59
|
+
throw new TypeError('Property description must be an object');
|
60
|
+
}
|
61
|
+
|
62
|
+
var propertyString = String(property);
|
63
|
+
var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
|
64
|
+
var getterType = 'get' in descriptor && typeof descriptor.get;
|
65
|
+
var setterType = 'set' in descriptor && typeof descriptor.set;
|
66
|
+
|
67
|
+
// handle descriptor.get
|
68
|
+
if (getterType) {
|
69
|
+
if (getterType !== 'function') {
|
70
|
+
throw new TypeError('Getter must be a function');
|
71
|
+
}
|
72
|
+
if (!supportsAccessors) {
|
73
|
+
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
74
|
+
}
|
75
|
+
if (hasValueOrWritable) {
|
76
|
+
throw new TypeError(ERR_VALUE_ACCESSORS);
|
77
|
+
}
|
78
|
+
Object.__defineGetter__.call(object, propertyString, descriptor.get);
|
79
|
+
} else {
|
80
|
+
object[propertyString] = descriptor.value;
|
81
|
+
}
|
82
|
+
|
83
|
+
// handle descriptor.set
|
84
|
+
if (setterType) {
|
85
|
+
if (setterType !== 'function') {
|
86
|
+
throw new TypeError('Setter must be a function');
|
87
|
+
}
|
88
|
+
if (!supportsAccessors) {
|
89
|
+
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
90
|
+
}
|
91
|
+
if (hasValueOrWritable) {
|
92
|
+
throw new TypeError(ERR_VALUE_ACCESSORS);
|
93
|
+
}
|
94
|
+
Object.__defineSetter__.call(object, propertyString, descriptor.set);
|
95
|
+
}
|
96
|
+
|
97
|
+
// OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
|
98
|
+
if ('value' in descriptor) {
|
99
|
+
object[propertyString] = descriptor.value;
|
100
|
+
}
|
101
|
+
|
102
|
+
return object;
|
103
|
+
};
|
104
|
+
}(Object.defineProperty));
|
105
|
+
})
|
106
|
+
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
107
|
+
|
108
|
+
(function(undefined) {
|
109
|
+
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Function/prototype/bind/detect.js
|
110
|
+
var detect = 'bind' in Function.prototype;
|
111
|
+
|
112
|
+
if (detect) return
|
113
|
+
|
114
|
+
// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Function.prototype.bind&flags=always
|
115
|
+
Object.defineProperty(Function.prototype, 'bind', {
|
116
|
+
value: function bind(that) { // .length is 1
|
117
|
+
// add necessary es5-shim utilities
|
118
|
+
var $Array = Array;
|
119
|
+
var $Object = Object;
|
120
|
+
var ObjectPrototype = $Object.prototype;
|
121
|
+
var ArrayPrototype = $Array.prototype;
|
122
|
+
var Empty = function Empty() {};
|
123
|
+
var to_string = ObjectPrototype.toString;
|
124
|
+
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
125
|
+
var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, tryFunctionObject = function tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value !== 'function') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; };
|
126
|
+
var array_slice = ArrayPrototype.slice;
|
127
|
+
var array_concat = ArrayPrototype.concat;
|
128
|
+
var array_push = ArrayPrototype.push;
|
129
|
+
var max = Math.max;
|
130
|
+
// /add necessary es5-shim utilities
|
131
|
+
|
132
|
+
// 1. Let Target be the this value.
|
133
|
+
var target = this;
|
134
|
+
// 2. If IsCallable(Target) is false, throw a TypeError exception.
|
135
|
+
if (!isCallable(target)) {
|
136
|
+
throw new TypeError('Function.prototype.bind called on incompatible ' + target);
|
137
|
+
}
|
138
|
+
// 3. Let A be a new (possibly empty) internal list of all of the
|
139
|
+
// argument values provided after thisArg (arg1, arg2 etc), in order.
|
140
|
+
// XXX slicedArgs will stand in for "A" if used
|
141
|
+
var args = array_slice.call(arguments, 1); // for normal call
|
142
|
+
// 4. Let F be a new native ECMAScript object.
|
143
|
+
// 11. Set the [[Prototype]] internal property of F to the standard
|
144
|
+
// built-in Function prototype object as specified in 15.3.3.1.
|
145
|
+
// 12. Set the [[Call]] internal property of F as described in
|
146
|
+
// 15.3.4.5.1.
|
147
|
+
// 13. Set the [[Construct]] internal property of F as described in
|
148
|
+
// 15.3.4.5.2.
|
149
|
+
// 14. Set the [[HasInstance]] internal property of F as described in
|
150
|
+
// 15.3.4.5.3.
|
151
|
+
var bound;
|
152
|
+
var binder = function () {
|
153
|
+
|
154
|
+
if (this instanceof bound) {
|
155
|
+
// 15.3.4.5.2 [[Construct]]
|
156
|
+
// When the [[Construct]] internal method of a function object,
|
157
|
+
// F that was created using the bind function is called with a
|
158
|
+
// list of arguments ExtraArgs, the following steps are taken:
|
159
|
+
// 1. Let target be the value of F's [[TargetFunction]]
|
160
|
+
// internal property.
|
161
|
+
// 2. If target has no [[Construct]] internal method, a
|
162
|
+
// TypeError exception is thrown.
|
163
|
+
// 3. Let boundArgs be the value of F's [[BoundArgs]] internal
|
164
|
+
// property.
|
165
|
+
// 4. Let args be a new list containing the same values as the
|
166
|
+
// list boundArgs in the same order followed by the same
|
167
|
+
// values as the list ExtraArgs in the same order.
|
168
|
+
// 5. Return the result of calling the [[Construct]] internal
|
169
|
+
// method of target providing args as the arguments.
|
170
|
+
|
171
|
+
var result = target.apply(
|
172
|
+
this,
|
173
|
+
array_concat.call(args, array_slice.call(arguments))
|
174
|
+
);
|
175
|
+
if ($Object(result) === result) {
|
176
|
+
return result;
|
177
|
+
}
|
178
|
+
return this;
|
179
|
+
|
180
|
+
} else {
|
181
|
+
// 15.3.4.5.1 [[Call]]
|
182
|
+
// When the [[Call]] internal method of a function object, F,
|
183
|
+
// which was created using the bind function is called with a
|
184
|
+
// this value and a list of arguments ExtraArgs, the following
|
185
|
+
// steps are taken:
|
186
|
+
// 1. Let boundArgs be the value of F's [[BoundArgs]] internal
|
187
|
+
// property.
|
188
|
+
// 2. Let boundThis be the value of F's [[BoundThis]] internal
|
189
|
+
// property.
|
190
|
+
// 3. Let target be the value of F's [[TargetFunction]] internal
|
191
|
+
// property.
|
192
|
+
// 4. Let args be a new list containing the same values as the
|
193
|
+
// list boundArgs in the same order followed by the same
|
194
|
+
// values as the list ExtraArgs in the same order.
|
195
|
+
// 5. Return the result of calling the [[Call]] internal method
|
196
|
+
// of target providing boundThis as the this value and
|
197
|
+
// providing args as the arguments.
|
198
|
+
|
199
|
+
// equiv: target.call(this, ...boundArgs, ...args)
|
200
|
+
return target.apply(
|
201
|
+
that,
|
202
|
+
array_concat.call(args, array_slice.call(arguments))
|
203
|
+
);
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
};
|
208
|
+
|
209
|
+
// 15. If the [[Class]] internal property of Target is "Function", then
|
210
|
+
// a. Let L be the length property of Target minus the length of A.
|
211
|
+
// b. Set the length own property of F to either 0 or L, whichever is
|
212
|
+
// larger.
|
213
|
+
// 16. Else set the length own property of F to 0.
|
214
|
+
|
215
|
+
var boundLength = max(0, target.length - args.length);
|
216
|
+
|
217
|
+
// 17. Set the attributes of the length own property of F to the values
|
218
|
+
// specified in 15.3.5.1.
|
219
|
+
var boundArgs = [];
|
220
|
+
for (var i = 0; i < boundLength; i++) {
|
221
|
+
array_push.call(boundArgs, '$' + i);
|
222
|
+
}
|
223
|
+
|
224
|
+
// XXX Build a dynamic function with desired amount of arguments is the only
|
225
|
+
// way to set the length property of a function.
|
226
|
+
// In environments where Content Security Policies enabled (Chrome extensions,
|
227
|
+
// for ex.) all use of eval or Function costructor throws an exception.
|
228
|
+
// However in all of these environments Function.prototype.bind exists
|
229
|
+
// and so this code will never be executed.
|
230
|
+
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
|
231
|
+
|
232
|
+
if (target.prototype) {
|
233
|
+
Empty.prototype = target.prototype;
|
234
|
+
bound.prototype = new Empty();
|
235
|
+
// Clean up dangling references.
|
236
|
+
Empty.prototype = null;
|
237
|
+
}
|
238
|
+
|
239
|
+
// TODO
|
240
|
+
// 18. Set the [[Extensible]] internal property of F to true.
|
241
|
+
|
242
|
+
// TODO
|
243
|
+
// 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
|
244
|
+
// 20. Call the [[DefineOwnProperty]] internal method of F with
|
245
|
+
// arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
|
246
|
+
// thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
|
247
|
+
// false.
|
248
|
+
// 21. Call the [[DefineOwnProperty]] internal method of F with
|
249
|
+
// arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
|
250
|
+
// [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
|
251
|
+
// and false.
|
252
|
+
|
253
|
+
// TODO
|
254
|
+
// NOTE Function objects created using Function.prototype.bind do not
|
255
|
+
// have a prototype property or the [[Code]], [[FormalParameters]], and
|
256
|
+
// [[Scope]] internal properties.
|
257
|
+
// XXX can't delete prototype in pure-js.
|
258
|
+
|
259
|
+
// 22. Return F.
|
260
|
+
return bound;
|
261
|
+
}
|
262
|
+
});
|
263
|
+
})
|
264
|
+
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
265
|
+
|
266
|
+
(function(undefined) {
|
267
|
+
|
268
|
+
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/detect.js
|
269
|
+
var detect = (
|
270
|
+
'DOMTokenList' in this && (function (x) {
|
271
|
+
return 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true;
|
272
|
+
})(document.createElement('x'))
|
273
|
+
);
|
274
|
+
|
275
|
+
if (detect) return
|
276
|
+
|
277
|
+
// Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/polyfill.js
|
278
|
+
(function (global) {
|
279
|
+
var nativeImpl = "DOMTokenList" in global && global.DOMTokenList;
|
280
|
+
|
281
|
+
if (
|
282
|
+
!nativeImpl ||
|
283
|
+
(
|
284
|
+
!!document.createElementNS &&
|
285
|
+
!!document.createElementNS('http://www.w3.org/2000/svg', 'svg') &&
|
286
|
+
!(document.createElementNS("http://www.w3.org/2000/svg", "svg").classList instanceof DOMTokenList)
|
287
|
+
)
|
288
|
+
) {
|
289
|
+
global.DOMTokenList = (function() { // eslint-disable-line no-unused-vars
|
290
|
+
var dpSupport = true;
|
291
|
+
var defineGetter = function (object, name, fn, configurable) {
|
292
|
+
if (Object.defineProperty)
|
293
|
+
Object.defineProperty(object, name, {
|
294
|
+
configurable: false === dpSupport ? true : !!configurable,
|
295
|
+
get: fn
|
296
|
+
});
|
297
|
+
|
298
|
+
else object.__defineGetter__(name, fn);
|
299
|
+
};
|
300
|
+
|
301
|
+
/** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
|
302
|
+
try {
|
303
|
+
defineGetter({}, "support");
|
304
|
+
}
|
305
|
+
catch (e) {
|
306
|
+
dpSupport = false;
|
307
|
+
}
|
308
|
+
|
309
|
+
|
310
|
+
var _DOMTokenList = function (el, prop) {
|
311
|
+
var that = this;
|
312
|
+
var tokens = [];
|
313
|
+
var tokenMap = {};
|
314
|
+
var length = 0;
|
315
|
+
var maxLength = 0;
|
316
|
+
var addIndexGetter = function (i) {
|
317
|
+
defineGetter(that, i, function () {
|
318
|
+
preop();
|
319
|
+
return tokens[i];
|
320
|
+
}, false);
|
321
|
+
|
322
|
+
};
|
323
|
+
var reindex = function () {
|
324
|
+
|
325
|
+
/** Define getter functions for array-like access to the tokenList's contents. */
|
326
|
+
if (length >= maxLength)
|
327
|
+
for (; maxLength < length; ++maxLength) {
|
328
|
+
addIndexGetter(maxLength);
|
329
|
+
}
|
330
|
+
};
|
331
|
+
|
332
|
+
/** Helper function called at the start of each class method. Internal use only. */
|
333
|
+
var preop = function () {
|
334
|
+
var error;
|
335
|
+
var i;
|
336
|
+
var args = arguments;
|
337
|
+
var rSpace = /\s+/;
|
338
|
+
|
339
|
+
/** Validate the token/s passed to an instance method, if any. */
|
340
|
+
if (args.length)
|
341
|
+
for (i = 0; i < args.length; ++i)
|
342
|
+
if (rSpace.test(args[i])) {
|
343
|
+
error = new SyntaxError('String "' + args[i] + '" ' + "contains" + ' an invalid character');
|
344
|
+
error.code = 5;
|
345
|
+
error.name = "InvalidCharacterError";
|
346
|
+
throw error;
|
347
|
+
}
|
348
|
+
|
349
|
+
|
350
|
+
/** Split the new value apart by whitespace*/
|
351
|
+
if (typeof el[prop] === "object") {
|
352
|
+
tokens = ("" + el[prop].baseVal).replace(/^\s+|\s+$/g, "").split(rSpace);
|
353
|
+
} else {
|
354
|
+
tokens = ("" + el[prop]).replace(/^\s+|\s+$/g, "").split(rSpace);
|
355
|
+
}
|
356
|
+
|
357
|
+
/** Avoid treating blank strings as single-item token lists */
|
358
|
+
if ("" === tokens[0]) tokens = [];
|
359
|
+
|
360
|
+
/** Repopulate the internal token lists */
|
361
|
+
tokenMap = {};
|
362
|
+
for (i = 0; i < tokens.length; ++i)
|
363
|
+
tokenMap[tokens[i]] = true;
|
364
|
+
length = tokens.length;
|
365
|
+
reindex();
|
366
|
+
};
|
367
|
+
|
368
|
+
/** Populate our internal token list if the targeted attribute of the subject element isn't empty. */
|
369
|
+
preop();
|
370
|
+
|
371
|
+
/** Return the number of tokens in the underlying string. Read-only. */
|
372
|
+
defineGetter(that, "length", function () {
|
373
|
+
preop();
|
374
|
+
return length;
|
375
|
+
});
|
376
|
+
|
377
|
+
/** Override the default toString/toLocaleString methods to return a space-delimited list of tokens when typecast. */
|
378
|
+
that.toLocaleString =
|
379
|
+
that.toString = function () {
|
380
|
+
preop();
|
381
|
+
return tokens.join(" ");
|
382
|
+
};
|
383
|
+
|
384
|
+
that.item = function (idx) {
|
385
|
+
preop();
|
386
|
+
return tokens[idx];
|
387
|
+
};
|
388
|
+
|
389
|
+
that.contains = function (token) {
|
390
|
+
preop();
|
391
|
+
return !!tokenMap[token];
|
392
|
+
};
|
393
|
+
|
394
|
+
that.add = function () {
|
395
|
+
preop.apply(that, args = arguments);
|
396
|
+
|
397
|
+
for (var args, token, i = 0, l = args.length; i < l; ++i) {
|
398
|
+
token = args[i];
|
399
|
+
if (!tokenMap[token]) {
|
400
|
+
tokens.push(token);
|
401
|
+
tokenMap[token] = true;
|
402
|
+
}
|
403
|
+
}
|
404
|
+
|
405
|
+
/** Update the targeted attribute of the attached element if the token list's changed. */
|
406
|
+
if (length !== tokens.length) {
|
407
|
+
length = tokens.length >>> 0;
|
408
|
+
if (typeof el[prop] === "object") {
|
409
|
+
el[prop].baseVal = tokens.join(" ");
|
410
|
+
} else {
|
411
|
+
el[prop] = tokens.join(" ");
|
412
|
+
}
|
413
|
+
reindex();
|
414
|
+
}
|
415
|
+
};
|
416
|
+
|
417
|
+
that.remove = function () {
|
418
|
+
preop.apply(that, args = arguments);
|
419
|
+
|
420
|
+
/** Build a hash of token names to compare against when recollecting our token list. */
|
421
|
+
for (var args, ignore = {}, i = 0, t = []; i < args.length; ++i) {
|
422
|
+
ignore[args[i]] = true;
|
423
|
+
delete tokenMap[args[i]];
|
424
|
+
}
|
425
|
+
|
426
|
+
/** Run through our tokens list and reassign only those that aren't defined in the hash declared above. */
|
427
|
+
for (i = 0; i < tokens.length; ++i)
|
428
|
+
if (!ignore[tokens[i]]) t.push(tokens[i]);
|
429
|
+
|
430
|
+
tokens = t;
|
431
|
+
length = t.length >>> 0;
|
432
|
+
|
433
|
+
/** Update the targeted attribute of the attached element. */
|
434
|
+
if (typeof el[prop] === "object") {
|
435
|
+
el[prop].baseVal = tokens.join(" ");
|
436
|
+
} else {
|
437
|
+
el[prop] = tokens.join(" ");
|
438
|
+
}
|
439
|
+
reindex();
|
440
|
+
};
|
441
|
+
|
442
|
+
that.toggle = function (token, force) {
|
443
|
+
preop.apply(that, [token]);
|
444
|
+
|
445
|
+
/** Token state's being forced. */
|
446
|
+
if (undefined !== force) {
|
447
|
+
if (force) {
|
448
|
+
that.add(token);
|
449
|
+
return true;
|
450
|
+
} else {
|
451
|
+
that.remove(token);
|
452
|
+
return false;
|
453
|
+
}
|
454
|
+
}
|
455
|
+
|
456
|
+
/** Token already exists in tokenList. Remove it, and return FALSE. */
|
457
|
+
if (tokenMap[token]) {
|
458
|
+
that.remove(token);
|
459
|
+
return false;
|
460
|
+
}
|
461
|
+
|
462
|
+
/** Otherwise, add the token and return TRUE. */
|
463
|
+
that.add(token);
|
464
|
+
return true;
|
465
|
+
};
|
466
|
+
|
467
|
+
return that;
|
468
|
+
};
|
469
|
+
|
470
|
+
return _DOMTokenList;
|
471
|
+
}());
|
472
|
+
}
|
473
|
+
|
474
|
+
// Add second argument to native DOMTokenList.toggle() if necessary
|
475
|
+
(function () {
|
476
|
+
var e = document.createElement('span');
|
477
|
+
if (!('classList' in e)) return;
|
478
|
+
e.classList.toggle('x', false);
|
479
|
+
if (!e.classList.contains('x')) return;
|
480
|
+
e.classList.constructor.prototype.toggle = function toggle(token /*, force*/) {
|
481
|
+
var force = arguments[1];
|
482
|
+
if (force === undefined) {
|
483
|
+
var add = !this.contains(token);
|
484
|
+
this[add ? 'add' : 'remove'](token);
|
485
|
+
return add;
|
486
|
+
}
|
487
|
+
force = !!force;
|
488
|
+
this[force ? 'add' : 'remove'](token);
|
489
|
+
return force;
|
490
|
+
};
|
491
|
+
}());
|
492
|
+
|
493
|
+
// Add multiple arguments to native DOMTokenList.add() if necessary
|
494
|
+
(function () {
|
495
|
+
var e = document.createElement('span');
|
496
|
+
if (!('classList' in e)) return;
|
497
|
+
e.classList.add('a', 'b');
|
498
|
+
if (e.classList.contains('b')) return;
|
499
|
+
var native = e.classList.constructor.prototype.add;
|
500
|
+
e.classList.constructor.prototype.add = function () {
|
501
|
+
var args = arguments;
|
502
|
+
var l = arguments.length;
|
503
|
+
for (var i = 0; i < l; i++) {
|
504
|
+
native.call(this, args[i]);
|
505
|
+
}
|
506
|
+
};
|
507
|
+
}());
|
508
|
+
|
509
|
+
// Add multiple arguments to native DOMTokenList.remove() if necessary
|
510
|
+
(function () {
|
511
|
+
var e = document.createElement('span');
|
512
|
+
if (!('classList' in e)) return;
|
513
|
+
e.classList.add('a');
|
514
|
+
e.classList.add('b');
|
515
|
+
e.classList.remove('a', 'b');
|
516
|
+
if (!e.classList.contains('b')) return;
|
517
|
+
var native = e.classList.constructor.prototype.remove;
|
518
|
+
e.classList.constructor.prototype.remove = function () {
|
519
|
+
var args = arguments;
|
520
|
+
var l = arguments.length;
|
521
|
+
for (var i = 0; i < l; i++) {
|
522
|
+
native.call(this, args[i]);
|
523
|
+
}
|
524
|
+
};
|
525
|
+
}());
|
526
|
+
|
527
|
+
}(this));
|
528
|
+
|
529
|
+
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
530
|
+
|
531
|
+
(function(undefined) {
|
532
|
+
|
533
|
+
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
|
534
|
+
var detect = ("Document" in this);
|
535
|
+
|
536
|
+
if (detect) return
|
537
|
+
|
538
|
+
// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
|
539
|
+
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
|
540
|
+
|
541
|
+
if (this.HTMLDocument) { // IE8
|
542
|
+
|
543
|
+
// HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
|
544
|
+
this.Document = this.HTMLDocument;
|
545
|
+
|
546
|
+
} else {
|
547
|
+
|
548
|
+
// Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made.
|
549
|
+
this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());
|
550
|
+
this.Document.prototype = document;
|
551
|
+
}
|
552
|
+
}
|
553
|
+
|
554
|
+
|
555
|
+
})
|
556
|
+
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
557
|
+
|
558
|
+
(function(undefined) {
|
559
|
+
|
560
|
+
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
|
561
|
+
var detect = ('Element' in this && 'HTMLElement' in this);
|
562
|
+
|
563
|
+
if (detect) return
|
564
|
+
|
565
|
+
// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
|
566
|
+
(function () {
|
567
|
+
|
568
|
+
// IE8
|
569
|
+
if (window.Element && !window.HTMLElement) {
|
570
|
+
window.HTMLElement = window.Element;
|
571
|
+
return;
|
572
|
+
}
|
573
|
+
|
574
|
+
// create Element constructor
|
575
|
+
window.Element = window.HTMLElement = new Function('return function Element() {}')();
|
576
|
+
|
577
|
+
// generate sandboxed iframe
|
578
|
+
var vbody = document.appendChild(document.createElement('body'));
|
579
|
+
var frame = vbody.appendChild(document.createElement('iframe'));
|
580
|
+
|
581
|
+
// use sandboxed iframe to replicate Element functionality
|
582
|
+
var frameDocument = frame.contentWindow.document;
|
583
|
+
var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
|
584
|
+
var cache = {};
|
585
|
+
|
586
|
+
// polyfill Element.prototype on an element
|
587
|
+
var shiv = function (element, deep) {
|
588
|
+
var
|
589
|
+
childNodes = element.childNodes || [],
|
590
|
+
index = -1,
|
591
|
+
key, value, childNode;
|
592
|
+
|
593
|
+
if (element.nodeType === 1 && element.constructor !== Element) {
|
594
|
+
element.constructor = Element;
|
595
|
+
|
596
|
+
for (key in cache) {
|
597
|
+
value = cache[key];
|
598
|
+
element[key] = value;
|
599
|
+
}
|
600
|
+
}
|
601
|
+
|
602
|
+
while (childNode = deep && childNodes[++index]) {
|
603
|
+
shiv(childNode, deep);
|
604
|
+
}
|
605
|
+
|
606
|
+
return element;
|
607
|
+
};
|
608
|
+
|
609
|
+
var elements = document.getElementsByTagName('*');
|
610
|
+
var nativeCreateElement = document.createElement;
|
611
|
+
var interval;
|
612
|
+
var loopLimit = 100;
|
613
|
+
|
614
|
+
prototype.attachEvent('onpropertychange', function (event) {
|
615
|
+
var
|
616
|
+
propertyName = event.propertyName,
|
617
|
+
nonValue = !cache.hasOwnProperty(propertyName),
|
618
|
+
newValue = prototype[propertyName],
|
619
|
+
oldValue = cache[propertyName],
|
620
|
+
index = -1,
|
621
|
+
element;
|
622
|
+
|
623
|
+
while (element = elements[++index]) {
|
624
|
+
if (element.nodeType === 1) {
|
625
|
+
if (nonValue || element[propertyName] === oldValue) {
|
626
|
+
element[propertyName] = newValue;
|
627
|
+
}
|
628
|
+
}
|
629
|
+
}
|
630
|
+
|
631
|
+
cache[propertyName] = newValue;
|
632
|
+
});
|
633
|
+
|
634
|
+
prototype.constructor = Element;
|
635
|
+
|
636
|
+
if (!prototype.hasAttribute) {
|
637
|
+
// <Element>.hasAttribute
|
638
|
+
prototype.hasAttribute = function hasAttribute(name) {
|
639
|
+
return this.getAttribute(name) !== null;
|
640
|
+
};
|
641
|
+
}
|
642
|
+
|
643
|
+
// Apply Element prototype to the pre-existing DOM as soon as the body element appears.
|
644
|
+
function bodyCheck() {
|
645
|
+
if (!(loopLimit--)) clearTimeout(interval);
|
646
|
+
if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
|
647
|
+
shiv(document, true);
|
648
|
+
if (interval && document.body.prototype) clearTimeout(interval);
|
649
|
+
return (!!document.body.prototype);
|
650
|
+
}
|
651
|
+
return false;
|
652
|
+
}
|
653
|
+
if (!bodyCheck()) {
|
654
|
+
document.onreadystatechange = bodyCheck;
|
655
|
+
interval = setInterval(bodyCheck, 25);
|
656
|
+
}
|
657
|
+
|
658
|
+
// Apply to any new elements created after load
|
659
|
+
document.createElement = function createElement(nodeName) {
|
660
|
+
var element = nativeCreateElement(String(nodeName).toLowerCase());
|
661
|
+
return shiv(element);
|
662
|
+
};
|
663
|
+
|
664
|
+
// remove sandboxed iframe
|
665
|
+
document.removeChild(vbody);
|
666
|
+
}());
|
667
|
+
|
668
|
+
})
|
669
|
+
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
670
|
+
|
671
|
+
(function(undefined) {
|
672
|
+
|
673
|
+
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
|
674
|
+
var detect = (
|
675
|
+
'document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () {
|
676
|
+
var e = document.createElement('span');
|
677
|
+
e.classList.add('a', 'b');
|
678
|
+
return e.classList.contains('b');
|
679
|
+
}())
|
680
|
+
);
|
681
|
+
|
682
|
+
if (detect) return
|
683
|
+
|
684
|
+
// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.classList&flags=always
|
685
|
+
(function (global) {
|
686
|
+
var dpSupport = true;
|
687
|
+
var defineGetter = function (object, name, fn, configurable) {
|
688
|
+
if (Object.defineProperty)
|
689
|
+
Object.defineProperty(object, name, {
|
690
|
+
configurable: false === dpSupport ? true : !!configurable,
|
691
|
+
get: fn
|
692
|
+
});
|
693
|
+
|
694
|
+
else object.__defineGetter__(name, fn);
|
695
|
+
};
|
696
|
+
/** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
|
697
|
+
try {
|
698
|
+
defineGetter({}, "support");
|
699
|
+
}
|
700
|
+
catch (e) {
|
701
|
+
dpSupport = false;
|
702
|
+
}
|
703
|
+
/** Polyfills a property with a DOMTokenList */
|
704
|
+
var addProp = function (o, name, attr) {
|
705
|
+
|
706
|
+
defineGetter(o.prototype, name, function () {
|
707
|
+
var tokenList;
|
708
|
+
|
709
|
+
var THIS = this,
|
710
|
+
|
711
|
+
/** Prevent this from firing twice for some reason. What the hell, IE. */
|
712
|
+
gibberishProperty = "__defineGetter__" + "DEFINE_PROPERTY" + name;
|
713
|
+
if(THIS[gibberishProperty]) return tokenList;
|
714
|
+
THIS[gibberishProperty] = true;
|
715
|
+
|
716
|
+
/**
|
717
|
+
* IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead.
|
718
|
+
*
|
719
|
+
* What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror")
|
720
|
+
* that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML
|
721
|
+
* element instead, this would conflict with element types which use indexed properties (such as forms and
|
722
|
+
* select lists).
|
723
|
+
*/
|
724
|
+
if (false === dpSupport) {
|
725
|
+
|
726
|
+
var visage;
|
727
|
+
var mirror = addProp.mirror || document.createElement("div");
|
728
|
+
var reflections = mirror.childNodes;
|
729
|
+
var l = reflections.length;
|
730
|
+
|
731
|
+
for (var i = 0; i < l; ++i)
|
732
|
+
if (reflections[i]._R === THIS) {
|
733
|
+
visage = reflections[i];
|
734
|
+
break;
|
735
|
+
}
|
736
|
+
|
737
|
+
/** Couldn't find an element's reflection inside the mirror. Materialise one. */
|
738
|
+
visage || (visage = mirror.appendChild(document.createElement("div")));
|
739
|
+
|
740
|
+
tokenList = DOMTokenList.call(visage, THIS, attr);
|
741
|
+
} else tokenList = new DOMTokenList(THIS, attr);
|
742
|
+
|
743
|
+
defineGetter(THIS, name, function () {
|
744
|
+
return tokenList;
|
745
|
+
});
|
746
|
+
delete THIS[gibberishProperty];
|
747
|
+
|
748
|
+
return tokenList;
|
749
|
+
}, true);
|
750
|
+
};
|
751
|
+
|
752
|
+
addProp(global.Element, "classList", "className");
|
753
|
+
addProp(global.HTMLElement, "classList", "className");
|
754
|
+
addProp(global.HTMLLinkElement, "relList", "rel");
|
755
|
+
addProp(global.HTMLAnchorElement, "relList", "rel");
|
756
|
+
addProp(global.HTMLAreaElement, "relList", "rel");
|
757
|
+
}(this));
|
758
|
+
|
759
|
+
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
760
|
+
|
761
|
+
function Accordion ($module) {
|
762
|
+
this.$module = $module;
|
763
|
+
this.moduleId = $module.getAttribute('id');
|
764
|
+
this.$sections = $module.querySelectorAll('.govuk-accordion__section');
|
765
|
+
this.$openAllButton = '';
|
766
|
+
this.browserSupportsSessionStorage = helper.checkForSessionStorage();
|
767
|
+
|
768
|
+
this.controlsClass = 'govuk-accordion__controls';
|
769
|
+
this.openAllClass = 'govuk-accordion__open-all';
|
770
|
+
this.iconClass = 'govuk-accordion__icon';
|
771
|
+
|
772
|
+
this.sectionHeaderClass = 'govuk-accordion__section-header';
|
773
|
+
this.sectionHeaderFocusedClass = 'govuk-accordion__section-header--focused';
|
774
|
+
this.sectionHeadingClass = 'govuk-accordion__section-heading';
|
775
|
+
this.sectionSummaryClass = 'govuk-accordion__section-summary';
|
776
|
+
this.sectionButtonClass = 'govuk-accordion__section-button';
|
777
|
+
this.sectionExpandedClass = 'govuk-accordion__section--expanded';
|
778
|
+
}
|
779
|
+
|
780
|
+
// Initialize component
|
781
|
+
Accordion.prototype.init = function () {
|
782
|
+
// Check for module
|
783
|
+
if (!this.$module) {
|
784
|
+
return
|
785
|
+
}
|
786
|
+
|
787
|
+
this.initControls();
|
788
|
+
|
789
|
+
this.initSectionHeaders();
|
790
|
+
|
791
|
+
// See if "Open all" button text should be updated
|
792
|
+
var areAllSectionsOpen = this.checkIfAllSectionsOpen();
|
793
|
+
this.updateOpenAllButton(areAllSectionsOpen);
|
794
|
+
};
|
795
|
+
|
796
|
+
// Initialise controls and set attributes
|
797
|
+
Accordion.prototype.initControls = function () {
|
798
|
+
// Create "Open all" button and set attributes
|
799
|
+
this.$openAllButton = document.createElement('button');
|
800
|
+
this.$openAllButton.setAttribute('type', 'button');
|
801
|
+
this.$openAllButton.innerHTML = 'Open all <span class="govuk-visually-hidden">sections</span>';
|
802
|
+
this.$openAllButton.setAttribute('class', this.openAllClass);
|
803
|
+
this.$openAllButton.setAttribute('aria-expanded', 'false');
|
804
|
+
this.$openAllButton.setAttribute('type', 'button');
|
805
|
+
|
806
|
+
// Create control wrapper and add controls to it
|
807
|
+
var accordionControls = document.createElement('div');
|
808
|
+
accordionControls.setAttribute('class', this.controlsClass);
|
809
|
+
accordionControls.appendChild(this.$openAllButton);
|
810
|
+
this.$module.insertBefore(accordionControls, this.$module.firstChild);
|
811
|
+
|
812
|
+
// Handle events for the controls
|
813
|
+
this.$openAllButton.addEventListener('click', this.onOpenOrCloseAllToggle.bind(this));
|
814
|
+
};
|
815
|
+
|
816
|
+
// Initialise section headers
|
817
|
+
Accordion.prototype.initSectionHeaders = function () {
|
818
|
+
// Loop through section headers
|
819
|
+
nodeListForEach(this.$sections, function ($section, i) {
|
820
|
+
// Set header attributes
|
821
|
+
var header = $section.querySelector('.' + this.sectionHeaderClass);
|
822
|
+
this.initHeaderAttributes(header, i);
|
823
|
+
|
824
|
+
this.setExpanded(this.isExpanded($section), $section);
|
825
|
+
|
826
|
+
// Handle events
|
827
|
+
header.addEventListener('click', this.onSectionToggle.bind(this, $section));
|
828
|
+
|
829
|
+
// See if there is any state stored in sessionStorage and set the sections to
|
830
|
+
// open or closed.
|
831
|
+
this.setInitialState($section);
|
832
|
+
}.bind(this));
|
833
|
+
};
|
834
|
+
|
835
|
+
// Set individual header attributes
|
836
|
+
Accordion.prototype.initHeaderAttributes = function ($headerWrapper, index) {
|
837
|
+
var $module = this;
|
838
|
+
var $span = $headerWrapper.querySelector('.' + this.sectionButtonClass);
|
839
|
+
var $heading = $headerWrapper.querySelector('.' + this.sectionHeadingClass);
|
840
|
+
var $summary = $headerWrapper.querySelector('.' + this.sectionSummaryClass);
|
841
|
+
|
842
|
+
// Copy existing span element to an actual button element, for improved accessibility.
|
843
|
+
var $button = document.createElement('button');
|
844
|
+
$button.setAttribute('type', 'button');
|
845
|
+
$button.setAttribute('id', this.moduleId + '-heading-' + (index + 1));
|
846
|
+
$button.setAttribute('aria-controls', this.moduleId + '-content-' + (index + 1));
|
847
|
+
|
848
|
+
// Copy all attributes (https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes) from $span to $button
|
849
|
+
for (var i = 0; i < $span.attributes.length; i++) {
|
850
|
+
var attr = $span.attributes.item(i);
|
851
|
+
$button.setAttribute(attr.nodeName, attr.nodeValue);
|
852
|
+
}
|
853
|
+
|
854
|
+
$button.addEventListener('focusin', function (e) {
|
855
|
+
if (!$headerWrapper.classList.contains($module.sectionHeaderFocusedClass)) {
|
856
|
+
$headerWrapper.className += ' ' + $module.sectionHeaderFocusedClass;
|
857
|
+
}
|
858
|
+
});
|
859
|
+
|
860
|
+
$button.addEventListener('blur', function (e) {
|
861
|
+
$headerWrapper.classList.remove($module.sectionHeaderFocusedClass);
|
862
|
+
});
|
863
|
+
|
864
|
+
if (typeof ($summary) !== 'undefined' && $summary !== null) {
|
865
|
+
$button.setAttribute('aria-describedby', this.moduleId + '-summary-' + (index + 1));
|
866
|
+
}
|
867
|
+
|
868
|
+
// $span could contain HTML elements (see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content)
|
869
|
+
$button.innerHTML = $span.innerHTML;
|
870
|
+
|
871
|
+
$heading.removeChild($span);
|
872
|
+
$heading.appendChild($button);
|
873
|
+
|
874
|
+
// Add "+/-" icon
|
875
|
+
var icon = document.createElement('span');
|
876
|
+
icon.className = this.iconClass;
|
877
|
+
icon.setAttribute('aria-hidden', 'true');
|
878
|
+
|
879
|
+
$button.appendChild(icon);
|
880
|
+
};
|
881
|
+
|
882
|
+
// When section toggled, set and store state
|
883
|
+
Accordion.prototype.onSectionToggle = function ($section) {
|
884
|
+
var expanded = this.isExpanded($section);
|
885
|
+
this.setExpanded(!expanded, $section);
|
886
|
+
|
887
|
+
// Store the state in sessionStorage when a change is triggered
|
888
|
+
this.storeState($section);
|
889
|
+
};
|
890
|
+
|
891
|
+
// When Open/Close All toggled, set and store state
|
892
|
+
Accordion.prototype.onOpenOrCloseAllToggle = function () {
|
893
|
+
var $module = this;
|
894
|
+
var $sections = this.$sections;
|
895
|
+
|
896
|
+
var nowExpanded = !this.checkIfAllSectionsOpen();
|
897
|
+
|
898
|
+
nodeListForEach($sections, function ($section) {
|
899
|
+
$module.setExpanded(nowExpanded, $section);
|
900
|
+
// Store the state in sessionStorage when a change is triggered
|
901
|
+
$module.storeState($section);
|
902
|
+
});
|
903
|
+
|
904
|
+
$module.updateOpenAllButton(nowExpanded);
|
905
|
+
};
|
906
|
+
|
907
|
+
// Set section attributes when opened/closed
|
908
|
+
Accordion.prototype.setExpanded = function (expanded, $section) {
|
909
|
+
var $button = $section.querySelector('.' + this.sectionButtonClass);
|
910
|
+
$button.setAttribute('aria-expanded', expanded);
|
911
|
+
|
912
|
+
if (expanded) {
|
913
|
+
$section.classList.add(this.sectionExpandedClass);
|
914
|
+
} else {
|
915
|
+
$section.classList.remove(this.sectionExpandedClass);
|
916
|
+
}
|
917
|
+
|
918
|
+
// See if "Open all" button text should be updated
|
919
|
+
var areAllSectionsOpen = this.checkIfAllSectionsOpen();
|
920
|
+
this.updateOpenAllButton(areAllSectionsOpen);
|
921
|
+
};
|
922
|
+
|
923
|
+
// Get state of section
|
924
|
+
Accordion.prototype.isExpanded = function ($section) {
|
925
|
+
return $section.classList.contains(this.sectionExpandedClass)
|
926
|
+
};
|
927
|
+
|
928
|
+
// Check if all sections are open
|
929
|
+
Accordion.prototype.checkIfAllSectionsOpen = function () {
|
930
|
+
// Get a count of all the Accordion sections
|
931
|
+
var sectionsCount = this.$sections.length;
|
932
|
+
// Get a count of all Accordion sections that are expanded
|
933
|
+
var expandedSectionCount = this.$module.querySelectorAll('.' + this.sectionExpandedClass).length;
|
934
|
+
var areAllSectionsOpen = sectionsCount === expandedSectionCount;
|
935
|
+
|
936
|
+
return areAllSectionsOpen
|
937
|
+
};
|
938
|
+
|
939
|
+
// Update "Open all" button
|
940
|
+
Accordion.prototype.updateOpenAllButton = function (expanded) {
|
941
|
+
var newButtonText = expanded ? 'Close all' : 'Open all';
|
942
|
+
newButtonText += '<span class="govuk-visually-hidden"> sections</span>';
|
943
|
+
this.$openAllButton.setAttribute('aria-expanded', expanded);
|
944
|
+
this.$openAllButton.innerHTML = newButtonText;
|
945
|
+
};
|
946
|
+
|
947
|
+
// Check for `window.sessionStorage`, and that it actually works.
|
948
|
+
var helper = {
|
949
|
+
checkForSessionStorage: function () {
|
950
|
+
var testString = 'this is the test string';
|
951
|
+
var result;
|
952
|
+
try {
|
953
|
+
window.sessionStorage.setItem(testString, testString);
|
954
|
+
result = window.sessionStorage.getItem(testString) === testString.toString();
|
955
|
+
window.sessionStorage.removeItem(testString);
|
956
|
+
return result
|
957
|
+
} catch (exception) {
|
958
|
+
if ((typeof console === 'undefined' || typeof console.log === 'undefined')) {
|
959
|
+
console.log('Notice: sessionStorage not available.');
|
960
|
+
}
|
961
|
+
}
|
962
|
+
}
|
963
|
+
};
|
964
|
+
|
965
|
+
// Set the state of the accordions in sessionStorage
|
966
|
+
Accordion.prototype.storeState = function ($section) {
|
967
|
+
if (this.browserSupportsSessionStorage) {
|
968
|
+
// We need a unique way of identifying each content in the accordion. Since
|
969
|
+
// an `#id` should be unique and an `id` is required for `aria-` attributes
|
970
|
+
// `id` can be safely used.
|
971
|
+
var $button = $section.querySelector('.' + this.sectionButtonClass);
|
972
|
+
|
973
|
+
if ($button) {
|
974
|
+
var contentId = $button.getAttribute('aria-controls');
|
975
|
+
var contentState = $button.getAttribute('aria-expanded');
|
976
|
+
|
977
|
+
if (typeof contentId === 'undefined' && (typeof console === 'undefined' || typeof console.log === 'undefined')) {
|
978
|
+
console.error(new Error('No aria controls present in accordion section heading.'));
|
979
|
+
}
|
980
|
+
|
981
|
+
if (typeof contentState === 'undefined' && (typeof console === 'undefined' || typeof console.log === 'undefined')) {
|
982
|
+
console.error(new Error('No aria expanded present in accordion section heading.'));
|
983
|
+
}
|
984
|
+
|
985
|
+
// Only set the state when both `contentId` and `contentState` are taken from the DOM.
|
986
|
+
if (contentId && contentState) {
|
987
|
+
window.sessionStorage.setItem(contentId, contentState);
|
988
|
+
}
|
989
|
+
}
|
990
|
+
}
|
991
|
+
};
|
992
|
+
|
993
|
+
// Read the state of the accordions from sessionStorage
|
994
|
+
Accordion.prototype.setInitialState = function ($section) {
|
995
|
+
if (this.browserSupportsSessionStorage) {
|
996
|
+
var $button = $section.querySelector('.' + this.sectionButtonClass);
|
997
|
+
|
998
|
+
if ($button) {
|
999
|
+
var contentId = $button.getAttribute('aria-controls');
|
1000
|
+
var contentState = contentId ? window.sessionStorage.getItem(contentId) : null;
|
1001
|
+
|
1002
|
+
if (contentState !== null) {
|
1003
|
+
this.setExpanded(contentState === 'true', $section);
|
1004
|
+
}
|
1005
|
+
}
|
1006
|
+
}
|
1007
|
+
};
|
1008
|
+
|
1009
|
+
return Accordion;
|
1010
|
+
|
1011
|
+
})));
|