govuk_publishing_components 35.3.3 → 35.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +4 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/init-ga4.js +1 -1
- data/app/assets/stylesheets/component_guide/application.scss +37 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +10 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +0 -24
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -3
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +5 -5
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +1 -0
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -1
- data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -0
- data/config/locales/en.yml +2 -2
- data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +4 -0
- data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/axe.d.ts +77 -6
- data/node_modules/axe-core/axe.js +955 -600
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/locales/_template.json +6 -6
- data/node_modules/axe-core/locales/ja.json +91 -11
- data/node_modules/axe-core/package.json +5 -5
- data/node_modules/axe-core/sri-history.json +4 -0
- data/node_modules/govuk-frontend/README.md +4 -5
- data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
- data/node_modules/govuk-frontend/govuk/all.js +738 -258
- data/node_modules/govuk-frontend/govuk/all.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +11 -7
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
- data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/common/index.js +16 -4
- data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +20 -10
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common.js +16 -4
- data/node_modules/govuk-frontend/govuk/common.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +3 -3
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +234 -86
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +32 -13
- data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +8 -2
- data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +12 -12
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +8 -6
- data/node_modules/govuk-frontend/govuk/components/button/button.js +54 -19
- data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +11 -1
- data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/button/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +170 -76
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +3 -3
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +75 -24
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +47 -47
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +3 -3
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +26 -26
- data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/details.js +39 -13
- data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +10 -10
- data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +67 -27
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +19 -19
- data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +19 -19
- data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +14 -14
- data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
- data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +22 -22
- data/node_modules/govuk-frontend/govuk/components/header/header.js +46 -14
- data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
- data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +54 -41
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/input/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +6 -6
- data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +49 -22
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +16 -16
- data/node_modules/govuk-frontend/govuk/components/pagination/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +10 -10
- data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
- data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +46 -46
- data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +65 -22
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -2
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
- data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +19 -20
- data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/select/template.njk +5 -2
- data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +41 -13
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +34 -34
- data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +21 -21
- data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +15 -15
- data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +178 -60
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
- data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +18 -18
- data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +9 -5
- data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +3 -3
- data/node_modules/govuk-frontend/govuk/components/warning-text/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
- data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
- data/node_modules/govuk-frontend/govuk/i18n.js +38 -30
- data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/macros/i18n.njk +12 -11
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
- data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
- data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
- data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +10 -3
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +13 -7
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +8 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +8 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +10 -3
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +3 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -1
- data/node_modules/govuk-frontend/govuk-esm/all.mjs +81 -60
- data/node_modules/govuk-frontend/govuk-esm/all.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs +12 -8
- data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs +9 -0
- data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +44 -29
- data/node_modules/govuk-frontend/govuk-esm/common/index.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +15 -9
- data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common.mjs +3 -5
- data/node_modules/govuk-frontend/govuk-esm/common.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +319 -211
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +47 -30
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +169 -115
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +88 -51
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +64 -54
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +69 -50
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +59 -35
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +36 -25
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +67 -38
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +49 -32
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +263 -163
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +68 -57
- data/node_modules/govuk-frontend/govuk-esm/i18n.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs +5 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs +7 -4
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs +13 -10
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs +6 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs +6 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs +7 -4
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs +5 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +2 -1
- data/node_modules/govuk-frontend/package.json +3 -2
- metadata +44 -7
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px.png → dbt_crest_13px.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px_x2.png → dbt_crest_13px_x2.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px.png → dbt_crest_18px.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px_x2.png → dbt_crest_18px_x2.png} +0 -0
@@ -4,7 +4,8 @@
|
|
4
4
|
(global.GOVUKFrontend = global.GOVUKFrontend || {}, global.GOVUKFrontend.CharacterCount = factory());
|
5
5
|
}(this, (function () { 'use strict';
|
6
6
|
|
7
|
-
|
7
|
+
// @ts-nocheck
|
8
|
+
(function (undefined) {
|
8
9
|
|
9
10
|
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/detect.js
|
10
11
|
var detect = (
|
@@ -28,6 +29,8 @@
|
|
28
29
|
|
29
30
|
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
30
31
|
|
32
|
+
// @ts-nocheck
|
33
|
+
|
31
34
|
(function(undefined) {
|
32
35
|
|
33
36
|
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/detect.js
|
@@ -54,15 +57,16 @@
|
|
54
57
|
/**
|
55
58
|
* Returns the value of the given attribute closest to the given element (including itself)
|
56
59
|
*
|
57
|
-
* @
|
60
|
+
* @deprecated Will be made private in v5.0
|
61
|
+
* @param {Element} $element - The element to start walking the DOM tree up
|
58
62
|
* @param {string} attributeName - The name of the attribute
|
59
|
-
* @returns {string |
|
63
|
+
* @returns {string | null} Attribute value
|
60
64
|
*/
|
61
65
|
function closestAttributeValue ($element, attributeName) {
|
62
|
-
var closestElementWithAttribute = $element.closest('[' + attributeName + ']');
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
+
var $closestElementWithAttribute = $element.closest('[' + attributeName + ']');
|
67
|
+
return $closestElementWithAttribute
|
68
|
+
? $closestElementWithAttribute.getAttribute(attributeName)
|
69
|
+
: null
|
66
70
|
}
|
67
71
|
|
68
72
|
/**
|
@@ -82,6 +86,7 @@
|
|
82
86
|
* (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
|
83
87
|
* greatest priority on the LAST item passed in.
|
84
88
|
*
|
89
|
+
* @deprecated Will be made private in v5.0
|
85
90
|
* @returns {Object<string, unknown>} A flattened object of key-value pairs.
|
86
91
|
*/
|
87
92
|
function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
|
@@ -96,6 +101,7 @@
|
|
96
101
|
*/
|
97
102
|
var flattenObject = function (configObject) {
|
98
103
|
// Prepare an empty return object
|
104
|
+
/** @type {Object<string, unknown>} */
|
99
105
|
var flattenedObject = {};
|
100
106
|
|
101
107
|
/**
|
@@ -132,6 +138,7 @@
|
|
132
138
|
};
|
133
139
|
|
134
140
|
// Start with an empty object as our base
|
141
|
+
/** @type {Object<string, unknown>} */
|
135
142
|
var formattedConfigObject = {};
|
136
143
|
|
137
144
|
// Loop through each of the remaining passed objects and push their keys
|
@@ -153,6 +160,7 @@
|
|
153
160
|
* Extracts keys starting with a particular namespace from a flattened config
|
154
161
|
* object, removing the namespace in the process.
|
155
162
|
*
|
163
|
+
* @deprecated Will be made private in v5.0
|
156
164
|
* @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.
|
157
165
|
* @param {string} namespace - The namespace to filter keys with.
|
158
166
|
* @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed
|
@@ -164,10 +172,14 @@
|
|
164
172
|
if (!configObject || typeof configObject !== 'object') {
|
165
173
|
throw new Error('Provide a `configObject` of type "object".')
|
166
174
|
}
|
175
|
+
|
167
176
|
if (!namespace || typeof namespace !== 'string') {
|
168
177
|
throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.')
|
169
178
|
}
|
179
|
+
|
180
|
+
/** @type {Object<string, unknown>} */
|
170
181
|
var newObject = {};
|
182
|
+
|
171
183
|
for (var key in configObject) {
|
172
184
|
// Split the key into parts, using . as our namespace separator
|
173
185
|
var keyParts = key.split('.');
|
@@ -188,14 +200,16 @@
|
|
188
200
|
}
|
189
201
|
|
190
202
|
/**
|
203
|
+
* @template {Node} ElementType
|
191
204
|
* @callback nodeListIterator
|
192
|
-
* @param {
|
205
|
+
* @param {ElementType} value - The current node being iterated on
|
193
206
|
* @param {number} index - The current index in the iteration
|
194
|
-
* @param {NodeListOf<
|
207
|
+
* @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
|
195
208
|
* @returns {void}
|
196
209
|
*/
|
197
210
|
|
198
|
-
|
211
|
+
// @ts-nocheck
|
212
|
+
(function (undefined) {
|
199
213
|
|
200
214
|
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
|
201
215
|
var detect = (
|
@@ -282,7 +296,8 @@
|
|
282
296
|
})
|
283
297
|
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
284
298
|
|
285
|
-
|
299
|
+
// @ts-nocheck
|
300
|
+
(function (undefined) {
|
286
301
|
|
287
302
|
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
|
288
303
|
var detect = ("Document" in this);
|
@@ -309,6 +324,8 @@
|
|
309
324
|
})
|
310
325
|
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
311
326
|
|
327
|
+
// @ts-nocheck
|
328
|
+
|
312
329
|
(function(undefined) {
|
313
330
|
|
314
331
|
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
|
@@ -422,6 +439,8 @@
|
|
422
439
|
})
|
423
440
|
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
424
441
|
|
442
|
+
// @ts-nocheck
|
443
|
+
|
425
444
|
(function(undefined) {
|
426
445
|
|
427
446
|
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/13cf7c340974d128d557580b5e2dafcd1b1192d1/polyfills/Element/prototype/dataset/detect.js
|
@@ -442,10 +461,10 @@
|
|
442
461
|
var element = this;
|
443
462
|
var attributes = this.attributes;
|
444
463
|
var map = {};
|
445
|
-
|
464
|
+
|
446
465
|
for (var i = 0; i < attributes.length; i++) {
|
447
466
|
var attribute = attributes[i];
|
448
|
-
|
467
|
+
|
449
468
|
// This regex has been edited from the original polyfill, to add
|
450
469
|
// support for period (.) separators in data-* attribute names. These
|
451
470
|
// are allowed in the HTML spec, but were not covered by the original
|
@@ -453,11 +472,11 @@
|
|
453
472
|
if (attribute && attribute.name && (/^data-\w[.\w-]*$/).test(attribute.name)) {
|
454
473
|
var name = attribute.name;
|
455
474
|
var value = attribute.value;
|
456
|
-
|
475
|
+
|
457
476
|
var propName = name.substr(5).replace(/-./g, function (prop) {
|
458
477
|
return prop.charAt(1).toUpperCase();
|
459
478
|
});
|
460
|
-
|
479
|
+
|
461
480
|
// If this browser supports __defineGetter__ and __defineSetter__,
|
462
481
|
// continue using defineProperty. If not (like IE 8 and below), we use
|
463
482
|
// a hacky fallback which at least gives an object in the right format
|
@@ -481,18 +500,19 @@
|
|
481
500
|
|
482
501
|
}
|
483
502
|
}
|
484
|
-
|
503
|
+
|
485
504
|
return map;
|
486
505
|
}
|
487
506
|
});
|
488
507
|
|
489
508
|
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
490
509
|
|
491
|
-
|
510
|
+
// @ts-nocheck
|
511
|
+
(function (undefined) {
|
492
512
|
|
493
513
|
// Detection from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill
|
494
514
|
var detect = ('trim' in String.prototype);
|
495
|
-
|
515
|
+
|
496
516
|
if (detect) return
|
497
517
|
|
498
518
|
// Polyfill from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill
|
@@ -515,6 +535,7 @@
|
|
515
535
|
* Designed to be used to convert config passed via data attributes (which are
|
516
536
|
* always strings) into something sensible.
|
517
537
|
*
|
538
|
+
* @deprecated Will be made private in v5.0
|
518
539
|
* @param {string} value - The value to normalise
|
519
540
|
* @returns {string | boolean | number | undefined} Normalised data
|
520
541
|
*/
|
@@ -535,7 +556,7 @@
|
|
535
556
|
|
536
557
|
// Empty / whitespace-only strings are considered finite so we need to check
|
537
558
|
// the length of the trimmed string as well
|
538
|
-
if (trimmedValue.length > 0 && isFinite(trimmedValue)) {
|
559
|
+
if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
|
539
560
|
return Number(trimmedValue)
|
540
561
|
}
|
541
562
|
|
@@ -547,10 +568,12 @@
|
|
547
568
|
*
|
548
569
|
* Loop over an object and normalise each value using normaliseData function
|
549
570
|
*
|
571
|
+
* @deprecated Will be made private in v5.0
|
550
572
|
* @param {DOMStringMap} dataset - HTML element dataset
|
551
573
|
* @returns {Object<string, unknown>} Normalised dataset
|
552
574
|
*/
|
553
575
|
function normaliseDataset (dataset) {
|
576
|
+
/** @type {Object<string, unknown>} */
|
554
577
|
var out = {};
|
555
578
|
|
556
579
|
for (var key in dataset) {
|
@@ -595,17 +618,17 @@
|
|
595
618
|
}
|
596
619
|
|
597
620
|
// If the `count` option is set, determine which plural suffix is needed and
|
598
|
-
// change the lookupKey to match. We check to see if it's
|
621
|
+
// change the lookupKey to match. We check to see if it's numeric instead of
|
599
622
|
// falsy, as this could legitimately be 0.
|
600
|
-
if (options && typeof options.count
|
623
|
+
if (options && typeof options.count === 'number') {
|
601
624
|
// Get the plural suffix
|
602
625
|
lookupKey = lookupKey + '.' + this.getPluralSuffix(lookupKey, options.count);
|
603
626
|
}
|
604
627
|
|
605
|
-
|
606
|
-
|
607
|
-
var translationString = this.translations[lookupKey];
|
628
|
+
// Fetch the translation string for that lookup key
|
629
|
+
var translationString = this.translations[lookupKey];
|
608
630
|
|
631
|
+
if (typeof translationString === 'string') {
|
609
632
|
// Check for ${} placeholders in the translation string
|
610
633
|
if (translationString.match(/%{(.\S+)}/)) {
|
611
634
|
if (!options) {
|
@@ -632,32 +655,46 @@
|
|
632
655
|
* @returns {string} The translation string to output, with ${} placeholders replaced
|
633
656
|
*/
|
634
657
|
I18n.prototype.replacePlaceholders = function (translationString, options) {
|
658
|
+
/** @type {Intl.NumberFormat | undefined} */
|
635
659
|
var formatter;
|
636
660
|
|
637
661
|
if (this.hasIntlNumberFormatSupport()) {
|
638
662
|
formatter = new Intl.NumberFormat(this.locale);
|
639
663
|
}
|
640
664
|
|
641
|
-
return translationString.replace(
|
642
|
-
|
643
|
-
var placeholderValue = options[placeholderKey];
|
665
|
+
return translationString.replace(
|
666
|
+
/%{(.\S+)}/g,
|
644
667
|
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
668
|
+
/**
|
669
|
+
* Replace translation string placeholders
|
670
|
+
*
|
671
|
+
* @param {string} placeholderWithBraces - Placeholder with braces
|
672
|
+
* @param {string} placeholderKey - Placeholder key
|
673
|
+
* @returns {string} Placeholder value
|
674
|
+
*/
|
675
|
+
function (placeholderWithBraces, placeholderKey) {
|
676
|
+
if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {
|
677
|
+
var placeholderValue = options[placeholderKey];
|
678
|
+
|
679
|
+
// If a user has passed `false` as the value for the placeholder
|
680
|
+
// treat it as though the value should not be displayed
|
681
|
+
if (placeholderValue === false || (
|
682
|
+
typeof placeholderValue !== 'number' &&
|
683
|
+
typeof placeholderValue !== 'string')
|
684
|
+
) {
|
685
|
+
return ''
|
686
|
+
}
|
650
687
|
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
688
|
+
// If the placeholder's value is a number, localise the number formatting
|
689
|
+
if (typeof placeholderValue === 'number') {
|
690
|
+
return formatter ? formatter.format(placeholderValue) : placeholderValue.toString()
|
691
|
+
}
|
655
692
|
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
693
|
+
return placeholderValue
|
694
|
+
} else {
|
695
|
+
throw new Error('i18n: no data found to replace ' + placeholderWithBraces + ' placeholder in string')
|
696
|
+
}
|
697
|
+
})
|
661
698
|
};
|
662
699
|
|
663
700
|
/**
|
@@ -773,7 +810,7 @@
|
|
773
810
|
* regardless of region. There are exceptions, however, (e.g. Portuguese) so
|
774
811
|
* this searches by both the full and shortened locale codes, just to be sure.
|
775
812
|
*
|
776
|
-
* @returns {
|
813
|
+
* @returns {string | undefined} The name of the pluralisation rule to use (a key for one
|
777
814
|
* of the functions in this.pluralRules)
|
778
815
|
*/
|
779
816
|
I18n.prototype.getPluralRulesForLocale = function () {
|
@@ -824,7 +861,7 @@
|
|
824
861
|
* Spanish: European Portuguese (pt-PT), Italian (it), Spanish (es)
|
825
862
|
* Welsh: Welsh (cy)
|
826
863
|
*
|
827
|
-
* @type {Object<
|
864
|
+
* @type {Object<string, string[]>}
|
828
865
|
*/
|
829
866
|
I18n.pluralRulesMap = {
|
830
867
|
arabic: ['ar'],
|
@@ -912,12 +949,6 @@
|
|
912
949
|
/* eslint-enable jsdoc/require-jsdoc */
|
913
950
|
};
|
914
951
|
|
915
|
-
/**
|
916
|
-
* Supported languages for plural rules
|
917
|
-
*
|
918
|
-
* @typedef {'arabic' | 'chinese' | 'french' | 'german' | 'irish' | 'russian' | 'scottish' | 'spanish' | 'welsh'} PluralRuleName
|
919
|
-
*/
|
920
|
-
|
921
952
|
/**
|
922
953
|
* Plural rule category mnemonic tags
|
923
954
|
*
|
@@ -939,7 +970,8 @@
|
|
939
970
|
* @property {string} [many] - Plural form used for many
|
940
971
|
*/
|
941
972
|
|
942
|
-
|
973
|
+
// @ts-nocheck
|
974
|
+
(function (undefined) {
|
943
975
|
|
944
976
|
// Detection from https://github.com/Financial-Times/polyfill-library/blob/v3.111.0/polyfills/Date/now/detect.js
|
945
977
|
var detect = ('Date' in self && 'now' in self.Date && 'getTime' in self.Date.prototype);
|
@@ -953,7 +985,8 @@
|
|
953
985
|
|
954
986
|
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
955
987
|
|
956
|
-
|
988
|
+
// @ts-nocheck
|
989
|
+
(function (undefined) {
|
957
990
|
|
958
991
|
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/detect.js
|
959
992
|
var detect = (
|
@@ -1218,6 +1251,8 @@
|
|
1218
1251
|
|
1219
1252
|
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
1220
1253
|
|
1254
|
+
// @ts-nocheck
|
1255
|
+
|
1221
1256
|
(function(undefined) {
|
1222
1257
|
|
1223
1258
|
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
|
@@ -1308,7 +1343,8 @@
|
|
1308
1343
|
|
1309
1344
|
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
1310
1345
|
|
1311
|
-
|
1346
|
+
// @ts-nocheck
|
1347
|
+
(function (undefined) {
|
1312
1348
|
|
1313
1349
|
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Window/detect.js
|
1314
1350
|
var detect = ('Window' in this);
|
@@ -1329,6 +1365,8 @@
|
|
1329
1365
|
})
|
1330
1366
|
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
1331
1367
|
|
1368
|
+
// @ts-nocheck
|
1369
|
+
|
1332
1370
|
(function(undefined) {
|
1333
1371
|
|
1334
1372
|
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Event/detect.js
|
@@ -1578,6 +1616,8 @@
|
|
1578
1616
|
})
|
1579
1617
|
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
1580
1618
|
|
1619
|
+
// @ts-nocheck
|
1620
|
+
|
1581
1621
|
(function(undefined) {
|
1582
1622
|
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Function/prototype/bind/detect.js
|
1583
1623
|
var detect = 'bind' in Function.prototype;
|
@@ -1781,11 +1821,21 @@
|
|
1781
1821
|
* of the available characters/words has been entered.
|
1782
1822
|
*
|
1783
1823
|
* @class
|
1784
|
-
* @param {
|
1824
|
+
* @param {Element} $module - HTML element to use for character count
|
1785
1825
|
* @param {CharacterCountConfig} [config] - Character count config
|
1786
1826
|
*/
|
1787
1827
|
function CharacterCount ($module, config) {
|
1788
|
-
if (
|
1828
|
+
if (!($module instanceof HTMLElement)) {
|
1829
|
+
return this
|
1830
|
+
}
|
1831
|
+
|
1832
|
+
var $textarea = $module.querySelector('.govuk-js-character-count');
|
1833
|
+
if (
|
1834
|
+
!(
|
1835
|
+
$textarea instanceof HTMLTextAreaElement ||
|
1836
|
+
$textarea instanceof HTMLInputElement
|
1837
|
+
)
|
1838
|
+
) {
|
1789
1839
|
return this
|
1790
1840
|
}
|
1791
1841
|
|
@@ -1811,6 +1861,10 @@
|
|
1811
1861
|
};
|
1812
1862
|
}
|
1813
1863
|
|
1864
|
+
/**
|
1865
|
+
* @deprecated Will be made private in v5.0
|
1866
|
+
* @type {CharacterCountConfig}
|
1867
|
+
*/
|
1814
1868
|
this.config = mergeConfigs(
|
1815
1869
|
defaultConfig,
|
1816
1870
|
config || {},
|
@@ -1818,25 +1872,43 @@
|
|
1818
1872
|
datasetConfig
|
1819
1873
|
);
|
1820
1874
|
|
1875
|
+
/** @deprecated Will be made private in v5.0 */
|
1821
1876
|
this.i18n = new I18n(extractConfigByNamespace(this.config, 'i18n'), {
|
1822
1877
|
// Read the fallback if necessary rather than have it set in the defaults
|
1823
1878
|
locale: closestAttributeValue($module, 'lang')
|
1824
1879
|
});
|
1825
1880
|
|
1881
|
+
/** @deprecated Will be made private in v5.0 */
|
1882
|
+
this.maxLength = Infinity;
|
1826
1883
|
// Determine the limit attribute (characters or words)
|
1827
|
-
if (this.config.maxwords) {
|
1884
|
+
if ('maxwords' in this.config && this.config.maxwords) {
|
1828
1885
|
this.maxLength = this.config.maxwords;
|
1829
|
-
} else if (this.config.maxlength) {
|
1886
|
+
} else if ('maxlength' in this.config && this.config.maxlength) {
|
1830
1887
|
this.maxLength = this.config.maxlength;
|
1831
1888
|
} else {
|
1832
1889
|
return
|
1833
1890
|
}
|
1834
1891
|
|
1892
|
+
/** @deprecated Will be made private in v5.0 */
|
1835
1893
|
this.$module = $module;
|
1836
|
-
|
1894
|
+
|
1895
|
+
/** @deprecated Will be made private in v5.0 */
|
1896
|
+
this.$textarea = $textarea;
|
1897
|
+
|
1898
|
+
/** @deprecated Will be made private in v5.0 */
|
1837
1899
|
this.$visibleCountMessage = null;
|
1900
|
+
|
1901
|
+
/** @deprecated Will be made private in v5.0 */
|
1838
1902
|
this.$screenReaderCountMessage = null;
|
1903
|
+
|
1904
|
+
/** @deprecated Will be made private in v5.0 */
|
1839
1905
|
this.lastInputTimestamp = null;
|
1906
|
+
|
1907
|
+
/** @deprecated Will be made private in v5.0 */
|
1908
|
+
this.lastInputValue = '';
|
1909
|
+
|
1910
|
+
/** @deprecated Will be made private in v5.0 */
|
1911
|
+
this.valueChecker = null;
|
1840
1912
|
}
|
1841
1913
|
|
1842
1914
|
/**
|
@@ -1844,14 +1916,17 @@
|
|
1844
1916
|
*/
|
1845
1917
|
CharacterCount.prototype.init = function () {
|
1846
1918
|
// Check that required elements are present
|
1847
|
-
if (!this.$textarea) {
|
1919
|
+
if (!this.$module || !this.$textarea) {
|
1848
1920
|
return
|
1849
1921
|
}
|
1850
1922
|
|
1851
1923
|
var $textarea = this.$textarea;
|
1852
1924
|
var $textareaDescription = document.getElementById($textarea.id + '-info');
|
1925
|
+
if (!$textareaDescription) {
|
1926
|
+
return
|
1927
|
+
}
|
1853
1928
|
|
1854
|
-
// Inject a
|
1929
|
+
// Inject a description for the textarea if none is present already
|
1855
1930
|
// for when the component was rendered with no maxlength, maxwords
|
1856
1931
|
// nor custom textareaDescriptionText
|
1857
1932
|
if ($textareaDescription.innerText.match(/^\s*$/)) {
|
@@ -1892,11 +1967,11 @@
|
|
1892
1967
|
// state of the character count is not restored until *after* the
|
1893
1968
|
// DOMContentLoaded event is fired, so we need to manually update it after the
|
1894
1969
|
// pageshow event in browsers that support it.
|
1895
|
-
|
1896
|
-
window
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1970
|
+
window.addEventListener(
|
1971
|
+
'onpageshow' in window ? 'pageshow' : 'DOMContentLoaded',
|
1972
|
+
this.updateCountMessage.bind(this)
|
1973
|
+
);
|
1974
|
+
|
1900
1975
|
this.updateCountMessage();
|
1901
1976
|
};
|
1902
1977
|
|
@@ -1905,6 +1980,8 @@
|
|
1905
1980
|
*
|
1906
1981
|
* Set up event listeners on the $textarea so that the count messages update
|
1907
1982
|
* when the user types.
|
1983
|
+
*
|
1984
|
+
* @deprecated Will be made private in v5.0
|
1908
1985
|
*/
|
1909
1986
|
CharacterCount.prototype.bindChangeEvents = function () {
|
1910
1987
|
var $textarea = this.$textarea;
|
@@ -1920,6 +1997,8 @@
|
|
1920
1997
|
*
|
1921
1998
|
* Update the visible character counter and keep track of when the last update
|
1922
1999
|
* happened for each keypress
|
2000
|
+
*
|
2001
|
+
* @deprecated Will be made private in v5.0
|
1923
2002
|
*/
|
1924
2003
|
CharacterCount.prototype.handleKeyUp = function () {
|
1925
2004
|
this.updateVisibleCountMessage();
|
@@ -1938,6 +2017,8 @@
|
|
1938
2017
|
*
|
1939
2018
|
* This is so that the update triggered by the manual comparison doesn't
|
1940
2019
|
* conflict with debounced KeyboardEvent updates.
|
2020
|
+
*
|
2021
|
+
* @deprecated Will be made private in v5.0
|
1941
2022
|
*/
|
1942
2023
|
CharacterCount.prototype.handleFocus = function () {
|
1943
2024
|
this.valueChecker = setInterval(function () {
|
@@ -1951,6 +2032,8 @@
|
|
1951
2032
|
* Handle blur event
|
1952
2033
|
*
|
1953
2034
|
* Stop checking the textarea value once the textarea no longer has focus
|
2035
|
+
*
|
2036
|
+
* @deprecated Will be made private in v5.0
|
1954
2037
|
*/
|
1955
2038
|
CharacterCount.prototype.handleBlur = function () {
|
1956
2039
|
// Cancel value checking on blur
|
@@ -1959,11 +2042,12 @@
|
|
1959
2042
|
|
1960
2043
|
/**
|
1961
2044
|
* Update count message if textarea value has changed
|
2045
|
+
*
|
2046
|
+
* @deprecated Will be made private in v5.0
|
1962
2047
|
*/
|
1963
2048
|
CharacterCount.prototype.updateIfValueChanged = function () {
|
1964
|
-
if (
|
1965
|
-
|
1966
|
-
this.$textarea.oldValue = this.$textarea.value;
|
2049
|
+
if (this.$textarea.value !== this.lastInputValue) {
|
2050
|
+
this.lastInputValue = this.$textarea.value;
|
1967
2051
|
this.updateCountMessage();
|
1968
2052
|
}
|
1969
2053
|
};
|
@@ -1973,6 +2057,8 @@
|
|
1973
2057
|
*
|
1974
2058
|
* Helper function to update both the visible and screen reader-specific
|
1975
2059
|
* counters simultaneously (e.g. on init)
|
2060
|
+
*
|
2061
|
+
* @deprecated Will be made private in v5.0
|
1976
2062
|
*/
|
1977
2063
|
CharacterCount.prototype.updateCountMessage = function () {
|
1978
2064
|
this.updateVisibleCountMessage();
|
@@ -1981,6 +2067,8 @@
|
|
1981
2067
|
|
1982
2068
|
/**
|
1983
2069
|
* Update visible count message
|
2070
|
+
*
|
2071
|
+
* @deprecated Will be made private in v5.0
|
1984
2072
|
*/
|
1985
2073
|
CharacterCount.prototype.updateVisibleCountMessage = function () {
|
1986
2074
|
var $textarea = this.$textarea;
|
@@ -2012,6 +2100,8 @@
|
|
2012
2100
|
|
2013
2101
|
/**
|
2014
2102
|
* Update screen reader count message
|
2103
|
+
*
|
2104
|
+
* @deprecated Will be made private in v5.0
|
2015
2105
|
*/
|
2016
2106
|
CharacterCount.prototype.updateScreenReaderCountMessage = function () {
|
2017
2107
|
var $screenReaderCountMessage = this.$screenReaderCountMessage;
|
@@ -2021,7 +2111,7 @@
|
|
2021
2111
|
if (this.isOverThreshold()) {
|
2022
2112
|
$screenReaderCountMessage.removeAttribute('aria-hidden');
|
2023
2113
|
} else {
|
2024
|
-
$screenReaderCountMessage.setAttribute('aria-hidden', true);
|
2114
|
+
$screenReaderCountMessage.setAttribute('aria-hidden', 'true');
|
2025
2115
|
}
|
2026
2116
|
|
2027
2117
|
// Update message
|
@@ -2032,11 +2122,12 @@
|
|
2032
2122
|
* Count the number of characters (or words, if `config.maxwords` is set)
|
2033
2123
|
* in the given text
|
2034
2124
|
*
|
2125
|
+
* @deprecated Will be made private in v5.0
|
2035
2126
|
* @param {string} text - The text to count the characters of
|
2036
2127
|
* @returns {number} the number of characters (or words) in the text
|
2037
2128
|
*/
|
2038
2129
|
CharacterCount.prototype.count = function (text) {
|
2039
|
-
if (this.config.maxwords) {
|
2130
|
+
if ('maxwords' in this.config && this.config.maxwords) {
|
2040
2131
|
var tokens = text.match(/\S+/g) || []; // Matches consecutive non-whitespace chars
|
2041
2132
|
return tokens.length
|
2042
2133
|
} else {
|
@@ -2047,12 +2138,13 @@
|
|
2047
2138
|
/**
|
2048
2139
|
* Get count message
|
2049
2140
|
*
|
2141
|
+
* @deprecated Will be made private in v5.0
|
2050
2142
|
* @returns {string} Status message
|
2051
2143
|
*/
|
2052
2144
|
CharacterCount.prototype.getCountMessage = function () {
|
2053
2145
|
var remainingNumber = this.maxLength - this.count(this.$textarea.value);
|
2054
2146
|
|
2055
|
-
var countType = this.config.maxwords ? 'words' : 'characters';
|
2147
|
+
var countType = 'maxwords' in this.config && this.config.maxwords ? 'words' : 'characters';
|
2056
2148
|
return this.formatCountMessage(remainingNumber, countType)
|
2057
2149
|
};
|
2058
2150
|
|
@@ -2060,6 +2152,7 @@
|
|
2060
2152
|
* Formats the message shown to users according to what's counted
|
2061
2153
|
* and how many remain
|
2062
2154
|
*
|
2155
|
+
* @deprecated Will be made private in v5.0
|
2063
2156
|
* @param {number} remainingNumber - The number of words/characaters remaining
|
2064
2157
|
* @param {string} countType - "words" or "characters"
|
2065
2158
|
* @returns {string} Status message
|
@@ -2081,6 +2174,7 @@
|
|
2081
2174
|
* If there is no configured threshold, it is set to 0 and this function will
|
2082
2175
|
* always return true.
|
2083
2176
|
*
|
2177
|
+
* @deprecated Will be made private in v5.0
|
2084
2178
|
* @returns {boolean} true if the current count is over the config.threshold
|
2085
2179
|
* (or no threshold is set)
|
2086
2180
|
*/
|
@@ -2112,10 +2206,10 @@
|
|
2112
2206
|
*
|
2113
2207
|
* @typedef {object} CharacterCountConfigWithMaxLength
|
2114
2208
|
* @property {number} [maxlength] - The maximum number of characters.
|
2115
|
-
*
|
2209
|
+
* If maxwords is provided, the maxlength option will be ignored.
|
2116
2210
|
* @property {number} [threshold = 0] - The percentage value of the limit at
|
2117
|
-
*
|
2118
|
-
*
|
2211
|
+
* which point the count message is displayed. If this attribute is set, the
|
2212
|
+
* count message will be hidden by default.
|
2119
2213
|
* @property {CharacterCountTranslations} [i18n = CHARACTER_COUNT_TRANSLATIONS] - See constant {@link CHARACTER_COUNT_TRANSLATIONS}
|
2120
2214
|
*/
|
2121
2215
|
|
@@ -2124,10 +2218,10 @@
|
|
2124
2218
|
*
|
2125
2219
|
* @typedef {object} CharacterCountConfigWithMaxWords
|
2126
2220
|
* @property {number} [maxwords] - The maximum number of words. If maxwords is
|
2127
|
-
*
|
2221
|
+
* provided, the maxlength option will be ignored.
|
2128
2222
|
* @property {number} [threshold = 0] - The percentage value of the limit at
|
2129
|
-
*
|
2130
|
-
*
|
2223
|
+
* which point the count message is displayed. If this attribute is set, the
|
2224
|
+
* count message will be hidden by default.
|
2131
2225
|
* @property {CharacterCountTranslations} [i18n = CHARACTER_COUNT_TRANSLATIONS] - See constant {@link CHARACTER_COUNT_TRANSLATIONS}
|
2132
2226
|
*/
|
2133
2227
|
|