govuk_publishing_components 17.21.0 → 18.0.0
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/all_components.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/error-summary.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/radio.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +1 -1
- data/app/assets/stylesheets/component_guide/application.scss +5 -7
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +5 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +3 -15
- data/app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +28 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/_date-input.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_details.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +1 -13
- data/app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_file-upload.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_hint.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +18 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_inset-text.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_label.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +6 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_modal-dialogue.scss +8 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +6 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +10 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_select.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_skip-link.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +17 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +8 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +5 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_advisory.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_call-to-action.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_example.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_fraction.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_information-callout.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_legislative-list.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_media-player.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_govuk-frontend-settings.scss +0 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +4 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_variables.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +1 -1
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +14 -12
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_button.html.erb +16 -2
- data/app/views/govuk_publishing_components/components/_character_count.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/_details.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_error_summary.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_tabs.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_textarea.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_title.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/button.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/contents_list.yml +12 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/fieldset.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/label.yml +4 -1
- data/app/views/govuk_publishing_components/components/docs/table.yml +1 -0
- data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +2 -2
- data/config/initializers/assets.rb +3 -3
- data/config/locales/en.yml +0 -2
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/README.md +4 -9
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +4 -5
- data/node_modules/govuk-frontend/{all-ie8.scss → govuk/all-ie8.scss} +0 -0
- data/node_modules/govuk-frontend/{all.js → govuk/all.js} +116 -63
- data/node_modules/govuk-frontend/{all.scss → govuk/all.scss} +0 -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/{assets → govuk/assets}/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-apple-touch-icon-152x152.png +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-apple-touch-icon-167x167.png +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-apple-touch-icon-180x180.png +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-apple-touch-icon.png +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-crest-2x.png +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-crest.png +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-logotype-crown.png +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-mask-icon.svg +0 -0
- data/node_modules/govuk-frontend/{assets → govuk/assets}/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/{common.js → govuk/common.js} +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/_all.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/accordion/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/accordion/_accordion.scss +48 -28
- data/node_modules/govuk-frontend/{components → govuk/components}/accordion/accordion.js +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/accordion/macro-options.json +8 -2
- data/node_modules/govuk-frontend/{components → govuk/components}/accordion/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/accordion/template.njk +1 -3
- data/node_modules/govuk-frontend/{components → govuk/components}/back-link/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/back-link/_back-link.scss +17 -9
- data/node_modules/govuk-frontend/{components → govuk/components}/back-link/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/back-link/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/back-link/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/breadcrumbs/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/breadcrumbs/_breadcrumbs.scss +10 -11
- data/node_modules/govuk-frontend/{components → govuk/components}/breadcrumbs/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/breadcrumbs/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/breadcrumbs/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/button/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/button/_button.scss +76 -46
- data/node_modules/govuk-frontend/{components → govuk/components}/button/button.js +168 -17
- data/node_modules/govuk-frontend/{components → govuk/components}/button/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/button/macro.njk +0 -0
- data/node_modules/govuk-frontend/govuk/components/button/template.njk +60 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/character-count/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/character-count/_character-count.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/character-count/character-count.js +5 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/character-count/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/character-count/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/character-count/template.njk +2 -2
- data/node_modules/govuk-frontend/{components → govuk/components}/checkboxes/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/checkboxes/_checkboxes.scss +4 -6
- data/node_modules/govuk-frontend/{components → govuk/components}/checkboxes/checkboxes.js +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/checkboxes/macro-options.json +6 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/checkboxes/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/checkboxes/template.njk +18 -5
- data/node_modules/govuk-frontend/{components → govuk/components}/date-input/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/date-input/_date-input.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/date-input/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/date-input/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/date-input/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/details/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/details/_details.scss +12 -13
- data/node_modules/govuk-frontend/{components → govuk/components}/details/details.js +3 -4
- data/node_modules/govuk-frontend/{components → govuk/components}/details/implementation.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/details/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/details/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/details/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/error-message/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-message/_error-message.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-message/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-message/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-message/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-summary/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-summary/_error-summary.scss +4 -17
- data/node_modules/govuk-frontend/{components → govuk/components}/error-summary/error-summary.js +0 -10
- data/node_modules/govuk-frontend/{components → govuk/components}/error-summary/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-summary/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/error-summary/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/fieldset/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/fieldset/_fieldset.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/fieldset/macro-options.json +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/fieldset/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/fieldset/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/file-upload/README.md +0 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/_file-upload.scss +81 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/file-upload/macro-options.json +6 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/file-upload/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/file-upload/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/footer/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/footer/_footer.scss +47 -16
- data/node_modules/govuk-frontend/{components → govuk/components}/footer/macro-options.json +5 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/footer/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/footer/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/header/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/header/_header.scss +34 -21
- data/node_modules/govuk-frontend/{components → govuk/components}/header/header.js +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/header/macro-options.json +2 -2
- data/node_modules/govuk-frontend/{components → govuk/components}/header/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/header/template.njk +6 -9
- data/node_modules/govuk-frontend/{components → govuk/components}/hint/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/hint/_hint.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/hint/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/hint/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/hint/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/input/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/input/_input.scss +24 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/input/macro-options.json +6 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/input/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/input/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/inset-text/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/inset-text/_inset-text.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/inset-text/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/inset-text/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/inset-text/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/label/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/label/_label.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/label/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/label/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/label/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/panel/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/panel/_panel.scss +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/panel/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/panel/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/panel/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/phase-banner/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/phase-banner/_phase-banner.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/phase-banner/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/phase-banner/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/phase-banner/template.njk +5 -7
- data/node_modules/govuk-frontend/{components → govuk/components}/radios/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/radios/_radios.scss +7 -9
- data/node_modules/govuk-frontend/{components → govuk/components}/radios/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/radios/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/radios/radios.js +24 -11
- data/node_modules/govuk-frontend/{components → govuk/components}/radios/template.njk +15 -5
- data/node_modules/govuk-frontend/{components → govuk/components}/select/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/select/_select.scss +23 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/select/macro-options.json +6 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/select/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/select/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/skip-link/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/skip-link/_skip-link.scss +6 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/skip-link/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/skip-link/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/skip-link/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/summary-list/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/summary-list/_summary-list.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/summary-list/macro-options.json +7 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/summary-list/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/summary-list/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/table/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/table/_table.scss +1 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/table/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/table/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/table/template.njk +14 -14
- data/node_modules/govuk-frontend/{components → govuk/components}/tabs/README.md +0 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/_tabs.scss +142 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/tabs/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/tabs/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/tabs/tabs.js +59 -5
- data/node_modules/govuk-frontend/{components → govuk/components}/tabs/template.njk +4 -6
- data/node_modules/govuk-frontend/{components → govuk/components}/tag/README.md +0 -0
- data/node_modules/govuk-frontend/govuk/components/tag/_tag.scss +44 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/tag/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/tag/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/tag/template.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/textarea/README.md +0 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/_textarea.scss +55 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/textarea/macro-options.json +6 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/textarea/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/textarea/template.njk +1 -1
- data/node_modules/govuk-frontend/{components → govuk/components}/warning-text/README.md +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/warning-text/_warning-text.scss +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/warning-text/macro-options.json +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/warning-text/macro.njk +0 -0
- data/node_modules/govuk-frontend/{components → govuk/components}/warning-text/template.njk +0 -0
- data/node_modules/govuk-frontend/{core → govuk/core}/_all.scss +0 -0
- data/node_modules/govuk-frontend/{core → govuk/core}/_global-styles.scss +0 -0
- data/node_modules/govuk-frontend/{core → govuk/core}/_links.scss +0 -0
- data/node_modules/govuk-frontend/{core → govuk/core}/_lists.scss +0 -0
- data/node_modules/govuk-frontend/{core → govuk/core}/_section-break.scss +0 -0
- data/node_modules/govuk-frontend/{core → govuk/core}/_template.scss +0 -0
- data/node_modules/govuk-frontend/{core → govuk/core}/_typography.scss +0 -0
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_all.scss +1 -1
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_clearfix.scss +0 -0
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_colour.scss +23 -1
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_device-pixels.scss +0 -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 +60 -0
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_links.scss +15 -1
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_media-queries.scss +0 -0
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_shape-arrow.scss +0 -0
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_spacing.scss +0 -0
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_typography.scss +23 -5
- data/node_modules/govuk-frontend/{helpers → govuk/helpers}/_visually-hidden.scss +4 -2
- data/node_modules/govuk-frontend/{objects → govuk/objects}/_all.scss +0 -0
- data/node_modules/govuk-frontend/{objects → govuk/objects}/_form-group.scss +0 -0
- data/node_modules/govuk-frontend/{objects → govuk/objects}/_grid.scss +2 -2
- data/node_modules/govuk-frontend/{objects → govuk/objects}/_main-wrapper.scss +15 -1
- data/node_modules/govuk-frontend/{objects → govuk/objects}/_width-container.scss +0 -0
- data/node_modules/govuk-frontend/{overrides → govuk/overrides}/_all.scss +0 -0
- data/node_modules/govuk-frontend/{overrides → govuk/overrides}/_display.scss +0 -0
- data/node_modules/govuk-frontend/{overrides → govuk/overrides}/_spacing.scss +0 -0
- data/node_modules/govuk-frontend/{overrides → govuk/overrides}/_typography.scss +0 -0
- data/node_modules/govuk-frontend/{overrides → govuk/overrides}/_width.scss +0 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_all.scss +0 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_assets.scss +0 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_colours-applied.scss +9 -8
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_colours-organisations.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +101 -0
- data/node_modules/govuk-frontend/govuk/settings/_compatibility.scss +75 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_global-styles.scss +0 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_ie8.scss +0 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_measurements.scss +2 -2
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_media-queries.scss +0 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_spacing.scss +0 -0
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_typography-font-families.scss +11 -1
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_typography-font.scss +27 -7
- data/node_modules/govuk-frontend/{settings → govuk/settings}/_typography-responsive.scss +9 -10
- data/node_modules/govuk-frontend/{template.njk → govuk/template.njk} +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_all.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_compatibility.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_exports.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_font-url.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_ie8.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_iff.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_image-url.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_px-to-em.scss +0 -0
- data/node_modules/govuk-frontend/{tools → govuk/tools}/_px-to-rem.scss +0 -0
- data/node_modules/govuk-frontend/{utilities → govuk/utilities}/_all.scss +0 -0
- data/node_modules/govuk-frontend/{utilities → govuk/utilities}/_clearfix.scss +0 -0
- data/node_modules/govuk-frontend/{utilities → govuk/utilities}/_visually-hidden.scss +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/_sass-mq.scss +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/DOMTokenList.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Document.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Element.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Element/prototype/classList.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Element/prototype/closest.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Element/prototype/matches.js +0 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +259 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +257 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Event.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Function/prototype/bind.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Object/defineProperty.js +0 -0
- data/node_modules/govuk-frontend/{vendor → govuk/vendor}/polyfills/Window.js +0 -0
- data/node_modules/govuk-frontend/package.json +21 -21
- data/node_modules/react-is/README.md +2 -12
- data/node_modules/react-is/build-info.json +5 -5
- data/node_modules/react-is/cjs/react-is.development.js +7 -2
- data/node_modules/react-is/cjs/react-is.production.min.js +6 -6
- data/node_modules/react-is/package.json +13 -13
- data/node_modules/react-is/umd/react-is.development.js +7 -2
- data/node_modules/react-is/umd/react-is.production.min.js +5 -5
- data/node_modules/type/CHANGELOG.md +62 -50
- data/node_modules/type/LICENSE +15 -0
- data/node_modules/type/README.md +19 -19
- data/node_modules/type/error/is.js +28 -7
- data/node_modules/type/package.json +36 -22
- data/node_modules/type/test/error/is.js +13 -5
- metadata +247 -344
- data/app/assets/javascripts/govuk_publishing_components/components/accessible-autocomplete.js +0 -79
- data/app/assets/stylesheets/govuk_publishing_components/components/_accessible-autocomplete.scss +0 -41
- data/app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb +0 -35
- data/app/views/govuk_publishing_components/components/docs/accessible_autocomplete.yml +0 -49
- data/node_modules/accessible-autocomplete/CHANGELOG.md +0 -269
- data/node_modules/accessible-autocomplete/CONTRIBUTING.md +0 -150
- data/node_modules/accessible-autocomplete/LICENSE.txt +0 -20
- data/node_modules/accessible-autocomplete/Procfile +0 -1
- data/node_modules/accessible-autocomplete/README.md +0 -416
- data/node_modules/accessible-autocomplete/accessibility-criteria.md +0 -42
- data/node_modules/accessible-autocomplete/app.json +0 -15
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.css +0 -1
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js +0 -2
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js.map +0 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js +0 -2
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js.map +0 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js +0 -2
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js.map +0 -1
- data/node_modules/accessible-autocomplete/examples/form.html +0 -671
- data/node_modules/accessible-autocomplete/examples/index.html +0 -665
- data/node_modules/accessible-autocomplete/examples/multiselect.html +0 -134
- data/node_modules/accessible-autocomplete/examples/preact/index.html +0 -346
- data/node_modules/accessible-autocomplete/examples/react/index.html +0 -347
- data/node_modules/accessible-autocomplete/package-lock.json +0 -14491
- data/node_modules/accessible-autocomplete/package.json +0 -173
- data/node_modules/accessible-autocomplete/preact.js +0 -1
- data/node_modules/accessible-autocomplete/react.js +0 -1
- data/node_modules/accessible-autocomplete/scripts/check-staged.js +0 -14
- data/node_modules/accessible-autocomplete/src/autocomplete.css +0 -192
- data/node_modules/accessible-autocomplete/src/autocomplete.js +0 -618
- data/node_modules/accessible-autocomplete/src/dropdown-arrow-down.js +0 -11
- data/node_modules/accessible-autocomplete/src/status.js +0 -80
- data/node_modules/accessible-autocomplete/src/wrapper.js +0 -76
- data/node_modules/accessible-autocomplete/test/functional/dropdown-arrow-down.js +0 -44
- data/node_modules/accessible-autocomplete/test/functional/index.js +0 -485
- data/node_modules/accessible-autocomplete/test/functional/wrapper.js +0 -318
- data/node_modules/accessible-autocomplete/test/integration/index.js +0 -188
- data/node_modules/accessible-autocomplete/test/karma.config.js +0 -42
- data/node_modules/accessible-autocomplete/test/wdio.config.js +0 -80
- data/node_modules/accessible-autocomplete/webpack.config.babel.js +0 -193
- data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
- data/node_modules/govuk-frontend/components/button/template.njk +0 -35
- data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +0 -19
- data/node_modules/govuk-frontend/components/tabs/_tabs.scss +0 -130
- data/node_modules/govuk-frontend/components/tag/_tag.scss +0 -33
- data/node_modules/govuk-frontend/components/textarea/_textarea.scss +0 -32
- data/node_modules/govuk-frontend/helpers/_focusable.scss +0 -34
- data/node_modules/govuk-frontend/helpers/_font-faces.scss +0 -67
- data/node_modules/govuk-frontend/helpers/_grid.scss +0 -107
- data/node_modules/govuk-frontend/settings/_colours-palette.scss +0 -37
- data/node_modules/govuk-frontend/settings/_compatibility.scss +0 -51
- data/node_modules/preact/LICENSE +0 -21
- data/node_modules/preact/README.md +0 -592
- data/node_modules/preact/debug.js +0 -740
- data/node_modules/preact/debug.js.map +0 -1
- data/node_modules/preact/debug/dist/debug.js +0 -2
- data/node_modules/preact/debug/dist/debug.js.map +0 -1
- data/node_modules/preact/debug/dist/debug.mjs +0 -681
- data/node_modules/preact/debug/dist/debug.mjs.map +0 -1
- data/node_modules/preact/debug/dist/debug.module.js +0 -2
- data/node_modules/preact/debug/dist/debug.module.js.map +0 -1
- data/node_modules/preact/debug/dist/debug.umd.js +0 -2
- data/node_modules/preact/debug/dist/debug.umd.js.map +0 -1
- data/node_modules/preact/debug/index.js +0 -122
- data/node_modules/preact/devtools.js +0 -403
- data/node_modules/preact/devtools.js.map +0 -1
- data/node_modules/preact/devtools/devtools.js +0 -395
- data/node_modules/preact/devtools/index.js +0 -4
- data/node_modules/preact/dist/preact.d.ts +0 -1712
- data/node_modules/preact/dist/preact.dev.js +0 -727
- data/node_modules/preact/dist/preact.dev.js.map +0 -1
- data/node_modules/preact/dist/preact.js +0 -414
- data/node_modules/preact/dist/preact.js.flow +0 -25
- data/node_modules/preact/dist/preact.js.map +0 -1
- data/node_modules/preact/dist/preact.min.js +0 -2
- data/node_modules/preact/dist/preact.min.js.map +0 -1
- data/node_modules/preact/dist/preact.mjs +0 -724
- data/node_modules/preact/dist/preact.mjs.map +0 -1
- data/node_modules/preact/dist/preact.umd.js +0 -751
- data/node_modules/preact/dist/preact.umd.js.map +0 -1
- data/node_modules/preact/package.json +0 -226
- data/node_modules/preact/src/clone-element.js +0 -18
- data/node_modules/preact/src/component.js +0 -90
- data/node_modules/preact/src/constants.js +0 -17
- data/node_modules/preact/src/dom/index.js +0 -139
- data/node_modules/preact/src/h.js +0 -86
- data/node_modules/preact/src/options.js +0 -22
- data/node_modules/preact/src/preact.d.ts +0 -1712
- data/node_modules/preact/src/preact.js +0 -32
- data/node_modules/preact/src/preact.js.flow +0 -25
- data/node_modules/preact/src/render-queue.js +0 -27
- data/node_modules/preact/src/render.js +0 -22
- data/node_modules/preact/src/util.js +0 -30
- data/node_modules/preact/src/vdom/component-recycler.js +0 -48
- data/node_modules/preact/src/vdom/component.js +0 -296
- data/node_modules/preact/src/vdom/diff.js +0 -337
- data/node_modules/preact/src/vdom/index.js +0 -54
- data/node_modules/preact/src/vnode.js +0 -9
- data/node_modules/preact/typings.json +0 -5
@@ -1,173 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_args": [
|
3
|
-
[
|
4
|
-
{
|
5
|
-
"raw": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
6
|
-
"scope": null,
|
7
|
-
"escapedName": "accessible-autocomplete",
|
8
|
-
"name": "accessible-autocomplete",
|
9
|
-
"rawSpec": "git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
10
|
-
"spec": "git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
11
|
-
"type": "hosted",
|
12
|
-
"hosted": {
|
13
|
-
"type": "github",
|
14
|
-
"ssh": "git@github.com:alphagov/accessible-autocomplete.git#add-multiselect-support",
|
15
|
-
"sshUrl": "git+ssh://git@github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
16
|
-
"httpsUrl": "git+https://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
17
|
-
"gitUrl": "git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
18
|
-
"shortcut": "github:alphagov/accessible-autocomplete#add-multiselect-support",
|
19
|
-
"directUrl": "https://raw.githubusercontent.com/alphagov/accessible-autocomplete/add-multiselect-support/package.json"
|
20
|
-
}
|
21
|
-
},
|
22
|
-
"/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ"
|
23
|
-
]
|
24
|
-
],
|
25
|
-
"_from": "git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
26
|
-
"_id": "accessible-autocomplete@1.6.2",
|
27
|
-
"_inCache": true,
|
28
|
-
"_location": "/accessible-autocomplete",
|
29
|
-
"_phantomChildren": {},
|
30
|
-
"_requested": {
|
31
|
-
"raw": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
32
|
-
"scope": null,
|
33
|
-
"escapedName": "accessible-autocomplete",
|
34
|
-
"name": "accessible-autocomplete",
|
35
|
-
"rawSpec": "git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
36
|
-
"spec": "git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
37
|
-
"type": "hosted",
|
38
|
-
"hosted": {
|
39
|
-
"type": "github",
|
40
|
-
"ssh": "git@github.com:alphagov/accessible-autocomplete.git#add-multiselect-support",
|
41
|
-
"sshUrl": "git+ssh://git@github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
42
|
-
"httpsUrl": "git+https://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
43
|
-
"gitUrl": "git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
44
|
-
"shortcut": "github:alphagov/accessible-autocomplete#add-multiselect-support",
|
45
|
-
"directUrl": "https://raw.githubusercontent.com/alphagov/accessible-autocomplete/add-multiselect-support/package.json"
|
46
|
-
}
|
47
|
-
},
|
48
|
-
"_requiredBy": [
|
49
|
-
"/"
|
50
|
-
],
|
51
|
-
"_resolved": "git://github.com/alphagov/accessible-autocomplete.git#3523dd9fffc70cbd9f6f555f75863c33a709f49e",
|
52
|
-
"_shasum": "e84aa32f47a3675f17c583385901d70c398b19d2",
|
53
|
-
"_shrinkwrap": null,
|
54
|
-
"_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
55
|
-
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
|
56
|
-
"author": {
|
57
|
-
"name": "Government Digital Service",
|
58
|
-
"url": "https://www.gov.uk/government/organisations/government-digital-service"
|
59
|
-
},
|
60
|
-
"browserslist": [
|
61
|
-
">0.1%",
|
62
|
-
"last 2 Chrome versions",
|
63
|
-
"last 2 Firefox versions",
|
64
|
-
"last 2 Edge versions",
|
65
|
-
"last 2 Samsung versions",
|
66
|
-
"Safari >= 9",
|
67
|
-
"ie 8-11",
|
68
|
-
"iOS >= 9"
|
69
|
-
],
|
70
|
-
"bugs": {
|
71
|
-
"url": "https://github.com/alphagov/accessible-autocomplete/issues"
|
72
|
-
},
|
73
|
-
"dependencies": {
|
74
|
-
"preact": "^8.3.1"
|
75
|
-
},
|
76
|
-
"description": "An autocomplete component, built to be accessible.",
|
77
|
-
"devDependencies": {
|
78
|
-
"@babel/core": "^7.1.5",
|
79
|
-
"@babel/plugin-proposal-class-properties": "^7.1.0",
|
80
|
-
"@babel/plugin-proposal-decorators": "^7.1.2",
|
81
|
-
"@babel/plugin-transform-member-expression-literals": "^7.0.0",
|
82
|
-
"@babel/plugin-transform-modules-commonjs": "^7.1.0",
|
83
|
-
"@babel/plugin-transform-property-literals": "^7.0.0",
|
84
|
-
"@babel/plugin-transform-react-jsx": "^7.0.0",
|
85
|
-
"@babel/preset-env": "^7.1.5",
|
86
|
-
"@babel/register": "^7.0.0",
|
87
|
-
"babel-eslint": "^10.0.1",
|
88
|
-
"babel-loader": "^8.0.4",
|
89
|
-
"babel-plugin-istanbul": "^5.1.0",
|
90
|
-
"chai": "^4.2.0",
|
91
|
-
"chalk": "^2.4.1",
|
92
|
-
"copy-webpack-plugin": "^4.6.0",
|
93
|
-
"coveralls": "^3.0.2",
|
94
|
-
"cross-env": "^5.2.0",
|
95
|
-
"csso-cli": "^1.1.0",
|
96
|
-
"dotenv": "^6.1.0",
|
97
|
-
"husky": "^1.1.3",
|
98
|
-
"karma": "^3.1.1",
|
99
|
-
"karma-chai": "^0.1.0",
|
100
|
-
"karma-chai-sinon": "^0.1.5",
|
101
|
-
"karma-chrome-launcher": "^2.2.0",
|
102
|
-
"karma-coverage": "^1.1.2",
|
103
|
-
"karma-mocha": "^1.0.1",
|
104
|
-
"karma-mocha-reporter": "^2.2.5",
|
105
|
-
"karma-sourcemap-loader": "^0.3.7",
|
106
|
-
"karma-webpack": "^4.0.0-rc.2",
|
107
|
-
"mocha": "^5.2.0",
|
108
|
-
"npm-run-all": "^4.1.5",
|
109
|
-
"puppeteer": "^1.10.0",
|
110
|
-
"replace-bundle-webpack-plugin": "^1.0.0",
|
111
|
-
"sinon": "^6.3.5",
|
112
|
-
"sinon-chai": "^3.2.0",
|
113
|
-
"source-map-loader": "^0.2.4",
|
114
|
-
"standard": "^12.0.1",
|
115
|
-
"uglifyjs-webpack-plugin": "^2.0.1",
|
116
|
-
"wdio-mocha-framework": "^0.6.4",
|
117
|
-
"wdio-sauce-service": "^0.4.13",
|
118
|
-
"wdio-selenium-standalone-service": "^0.0.10",
|
119
|
-
"wdio-spec-reporter": "^0.1.5",
|
120
|
-
"wdio-static-server-service": "^1.0.1",
|
121
|
-
"wdio-webpack-dev-server-service": "^2.0.2",
|
122
|
-
"webdriverio": "^4.14.0",
|
123
|
-
"webpack": "^4.25.1",
|
124
|
-
"webpack-cli": "^3.1.2",
|
125
|
-
"webpack-dev-middleware": "^3.4.0",
|
126
|
-
"webpack-dev-server": "^3.1.10",
|
127
|
-
"webpack-sources": "^1.3.0"
|
128
|
-
},
|
129
|
-
"gitHead": "3523dd9fffc70cbd9f6f555f75863c33a709f49e",
|
130
|
-
"homepage": "https://github.com/alphagov/accessible-autocomplete#readme",
|
131
|
-
"husky": {
|
132
|
-
"hooks": {
|
133
|
-
"pre-push": "npm run build && node scripts/check-staged.js"
|
134
|
-
}
|
135
|
-
},
|
136
|
-
"keywords": [
|
137
|
-
"a11y",
|
138
|
-
"accessibility",
|
139
|
-
"autocomplete",
|
140
|
-
"component",
|
141
|
-
"plugin",
|
142
|
-
"typeahead",
|
143
|
-
"widget"
|
144
|
-
],
|
145
|
-
"license": "MIT",
|
146
|
-
"main": "dist/accessible-autocomplete.min.js",
|
147
|
-
"name": "accessible-autocomplete",
|
148
|
-
"optionalDependencies": {},
|
149
|
-
"readme": "# Accessible autocomplete\n\n[![npm version](https://img.shields.io/npm/v/accessible-autocomplete.svg)](http://npm.im/accessible-autocomplete)\n[![Build Status](https://travis-ci.org/alphagov/accessible-autocomplete.svg?branch=master)](https://travis-ci.org/alphagov/accessible-autocomplete)\n[![Coverage Status](https://coveralls.io/repos/github/alphagov/accessible-autocomplete/badge.svg?branch=master)](https://coveralls.io/github/alphagov/accessible-autocomplete?branch=master)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![Greenkeeper badge](https://badges.greenkeeper.io/alphagov/accessible-autocomplete.svg)](https://greenkeeper.io/)\n[![gzip size](http://img.badgesize.io/https://unpkg.com/accessible-autocomplete/dist/accessible-autocomplete.min.js?compression=gzip)](https://unpkg.com/accessible-autocomplete/dist/accessible-autocomplete.min.js)\n\n[![Sauce Labs Build Status](https://saucelabs.com/browser-matrix/tvararu-alphagov.svg)](https://saucelabs.com/u/tvararu-alphagov)\n\n`accessible-autocomplete` is a JavaScript autocomplete built from the ground up to be accessible. The design goals are:\n\n- **Accessibility**: Following WAI-ARIA best practices and testing with assistive technologies.\n- **User experience**: Supporting a wide variety of user needs.\n- **Compatibility**: Working with as many browsers, devices, and assistive technologies as possible.\n\n[Try out the examples!](https://alphagov.github.io/accessible-autocomplete/examples/)\n\n## Installation / usage\n\n### Using npm and a module system\n\nInstall it by running:\n\n```bash\nnpm install --save accessible-autocomplete\n```\n\nThe `accessibleAutocomplete` function will render an autocomplete `<input>` and its accompanying suggestions and `aria-live` region. Your page should provide a `<label>` and a container element:\n\n```html\n<label for=\"my-autocomplete\">Select your country</label>\n<div id=\"my-autocomplete-container\"></div>\n```\n\nThen import it using a module system like Browserify / Webpack / Rollup, and call the `accessibleAutocomplete` function, providing an array of values:\n\n```js\nimport accessibleAutocomplete from 'accessible-autocomplete'\n\nconst countries = [\n 'France',\n 'Germany',\n 'United Kingdom'\n]\n\naccessibleAutocomplete({\n element: document.querySelector('#my-autocomplete-container'),\n id: 'my-autocomplete', // To match it to the existing <label>.\n source: countries\n})\n```\n\nIf you want to use it as a replacement for a `<select>` element, read the [Progressive enhancement](#progressive-enhancement) section.\n\n### As a plain JavaScript module\n\nYou can copy the [dist/accessible-autocomplete.min.js](dist/accessible-autocomplete.min.js) file to your JavaScript folder and import it into the browser:\n\n```html\n<script type=\"text/javascript\" src=\"assets/js/accessible-autocomplete.min.js\"></script>\n```\n\n### Styling the autocomplete\n\nA stylesheet is included with the package at [dist/accessible-autocomplete.min.css](dist/accessible-autocomplete.min.css).\n\nYou can copy it to your stylesheets folder and import it into the browser:\n\n```html\n<link rel=\"stylesheet\" href=\"assets/css/accessible-autocomplete.min.css\" />\n```\n\nYou can also import it using Sass:\n\n```css\n@import \"accessible-autocomplete\";\n```\n\n### Using with Preact\n\nIf you already use Preact in your application, you can import a bundle that will use that:\n\n```js\nimport preact from 'preact'\nimport Autocomplete from 'accessible-autocomplete/preact'\n\npreact.render(\n <Autocomplete id='autocomplete' source={suggest} />,\n document.querySelector('#container')\n)\n```\n\n[Try out the Preact example!](https://alphagov.github.io/accessible-autocomplete/examples/preact/)\n\n### Using with React\n\nIf you already use React in your application, you can import a bundle that will use that:\n\n```js\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport Autocomplete from 'accessible-autocomplete/react'\n\nReactDOM.render(\n <Autocomplete id='autocomplete' source={suggest} />,\n document.querySelector('#container')\n)\n```\n\n[Try out the React example!](https://alphagov.github.io/accessible-autocomplete/examples/react/)\n\n#### React versions\n\nReact v15.5.4 has been tested to work with the Accessible Autocomplete - although make sure to check\nout [documented issues](https://github.com/alphagov/accessible-autocomplete/issues).\n\nReact v15.6.2 and 16.0 have been incompletely tested with the Accessible Autocomplete: while no undocumented issues were found, we recommend you carry out thorough testing if you wish to use these or later versions of React.\n\n## API documentation\n\n### Required options\n\n#### `element`\n\nType: `HTMLElement`\n\nThe container element in which the autocomplete will be rendered in.\n\n#### `id`\n\nType: `string`\n\nThe `id` to assign to the autocomplete input field, to use with a `<label for=id>`. Not required if using `enhanceSelectElement`.\n\n#### `source`\n\nType: `Array | Function`\n\nAn array of values to search when the user types in the input field, or a function to take what the user types and call a callback function with the results to be displayed.\n\nAn example of an array of values:\n\n```js\nconst countries = [\n 'France',\n 'Germany',\n 'United Kingdom'\n]\n```\n\nIf `source` is a function, the arguments are: `query: string, populateResults: Function`\n\nSimilar to the [`source` argument for typeahead.js](https://github.com/corejavascript/typeahead.js/blob/47d46b40cb834d8285ac9328c4b436e5eccf7197/doc/jquery_typeahead.md#datasets), a backing data source for suggestions. `query` is what gets typed into the input field, which will callback to `populateResults` synchronously with the array of string results to display in the menu.\n\nAn example of a simple suggestion engine:\n\n```js\nfunction suggest (query, populateResults) {\n const results = [\n 'France',\n 'Germany',\n 'United Kingdom'\n ]\n const filteredResults = results.filter(result => result.indexOf(query) !== -1)\n populateResults(filteredResults)\n}\n```\n\n### Other options\n\n#### `autoselect` (default: `false`)\n\nType: `Boolean`\n\nSet to true to highlight the first option when the user types in something and receives results. Pressing enter will select it.\n\n#### `confirmOnBlur` (default: `true`)\n\nType: `Boolean`\n\nThe autocomplete will confirm the currently selected option when the user clicks outside of the component. Set to `false` to disable.\n\n#### `cssNamespace` (default: `'autocomplete'`)\n\nType: `string`\n\nUse this property to override the [BEM](http://getbem.com/) block name that the JavaScript component will use. You will need to rewrite the CSS class names to use your specified block name.\n\n#### `defaultValue` (default: `''`)\n\nType: `string`\n\nSpecify a string to prefill the autocomplete with.\n\n#### `displayMenu` (default: `'inline'`)\n\nType: `'inline' | 'overlay'`\n\nYou can set this property to specify the way the menu should appear, whether inline or as an overlay.\n\n#### `minLength` (default: `0`)\n\nType: `number`\n\nThe minimum number of characters that should be entered before the autocomplete will attempt to suggest options. When the query length is under this, the aria status region will also provide helpful text to the user informing them they should type in more.\n\n#### `name` (default: `'input-autocomplete'`)\n\nType: `string`\n\nThe `name` for the autocomplete input field, to use with a parent `<form>`.\n\n#### `onConfirm` (default: `() => {}`)\n\nType: `Function`\n\nArguments: `confirmed: Object`\n\nThis function will be called when the user confirms an option, with the option they've confirmed.\n\n#### `placeholder` (default: `''`) :warning: not recommended :warning:\n\nType: `string`\n\nThis option will populate the `placeholder` attribute on the input element.\n\nWe think [placeholders have usability issues](http://adamsilver.io/articles/placeholders-are-problematic/) and that there are [better alternatives to input placeholder text](https://govuk-elements.herokuapp.com/form-elements/#form-hint-text), so we do not recommend using this option.\n\n#### `required` (default: `false`)\n\nType: `Boolean`\n\nThe input field will be rendered with a `required` attribute, see [W3C `required` attribute definition](https://www.w3.org/TR/html5/forms.html#the-required-attribute).\n\n#### `showAllValues` (default: `false`)\n\nType: `Boolean`\n\nIf this is set to `true`, all values are shown when the user clicks the input. This is similar\nto a default dropdown, so the autocomplete is rendered with a dropdown arrow to convey\nthis behaviour.\n\n#### `showNoOptionsFound` (default: `true`)\n\nType: `Boolean`\n\nThe autocomplete will display a \"No results found\" template when there are no results. Set to `false` to disable.\n\n#### `templates` (default: `undefined`)\n\nType:\n\n```js\n{\n inputValue: Function,\n suggestion: Function\n}\n```\n\nThis object defines templates (functions) that are used for displaying parts of the autocomplete.\n\n`inputValue` is a function that receives one argument, the currently selected suggestion. It returns the string value to be inserted into the input.\n\n`suggestion` is a function that receives one argument, a suggestion to be displayed. It is used when rendering suggestions, and should return a string, which can contain HTML. :warning: **Caution:** because this function allows you to output arbitrary HTML, you should [make sure it's trusted](https://en.wikipedia.org/wiki/Cross-site_scripting), and accessible.\n\n#### `dropdownArrow` (default: A rectangle pointing down)\n\nType: `Function`\n\nA function that gets passed an object with the property `className` (`{ className: '' }`) and should return a string of HTML or a (P)React element. :warning: **Caution:** because this function allows you to output arbitrary HTML, you should [make sure it's trusted](https://en.wikipedia.org/wiki/Cross-site_scripting), and accessible.\n\n### Internationalization\n\n#### `tNoResults` (default: `() => 'No results found'`)\n\nType: `Function`\n\nA function that receives no arguments and should return the text used in the dropdown to indicate that there are no results.\n\n#### `tStatusQueryTooShort` (default: `` (minQueryLength) => `Type in ${minQueryLength} or more characters for results.` ``)\n\nType: `Function`\n\nA function that receives one argument that indicates the minimal amount of characters needed for the dropdown to trigger and should return the text used in the accessibility hint to indicate that the query is too short.\n\n#### `tStatusNoResults` (default: `() => 'No search results.'`)\n\nType: `Function`\n\nA function that receives no arguments and should return the text that is used in the accessibility hint to indicate that there are no results.\n\n#### `tStatusSelectedOption` (default: `` (selectedOption, length, index) => `${selectedOption} (${index + 1} of ${length}) is selected.` ``)\n\nType: `Function`\n\nA function that receives two arguments, the selectedOption and the amount of available options, and it should return the text used in the accessibility hint to indicate which option is selected.\n\n#### `tStatusResults`\n\nDefault:\n\n```js\n(length, contentSelectedOption) => {\n const words = {\n result: (length === 1) ? 'result' : 'results',\n is: (length === 1) ? 'is' : 'are'\n }\n\n return <span>{length} {words.result} {words.is} available. {contentSelectedOption}</span>\n}\n```\n\nType: `Function`\n\nA function that receives two arguments, the count of available options and the return value of `tStatusSelectedOption`, and should return the text used in the accessibility hint to indicate which options are available and which is selected.\n\n## Progressive enhancement\n\nIf your autocomplete is meant to select from a small list of options (a few hundred), we strongly suggest that you render a `<select>` menu on the server, and use progressive enhancement.\n\nIf you have the following HTML:\n\n```html\n<select id=\"location-picker\">\n <option value=\"fr\">France</option>\n <option value=\"de\">Germany</option>\n <option value=\"gb\">United Kingdom</option>\n</select>\n```\n\nYou can use the `accessibleAutocomplete.enhanceSelectElement` function to enhance it into an autocomplete:\n\n```js\naccessibleAutocomplete.enhanceSelectElement({\n selectElement: document.querySelector('#location-picker')\n})\n```\n\nThis will:\n\n- Place an autocomplete input field after the specified `<select>`\n- Default the autocomplete `autoselect` to `true`\n- Default the autocomplete `defaultValue` to the select's `option[selected]`\n- Default the autocomplete `id` to the `<select>`'s `id`\n- Default the autocomplete `name` attribute to `''` to prevent it being included in form submissions\n- Default the autocomplete `source` to use existing `<option>`s from the `<select>`\n- Hide the `<select>` using inline `display: none`\n- Set the `<select>`'s `id` to `${id}-select` to decouple from any `<label>`\n- Upon confirming a value in the autocomplete, update the original `<select>`\n\nThis function takes the same options as `accessibleAutocomplete`, with the only difference being that it uses `selectElement` instead of `element`, which needs to be an instance of `HTMLSelectElement`.\n\n> **Note**: The `accessibleAutocomplete.enhanceSelectElement` function is fairly light and wraps the public API for `accessibleAutocomplete`. If your use case doesn't fit the above defaults, try [reading the source](src/wrapper.js) and seeing if you can write your own.\n\n### Null options\n\nIf your `<select>` element has a \"null\" option - a default option with no value - then you can pass a `defaultValue` option to `enhanceSelectElement` which will replace the label of this option when it is selected.\n\nWith the following HTML:\n\n```html\n<select id=\"location-picker\">\n <option value=\"\">Select a country</option>\n <option value=\"fr\">France</option>\n <option value=\"de\">Germany</option>\n <option value=\"gb\">United Kingdom</option>\n</select>\n```\n\nThen passing a `defaultValue` option of `''` will then leave the autocomplete blank if the null option is selected.\n\n```js\naccessibleAutocomplete.enhanceSelectElement({\n defaultValue: '',\n selectElement: document.querySelector('#location-picker')\n})\n```\n\nAny null options will also be filtered out of the options used to populate the `source` of the autocomplete element. To preserve options with no value in the autcomplete then pass a `preserveNullOptions` flag of `true` to `enhanceSelectElement`.\n\n## Analytics and tracking\n\nThe following events get triggered on the input element during the life cycle of the autocomplete:\n\n- `onConfirm` - This function will be called when the user confirms an option, with the option they've chosen.\n\nExample usage:\n\n```js\naccessibleAutocomplete({\n // additional options\n onConfirm: (val) => {\n track(val)\n }\n})\n```\n\n## Why another autocomplete?\n\n`accessible-autocomplete` was built after studying many existing solutions and prototyping patches to fix user experience or accessibility issues. It draws heavy inspiration from the following (and a lot of others):\n\n- [ljwatson/design-patterns](http://ljwatson.github.io/design-patterns/autocomplete/index.html): great accessible experience\n- [corejavascript/corejs-typeahead](https://github.com/corejavascript/typeahead.js): flexible autocomplete/suggestion engine architecture\n- [JamieAppleseed/selectToAutocomplete](https://github.com/JamieAppleseed/selectToAutocomplete): ease of use\n\n## Developing locally\n\nCheck out the [CONTRIBUTING](CONTRIBUTING.md) guide for instructions.\n\nIf you want to help and want to get more familiar with the codebase, try starting with the [\"good for beginners\"](https://github.com/alphagov/accessible-autocomplete/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+for+beginners%22) issues.\n\n## License\n\n[MIT](LICENSE.txt).\n",
|
150
|
-
"readmeFilename": "README.md",
|
151
|
-
"repository": {
|
152
|
-
"type": "git",
|
153
|
-
"url": "git+https://github.com/alphagov/accessible-autocomplete.git"
|
154
|
-
},
|
155
|
-
"scripts": {
|
156
|
-
"build": "run-s 'build:js' 'build:css'",
|
157
|
-
"build:css": "csso src/autocomplete.css -o dist/accessible-autocomplete.min.css",
|
158
|
-
"build:js": "cross-env NODE_ENV=production webpack --progress --display-modules",
|
159
|
-
"dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --progress",
|
160
|
-
"karma": "npm run karma:dev -- --single-run",
|
161
|
-
"karma:dev": "cross-env NODE_ENV=test karma start test/karma.config.js",
|
162
|
-
"preversion": "npm test",
|
163
|
-
"standard": "standard",
|
164
|
-
"test": "run-p standard karma wdio",
|
165
|
-
"version": "npm run build && git add -A dist",
|
166
|
-
"wdio": "cross-env NODE_ENV=test wdio test/wdio.config.js && git checkout dist/"
|
167
|
-
},
|
168
|
-
"standard": {
|
169
|
-
"parser": "babel-eslint"
|
170
|
-
},
|
171
|
-
"style": "dist/accessible-autocomplete.min.css",
|
172
|
-
"version": "1.6.2"
|
173
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = require('./dist/lib/accessible-autocomplete.preact.min')
|
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = require('./dist/lib/accessible-autocomplete.react.min')
|
@@ -1,14 +0,0 @@
|
|
1
|
-
const cp = require('child_process')
|
2
|
-
const chalk = require('chalk')
|
3
|
-
|
4
|
-
cp.exec('git diff --name-only dist/', (err, stdout) => {
|
5
|
-
if (err) {
|
6
|
-
console.log(chalk.red('ERROR:'), err)
|
7
|
-
return process.exit(1)
|
8
|
-
}
|
9
|
-
if (stdout.toString().length) {
|
10
|
-
console.log(chalk.red('ERROR:'), 'There are unstaged changes in `dist/` after running `npm run build`. Please commit them.')
|
11
|
-
return process.exit(1)
|
12
|
-
}
|
13
|
-
process.exit()
|
14
|
-
})
|
@@ -1,192 +0,0 @@
|
|
1
|
-
.autocomplete__wrapper {
|
2
|
-
position: relative;
|
3
|
-
}
|
4
|
-
|
5
|
-
.autocomplete__hint,
|
6
|
-
.autocomplete__input {
|
7
|
-
-webkit-font-smoothing: antialiased;
|
8
|
-
-moz-osx-font-smoothing: grayscale;
|
9
|
-
font-weight: 400;
|
10
|
-
font-size: 16px;
|
11
|
-
line-height: 1.25;
|
12
|
-
box-sizing: border-box;
|
13
|
-
width: 100%;
|
14
|
-
height: 40px;
|
15
|
-
padding: 5px;
|
16
|
-
border: 2px solid #0b0c0c;
|
17
|
-
border-radius: 0;
|
18
|
-
-webkit-appearance: none;
|
19
|
-
-moz-appearance: none;
|
20
|
-
appearance: none;
|
21
|
-
margin-bottom: 0;
|
22
|
-
}
|
23
|
-
|
24
|
-
.autocomplete__input {
|
25
|
-
background-color: transparent;
|
26
|
-
position: relative;
|
27
|
-
}
|
28
|
-
|
29
|
-
.autocomplete__hint {
|
30
|
-
color: #BFC1C3;
|
31
|
-
position: absolute;
|
32
|
-
}
|
33
|
-
|
34
|
-
.autocomplete__input--default{
|
35
|
-
padding: 4px;
|
36
|
-
}
|
37
|
-
|
38
|
-
.autocomplete__input--focused,
|
39
|
-
.autocomplete__input:focus {
|
40
|
-
outline-offset: 0;
|
41
|
-
outline: 3px solid #ffbf47;
|
42
|
-
}
|
43
|
-
|
44
|
-
.autocomplete__input--show-all-values {
|
45
|
-
padding: 4px 34px 4px 4px;
|
46
|
-
cursor: pointer;
|
47
|
-
}
|
48
|
-
|
49
|
-
.autocomplete__dropdown-arrow-down{
|
50
|
-
z-index: -1;
|
51
|
-
display: inline-block;
|
52
|
-
position: absolute;
|
53
|
-
right: 8px;
|
54
|
-
width: 24px;
|
55
|
-
height: 24px;
|
56
|
-
top: 10px;
|
57
|
-
}
|
58
|
-
|
59
|
-
.autocomplete__menu {
|
60
|
-
background-color: #fff;
|
61
|
-
border: 2px solid #0B0C0C;
|
62
|
-
border-top: 0;
|
63
|
-
color: #34384B;
|
64
|
-
margin: 0;
|
65
|
-
max-height: 342px;
|
66
|
-
overflow-x: hidden;
|
67
|
-
padding: 0;
|
68
|
-
width: 100%;
|
69
|
-
width: calc(100% - 4px);
|
70
|
-
}
|
71
|
-
|
72
|
-
.autocomplete__menu--visible {
|
73
|
-
display: block;
|
74
|
-
}
|
75
|
-
|
76
|
-
.autocomplete__menu--hidden {
|
77
|
-
display: none;
|
78
|
-
}
|
79
|
-
|
80
|
-
.autocomplete__menu--overlay {
|
81
|
-
box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;
|
82
|
-
left: 0;
|
83
|
-
position: absolute;
|
84
|
-
top: 100%;
|
85
|
-
z-index: 100;
|
86
|
-
}
|
87
|
-
|
88
|
-
.autocomplete__menu--inline {
|
89
|
-
position: relative;
|
90
|
-
}
|
91
|
-
|
92
|
-
.autocomplete__option {
|
93
|
-
border-bottom: solid #BFC1C3;
|
94
|
-
border-width: 1px 0;
|
95
|
-
cursor: pointer;
|
96
|
-
display: block;
|
97
|
-
position: relative;
|
98
|
-
}
|
99
|
-
|
100
|
-
.autocomplete__option > * {
|
101
|
-
pointer-events: none;
|
102
|
-
}
|
103
|
-
|
104
|
-
.autocomplete__option:first-of-type {
|
105
|
-
border-top-width: 0;
|
106
|
-
}
|
107
|
-
|
108
|
-
.autocomplete__option:last-of-type {
|
109
|
-
border-bottom-width: 0;
|
110
|
-
}
|
111
|
-
|
112
|
-
.autocomplete__option--odd {
|
113
|
-
background-color: #FAFAFA;
|
114
|
-
}
|
115
|
-
|
116
|
-
.autocomplete__option--focused,
|
117
|
-
.autocomplete__option:hover {
|
118
|
-
background-color: #005EA5;
|
119
|
-
border-color: #005EA5;
|
120
|
-
color: white;
|
121
|
-
outline: none;
|
122
|
-
}
|
123
|
-
|
124
|
-
.autocomplete__option--no-results {
|
125
|
-
background-color: #FAFAFA;
|
126
|
-
color: #646b6f;
|
127
|
-
cursor: not-allowed;
|
128
|
-
}
|
129
|
-
|
130
|
-
.autocomplete__hint,
|
131
|
-
.autocomplete__input,
|
132
|
-
.autocomplete__option {
|
133
|
-
font-size: 16px;
|
134
|
-
line-height: 1.25;
|
135
|
-
}
|
136
|
-
|
137
|
-
.autocomplete__hint,
|
138
|
-
.autocomplete__option {
|
139
|
-
padding: 4px;
|
140
|
-
}
|
141
|
-
|
142
|
-
@media (min-width: 641px) {
|
143
|
-
.autocomplete__hint,
|
144
|
-
.autocomplete__input,
|
145
|
-
.autocomplete__option {
|
146
|
-
font-size: 19px;
|
147
|
-
line-height: 1.31579;
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
.autocomplete__list {
|
152
|
-
list-style-type: none;
|
153
|
-
padding: 0;
|
154
|
-
margin: 20px 0 0;
|
155
|
-
}
|
156
|
-
|
157
|
-
.autocomplete__list .autocomplete__selected-option,
|
158
|
-
.autocomplete__list .autocomplete__selected-option:hover {
|
159
|
-
cursor: inherit;
|
160
|
-
color: #0b0c0c;
|
161
|
-
margin: 5px 0;
|
162
|
-
}
|
163
|
-
|
164
|
-
.autocomplete__list .autocomplete__remove-option {
|
165
|
-
cursor: pointer;
|
166
|
-
color: #005ea5;
|
167
|
-
text-decoration: underline;
|
168
|
-
background: transparent;
|
169
|
-
border: none;
|
170
|
-
font-size: inherit;
|
171
|
-
margin-left: 5px;
|
172
|
-
}
|
173
|
-
|
174
|
-
.autocomplete__list .autocomplete__remove-option:hover{
|
175
|
-
color: #2b8cc4;
|
176
|
-
}
|
177
|
-
|
178
|
-
.autocomplete__list .autocomplete__remove-option:focus{
|
179
|
-
color: #0b0c0c;
|
180
|
-
outline: 3px solid #ffbf47;
|
181
|
-
outline-offset: 0;
|
182
|
-
background-color: #ffbf47;
|
183
|
-
}
|
184
|
-
|
185
|
-
.autocomplete__list .autocomplete__remove-option:before {
|
186
|
-
content: '× ';
|
187
|
-
color: inherit;
|
188
|
-
}
|
189
|
-
|
190
|
-
.autocomplete__list-item-description {
|
191
|
-
display: none;
|
192
|
-
}
|
@@ -1,618 +0,0 @@
|
|
1
|
-
import { createElement, Component } from 'preact' /** @jsx createElement */
|
2
|
-
import Status from './status'
|
3
|
-
import DropdownArrowDown from './dropdown-arrow-down'
|
4
|
-
|
5
|
-
const IS_PREACT = process.env.COMPONENT_LIBRARY === 'PREACT'
|
6
|
-
const IS_REACT = process.env.COMPONENT_LIBRARY === 'REACT'
|
7
|
-
|
8
|
-
const keyCodes = {
|
9
|
-
13: 'enter',
|
10
|
-
27: 'escape',
|
11
|
-
32: 'space',
|
12
|
-
38: 'up',
|
13
|
-
40: 'down'
|
14
|
-
}
|
15
|
-
|
16
|
-
// Based on https://github.com/ausi/Feature-detection-technique-for-pointer-events
|
17
|
-
const hasPointerEvents = (() => {
|
18
|
-
const element = document.createElement('x')
|
19
|
-
element.style.cssText = 'pointer-events:auto'
|
20
|
-
return element.style.pointerEvents === 'auto'
|
21
|
-
})()
|
22
|
-
|
23
|
-
function isIosDevice () {
|
24
|
-
return !!(navigator.userAgent.match(/(iPod|iPhone|iPad)/g) && navigator.userAgent.match(/AppleWebKit/g))
|
25
|
-
}
|
26
|
-
|
27
|
-
function isPrintableKeyCode (keyCode) {
|
28
|
-
return (
|
29
|
-
(keyCode > 47 && keyCode < 58) || // number keys
|
30
|
-
keyCode === 32 || keyCode === 8 || // spacebar or backspace
|
31
|
-
(keyCode > 64 && keyCode < 91) || // letter keys
|
32
|
-
(keyCode > 95 && keyCode < 112) || // numpad keys
|
33
|
-
(keyCode > 185 && keyCode < 193) || // ;=,-./` (in order)
|
34
|
-
(keyCode > 218 && keyCode < 223) // [\]' (in order)
|
35
|
-
)
|
36
|
-
}
|
37
|
-
|
38
|
-
// Preact does not implement onChange on inputs, but React does.
|
39
|
-
function onChangeCrossLibrary (handler) {
|
40
|
-
if (IS_PREACT) { return { onInput: handler } }
|
41
|
-
if (IS_REACT) { return { onChange: handler } }
|
42
|
-
}
|
43
|
-
|
44
|
-
export default class Autocomplete extends Component {
|
45
|
-
static defaultProps = {
|
46
|
-
autoselect: false,
|
47
|
-
cssNamespace: 'autocomplete',
|
48
|
-
customAttributes: {},
|
49
|
-
defaultValue: '',
|
50
|
-
displayMenu: 'inline',
|
51
|
-
minLength: 0,
|
52
|
-
name: 'input-autocomplete',
|
53
|
-
placeholder: '',
|
54
|
-
onConfirm: () => {},
|
55
|
-
confirmOnBlur: true,
|
56
|
-
showNoOptionsFound: true,
|
57
|
-
showAllValues: false,
|
58
|
-
required: false,
|
59
|
-
multiple: false,
|
60
|
-
selectedOptions: {},
|
61
|
-
tNoResults: () => 'No results found',
|
62
|
-
tSelectedOptionDescription: () => 'Press Enter or Space to remove selection',
|
63
|
-
dropdownArrow: DropdownArrowDown
|
64
|
-
}
|
65
|
-
|
66
|
-
elementReferences = {}
|
67
|
-
|
68
|
-
constructor (props) {
|
69
|
-
super(props)
|
70
|
-
|
71
|
-
this.state = {
|
72
|
-
focused: null,
|
73
|
-
hovered: null,
|
74
|
-
clicked: null,
|
75
|
-
menuOpen: false,
|
76
|
-
options: props.defaultValue ? [props.defaultValue] : [],
|
77
|
-
selectedOptions: props.selectedOptions ? [props.selectedOptions] : [],
|
78
|
-
query: props.defaultValue,
|
79
|
-
selected: null
|
80
|
-
}
|
81
|
-
|
82
|
-
this.handleComponentBlur = this.handleComponentBlur.bind(this)
|
83
|
-
this.handleKeyDown = this.handleKeyDown.bind(this)
|
84
|
-
this.handleUpArrow = this.handleUpArrow.bind(this)
|
85
|
-
this.handleDownArrow = this.handleDownArrow.bind(this)
|
86
|
-
this.handleEnter = this.handleEnter.bind(this)
|
87
|
-
this.handlePrintableKey = this.handlePrintableKey.bind(this)
|
88
|
-
|
89
|
-
this.handleListMouseLeave = this.handleListMouseLeave.bind(this)
|
90
|
-
|
91
|
-
this.handleOptionBlur = this.handleOptionBlur.bind(this)
|
92
|
-
this.handleOptionClick = this.handleOptionClick.bind(this)
|
93
|
-
this.handleOptionFocus = this.handleOptionFocus.bind(this)
|
94
|
-
this.handleOptionMouseEnter = this.handleOptionMouseEnter.bind(this)
|
95
|
-
|
96
|
-
this.handleSelectedOptionClick = this.handleSelectedOptionClick.bind(this)
|
97
|
-
this.handleSelectedOptionKeyDown = this.handleSelectedOptionKeyDown.bind(this)
|
98
|
-
|
99
|
-
this.handleInputBlur = this.handleInputBlur.bind(this)
|
100
|
-
this.handleInputChange = this.handleInputChange.bind(this)
|
101
|
-
this.handleInputFocus = this.handleInputFocus.bind(this)
|
102
|
-
|
103
|
-
this.pollInputElement = this.pollInputElement.bind(this)
|
104
|
-
this.getDirectInputChanges = this.getDirectInputChanges.bind(this)
|
105
|
-
}
|
106
|
-
|
107
|
-
componentDidMount () {
|
108
|
-
this.pollInputElement()
|
109
|
-
}
|
110
|
-
|
111
|
-
componentWillUnmount () {
|
112
|
-
clearTimeout(this.$pollInput)
|
113
|
-
clearTimeout(this.$blurInput)
|
114
|
-
}
|
115
|
-
|
116
|
-
// Applications like Dragon NaturallySpeaking will modify the
|
117
|
-
// `input` field by directly changing its `.value`. These events
|
118
|
-
// don't trigger our JavaScript event listeners, so we need to poll
|
119
|
-
// to handle when and if they occur.
|
120
|
-
pollInputElement () {
|
121
|
-
this.getDirectInputChanges()
|
122
|
-
this.$pollInput = setTimeout(() => {
|
123
|
-
this.pollInputElement()
|
124
|
-
}, 100)
|
125
|
-
}
|
126
|
-
|
127
|
-
getDirectInputChanges () {
|
128
|
-
const inputReference = this.elementReferences[-1]
|
129
|
-
const queryHasChanged = inputReference && inputReference.value !== this.state.query
|
130
|
-
|
131
|
-
if (queryHasChanged) {
|
132
|
-
this.handleInputChange({ target: { value: inputReference.value } })
|
133
|
-
}
|
134
|
-
}
|
135
|
-
|
136
|
-
componentDidUpdate (prevProps, prevState) {
|
137
|
-
const { focused, clicked } = this.state
|
138
|
-
const componentLostFocus = focused === null
|
139
|
-
const focusedChanged = prevState.focused !== focused
|
140
|
-
const focusDifferentElement = (focusedChanged && !componentLostFocus) || clicked !== null
|
141
|
-
if (focusDifferentElement) {
|
142
|
-
this.elementReferences[focused].focus()
|
143
|
-
}
|
144
|
-
const focusedInput = focused === -1
|
145
|
-
const componentGainedFocus = focusedChanged && prevState.focused === null
|
146
|
-
const selectAllText = focusedInput && componentGainedFocus
|
147
|
-
if (selectAllText) {
|
148
|
-
const inputElement = this.elementReferences[focused]
|
149
|
-
inputElement.setSelectionRange(0, inputElement.value.length)
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
hasAutoselect () {
|
154
|
-
return isIosDevice() ? false : this.props.autoselect
|
155
|
-
}
|
156
|
-
|
157
|
-
// This template is used when converting from a state.options object into a state.query.
|
158
|
-
templateInputValue (value) {
|
159
|
-
const inputValueTemplate = this.props.templates && this.props.templates.inputValue
|
160
|
-
return inputValueTemplate ? inputValueTemplate(value) : value
|
161
|
-
}
|
162
|
-
|
163
|
-
// This template is used when displaying results / suggestions.
|
164
|
-
templateSuggestion (value) {
|
165
|
-
const suggestionTemplate = this.props.templates && this.props.templates.suggestion
|
166
|
-
return suggestionTemplate ? suggestionTemplate(value) : value
|
167
|
-
}
|
168
|
-
|
169
|
-
handleComponentBlur (newState) {
|
170
|
-
const { options, query, selected } = this.state
|
171
|
-
let newQuery
|
172
|
-
if (this.props.confirmOnBlur) {
|
173
|
-
newQuery = newState.query || query
|
174
|
-
if (options[selected]) this.props.onConfirm(options[selected])
|
175
|
-
else this.props.onConfirm(options[0])
|
176
|
-
} else {
|
177
|
-
newQuery = query
|
178
|
-
}
|
179
|
-
this.setState({
|
180
|
-
focused: null,
|
181
|
-
clicked: null,
|
182
|
-
menuOpen: newState.menuOpen || false,
|
183
|
-
query: newQuery,
|
184
|
-
selected: null
|
185
|
-
})
|
186
|
-
|
187
|
-
if (this.props.selectElement && this.props.selectElement.multiple) {
|
188
|
-
// Reset input state
|
189
|
-
this.setState({
|
190
|
-
menuOpen: false,
|
191
|
-
selected: null,
|
192
|
-
query: ''
|
193
|
-
})
|
194
|
-
}
|
195
|
-
}
|
196
|
-
|
197
|
-
handleListMouseLeave (event) {
|
198
|
-
this.setState({
|
199
|
-
hovered: null
|
200
|
-
})
|
201
|
-
}
|
202
|
-
|
203
|
-
handleOptionBlur (event, index) {
|
204
|
-
const { focused, clicked, menuOpen, options, selected } = this.state
|
205
|
-
const focusingOutsideComponent = event.relatedTarget === null && clicked === null
|
206
|
-
const focusingInput = event.relatedTarget === this.elementReferences[-1]
|
207
|
-
const focusingAnotherOption = focused !== index && focused !== -1
|
208
|
-
const blurComponent = (!focusingAnotherOption && focusingOutsideComponent) || !(focusingAnotherOption || focusingInput)
|
209
|
-
if (blurComponent) {
|
210
|
-
const keepMenuOpen = menuOpen && isIosDevice()
|
211
|
-
this.handleComponentBlur({
|
212
|
-
menuOpen: keepMenuOpen,
|
213
|
-
query: this.templateInputValue(options[selected])
|
214
|
-
})
|
215
|
-
}
|
216
|
-
}
|
217
|
-
|
218
|
-
handleInputBlur (event) {
|
219
|
-
const { focused, menuOpen, options, query, selected } = this.state
|
220
|
-
const focusingAnOption = focused !== -1
|
221
|
-
clearTimeout(this.$blurInput)
|
222
|
-
if (!focusingAnOption) {
|
223
|
-
const keepMenuOpen = menuOpen && isIosDevice()
|
224
|
-
const newQuery = isIosDevice() ? query : this.templateInputValue(options[selected])
|
225
|
-
this.$blurInput = setTimeout(() => this.handleComponentBlur({
|
226
|
-
menuOpen: keepMenuOpen,
|
227
|
-
query: newQuery
|
228
|
-
}), 200)
|
229
|
-
}
|
230
|
-
}
|
231
|
-
|
232
|
-
handleInputChange (event) {
|
233
|
-
const { minLength, source, showAllValues } = this.props
|
234
|
-
const autoselect = this.hasAutoselect()
|
235
|
-
const query = event.target.value
|
236
|
-
const queryEmpty = query.length === 0
|
237
|
-
const queryChanged = this.state.query.length !== query.length
|
238
|
-
const queryLongEnough = query.length >= minLength
|
239
|
-
|
240
|
-
this.setState({ query })
|
241
|
-
|
242
|
-
const searchForOptions = showAllValues || (!queryEmpty && queryChanged && queryLongEnough)
|
243
|
-
if (searchForOptions) {
|
244
|
-
source(query, (options) => {
|
245
|
-
const optionsAvailable = options.length > 0
|
246
|
-
this.setState({
|
247
|
-
menuOpen: optionsAvailable,
|
248
|
-
options,
|
249
|
-
selected: (autoselect && optionsAvailable) ? 0 : -1
|
250
|
-
})
|
251
|
-
})
|
252
|
-
} else if (queryEmpty || !queryLongEnough) {
|
253
|
-
this.setState({
|
254
|
-
menuOpen: false,
|
255
|
-
options: []
|
256
|
-
})
|
257
|
-
}
|
258
|
-
}
|
259
|
-
|
260
|
-
handleInputClick (event) {
|
261
|
-
this.handleInputChange(event)
|
262
|
-
}
|
263
|
-
|
264
|
-
handleInputFocus (event) {
|
265
|
-
this.setState({
|
266
|
-
focused: -1
|
267
|
-
})
|
268
|
-
}
|
269
|
-
|
270
|
-
handleOptionFocus (index) {
|
271
|
-
this.setState({
|
272
|
-
focused: index,
|
273
|
-
hovered: null,
|
274
|
-
selected: index
|
275
|
-
})
|
276
|
-
}
|
277
|
-
|
278
|
-
handleOptionMouseEnter (event, index) {
|
279
|
-
// iOS Safari prevents click event if mouseenter adds hover background colour
|
280
|
-
// See: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW4
|
281
|
-
if (!isIosDevice()) {
|
282
|
-
this.setState({
|
283
|
-
hovered: index
|
284
|
-
})
|
285
|
-
}
|
286
|
-
}
|
287
|
-
|
288
|
-
handleOptionClick (event, index) {
|
289
|
-
const selectedOption = this.state.options[index]
|
290
|
-
const newQuery = this.templateInputValue(selectedOption)
|
291
|
-
clearTimeout(this.$blurInput)
|
292
|
-
if (selectedOption) this.props.onConfirm(selectedOption)
|
293
|
-
else this.props.onConfirm(this.state.options[0])
|
294
|
-
this.setState({
|
295
|
-
focused: -1,
|
296
|
-
clicked: index,
|
297
|
-
hovered: null,
|
298
|
-
menuOpen: false,
|
299
|
-
query: newQuery,
|
300
|
-
selected: -1
|
301
|
-
})
|
302
|
-
if (this.props.selectElement && this.props.selectElement.multiple) {
|
303
|
-
this.updateMultiselect(selectedOption)
|
304
|
-
}
|
305
|
-
this.forceUpdate()
|
306
|
-
}
|
307
|
-
|
308
|
-
updateMultiselect (selectedOption) {
|
309
|
-
if (selectedOption) {
|
310
|
-
// Update select state for option
|
311
|
-
const addedSelectOption = [].filter.call(this.props.selectElement.options, option => option.textContent === selectedOption)[0]
|
312
|
-
if (addedSelectOption) { addedSelectOption.selected = true }
|
313
|
-
|
314
|
-
// Update multiselect list
|
315
|
-
let availableOptions = [].filter.call(this.props.selectElement.options, option => option.textContent)
|
316
|
-
this.props.selectedOptions = availableOptions.filter(option => option.selected === true)
|
317
|
-
|
318
|
-
// Reset input state
|
319
|
-
this.setState({
|
320
|
-
menuOpen: false,
|
321
|
-
selected: null,
|
322
|
-
query: ''
|
323
|
-
})
|
324
|
-
}
|
325
|
-
}
|
326
|
-
|
327
|
-
handleSelectedOptionClick (event, index) {
|
328
|
-
// Remove from the list
|
329
|
-
const removedOption = this.props.selectedOptions[index]
|
330
|
-
this.props.selectedOptions = this.props.selectedOptions.filter(e => e !== removedOption)
|
331
|
-
|
332
|
-
// Update select state for option
|
333
|
-
const removedSelectOption = [].filter.call(this.props.selectElement.options, option => option.textContent === removedOption.textContent)[0]
|
334
|
-
if (removedSelectOption) { removedSelectOption.selected = false }
|
335
|
-
|
336
|
-
this.forceUpdate()
|
337
|
-
}
|
338
|
-
|
339
|
-
handleSelectedOptionKeyDown (event, index) {
|
340
|
-
switch (keyCodes[event.keyCode]) {
|
341
|
-
case 'space':
|
342
|
-
this.handleSelectedOptionClick(event, index)
|
343
|
-
break
|
344
|
-
case 'enter':
|
345
|
-
this.handleSelectedOptionClick(event, index)
|
346
|
-
break
|
347
|
-
}
|
348
|
-
}
|
349
|
-
|
350
|
-
handleUpArrow (event) {
|
351
|
-
event.preventDefault()
|
352
|
-
const { menuOpen, selected } = this.state
|
353
|
-
const isNotAtTop = selected !== -1
|
354
|
-
const allowMoveUp = isNotAtTop && menuOpen
|
355
|
-
if (allowMoveUp) {
|
356
|
-
this.handleOptionFocus(selected - 1)
|
357
|
-
}
|
358
|
-
}
|
359
|
-
|
360
|
-
handleDownArrow (event) {
|
361
|
-
event.preventDefault()
|
362
|
-
// if not open, open
|
363
|
-
if (this.props.showAllValues && this.state.menuOpen === false) {
|
364
|
-
event.preventDefault()
|
365
|
-
this.props.source('', (options) => {
|
366
|
-
this.setState({
|
367
|
-
menuOpen: true,
|
368
|
-
options,
|
369
|
-
selected: 0,
|
370
|
-
focused: 0,
|
371
|
-
hovered: null
|
372
|
-
})
|
373
|
-
})
|
374
|
-
} else if (this.state.menuOpen === true) {
|
375
|
-
const { menuOpen, options, selected } = this.state
|
376
|
-
const isNotAtBottom = selected !== options.length - 1
|
377
|
-
const allowMoveDown = isNotAtBottom && menuOpen
|
378
|
-
if (allowMoveDown) {
|
379
|
-
this.handleOptionFocus(selected + 1)
|
380
|
-
}
|
381
|
-
}
|
382
|
-
}
|
383
|
-
|
384
|
-
handleSpace (event) {
|
385
|
-
// if not open, open
|
386
|
-
if (this.props.showAllValues && this.state.menuOpen === false && this.state.query === '') {
|
387
|
-
event.preventDefault()
|
388
|
-
this.props.source('', (options) => {
|
389
|
-
this.setState({
|
390
|
-
menuOpen: true,
|
391
|
-
options
|
392
|
-
})
|
393
|
-
})
|
394
|
-
}
|
395
|
-
const focusIsOnOption = this.state.focused !== -1
|
396
|
-
if (focusIsOnOption) {
|
397
|
-
event.preventDefault()
|
398
|
-
this.handleOptionClick(event, this.state.focused)
|
399
|
-
}
|
400
|
-
}
|
401
|
-
|
402
|
-
handleEnter (event) {
|
403
|
-
if (this.state.menuOpen) {
|
404
|
-
event.preventDefault()
|
405
|
-
const hasSelectedOption = this.state.selected >= 0
|
406
|
-
if (hasSelectedOption) {
|
407
|
-
this.handleOptionClick(event, this.state.selected)
|
408
|
-
}
|
409
|
-
}
|
410
|
-
}
|
411
|
-
|
412
|
-
handlePrintableKey (event) {
|
413
|
-
const inputElement = this.elementReferences[-1]
|
414
|
-
const eventIsOnInput = event.target === inputElement
|
415
|
-
if (!eventIsOnInput) {
|
416
|
-
// FIXME: This would be better if it was in componentDidUpdate,
|
417
|
-
// but using setState to trigger that seems to not work correctly
|
418
|
-
// in preact@8.1.0.
|
419
|
-
inputElement.focus()
|
420
|
-
}
|
421
|
-
}
|
422
|
-
|
423
|
-
handleKeyDown (event) {
|
424
|
-
switch (keyCodes[event.keyCode]) {
|
425
|
-
case 'up':
|
426
|
-
this.handleUpArrow(event)
|
427
|
-
break
|
428
|
-
case 'down':
|
429
|
-
this.handleDownArrow(event)
|
430
|
-
break
|
431
|
-
case 'space':
|
432
|
-
this.handleSpace(event)
|
433
|
-
break
|
434
|
-
case 'enter':
|
435
|
-
this.handleEnter(event)
|
436
|
-
break
|
437
|
-
case 'escape':
|
438
|
-
this.handleComponentBlur({
|
439
|
-
query: this.state.query
|
440
|
-
})
|
441
|
-
break
|
442
|
-
default:
|
443
|
-
if (isPrintableKeyCode(event.keyCode)) {
|
444
|
-
this.handlePrintableKey(event)
|
445
|
-
}
|
446
|
-
break
|
447
|
-
}
|
448
|
-
}
|
449
|
-
|
450
|
-
render () {
|
451
|
-
const {
|
452
|
-
cssNamespace,
|
453
|
-
displayMenu,
|
454
|
-
id,
|
455
|
-
minLength,
|
456
|
-
name,
|
457
|
-
placeholder,
|
458
|
-
required,
|
459
|
-
multiple,
|
460
|
-
showAllValues,
|
461
|
-
tNoResults,
|
462
|
-
tStatusQueryTooShort,
|
463
|
-
tStatusNoResults,
|
464
|
-
tStatusSelectedOption,
|
465
|
-
tStatusResults,
|
466
|
-
tSelectedOptionDescription,
|
467
|
-
dropdownArrow: dropdownArrowFactory,
|
468
|
-
customAttributes
|
469
|
-
} = this.props
|
470
|
-
const { focused, hovered, menuOpen, options, query, selected } = this.state
|
471
|
-
const autoselect = this.hasAutoselect()
|
472
|
-
|
473
|
-
const inputFocused = focused === -1
|
474
|
-
const noOptionsAvailable = options.length === 0
|
475
|
-
const queryNotEmpty = query.length !== 0
|
476
|
-
const queryLongEnough = query.length >= minLength
|
477
|
-
const showNoOptionsFound = this.props.showNoOptionsFound &&
|
478
|
-
inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough
|
479
|
-
|
480
|
-
const wrapperClassName = `${cssNamespace}__wrapper`
|
481
|
-
|
482
|
-
const inputClassName = `${cssNamespace}__input`
|
483
|
-
const componentIsFocused = focused !== null
|
484
|
-
const inputModifierFocused = componentIsFocused ? ` ${inputClassName}--focused` : ''
|
485
|
-
const inputModifierType = this.props.showAllValues ? ` ${inputClassName}--show-all-values` : ` ${inputClassName}--default`
|
486
|
-
const dropdownArrowClassName = `${cssNamespace}__dropdown-arrow-down`
|
487
|
-
const optionFocused = focused !== -1 && focused !== null
|
488
|
-
|
489
|
-
const menuClassName = `${cssNamespace}__menu`
|
490
|
-
const menuModifierDisplayMenu = `${menuClassName}--${displayMenu}`
|
491
|
-
const menuIsVisible = menuOpen || showNoOptionsFound
|
492
|
-
const menuModifierVisibility = `${menuClassName}--${(menuIsVisible) ? 'visible' : 'hidden'}`
|
493
|
-
|
494
|
-
const optionClassName = `${cssNamespace}__option`
|
495
|
-
|
496
|
-
const selectedOptionsClassName = `${cssNamespace}__list`
|
497
|
-
|
498
|
-
const hintClassName = `${cssNamespace}__hint`
|
499
|
-
const selectedOptionText = this.templateInputValue(options[selected])
|
500
|
-
const optionBeginsWithQuery = selectedOptionText &&
|
501
|
-
selectedOptionText.toLowerCase().indexOf(query.toLowerCase()) === 0
|
502
|
-
const hintValue = (optionBeginsWithQuery && autoselect)
|
503
|
-
? query + selectedOptionText.substr(query.length)
|
504
|
-
: ''
|
505
|
-
const showHint = hasPointerEvents && hintValue
|
506
|
-
|
507
|
-
let dropdownArrow
|
508
|
-
|
509
|
-
// we only need a dropdown arrow if showAllValues is set to a truthy value
|
510
|
-
if (showAllValues) {
|
511
|
-
dropdownArrow = dropdownArrowFactory({ className: dropdownArrowClassName })
|
512
|
-
|
513
|
-
// if the factory returns a string we'll render this as HTML (usage w/o (P)React)
|
514
|
-
if (typeof dropdownArrow === 'string') {
|
515
|
-
dropdownArrow = <div className={`${cssNamespace}__dropdown-arrow-down-wrapper`} dangerouslySetInnerHTML={{ __html: dropdownArrow }} />
|
516
|
-
}
|
517
|
-
}
|
518
|
-
|
519
|
-
return (
|
520
|
-
<div className={wrapperClassName} onKeyDown={this.handleKeyDown} role='combobox' aria-expanded={menuOpen ? 'true' : 'false'}>
|
521
|
-
<Status
|
522
|
-
length={options.length}
|
523
|
-
queryLength={query.length}
|
524
|
-
minQueryLength={minLength}
|
525
|
-
selectedOption={this.templateInputValue(options[selected])}
|
526
|
-
selectedOptionIndex={selected}
|
527
|
-
tQueryTooShort={tStatusQueryTooShort}
|
528
|
-
tNoResults={tStatusNoResults}
|
529
|
-
tSelectedOption={tStatusSelectedOption}
|
530
|
-
tResults={tStatusResults}
|
531
|
-
/>
|
532
|
-
|
533
|
-
{showHint && (
|
534
|
-
<span><input className={hintClassName} readonly tabIndex='-1' value={hintValue} /></span>
|
535
|
-
)}
|
536
|
-
|
537
|
-
<input
|
538
|
-
aria-activedescendant={optionFocused ? `${id}__option--${focused}` : false}
|
539
|
-
aria-owns={`${id}__listbox`}
|
540
|
-
autoComplete='off'
|
541
|
-
className={`${inputClassName}${inputModifierFocused}${inputModifierType}`}
|
542
|
-
id={id}
|
543
|
-
onClick={(event) => this.handleInputClick(event)}
|
544
|
-
onBlur={this.handleInputBlur}
|
545
|
-
{...onChangeCrossLibrary(this.handleInputChange)}
|
546
|
-
onFocus={this.handleInputFocus}
|
547
|
-
name={name}
|
548
|
-
placeholder={placeholder}
|
549
|
-
ref={(inputElement) => { this.elementReferences[-1] = inputElement }}
|
550
|
-
type='text'
|
551
|
-
role='textbox'
|
552
|
-
required={required}
|
553
|
-
value={query}
|
554
|
-
{...customAttributes}
|
555
|
-
/>
|
556
|
-
|
557
|
-
{dropdownArrow}
|
558
|
-
|
559
|
-
<ul
|
560
|
-
className={`${menuClassName} ${menuModifierDisplayMenu} ${menuModifierVisibility}`}
|
561
|
-
onMouseLeave={(event) => this.handleListMouseLeave(event)}
|
562
|
-
id={`${id}__listbox`}
|
563
|
-
role='listbox'
|
564
|
-
>
|
565
|
-
{options.map((option, index) => {
|
566
|
-
const showFocused = focused === -1 ? selected === index : focused === index
|
567
|
-
const optionModifierFocused = showFocused && hovered === null ? ` ${optionClassName}--focused` : ''
|
568
|
-
const optionModifierOdd = (index % 2) ? ` ${optionClassName}--odd` : ''
|
569
|
-
|
570
|
-
return (
|
571
|
-
<li
|
572
|
-
aria-selected={focused === index}
|
573
|
-
className={`${optionClassName}${optionModifierFocused}${optionModifierOdd}`}
|
574
|
-
dangerouslySetInnerHTML={{ __html: this.templateSuggestion(option) }}
|
575
|
-
id={`${id}__option--${index}`}
|
576
|
-
key={index}
|
577
|
-
onBlur={(event) => this.handleOptionBlur(event, index)}
|
578
|
-
onClick={(event) => this.handleOptionClick(event, index)}
|
579
|
-
onMouseEnter={(event) => this.handleOptionMouseEnter(event, index)}
|
580
|
-
ref={(optionEl) => { this.elementReferences[index] = optionEl }}
|
581
|
-
role='option'
|
582
|
-
tabIndex='-1'
|
583
|
-
/>
|
584
|
-
)
|
585
|
-
})}
|
586
|
-
|
587
|
-
{showNoOptionsFound && (
|
588
|
-
<li className={`${optionClassName} ${optionClassName}--no-results`}>{tNoResults()}</li>
|
589
|
-
)}
|
590
|
-
</ul>
|
591
|
-
|
592
|
-
{multiple && (
|
593
|
-
<ul
|
594
|
-
className={`${selectedOptionsClassName}`}
|
595
|
-
id={`${id}__list`}
|
596
|
-
role='listbox'
|
597
|
-
>
|
598
|
-
{this.props.selectedOptions.map((option, index) => {
|
599
|
-
return (
|
600
|
-
<li id={`${id}__option--${index}`} className='autocomplete__selected-option'>
|
601
|
-
<span dangerouslySetInnerHTML={{ __html: this.templateSuggestion(option.textContent) }} />
|
602
|
-
<button
|
603
|
-
type='button'
|
604
|
-
className='autocomplete__remove-option'
|
605
|
-
aria-label={`${this.templateSuggestion(option.textContent)}, selected. ${tSelectedOptionDescription()}`}
|
606
|
-
onClick={(event) => this.handleSelectedOptionClick(event, index)}>remove</button>
|
607
|
-
</li>
|
608
|
-
)
|
609
|
-
})}
|
610
|
-
{showNoOptionsFound && (
|
611
|
-
<li className={`${optionClassName} ${optionClassName}--no-results`}>{tNoResults()}</li>
|
612
|
-
)}
|
613
|
-
</ul>
|
614
|
-
)}
|
615
|
-
</div>
|
616
|
-
)
|
617
|
-
}
|
618
|
-
}
|