diff --git a/.npmignore b/.npmignore deleted file mode 100644 index fe42a0201..000000000 --- a/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -dist/nhsuk.js -dist/nhsuk.css diff --git a/app/_templates/layout.njk b/app/_templates/layout.njk index cdd63d5ed..841b332e0 100644 --- a/app/_templates/layout.njk +++ b/app/_templates/layout.njk @@ -19,7 +19,6 @@ - diff --git a/docs/installation/installing-compiled.md b/docs/installation/installing-compiled.md index 7b4fe384f..5875b5560 100644 --- a/docs/installation/installing-compiled.md +++ b/docs/installation/installing-compiled.md @@ -30,7 +30,6 @@ If you require any of this functionality, you should [install using npm](/docs/i - @@ -62,7 +61,6 @@ If you require any of this functionality, you should [install using npm](/docs/i - diff --git a/gulpfile.js b/gulpfile.js index a652088aa..b08682253 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -79,31 +79,6 @@ function webpackJS() { .pipe(gulp.dest('./dist')); } -/* Concat the NHS.UK components JS with third party JS (typeahead). */ -function concatJS() { - return gulp.src([ - 'packages/components/header/typeahead.bundle.min.js', - 'packages/components/header/nhs.typeahead.js', - 'dist/nhsuk.js', - ]) - .pipe(concat('nhsuk.js')) - .pipe(gulp.dest(['dist/'])); -} - -/* Delete the Webpack nhsuk.bundle.js after its been concatenated. */ -function cleanJS() { - return del('dist/nhsuk.bundle.js'); -} - -/* Copy jQuery dependency into dist folder for release */ -function thirdPartyAssets() { - return gulp.src('./node_modules/jquery/dist/jquery.min.js') - .pipe(rename({ - basename: 'jquery-3.3.1.min', - })) - .pipe(gulp.dest('dist/')); -} - /* Minify the JS file for release */ function minifyJS() { return gulp.src([ @@ -181,8 +156,6 @@ gulp.task('style', compileCSS); gulp.task('build', gulp.series([ compileCSS, webpackJS, - concatJS, - cleanJS, ])); gulp.task('bundle', gulp.series([ cleanDist, @@ -194,7 +167,6 @@ gulp.task('bundle', gulp.series([ gulp.task('zip', gulp.series([ 'bundle', assets, - thirdPartyAssets, jsFolder, cssFolder, createZip diff --git a/package-lock.json b/package-lock.json index dc7e6f279..07620618d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1298,6 +1298,14 @@ "negotiator": "0.6.1" } }, + "accessible-autocomplete": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/accessible-autocomplete/-/accessible-autocomplete-1.6.2.tgz", + "integrity": "sha512-7S+6Vi82LQFSSd5feKedu46tiY2/DShpdXiRp0NY3cLwc+DKe1ayWd66mb3JVi8LTQubRM7jco+u92e6w0bbvg==", + "requires": { + "preact": "^8.3.1" + } + }, "acorn": { "version": "5.7.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", @@ -4692,27 +4700,27 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "aproba": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "dev": true, "optional": true, @@ -4723,13 +4731,13 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.11", - "resolved": false, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { @@ -4739,39 +4747,39 @@ }, "chownr": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "concat-map": { "version": "0.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "console-control-strings": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true }, "core-util-is": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true, "optional": true }, "debug": { "version": "2.6.9", - "resolved": false, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "optional": true, @@ -4781,28 +4789,28 @@ }, "deep-extend": { "version": "0.5.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", "dev": true, "optional": true }, "delegates": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "dev": true, "optional": true }, "fs-minipass": { "version": "1.2.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "dev": true, "optional": true, @@ -4812,14 +4820,14 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true, @@ -4836,7 +4844,7 @@ }, "glob": { "version": "7.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "optional": true, @@ -4851,14 +4859,14 @@ }, "has-unicode": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.21", - "resolved": false, + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", "dev": true, "optional": true, @@ -4868,7 +4876,7 @@ }, "ignore-walk": { "version": "3.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "dev": true, "optional": true, @@ -4878,7 +4886,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "optional": true, @@ -4889,20 +4897,20 @@ }, "inherits": { "version": "2.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "ini": { "version": "1.3.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { @@ -4911,14 +4919,14 @@ }, "isarray": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { @@ -4927,13 +4935,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "minipass": { "version": "2.2.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz", "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "dev": true, "requires": { @@ -4943,7 +4951,7 @@ }, "minizlib": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", "dev": true, "optional": true, @@ -4953,7 +4961,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -4962,14 +4970,14 @@ }, "ms": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true, "optional": true }, "needle": { "version": "2.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.0.tgz", "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", "dev": true, "optional": true, @@ -4981,7 +4989,7 @@ }, "node-pre-gyp": { "version": "0.10.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz", "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", "dev": true, "optional": true, @@ -5000,7 +5008,7 @@ }, "nopt": { "version": "4.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, @@ -5011,14 +5019,14 @@ }, "npm-bundled": { "version": "1.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.3.tgz", "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", "dev": true, "optional": true }, "npm-packlist": { "version": "1.1.10", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.10.tgz", "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", "dev": true, "optional": true, @@ -5029,7 +5037,7 @@ }, "npmlog": { "version": "4.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "optional": true, @@ -5042,20 +5050,20 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "object-assign": { "version": "4.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { @@ -5064,21 +5072,21 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "optional": true, @@ -5089,21 +5097,21 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true, "optional": true }, "rc": { "version": "1.2.7", - "resolved": false, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.7.tgz", "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", "dev": true, "optional": true, @@ -5116,7 +5124,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true, "optional": true @@ -5125,7 +5133,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "optional": true, @@ -5141,7 +5149,7 @@ }, "rimraf": { "version": "2.6.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "optional": true, @@ -5151,48 +5159,48 @@ }, "safe-buffer": { "version": "5.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, "safer-buffer": { "version": "2.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "optional": true }, "sax": { "version": "1.2.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true, "optional": true }, "semver": { "version": "5.5.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "string-width": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -5203,7 +5211,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "optional": true, @@ -5213,7 +5221,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -5222,14 +5230,14 @@ }, "strip-json-comments": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "4.4.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.1.tgz", "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", "dev": true, "optional": true, @@ -5245,14 +5253,14 @@ }, "util-deprecate": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true, "optional": true }, "wide-align": { "version": "1.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "dev": true, "optional": true, @@ -5262,13 +5270,13 @@ }, "wrappy": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "yallist": { "version": "3.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", "dev": true } @@ -6905,12 +6913,6 @@ "integrity": "sha1-U+RI7J0mPmgyZkZ+lELSxaLvVII=", "dev": true }, - "jquery": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", - "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==", - "dev": true - }, "js-base64": { "version": "2.4.9", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.9.tgz", @@ -8938,6 +8940,11 @@ "integrity": "sha512-vPvPe8TKgp4FLgY3+DfxCE5PIfoXBK2lyLfNCxsRbDsV6vS4oU5RG/IWxrblMn6heagbnMED3MemUQllQ2bQUg==", "dev": true }, + "preact": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/preact/-/preact-8.4.2.tgz", + "integrity": "sha512-TsINETWiisfB6RTk0wh3/mvxbGRvx+ljeBccZ4Z6MPFKgu/KFGyf2Bmw3Z/jlXhL5JlNKY6QAbA9PVyzIy9//A==" + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", diff --git a/package.json b/package.json index c5ab7c14e..39fb86e46 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,9 @@ "build-gh-release": "gulp zip" }, "dependencies": { + "accessible-autocomplete": "^1.6.2", "sass-mq": "^4.0.2" }, - "peerDependencies": { - "jquery": "^3.3.1" - }, "devDependencies": { "@babel/core": "^7.2.2", "@babel/preset-env": "^7.2.3", @@ -48,7 +46,6 @@ "gulp-wrap": "^0.14.0", "gulp-zip": "^4.2.0", "htmlhint": "^0.10.1", - "jquery": "^3.3.1", "nunjucks": "^3.1.6", "sass-lint": "^1.12.1", "webpack-stream": "^5.2.1" diff --git a/packages/components/header/README.md b/packages/components/header/README.md index 18b209303..dcb0e6185 100644 --- a/packages/components/header/README.md +++ b/packages/components/header/README.md @@ -11,8 +11,6 @@ Find out more about the header component and when to use it in the [NHS Digital For this component to work, you need to make sure you include the required JavaScript. You can either include the compiled JavaScript for all components `nhsuk.min.js` or the individual component JavaScript `header.js`. -The search component autocomplete requires jQuery, please ensure you have jQuery included within you project for this to work. In the future we are looking to remove the jQuery dependency. You must also include the typeahead scripts for the autocomplete `typeahead.bundle.min.js` and `nhs.typeahead.js`. - > For performance and security reasons, we do not recommend using a jQuery CDN, instead have the jQuery dependency hosted local to your project. ## Quick start examples diff --git a/packages/components/header/_autocomplete.scss b/packages/components/header/_autocomplete.scss new file mode 100644 index 000000000..968097275 --- /dev/null +++ b/packages/components/header/_autocomplete.scss @@ -0,0 +1,182 @@ +/* ========================================================================== + COMPONENTS / #HEADER / #AUTOCOMPLETE + ========================================================================== */ + +/** + * 1. IE 10 prefix for flexbox + * 2. Proprietary extension so form field looks the same in Safari + * 3. Custom height and width of form items + * 4. Custom height and width of svg icons + * 5. Custom spacing to position the search icon + * 6. Drop shadow on search suggestions dopdown box, custom spread and blur + * 7. Needs !important because autocomplete js adds inline styling so need to + * override + * 8. Z-index to bring the dropdown to the front + * 9. No current spacing at 12px so using this value +*/ + +.autocomplete-container { + display: inline-block; + + @include mq($until: tablet) { + display: inline; + width: 100%; + } +} + +.autocomplete__wrapper { + position: relative; +} + +@include mq($until: tablet) { + /* duplicate of .nhsuk-search__input in _header.scss, for non javascript version */ + .autocomplete__input { + -ms-flex-positive: 2; /* [1] */ + -webkit-appearance: listbox; // sass-lint:disable-line prefixes /* [2] */ + border-bottom: 1px solid $color_nhsuk-grey-3; + border-bottom-left-radius: $nhsuk-border-radius; + border-bottom-right-radius: 0; + border-left: 1px solid $color_nhsuk-grey-3; + border-right: 0; + border-top: 1px solid $color_nhsuk-grey-3; + border-top-left-radius: $nhsuk-border-radius; + border-top-right-radius: 0; + flex-grow: 2; + font-size: inherit; + height: 52px; /* [3] */ + margin: 0; + outline: none; + padding: 0 nhsuk-spacing(3); + width: 100%; /* [3] */ + + &:focus { + box-shadow: inset 0 0 0 $nhsuk-box-shadow-spread $nhsuk-focus-color; + } + } +} + +@include mq($from: tablet) { + /* duplicate of .nhsuk-search__input in _header.scss, for non javascript version */ + .autocomplete__input { + -webkit-appearance: listbox; // sass-lint:disable-line prefixes /* [2] */ + border: 1px solid $color_nhsuk-white; + border-bottom-left-radius: $nhsuk-border-radius; + border-bottom-right-radius: 0; + border-top-left-radius: $nhsuk-border-radius; + border-top-right-radius: 0; + font-size: $nhsuk-base-font-size; + height: 40px; /* [3] */ + padding: 0 12px; /* [9] */ + width: 235px; /* [3] */ + + &:focus { + border: 1px solid $nhsuk-focus-color; + box-shadow: inset 0 0 0 ($nhsuk-box-shadow-spread - 1) $nhsuk-focus-color; + outline: none; + } + + &::placeholder { + color: $color_nhsuk-grey-2; + font-size: $nhsuk-base-font-size; + } + } +} + +.autocomplete__menu { + // sass-lint:disable-block no-vendor-prefixes, no-color-literals + -moz-box-shadow: 0 3px 5px rgba($nhsuk-box-shadow-color, $alpha-transparency-50); /* [6] */ + -webkit-box-shadow: 0 3px 5px rgba($nhsuk-box-shadow-color, $alpha-transparency-50); /* [6] */ + background-color: $color_nhsuk-white; + border-bottom: 1px solid $color_nhsuk-grey-4; + border-bottom-left-radius: $nhsuk-border-radius; + border-bottom-right-radius: $nhsuk-border-radius; + border-left: 1px solid $color_nhsuk-grey-4; + border-right: 1px solid $color_nhsuk-grey-4; + box-shadow: 0 0 ($nhsuk-box-shadow-spread - 1) 0 rgba($nhsuk-box-shadow-color, $alpha-transparency-50); /* [6] */ + list-style: none; + margin-top: 2px; + overflow-x: hidden; + overflow-y: auto; + padding: nhsuk-spacing(3); + position: fixed; + z-index: 1; /* [8] */ + + @include mq($until: tablet) { + border: 0; + box-shadow: none; + margin: 0; + padding-left: 0; + padding-right: 0; + position: relative; + top: auto !important; // sass-lint:disable-line no-important /* [7] */ + width: 100% !important; // sass-lint:disable-line no-important /* [7] */ + } +} + +.autocomplete__menu--visible { + display: block; +} + +.autocomplete__menu--hidden { + display: none; +} + +.autocomplete__option { + border-bottom: 1px solid $color_nhsuk-grey-5; + color: $color_nhsuk-blue; + cursor: pointer; + font-size: $nhsuk-base-font-size; + font-weight: $nhsuk-font-light; + padding-bottom: 12px; /* [9] */ + text-align: left; + text-decoration: underline; + + .nhsuk-icon__search { + fill: $color_nhsuk-grey-3; + float: left; + height: 22px; /* [4] */ + margin: 5px 4px 0 0; /* [5] */ + width: 22px; /* [4] */ + } + + &:hover, + &:active { + text-decoration: none; + } + + &:hover, + &:focus { + a { + background-color: $color_nhsuk-warm-yellow; + box-shadow: 0 0 0 $nhsuk-box-shadow-spread $color_nhsuk-warm-yellow; + color: $color_nhsuk-black; + text-decoration: none; + } + } + + &:focus { + outline: 1px solid transparent; + text-decoration: none; + } + + @include mq($from: tablet) { + &:last-child { + border-bottom: 0; + } + } +} + +.autocomplete__option--no-results { + border-bottom: 0; + color: $color_nhsuk-black; + font-size: $nhsuk-base-font-size; + line-height: $nhsuk-base-line-height; + margin: 0; + padding: 0; + text-align: left; + text-decoration: none; + + @include mq($until: tablet) { + padding: nhsuk-spacing(3) 0; + } +} diff --git a/packages/components/header/_header.scss b/packages/components/header/_header.scss index 158cffd86..b07da7adc 100644 --- a/packages/components/header/_header.scss +++ b/packages/components/header/_header.scss @@ -38,6 +38,8 @@ * 16. Custom padding-top to vertically align service name and logo */ +@import 'autocomplete'; + .nhsuk-header { @include clearfix(); background-color: $color_nhsuk-blue; @@ -114,6 +116,7 @@ } .nhsuk-header__search-form { + height: 100%; overflow: hidden; } @@ -227,6 +230,7 @@ .nhsuk-header__search-wrap { display: block; + line-height: 0; } .nhsuk-header__search-toggle { @@ -250,6 +254,8 @@ &:focus { border: 1px solid $nhsuk-focus-color; + border-bottom-left-radius: 0; + border-top-left-radius: 0; box-shadow: inset 0 0 0 ($nhsuk-box-shadow-spread - 1) $nhsuk-focus-color; outline: none; } @@ -320,115 +326,6 @@ } -.twitter-typeahead { - display: inline !important; // sass-lint:disable-line no-important /* [6] */ - width: 100%; -} - -.suggestions-list { - -moz-box-shadow: 0 3px 5px 0 rgba($nhsuk-box-shadow-color, $alpha-transparency-50); // sass-lint:disable-line no-vendor-prefixes, no-color-literals /* [8] */ - -webkit-box-shadow: 0 3px 5px 0 rgba($nhsuk-box-shadow-color, $alpha-transparency-50); // sass-lint:disable-line no-vendor-prefixes, no-color-literals /* [8] */ - background-color: $color_nhsuk-white; - border-bottom: 1px solid $color_nhsuk-grey-4; - border-bottom-left-radius: $nhsuk-border-radius; - border-bottom-right-radius: $nhsuk-border-radius; - border-left: 1px solid $color_nhsuk-grey-4; - border-right: 1px solid $color_nhsuk-grey-4; - border-top: 2px solid $color_nhsuk-blue; - box-shadow: 0 0 ($nhsuk-box-shadow-spread - 1) 0 rgba($nhsuk-box-shadow-color, $alpha-transparency-50); // sass-lint:disable-line no-color-literals /* [8] */ - height: auto; - list-style: none; - margin-top: 0; - overflow-x: hidden; - overflow-y: auto; - padding: nhsuk-spacing(2) nhsuk-spacing(3) nhsuk-spacing(3); - position: absolute; - z-index: 1; /* [10] */ -} - - -@include mq($until: tablet) { - - .suggestions-menu { - position: relative !important; // sass-lint:disable-line no-important /* [6] */ - top: 0 !important; // sass-lint:disable-line no-important /* [6] */ - } - - .suggestions-list { - border: 0; - border-radius: 0; - box-shadow: none; - left: auto !important; // sass-lint:disable-line no-important /* [6] */ - margin: 0; - padding-bottom: nhsuk-spacing(3); - position: relative !important; // sass-lint:disable-line no-important /* [6] */ - top: auto !important; // sass-lint:disable-line no-important /* [6] */ - width: 100% !important; // sass-lint:disable-line no-important /* [6] */ - } - -} - -.suggestions-item { - border-bottom: 1px solid $color_nhsuk-grey-5; - color: $color_nhsuk-blue; - cursor: pointer; - font-size: $nhsuk-base-font-size; - font-weight: $nhsuk-font-light; - padding-bottom: 12px; /* [9] */ - text-align: left; - text-decoration: underline; - - .nhsuk-icon__search { - fill: $color_nhsuk-grey-3; - float: left; - height: 22px; /* [2] */ - margin: 5px 4px 0 0; /* [7] */ - width: 22px; /* [2] */ - } - - &:hover, - &:active { - text-decoration: none; - } - - &:hover, - &:focus { - div { - background-color: $color_nhsuk-warm-yellow; - box-shadow: 0 0 0 $nhsuk-box-shadow-spread $color_nhsuk-warm-yellow; - color: $color_nhsuk-black; - display: inline; - } - } - -} - -.suggestions-item--selected { - a { - background-color: $color_nhsuk-warm-yellow; - box-shadow: 0 0 0 $nhsuk-box-shadow-spread $color_nhsuk-warm-yellow; - color: $color_nhsuk-black; - display: inline; - text-decoration: none; - } -} - -.suggestions-title { - border-bottom: 1px solid $color_nhsuk-grey-4; - color: $nhsuk-text-color; - font-size: $nhsuk-base-font-size; - font-weight: $nhsuk-font-bold; - padding-bottom: 12px; /* [9] */ - text-align: left; -} - -.suggestions-none { - font-size: $nhsuk-base-font-size; - line-height: $nhsuk-base-line-height; - margin: 0; - text-align: left; -} - /* Main navigation * * Appears below the header strip diff --git a/packages/components/header/autocomplete.js b/packages/components/header/autocomplete.js new file mode 100644 index 000000000..882e47a26 --- /dev/null +++ b/packages/components/header/autocomplete.js @@ -0,0 +1,118 @@ +import accessibleAutocomplete from 'accessible-autocomplete'; + +function positionsAndWidths() { + // Get width and position for desktop sizes to position the dropdown. + // For smaller viewports, doesn't need to be positioned so styling is overridden by CSS + const wrap = document.getElementById('wrap-search'); + + if (wrap) { + const wrapRect = wrap.getBoundingClientRect(); + const listBox = document.getElementById('search-field__listbox'); + listBox.style.width = wrapRect.width + 'px'; + listBox.style.top = wrapRect.bottom + 'px'; + } +} + +function getFunnelbackQueryUrl(query) { + const FUNNELBACK_QUERY_PATH = 'https://nhs.funnelback.co.uk/s/suggest.json'; + const FUNNELBACK_MAX_RESULTS = 10; + return `${FUNNELBACK_QUERY_PATH}?collection=nhs-meta&partial_query=${query}&sort=0&fmt=json++&profile=&show=${FUNNELBACK_MAX_RESULTS}`; +} + +function getFunnelbackResults(query, populateResults) { + const url = getFunnelbackQueryUrl(query); + const xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.onload = function () { + if (xhr.status === 200) { + const data = JSON.parse(xhr.responseText); + const results = data.map(item => { + return item.disp; + }); + populateResults(results); + } else { + // TODO: nice error messaging here + // console.warn(xhr); + } + }; + xhr.send(); +} + +function autocomplete(config) { + const defaultId = 'search-field'; + const id = (config && config.id) ? config.id : defaultId; + const fallbackInputElement = document.getElementById(id); + + if (!fallbackInputElement) { + return; + } + + function suggestionTemplate(result) { + const truncateLength = 36; + const dots = result.length > truncateLength ? '...' : ''; + const resultTruncated = result.substring(0, truncateLength) + dots; + const svgIcon = ''; + const resultsHref = '' + resultTruncated + ''; + + return svgIcon + resultsHref; + } + + const defaultConfig = { + element: document.querySelector('#autocomplete-container'), + id: id, + minLength: 2, + placeholder: fallbackInputElement.placeholder, + confirmOnBlur: false, + onConfirm: (SelectedContent) => { + window.open('https://www.nhs.uk/search?collection=nhs-meta&query=' + SelectedContent, '_self'); + }, + source: getFunnelbackResults, + templates: { + suggestion: suggestionTemplate, + }, + }; + + const accessibleAutocompleteConfig = { + ...defaultConfig, + ...config, + }; + + const idToremove = document.getElementById(id); + idToremove.parentNode.removeChild(idToremove); + accessibleAutocomplete(accessibleAutocompleteConfig); + +} + +if (document.getElementById('wrap-search')) { + + // only add event listener if 'wrap-search' exists to act on + window.addEventListener("load", function(event) { + + positionsAndWidths(); + + // To deal with window resizing, need to reset positioning of search results dropdown + // Use setTimeout on resize so as not to kill CPU + // https://developer.mozilla.org/en-US/docs/Web/Events/resize + window.addEventListener("resize", resizeThrottler, false); + + let resizeTimeout; + function resizeThrottler() { + // ignore resize events as long as an actualResizeHandler execution is in the queue + if ( !resizeTimeout ) { + resizeTimeout = setTimeout(function() { + resizeTimeout = null; + actualResizeHandler(); + // The actualResizeHandler will execute at a rate of 15fps + }, 66); + } + } + + function actualResizeHandler() { + positionsAndWidths(); + } + + }); + +} + +export default autocomplete; diff --git a/packages/components/header/nhs.typeahead.js b/packages/components/header/nhs.typeahead.js deleted file mode 100644 index a798ccbac..000000000 --- a/packages/components/header/nhs.typeahead.js +++ /dev/null @@ -1,158 +0,0 @@ -window.onload = function() { - if (window.jQuery) { - - var NHSUK = NHSUK || {}; - - NHSUK.typeahead = - (function ($) { - var maxResultCount = 10, - suggestHost = 'nhs.funnelback.co.uk' - ? 'nhs.funnelback.co.uk' - : location.hostname, - searchHost = 'www.nhs.uk' - ? 'www.nhs.uk' - : location.hostname, - searchUrl = 'https://' + searchHost + '/search?collection=nhs-meta', - suggestUrl = 'https://' + suggestHost - + '/s/suggest.json?collection=nhs-meta&partial_query=%QUERY&sort=0&fmt=json++&profile=&show=' - + maxResultCount, - suggestions = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('disp'), - queryTokenizer: Bloodhound.tokenizers.whitespace, - limit: maxResultCount, - remote: { url : suggestUrl,wildcard: '%QUERY' } - }), - searchField = '#search-field'; - - function init() { - suggestions.initialize(); - - var $suggestionsMenu = 'suggestions-menu', - $suggestionsList = 'suggestions-list', - $suggestionsItem = 'suggestions-item', - $suggestionsWrapper = 'suggestions-wrapper', - $suggestionsItemSelected = 'suggestions-item--selected', - $searchInputShadow = 'nhsuk-search__input--shadow', - $iconSearch = '', - $suggestionsTitle = 'suggestions-title', - $suggestionsNone = 'suggestions-none', - $searchContainer = 'nhsuk-header__search', - $searchForm = 'nhsuk-header__search-form', - $searchInput = 'nhsuk-search__input', - $searchSubmit = 'nhsuk-search__submit', - $searchInputWithDropdown = 'nhsuk-search__input--withdropdown', - $searchSubmitWithDropdown = 'nhsuk-search__submit--withdropdown'; - - $(searchField).typeahead({ - minLength: 2, - highlight: true, - classNames: { - menu: $suggestionsMenu, - suggestion: $suggestionsItem, - highlight: '', - selectable: 's', // unused but required for some reason - dataset: $suggestionsWrapper, - cursor: $suggestionsItemSelected, - hint: $searchInputShadow - } - }, - { - name : '-suggestions', - limit: maxResultCount, - display: 'disp', - source: suggestions.ttAdapter(), - templates: { - header: '
  • Search suggestions
  • ', - notFound: '
  • No suggestions
  • ', - suggestion: function(data){ - var displayitem = ""; - switch (data.disp_t) { - case 'J': - $.each(data.disp, function(key, value) { - displayitem += (key, value); - displayitem += " "; - }); - break; - - default: - - if (data.disp.length > 36) - displayitem = data.disp.substring(0,36)+'...'; - else - displayitem = data.disp; - break; - } - - switch (data.action_t) { - case 'Q': - displayitem = '
  • ' + $iconSearch + '' + displayitem + '
  • '; - break; - case 'E': - displayitem = '
  • ' + $iconSearch + '' + displayitem + '
  • '; - break; - case 'U': - displayitem = '
  • ' + $iconSearch + '' + displayitem + '
  • '; - break; - case 'C': - displayitem = '
  • ' + $iconSearch + '' + displayitem + '
  • '; - break; - default: - displayitem = '
  • ' + $iconSearch + '' + displayitem + '
  • '; - break; - } - - return displayitem; - }, - } - - }) - .bind('typeahead:open', function() { - var val = $(searchField).typeahead('val'), - value = $(searchField).attr('value'); - - if (val === value) { - $(searchField).typeahead('val', value); - } - if (val.toLowerCase() === 'enter a search term'){ - $(searchField).typeahead('val', ''); - } - - }) - .bind('typeahead:render', function() { - $('.' + $suggestionsWrapper).wrapInner(''); // add list element around the suggestions - $('.' + $suggestionsList).css('width', $('.' + $searchForm).width()); // get width of the form and give it to the dropdown list - $('.' + $searchInput).addClass($searchInputWithDropdown); // add classes to remove border radius on input and submit fields when dropdown appears - $('.' + $searchSubmit).addClass($searchSubmitWithDropdown); - $('.' + $suggestionsMenu).insertAfter( $('.' + $searchContainer) ); // move the suggestions in the DOM - - // calculate where to position the dropdown from the top and left - var topoffset = $('.' + $searchForm).offset().top + $('.' + $searchInput).height(); - var position = $('.' + $searchContainer).position(); - - $('.' + $suggestionsMenu).css({ - 'top' : topoffset + 2, // add 2 for borders? - 'left' : position.left - }); - - }) - .bind('typeahead:close', function() { - $('.' + $searchInput).removeClass($searchInputWithDropdown); - $('.' + $searchSubmit).removeClass($searchSubmitWithDropdown); - }) - .bind('typeahead:idle', function() { - $('.' + $suggestionsList).hide(); - }); - } - - return { - init: init - }; - }(jQuery)); - - $(function(){ - NHSUK.typeahead.init(); - $('.nhsuk-search__input--shadow').attr('aria-hidden', 'true').addClass('nhsuk-u-visually-hidden'); // hide the extra input field created by typeahead to screen readers - }); - - } -} diff --git a/packages/components/header/template.njk b/packages/components/header/template.njk index f918753f3..24c8f09e8 100644 --- a/packages/components/header/template.njk +++ b/packages/components/header/template.njk @@ -45,6 +45,7 @@