@nice-digital/global-nav 7.1.1091 → 7.1.1092
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Footer/Pages/links.json +15 -11
- package/lib/Footer/Services/Services.js +1 -1
- package/lib/Header/Header.js +16 -2
- package/lib/Header/Header.module.scss +1 -0
- package/lib/Header/Nav/Dropdown/Components/Components.module.scss +1 -1
- package/lib/Header/Nav/Dropdown/Components/MoreFromNICE.js +87 -0
- package/lib/Header/Nav/Dropdown/Components/index.js +8 -1
- package/lib/Header/Nav/Dropdown/Dropdown.module.scss +4 -0
- package/lib/Header/Nav/Nav.module.scss +16 -4
- package/lib/Header/Nav/NavLinks/NavLinks.js +4 -6
- package/lib/Header/Nav/NavLinks/NavLinks.module.scss +4 -0
- package/lib/Header/Nav/__mocks__/services.json +3 -3
- package/lib/Header/Search/Autocomplete/Autocomplete.js +38 -20
- package/lib/Header/context/HeaderContext.js +2 -1
- package/lib/services.json +50 -49
- package/package.json +1 -1
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"href": "https://www.nice.org.uk/
|
|
4
|
-
"text": "
|
|
3
|
+
"href": "https://www.nice.org.uk/what-nice-does",
|
|
4
|
+
"text": "What NICE does"
|
|
5
5
|
},
|
|
6
6
|
{
|
|
7
|
-
"href": "https://www.nice.org.uk/
|
|
8
|
-
"text": "
|
|
7
|
+
"href": "https://www.nice.org.uk/implementing-nice-guidance",
|
|
8
|
+
"text": "Implementing NICE guidance"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"href": "https://www.nice.org.uk/get-involved",
|
|
12
|
-
"text": "Get involved
|
|
12
|
+
"text": "Get involved"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"href": "https://www.nice.org.uk/
|
|
16
|
-
"text": "
|
|
15
|
+
"href": "https://www.nice.org.uk/about-us",
|
|
16
|
+
"text": "About us"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"href": "https://www.nice.org.uk/careers",
|
|
20
|
+
"text": "Careers"
|
|
17
21
|
},
|
|
18
22
|
{
|
|
19
23
|
"href": "https://www.nice.org.uk/news",
|
|
20
|
-
"text": "News"
|
|
24
|
+
"text": "News, blogs and podcasts"
|
|
21
25
|
},
|
|
22
26
|
{
|
|
23
|
-
"href": "https://www.nice.org.uk/
|
|
27
|
+
"href": "https://www.nice.org.uk/nice-newsletters-and-alerts",
|
|
24
28
|
"text": "Newsletters and alerts"
|
|
25
29
|
},
|
|
26
30
|
{
|
|
27
|
-
"href": "https://www.nice.org.uk/
|
|
31
|
+
"href": "https://www.nice.org.uk/contact-us",
|
|
28
32
|
"text": "Contact us"
|
|
29
33
|
},
|
|
30
34
|
{
|
|
@@ -32,7 +36,7 @@
|
|
|
32
36
|
"text": "Leave feedback"
|
|
33
37
|
},
|
|
34
38
|
{
|
|
35
|
-
"href": "https://www.nice.org.uk/
|
|
39
|
+
"href": "https://www.nice.org.uk/reusing-our-content",
|
|
36
40
|
"text": "Reusing our content"
|
|
37
41
|
},
|
|
38
42
|
{
|
|
@@ -41,7 +41,7 @@ FooterLink.propTypes = {
|
|
|
41
41
|
landingPath: _propTypes.default.string,
|
|
42
42
|
id: _propTypes.default.string,
|
|
43
43
|
text: _propTypes.default.string,
|
|
44
|
-
abbreviation: _propTypes.default.
|
|
44
|
+
abbreviation: _propTypes.default.string,
|
|
45
45
|
title: _propTypes.default.string
|
|
46
46
|
};
|
|
47
47
|
function FooterLink(_ref) {
|
package/lib/Header/Header.js
CHANGED
|
@@ -149,7 +149,7 @@ var Header = function Header(_ref) {
|
|
|
149
149
|
className: _HeaderModule.default.container,
|
|
150
150
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
151
151
|
href: "https://www.nice.org.uk/",
|
|
152
|
-
"aria-label": "
|
|
152
|
+
"aria-label": "NICE: National Institute for Health and Care Excellence homepage",
|
|
153
153
|
className: _HeaderModule.default.home,
|
|
154
154
|
onClick: handleLogoClick,
|
|
155
155
|
"data-tracking": "Logo",
|
|
@@ -324,7 +324,7 @@ var OldHeader = exports.OldHeader = /*#__PURE__*/function (_Component) {
|
|
|
324
324
|
className: _HeaderModule.default.container,
|
|
325
325
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
326
326
|
href: "https://www.nice.org.uk/",
|
|
327
|
-
"aria-label": "
|
|
327
|
+
"aria-label": "NICE: National Institute for Health and Care Excellence homepage",
|
|
328
328
|
className: _HeaderModule.default.home,
|
|
329
329
|
onClick: this.handleLogoClick,
|
|
330
330
|
"data-tracking": "Logo",
|
|
@@ -389,4 +389,18 @@ Header.propTypes = {
|
|
|
389
389
|
additionalSubMenuItems: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
390
390
|
renderSearchOnly: _propTypes.default.bool
|
|
391
391
|
};
|
|
392
|
+
OldHeader.propTypes = {
|
|
393
|
+
service: _propTypes.default.string,
|
|
394
|
+
skipLinkId: _propTypes.default.string,
|
|
395
|
+
enabled: _propTypes.default.bool,
|
|
396
|
+
search: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
|
|
397
|
+
auth: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
|
|
398
|
+
onNavigating: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
|
|
399
|
+
onResize: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
|
|
400
|
+
onDropdownOpen: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
|
|
401
|
+
onDropdownClose: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
|
|
402
|
+
onRendered: _propTypes.default.func,
|
|
403
|
+
additionalSubMenuItems: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
404
|
+
renderSearchOnly: _propTypes.default.bool
|
|
405
|
+
};
|
|
392
406
|
var _default = exports.default = Header;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.MoreFromNICE = MoreFromNICE;
|
|
8
|
+
var _Grid = require("./Grid");
|
|
9
|
+
var _ComponentsModule = _interopRequireDefault(require("./Components.module.scss"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/* eslint-disable react/prop-types */
|
|
13
|
+
|
|
14
|
+
function MoreFromNICE(_ref) {
|
|
15
|
+
var rootUrl = _ref.rootUrl;
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
17
|
+
"aria-label": "More from NICE - navigation",
|
|
18
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
19
|
+
className: "mt--0",
|
|
20
|
+
children: "Explore more from NICE"
|
|
21
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.Grid, {
|
|
22
|
+
gutter: "loose",
|
|
23
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.GridItem, {
|
|
24
|
+
"data-tracking": "Explore more",
|
|
25
|
+
className: (0, _classnames.default)(_ComponentsModule.default.aboutCol),
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
27
|
+
className: (0, _classnames.default)(_ComponentsModule.default.listColumnar, "mt--d"),
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
29
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
30
|
+
href: "".concat(rootUrl, "/what-nice-does"),
|
|
31
|
+
children: "What NICE does"
|
|
32
|
+
})
|
|
33
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
34
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
35
|
+
href: "".concat(rootUrl, "/about-us"),
|
|
36
|
+
children: "About us"
|
|
37
|
+
})
|
|
38
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
39
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
40
|
+
href: "".concat(rootUrl, "/reusing-our-content"),
|
|
41
|
+
children: "Reusing our content"
|
|
42
|
+
})
|
|
43
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
45
|
+
href: "".concat(rootUrl, "/implementing-nice-guidance"),
|
|
46
|
+
children: "Implementing NICE guidance"
|
|
47
|
+
})
|
|
48
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
49
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
50
|
+
href: "".concat(rootUrl, "/news"),
|
|
51
|
+
children: "News, blogs and podcasts"
|
|
52
|
+
})
|
|
53
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
55
|
+
href: "".concat(rootUrl, "/contact-us"),
|
|
56
|
+
children: "Contact us"
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
59
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
60
|
+
href: "".concat(rootUrl, "/get-involved"),
|
|
61
|
+
children: "Get involved"
|
|
62
|
+
})
|
|
63
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
65
|
+
href: "".concat(rootUrl, "/careers"),
|
|
66
|
+
children: "Careers"
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
72
|
+
className: (0, _classnames.default)(_ComponentsModule.default.inlineList, "mt--d"),
|
|
73
|
+
"data-tracking": "Quick links",
|
|
74
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
75
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
76
|
+
href: "".concat(rootUrl, "/get-involved/our-committees"),
|
|
77
|
+
children: "Join a committee"
|
|
78
|
+
})
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
81
|
+
href: "".concat(rootUrl, "/get-involved/consultations"),
|
|
82
|
+
children: "Comment on a consultation"
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "LifeSciences", {
|
|
|
15
15
|
return _LifeSciences.LifeSciences;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "MoreFromNICE", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _MoreFromNICE.MoreFromNICE;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "StandardsAndIndicators", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function get() {
|
|
@@ -23,4 +29,5 @@ Object.defineProperty(exports, "StandardsAndIndicators", {
|
|
|
23
29
|
});
|
|
24
30
|
var _AboutUs = require("./AboutUs");
|
|
25
31
|
var _LifeSciences = require("./LifeSciences");
|
|
26
|
-
var _StandardsAndIndicators = require("./StandardsAndIndicators");
|
|
32
|
+
var _StandardsAndIndicators = require("./StandardsAndIndicators");
|
|
33
|
+
var _MoreFromNICE = require("./MoreFromNICE");
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
@use '../header-settings';
|
|
11
11
|
@use '../../Common.module.scss';
|
|
12
12
|
|
|
13
|
+
$chevron-vertical-nudge-desktop: -3 * utils.rem(spacing.$x-small);
|
|
14
|
+
|
|
13
15
|
.wrapper {
|
|
14
16
|
@include visibility.hide-print;
|
|
15
17
|
display: none;
|
|
@@ -62,15 +64,14 @@
|
|
|
62
64
|
|
|
63
65
|
> li {
|
|
64
66
|
margin: 0;
|
|
65
|
-
@include media-queries.mq($from: md) {
|
|
66
|
-
flex-grow: 1;
|
|
67
|
-
}
|
|
68
67
|
}
|
|
68
|
+
|
|
69
69
|
@include media-queries.mq($from: md) {
|
|
70
70
|
@include layout.container;
|
|
71
71
|
display: flex;
|
|
72
72
|
flex-flow: row nowrap;
|
|
73
|
-
|
|
73
|
+
gap: utils.rem(spacing.$medium);
|
|
74
|
+
justify-content: flex-start;
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -124,6 +125,17 @@ a.link,
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
svg {
|
|
129
|
+
align-self: center;
|
|
130
|
+
margin-left: utils.rem(spacing.$x-small);
|
|
131
|
+
position: relative;
|
|
132
|
+
vertical-align: middle;
|
|
133
|
+
|
|
134
|
+
@include media-queries.mq($from: md) {
|
|
135
|
+
top: $chevron-vertical-nudge-desktop;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
127
139
|
@include media-queries.mq($from: md) {
|
|
128
140
|
justify-content: space-evenly;
|
|
129
141
|
padding: utils.rem(spacing.$medium);
|
|
@@ -21,9 +21,7 @@ var _NavLinksModule = _interopRequireDefault(require("./NavLinks.module.scss"));
|
|
|
21
21
|
var _tracker = require("../../../tracker");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
var componentsWithDropdowns = {
|
|
24
|
-
|
|
25
|
-
"life-sciences": _Components.LifeSciences,
|
|
26
|
-
"standards-and-indicators": _Components.StandardsAndIndicators
|
|
24
|
+
"more-from-nice": _Components.MoreFromNICE
|
|
27
25
|
};
|
|
28
26
|
function NavLinks(_ref) {
|
|
29
27
|
var servicesToDisplay = _ref.servicesToDisplay,
|
|
@@ -54,7 +52,7 @@ function NavLinks(_ref) {
|
|
|
54
52
|
}
|
|
55
53
|
var escapeKeydown = (0, _react.useCallback)(function (result) {
|
|
56
54
|
if (result) setidOfOpenDropdown(null);
|
|
57
|
-
}, []);
|
|
55
|
+
}, [setidOfOpenDropdown]);
|
|
58
56
|
var _useEscapeKeydown = (0, _useEscapeKeydown2.default)(escapeKeydown),
|
|
59
57
|
keydownRef = _useEscapeKeydown.keydownRef;
|
|
60
58
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
@@ -91,7 +89,7 @@ function NavLinks(_ref) {
|
|
|
91
89
|
"aria-controls": "dropdown-".concat(id),
|
|
92
90
|
"aria-expanded": id === idOfOpenDropdown ? true : false,
|
|
93
91
|
id: "navlink-".concat(id),
|
|
94
|
-
"aria-label":
|
|
92
|
+
"aria-label": title && abbreviation ? "".concat(title, " (").concat(abbreviation, ")") : text.replace(/\u00A0/g, " "),
|
|
95
93
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
96
94
|
children: text
|
|
97
95
|
}), id === idOfOpenDropdown ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronUp.default, {
|
|
@@ -110,7 +108,7 @@ function NavLinks(_ref) {
|
|
|
110
108
|
className: _NavLinksModule.default.link,
|
|
111
109
|
onClick: handleNavLinkClick,
|
|
112
110
|
id: "navlink-".concat(id),
|
|
113
|
-
"aria-label":
|
|
111
|
+
"aria-label": title && abbreviation ? "".concat(title, " (").concat(abbreviation, ")") : text.replace(/\u00A0/g, " "),
|
|
114
112
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
115
113
|
children: text
|
|
116
114
|
}), nestedLinks && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronDown.default, {
|
|
@@ -73,8 +73,12 @@ button.link {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.icon {
|
|
76
|
+
align-self: flex-start;
|
|
76
77
|
flex-shrink: 0;
|
|
77
78
|
margin-left: utils.rem(spacing.$x-small);
|
|
79
|
+
margin-top: utils.rem(spacing.$x-small);
|
|
80
|
+
vertical-align: text-top;
|
|
81
|
+
|
|
78
82
|
@include media-queries.mq($from: md) {
|
|
79
83
|
margin-left: 0;
|
|
80
84
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"host": "www.test.nice.org",
|
|
5
5
|
"landingPath": "/url1/",
|
|
6
6
|
"text": "First link",
|
|
7
|
-
"id": "
|
|
7
|
+
"id": "more-from-nice",
|
|
8
8
|
"header": true
|
|
9
9
|
},
|
|
10
10
|
{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"text": "Second link",
|
|
14
14
|
"id": "link2",
|
|
15
15
|
"header": true,
|
|
16
|
-
"abbreviation":
|
|
16
|
+
"abbreviation": "lnk2",
|
|
17
17
|
"title": "Second link abbreviation title",
|
|
18
18
|
"links": [
|
|
19
19
|
{
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"text": "Third link",
|
|
33
33
|
"id": "link3",
|
|
34
34
|
"header": true,
|
|
35
|
-
"abbreviation":
|
|
35
|
+
"abbreviation": "lnk3",
|
|
36
36
|
"title": "Third link abbreviation title",
|
|
37
37
|
"links": [
|
|
38
38
|
{
|
|
@@ -22,7 +22,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
/** The minimum number of characters that should be entered before the autocomplete will attempt to suggest options. */
|
|
23
23
|
var minAutocompleteLength = 3;
|
|
24
24
|
|
|
25
|
-
/** Delay in
|
|
25
|
+
/** Delay in milliseconds before loading results */
|
|
26
26
|
var rateLimitWait = exports.rateLimitWait = 100;
|
|
27
27
|
var suggestionTemplateDefault = function suggestionTemplateDefault(suggestion) {
|
|
28
28
|
if (!suggestion || !suggestion.Link) return "";
|
|
@@ -47,6 +47,10 @@ function Autocomplete(props) {
|
|
|
47
47
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
48
48
|
suggestions = _useState4[0],
|
|
49
49
|
setSuggestions = _useState4[1],
|
|
50
|
+
_useState5 = (0, _react.useState)(""),
|
|
51
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
52
|
+
liveMessage = _useState6[0],
|
|
53
|
+
setLiveMessage = _useState6[1],
|
|
50
54
|
inputChangeHandler = function inputChangeHandler(event) {
|
|
51
55
|
setQueryText(event.target.value);
|
|
52
56
|
};
|
|
@@ -80,6 +84,7 @@ function Autocomplete(props) {
|
|
|
80
84
|
(0, _react.useEffect)(function () {
|
|
81
85
|
if (sourceProp === false || debouncedQueryText === "" || debouncedQueryText.length < minAutocompleteLength) {
|
|
82
86
|
setSuggestions([]);
|
|
87
|
+
setLiveMessage("");
|
|
83
88
|
return;
|
|
84
89
|
}
|
|
85
90
|
var source;
|
|
@@ -91,7 +96,9 @@ function Autocomplete(props) {
|
|
|
91
96
|
if (!source) return;
|
|
92
97
|
}
|
|
93
98
|
if (source) {
|
|
94
|
-
|
|
99
|
+
var results = (0, _suggester.suggester)(source, debouncedQueryText, maxResults);
|
|
100
|
+
setSuggestions(results);
|
|
101
|
+
setLiveMessage("".concat(results.length, " search autocomplete result").concat(results.length !== 1 ? "s" : "", " available. Use up and down arrow keys to review and Enter to select."));
|
|
95
102
|
return;
|
|
96
103
|
}
|
|
97
104
|
|
|
@@ -99,12 +106,25 @@ function Autocomplete(props) {
|
|
|
99
106
|
fetch("".concat(sourceProp).concat(sourceProp.indexOf("?") === -1 ? "?" : "&", "q=").concat(debouncedQueryText)).then(function (response) {
|
|
100
107
|
return response.json();
|
|
101
108
|
}).then(function (data) {
|
|
102
|
-
|
|
109
|
+
var results = data.slice(0, maxResults);
|
|
110
|
+
setSuggestions(results);
|
|
111
|
+
setLiveMessage("".concat(results.length, " result").concat(results.length !== 1 ? "s" : "", " available. Use up and down arrow keys to review and Enter to select."));
|
|
103
112
|
});
|
|
104
|
-
}, [debouncedQueryText]);
|
|
105
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
113
|
+
}, [debouncedQueryText, sourceProp]);
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
106
115
|
className: _AutocompleteModule.default.ac,
|
|
107
|
-
children:
|
|
116
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
117
|
+
"aria-live": "polite",
|
|
118
|
+
"aria-atomic": "true",
|
|
119
|
+
style: {
|
|
120
|
+
position: "absolute",
|
|
121
|
+
left: "-9999px",
|
|
122
|
+
height: "1px",
|
|
123
|
+
width: "1px",
|
|
124
|
+
overflow: "hidden"
|
|
125
|
+
},
|
|
126
|
+
children: liveMessage
|
|
127
|
+
}), !sourceProp || !isClient ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
108
128
|
className: "autocomplete__wrapper",
|
|
109
129
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
110
130
|
type: "search",
|
|
@@ -120,10 +140,7 @@ function Autocomplete(props) {
|
|
|
120
140
|
value: queryText,
|
|
121
141
|
onChange: onValueChangeHandler,
|
|
122
142
|
nullable: true,
|
|
123
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Combobox.
|
|
124
|
-
className: "visually-hidden",
|
|
125
|
-
children: placeholder
|
|
126
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Combobox.Input, {
|
|
143
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Combobox.Input, {
|
|
127
144
|
id: "autocomplete",
|
|
128
145
|
name: "q",
|
|
129
146
|
className: "autocomplete__input autocomplete__input--default",
|
|
@@ -144,8 +161,11 @@ function Autocomplete(props) {
|
|
|
144
161
|
var active = _ref.active;
|
|
145
162
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
146
163
|
className: "visually-hidden autocomplete__option ".concat(active ? "autocomplete__option--focused" : ""),
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
tabIndex: -1,
|
|
147
166
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
148
167
|
href: "/search?q=".concat(queryText),
|
|
168
|
+
tabIndex: -1,
|
|
149
169
|
children: queryText.length === 0 ? "Empty search" : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
150
170
|
children: ["Search for ", /*#__PURE__*/(0, _jsxRuntime.jsx)("em", {
|
|
151
171
|
children: queryText
|
|
@@ -179,18 +199,16 @@ function Autocomplete(props) {
|
|
|
179
199
|
}, suggestion.Title);
|
|
180
200
|
})]
|
|
181
201
|
})]
|
|
182
|
-
})
|
|
202
|
+
})]
|
|
183
203
|
});
|
|
184
204
|
}
|
|
185
205
|
Autocomplete.propTypes = {
|
|
186
|
-
source: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
187
|
-
Title: _propTypes.default.string.isRequired,
|
|
188
|
-
TitleHtml: _propTypes.default.string,
|
|
189
|
-
TypeAheadType: _propTypes.default.string,
|
|
190
|
-
Link: _propTypes.default.string.isRequired
|
|
191
|
-
}))]),
|
|
192
|
-
suggestionTemplate: _propTypes.default.func,
|
|
193
|
-
placeholder: _propTypes.default.string,
|
|
194
206
|
query: _propTypes.default.string,
|
|
195
|
-
onNavigating: _propTypes.default.
|
|
207
|
+
onNavigating: _propTypes.default.func,
|
|
208
|
+
placeholder: _propTypes.default.string,
|
|
209
|
+
suggestionTemplate: _propTypes.default.func,
|
|
210
|
+
source: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.string, _propTypes.default.shape({
|
|
211
|
+
Link: _propTypes.default.string,
|
|
212
|
+
Title: _propTypes.default.string
|
|
213
|
+
})])
|
|
196
214
|
};
|
|
@@ -44,9 +44,10 @@ var HeaderContextProvider = exports.HeaderContextProvider = function HeaderConte
|
|
|
44
44
|
document.body.removeEventListener("click", handleClickOutsideHeaderMenu);
|
|
45
45
|
};
|
|
46
46
|
}, [handleClickOutsideHeaderMenu]);
|
|
47
|
+
var locationHref = typeof location == "undefined" ? null : location.href;
|
|
47
48
|
(0, _react.useEffect)(function () {
|
|
48
49
|
setidOfOpenDropdown(null);
|
|
49
|
-
}, [
|
|
50
|
+
}, [locationHref]);
|
|
50
51
|
var popStateHandler = function popStateHandler() {
|
|
51
52
|
setidOfOpenDropdown(null);
|
|
52
53
|
};
|
package/lib/services.json
CHANGED
|
@@ -11,24 +11,49 @@
|
|
|
11
11
|
{
|
|
12
12
|
"host": "www.nice.org.uk",
|
|
13
13
|
"landingPath": "/standards-and-indicators",
|
|
14
|
-
"text": "Standards
|
|
14
|
+
"text": "Standards\u00A0and indicators",
|
|
15
15
|
"id": "standards-and-indicators",
|
|
16
16
|
"footer": true,
|
|
17
17
|
"header": true
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
"host": "
|
|
21
|
-
"landingPath": "/
|
|
22
|
-
"text": "
|
|
23
|
-
"
|
|
20
|
+
"host": "cks.nice.org.uk",
|
|
21
|
+
"landingPath": "/",
|
|
22
|
+
"text": "Clinical\u00A0Knowledge Summaries (CKS)",
|
|
23
|
+
"abbreviation": "CKS",
|
|
24
|
+
"title": "Clinical Knowledge Summaries",
|
|
25
|
+
"id": "cks",
|
|
24
26
|
"footer": true,
|
|
25
|
-
"header": true
|
|
27
|
+
"header": true,
|
|
28
|
+
"links": [
|
|
29
|
+
{
|
|
30
|
+
"image": "cks",
|
|
31
|
+
"text": "CKS - homepage",
|
|
32
|
+
"href": "/"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"text": "Health topics A to Z",
|
|
36
|
+
"href": "/topics/"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"text": "Specialities",
|
|
40
|
+
"href": "/specialities/"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"text": "What's new",
|
|
44
|
+
"href": "/whats-new/"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"text": "About CKS",
|
|
48
|
+
"href": "/about/"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
26
51
|
},
|
|
27
52
|
{
|
|
28
53
|
"host": "bnf.nice.org.uk",
|
|
29
54
|
"landingPath": "/",
|
|
30
|
-
"text": "British National Formulary
|
|
31
|
-
"abbreviation":
|
|
55
|
+
"text": "British National Formulary\u00A0(BNF)",
|
|
56
|
+
"abbreviation": "BNF",
|
|
32
57
|
"title": "British National Formulary",
|
|
33
58
|
"id": "bnf",
|
|
34
59
|
"footer": true,
|
|
@@ -36,7 +61,7 @@
|
|
|
36
61
|
"links": [
|
|
37
62
|
{
|
|
38
63
|
"image": "bnf",
|
|
39
|
-
"text": "BNF -
|
|
64
|
+
"text": "BNF - homepage",
|
|
40
65
|
"href": "/"
|
|
41
66
|
},
|
|
42
67
|
{
|
|
@@ -65,7 +90,7 @@
|
|
|
65
90
|
"host": "bnfc.nice.org.uk",
|
|
66
91
|
"landingPath": "/",
|
|
67
92
|
"text": "British National Formulary for Children (BNFC)",
|
|
68
|
-
"abbreviation":
|
|
93
|
+
"abbreviation": "BNFC",
|
|
69
94
|
"title": "British National Formulary for Children",
|
|
70
95
|
"id": "bnfc",
|
|
71
96
|
"footer": true,
|
|
@@ -73,7 +98,7 @@
|
|
|
73
98
|
"links": [
|
|
74
99
|
{
|
|
75
100
|
"image": "bnfc",
|
|
76
|
-
"text": "
|
|
101
|
+
"text": "BNF for Children - homepage",
|
|
77
102
|
"href": "/"
|
|
78
103
|
},
|
|
79
104
|
{
|
|
@@ -99,51 +124,27 @@
|
|
|
99
124
|
]
|
|
100
125
|
},
|
|
101
126
|
{
|
|
102
|
-
"host": "
|
|
103
|
-
"landingPath": "/",
|
|
104
|
-
"text": "
|
|
105
|
-
"
|
|
106
|
-
"title": "Clinical Knowledge Summaries",
|
|
107
|
-
"id": "cks",
|
|
127
|
+
"host": "www.nice.org.uk",
|
|
128
|
+
"landingPath": "/about/what-we-do/life-sciences",
|
|
129
|
+
"text": "Life sciences",
|
|
130
|
+
"id": "life-sciences",
|
|
108
131
|
"footer": true,
|
|
109
|
-
"header": true
|
|
110
|
-
"links": [
|
|
111
|
-
{
|
|
112
|
-
"image": "cks",
|
|
113
|
-
"text": "CKS - Home",
|
|
114
|
-
"href": "/"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"text": "Health topics A to Z",
|
|
118
|
-
"href": "/topics/"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"text": "Specialities",
|
|
122
|
-
"href": "/specialities/"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"text": "What's new",
|
|
126
|
-
"href": "/whats-new/"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"text": "About CKS",
|
|
130
|
-
"href": "/about/"
|
|
131
|
-
}
|
|
132
|
-
]
|
|
132
|
+
"header": true
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"host": "www.nice.org.uk",
|
|
136
|
-
"landingPath": "/
|
|
137
|
-
"text": "
|
|
138
|
-
"id": "
|
|
139
|
-
"header": true
|
|
136
|
+
"landingPath": "/more-from-nice",
|
|
137
|
+
"text": "More\u00A0from NICE",
|
|
138
|
+
"id": "more-from-nice",
|
|
139
|
+
"header": true,
|
|
140
|
+
"footer": false
|
|
140
141
|
},
|
|
141
142
|
{
|
|
142
143
|
"host": "www.nice.org.uk",
|
|
143
|
-
"landingPath": "/
|
|
144
|
-
"title": "
|
|
145
|
-
"text": "
|
|
146
|
-
"id": "knowledge-
|
|
144
|
+
"landingPath": "/library-and-knowledge-services",
|
|
145
|
+
"title": "Library and knowledge services",
|
|
146
|
+
"text": "Library and knowledge services",
|
|
147
|
+
"id": "knowledge-services",
|
|
147
148
|
"footer": true,
|
|
148
149
|
"header": false
|
|
149
150
|
}
|