govuk_publishing_components 43.3.0 → 43.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/icon-autocomplete-search-suggestion.svg +4 -0
  3. data/app/assets/javascripts/govuk_publishing_components/components/search-with-autocomplete.js +123 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +5 -4
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +0 -2
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_search-with-autocomplete.scss +200 -0
  7. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +16 -40
  8. data/app/views/govuk_publishing_components/components/_search.html.erb +16 -14
  9. data/app/views/govuk_publishing_components/components/_search_with_autocomplete.html.erb +27 -0
  10. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +0 -41
  11. data/app/views/govuk_publishing_components/components/docs/phase_banner.yml +4 -0
  12. data/app/views/govuk_publishing_components/components/docs/search_with_autocomplete.yml +61 -0
  13. data/lib/govuk_publishing_components/version.rb +1 -1
  14. data/node_modules/accessible-autocomplete/CHANGELOG.md +390 -0
  15. data/node_modules/accessible-autocomplete/CODEOWNERS +2 -0
  16. data/node_modules/accessible-autocomplete/CONTRIBUTING.md +161 -0
  17. data/node_modules/accessible-autocomplete/LICENSE.txt +20 -0
  18. data/node_modules/accessible-autocomplete/Procfile +1 -0
  19. data/node_modules/accessible-autocomplete/README.md +490 -0
  20. data/node_modules/accessible-autocomplete/accessibility-criteria.md +42 -0
  21. data/node_modules/accessible-autocomplete/app.json +15 -0
  22. data/node_modules/accessible-autocomplete/babel.config.js +29 -0
  23. data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.css +3 -0
  24. data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.css.map +1 -0
  25. data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js +2 -0
  26. data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js.map +1 -0
  27. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js +2 -0
  28. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js.map +1 -0
  29. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js +2 -0
  30. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js.map +1 -0
  31. data/node_modules/accessible-autocomplete/examples/form-single.html +379 -0
  32. data/node_modules/accessible-autocomplete/examples/form.html +673 -0
  33. data/node_modules/accessible-autocomplete/examples/index.html +738 -0
  34. data/node_modules/accessible-autocomplete/examples/preact/index.html +346 -0
  35. data/node_modules/accessible-autocomplete/examples/react/index.html +347 -0
  36. data/node_modules/accessible-autocomplete/package.json +93 -0
  37. data/node_modules/accessible-autocomplete/postcss.config.js +16 -0
  38. data/node_modules/accessible-autocomplete/preact.js +1 -0
  39. data/node_modules/accessible-autocomplete/react.js +1 -0
  40. data/node_modules/accessible-autocomplete/scripts/check-staged.mjs +16 -0
  41. data/node_modules/accessible-autocomplete/src/autocomplete.css +167 -0
  42. data/node_modules/accessible-autocomplete/src/autocomplete.js +608 -0
  43. data/node_modules/accessible-autocomplete/src/dropdown-arrow-down.js +11 -0
  44. data/node_modules/accessible-autocomplete/src/status.js +125 -0
  45. data/node_modules/accessible-autocomplete/src/wrapper.js +60 -0
  46. data/node_modules/accessible-autocomplete/test/functional/dropdown-arrow-down.js +46 -0
  47. data/node_modules/accessible-autocomplete/test/functional/index.js +793 -0
  48. data/node_modules/accessible-autocomplete/test/functional/wrapper.js +339 -0
  49. data/node_modules/accessible-autocomplete/test/integration/index.js +309 -0
  50. data/node_modules/accessible-autocomplete/test/karma.config.js +46 -0
  51. data/node_modules/accessible-autocomplete/test/wdio.config.js +123 -0
  52. data/node_modules/accessible-autocomplete/webpack.config.mjs +244 -0
  53. metadata +46 -2
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "accessible-autocomplete",
3
+ "version": "3.0.0",
4
+ "main": "dist/accessible-autocomplete.min.js",
5
+ "style": "dist/accessible-autocomplete.min.css",
6
+ "description": "An autocomplete component, built to be accessible.",
7
+ "repository": "alphagov/accessible-autocomplete",
8
+ "author": "Government Digital Service (https://www.gov.uk/government/organisations/government-digital-service)",
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "a11y",
12
+ "accessibility",
13
+ "autocomplete",
14
+ "component",
15
+ "plugin",
16
+ "typeahead",
17
+ "widget"
18
+ ],
19
+ "scripts": {
20
+ "build": "cross-env NODE_ENV=production webpack --progress",
21
+ "dev": "cross-env NODE_ENV=development webpack serve",
22
+ "karma:dev": "cross-env NODE_ENV=test karma start test/karma.config.js",
23
+ "karma": "npm run karma:dev -- --single-run",
24
+ "prepare": "node -e \"try { (await import('husky')).default() } catch (e) { if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e }\" --input-type module",
25
+ "preversion": "npm test",
26
+ "standard": "standard",
27
+ "pretest": "npm run build",
28
+ "test": "run-p standard karma wdio",
29
+ "version": "git add -A dist",
30
+ "wdio": "cross-env NODE_ENV=test wdio test/wdio.config.js"
31
+ },
32
+ "devDependencies": {
33
+ "@babel/core": "^7.23.9",
34
+ "@babel/eslint-parser": "^7.23.10",
35
+ "@babel/plugin-transform-react-jsx": "^7.23.4",
36
+ "@babel/preset-env": "^7.23.9",
37
+ "@babel/register": "^7.23.7",
38
+ "@wdio/cli": "^8.32.3",
39
+ "@wdio/globals": "^8.32.3",
40
+ "@wdio/local-runner": "^8.32.3",
41
+ "@wdio/mocha-framework": "^8.32.3",
42
+ "@wdio/sauce-service": "^8.32.3",
43
+ "@wdio/spec-reporter": "^8.32.2",
44
+ "@wdio/static-server-service": "^8.32.2",
45
+ "autoprefixer": "^10.4.17",
46
+ "babel-loader": "^9.1.3",
47
+ "babel-plugin-istanbul": "^6.1.1",
48
+ "chai": "^5.1.0",
49
+ "chalk": "^5.3.0",
50
+ "core-js": "^3.36.0",
51
+ "cross-env": "^7.0.3",
52
+ "css-loader": "^6.10.0",
53
+ "cssnano": "^6.0.3",
54
+ "cssnano-preset-default": "^6.0.3",
55
+ "devtools": "^8.32.3",
56
+ "dotenv": "^16.4.4",
57
+ "husky": "^9.0.11",
58
+ "karma": "^6.4.2",
59
+ "karma-chrome-launcher": "^3.2.0",
60
+ "karma-mocha": "^2.0.1",
61
+ "karma-mocha-reporter": "^2.2.5",
62
+ "karma-sourcemap-loader": "^0.4.0",
63
+ "karma-webpack": "^5.0.1",
64
+ "mini-css-extract-plugin": "^2.8.0",
65
+ "mocha": "^10.3.0",
66
+ "npm-run-all": "^4.1.5",
67
+ "postcss": "^8.4.35",
68
+ "postcss-loader": "^8.1.0",
69
+ "preact": "^8.5.3",
70
+ "puppeteer": "^22.2.0",
71
+ "source-map-loader": "^5.0.0",
72
+ "standard": "^17.1.0",
73
+ "terser-webpack-plugin": "^5.3.9",
74
+ "webdriverio": "^8.28.6",
75
+ "webpack": "^5.90.1",
76
+ "webpack-cli": "^5.1.4",
77
+ "webpack-dev-server": "^5.0.1"
78
+ },
79
+ "peerDependencies": {
80
+ "preact": "^8.0.0"
81
+ },
82
+ "peerDependenciesMeta": {
83
+ "preact": {
84
+ "optional": true
85
+ }
86
+ },
87
+ "standard": {
88
+ "ignore": [
89
+ "dist"
90
+ ],
91
+ "parser": "@babel/eslint-parser"
92
+ }
93
+ }
@@ -0,0 +1,16 @@
1
+ const autoprefixer = require('autoprefixer')
2
+ const cssnano = require('cssnano')
3
+ const cssnanoPresetDefault = require('cssnano-preset-default')
4
+
5
+ /**
6
+ * PostCSS config
7
+ */
8
+ module.exports = {
9
+ plugins: [
10
+ // Add vendor prefixes
11
+ autoprefixer({ env: 'stylesheets' }),
12
+
13
+ // Always minify CSS
14
+ cssnano({ preset: [cssnanoPresetDefault] })
15
+ ]
16
+ }
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/lib/accessible-autocomplete.preact.min')
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/lib/accessible-autocomplete.react.min')
@@ -0,0 +1,16 @@
1
+ import { exec } from 'node:child_process'
2
+ import chalk from 'chalk'
3
+
4
+ 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
+
10
+ if (stdout.toString().length) {
11
+ console.log(chalk.red('ERROR:'), 'There are unstaged changes in `dist/` after running `npm run build`. Please commit them.')
12
+ return process.exit(1)
13
+ }
14
+
15
+ process.exit()
16
+ })
@@ -0,0 +1,167 @@
1
+ .autocomplete__wrapper {
2
+ position: relative;
3
+ }
4
+
5
+ .autocomplete__hint,
6
+ .autocomplete__input {
7
+ appearance: none;
8
+ border: 2px solid #0b0c0c;
9
+ border-radius: 0; /* Safari 10 on iOS adds implicit border rounding. */
10
+ box-sizing: border-box;
11
+ margin-bottom: 0; /* BUG: Safari 10 on macOS seems to add an implicit margin. */
12
+ line-height: 1.25;
13
+ height: 2.5rem;
14
+ width: 100%;
15
+ }
16
+
17
+ .autocomplete__input {
18
+ background-color: transparent;
19
+ position: relative;
20
+ }
21
+
22
+ .autocomplete__hint {
23
+ color: #505a5f;
24
+ position: absolute;
25
+ }
26
+
27
+ .autocomplete__input--default {
28
+ padding: 5px;
29
+ }
30
+
31
+ .autocomplete__input--focused {
32
+ outline: 3px solid #fd0;
33
+ outline-offset: 0;
34
+ box-shadow: inset 0 0 0 2px;
35
+ }
36
+
37
+ .autocomplete__input--show-all-values {
38
+ padding: 5px 35px 5px 5px; /* Space for arrow. Other padding should match .autocomplete__input--default. */
39
+ cursor: pointer;
40
+ }
41
+
42
+ .autocomplete__dropdown-arrow-down {
43
+ z-index: -1;
44
+ display: inline-block;
45
+ position: absolute;
46
+ right: 8px;
47
+ width: 24px;
48
+ height: 24px;
49
+ top: 10px;
50
+ }
51
+
52
+ .autocomplete__menu {
53
+ background-color: #ffffff;
54
+ border: 2px solid #0b0c0c;
55
+ border-top: 0;
56
+ color: #0b0c0c;
57
+ margin: 0;
58
+ max-height: 342px;
59
+ overflow-x: hidden;
60
+ padding: 0;
61
+ width: 100%;
62
+ width: calc(100% - 4px);
63
+ }
64
+
65
+ .autocomplete__menu--visible {
66
+ display: block;
67
+ }
68
+
69
+ .autocomplete__menu--hidden {
70
+ display: none;
71
+ }
72
+
73
+ .autocomplete__menu--overlay {
74
+ box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;
75
+ left: 0;
76
+ position: absolute;
77
+ top: 100%;
78
+ z-index: 100;
79
+ }
80
+
81
+ .autocomplete__menu--inline {
82
+ position: relative;
83
+ }
84
+
85
+ .autocomplete__option {
86
+ border-bottom: solid #b1b4b6;
87
+ border-width: 1px 0;
88
+ cursor: pointer;
89
+ display: block;
90
+ position: relative;
91
+ }
92
+
93
+ .autocomplete__option > * {
94
+ pointer-events: none;
95
+ }
96
+
97
+ .autocomplete__option:first-of-type {
98
+ border-top-width: 0;
99
+ }
100
+
101
+ .autocomplete__option:last-of-type {
102
+ border-bottom-width: 0;
103
+ }
104
+
105
+ .autocomplete__option--odd {
106
+ background-color: #f3f2f1;
107
+ }
108
+
109
+ .autocomplete__option--focused,
110
+ .autocomplete__option:hover {
111
+ background-color: #1d70b8;
112
+ border-color: #1d70b8;
113
+ color: white;
114
+ outline: none;
115
+ }
116
+
117
+ @media (-ms-high-contrast: active), (forced-colors: active) {
118
+ .autocomplete__menu {
119
+ border-color: FieldText;
120
+ }
121
+
122
+ .autocomplete__option {
123
+ background-color: Field;
124
+ color: FieldText;
125
+ }
126
+
127
+ .autocomplete__option--focused,
128
+ .autocomplete__option:hover {
129
+ forced-color-adjust: none; /* prevent backplate from obscuring text */
130
+ background-color: Highlight;
131
+ border-color: Highlight;
132
+ color: HighlightText;
133
+
134
+ /* Prefer SelectedItem / SelectedItemText in browsers that support it */
135
+ background-color: SelectedItem;
136
+ border-color: SelectedItem;
137
+ color: SelectedItemText;
138
+ outline-color: SelectedItemText;
139
+ }
140
+ }
141
+
142
+ .autocomplete__option--no-results {
143
+ background-color: #f3f2f1;
144
+ color: #505a5f;
145
+ cursor: not-allowed;
146
+ }
147
+
148
+ .autocomplete__hint,
149
+ .autocomplete__input,
150
+ .autocomplete__option {
151
+ font-size: 1rem;
152
+ font-weight: 400;
153
+ }
154
+
155
+ .autocomplete__hint,
156
+ .autocomplete__option {
157
+ padding: 5px;
158
+ }
159
+
160
+ @media (min-width: 641px) {
161
+ .autocomplete__hint,
162
+ .autocomplete__input,
163
+ .autocomplete__option {
164
+ font-size: 1.1875rem;
165
+ line-height: 1.3157894737;
166
+ }
167
+ }