northants-design-system 0.4.1 → 0.4.3
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/build/index.esm.js +65 -44
- package/build/index.esm.js.map +1 -1
- package/build/index.js +65 -44
- package/build/index.js.map +1 -1
- package/build/library/components/icons/TwitterIcon/Icon.d.ts +3 -3
- package/build/library/directory/DirectoryService/DirectoryService.types.d.ts +4 -0
- package/build/library/directory/DirectoryService/DirectoryServiceTransform.d.ts +3 -2
- package/build/library/structure/SearchResultsList/SearchResultsList.d.ts +3 -3
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -23920,8 +23920,8 @@ var ServiceIcon$3 = function (_a) {
|
|
|
23920
23920
|
|
|
23921
23921
|
var ServiceIcon$2 = function (_a) {
|
|
23922
23922
|
var colourFill = _a.colourFill;
|
|
23923
|
-
return (React.createElement("svg", { width: "36", height: "36",
|
|
23924
|
-
React.createElement("path", { d: "
|
|
23923
|
+
return (React.createElement("svg", { width: "36", height: "36", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 36 36" },
|
|
23924
|
+
React.createElement("path", { d: "m0,5.14v25.72c0,2.84,2.31,5.14,5.14,5.14h25.72c2.84,0,5.14-2.31,5.14-5.14V5.14c0-2.83-2.31-5.14-5.14-5.14H5.14C2.31,0,0,2.31,0,5.14Zm29.01,1.61l-8.34,9.53,9.81,12.97h-7.68l-6.01-7.86-6.88,7.86h-3.81l8.92-10.19L5.59,6.75h7.87l5.45,7.19,6.29-7.19s3.81,0,3.81,0Zm-3.03,20.17L12.31,8.84h-2.27l13.83,18.08h2.13Z", fill: colourFill })));
|
|
23925
23925
|
};
|
|
23926
23926
|
|
|
23927
23927
|
var ServiceIcon$1 = function (_a) {
|
|
@@ -26113,6 +26113,7 @@ var SignpostLinksList = function (_a) {
|
|
|
26113
26113
|
|
|
26114
26114
|
var SearchResultsList = function (_a) {
|
|
26115
26115
|
var searchTerm = _a.searchTerm, results = _a.results, _b = _a.totalResults, totalResults = _b === void 0 ? 0 : _b, _c = _a.pageNumber, pageNumber = _c === void 0 ? 0 : _c;
|
|
26116
|
+
var themeContext = useContext(ThemeContext);
|
|
26116
26117
|
if (totalResults === 0) {
|
|
26117
26118
|
return (React.createElement(Container$h, { "data-testid": "SearchResultsList" },
|
|
26118
26119
|
React.createElement(ResultInfo$2, null, "No results found")));
|
|
@@ -26120,30 +26121,18 @@ var SearchResultsList = function (_a) {
|
|
|
26120
26121
|
else {
|
|
26121
26122
|
return (React.createElement(Container$h, { "data-testid": "SearchResultsList" },
|
|
26122
26123
|
React.createElement(ResultInfo$2, null,
|
|
26123
|
-
|
|
26124
|
+
pageNumber > 1 && 'Page ' + pageNumber + ' of ',
|
|
26124
26125
|
totalResults,
|
|
26125
26126
|
" total results for '",
|
|
26126
26127
|
searchTerm,
|
|
26127
26128
|
"'"),
|
|
26128
|
-
results.map(function (result, i) {
|
|
26129
|
-
|
|
26130
|
-
|
|
26131
|
-
|
|
26132
|
-
|
|
26133
|
-
result.signpostLinksArray
|
|
26134
|
-
|
|
26135
|
-
result.signpostLinksArray.length > 1 ?
|
|
26136
|
-
React.createElement(React.Fragment, null, result.TopLineText ?
|
|
26137
|
-
React.createElement("p", null, result.TopLineText)
|
|
26138
|
-
:
|
|
26139
|
-
React.createElement("p", null, "Select your local area for information:"))
|
|
26140
|
-
:
|
|
26141
|
-
React.createElement(React.Fragment, null, result.TopLineText ?
|
|
26142
|
-
React.createElement("p", null, result.TopLineText)
|
|
26143
|
-
:
|
|
26144
|
-
React.createElement("p", null, "Go straight to the information:")),
|
|
26145
|
-
React.createElement(SignpostLinksList, { signpostLinksArray: result.signpostLinksArray })));
|
|
26146
|
-
})));
|
|
26129
|
+
results.map(function (result, i) { return (React.createElement(Result, { key: i },
|
|
26130
|
+
result.service && React.createElement(ServiceArea, null, result.service),
|
|
26131
|
+
React.createElement(Title$3, { href: result.link }, result.title),
|
|
26132
|
+
React.createElement(Summary$2, null, result.summary),
|
|
26133
|
+
result.signpostLinksArray && themeContext.cardinal_name === 'north' && (React.createElement(SignpostContainer, null,
|
|
26134
|
+
result.signpostLinksArray.length > 1 ? (React.createElement(React.Fragment, null, result.TopLineText ? React.createElement("p", null, result.TopLineText) : React.createElement("p", null, "Select your local area for information:"))) : (React.createElement(React.Fragment, null, result.TopLineText ? React.createElement("p", null, result.TopLineText) : React.createElement("p", null, "Go straight to the information:"))),
|
|
26135
|
+
React.createElement(SignpostLinksList, { signpostLinksArray: result.signpostLinksArray }))))); })));
|
|
26147
26136
|
}
|
|
26148
26137
|
};
|
|
26149
26138
|
|
|
@@ -28841,7 +28830,8 @@ var transformService = function (email, url, phone) {
|
|
|
28841
28830
|
}
|
|
28842
28831
|
return service;
|
|
28843
28832
|
};
|
|
28844
|
-
var transformDescriptionDetails = function (accreditations, fees, service_areas, languages) {
|
|
28833
|
+
var transformDescriptionDetails = function (accreditations, fees, service_areas, languages, eligibilities, ageInMonths) {
|
|
28834
|
+
if (ageInMonths === void 0) { ageInMonths = false; }
|
|
28845
28835
|
var details = [];
|
|
28846
28836
|
if (accreditations) {
|
|
28847
28837
|
details.push({
|
|
@@ -28858,7 +28848,13 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
|
|
|
28858
28848
|
detail: fees,
|
|
28859
28849
|
});
|
|
28860
28850
|
}
|
|
28861
|
-
if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length)
|
|
28851
|
+
if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) === 1) {
|
|
28852
|
+
details.push({
|
|
28853
|
+
term: 'Locality',
|
|
28854
|
+
detail: "<span>".concat(service_areas[0].service_area, "</span>"),
|
|
28855
|
+
});
|
|
28856
|
+
}
|
|
28857
|
+
else if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) > 1) {
|
|
28862
28858
|
details.push({
|
|
28863
28859
|
term: 'Locality',
|
|
28864
28860
|
detail: '<ul>' +
|
|
@@ -28870,7 +28866,13 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
|
|
|
28870
28866
|
'</ul>',
|
|
28871
28867
|
});
|
|
28872
28868
|
}
|
|
28873
|
-
if ((languages === null || languages === void 0 ? void 0 : languages.length)
|
|
28869
|
+
if ((languages === null || languages === void 0 ? void 0 : languages.length) === 1) {
|
|
28870
|
+
details.push({
|
|
28871
|
+
term: 'Additional languages',
|
|
28872
|
+
detail: "<span>".concat(languages[0].language, "</span>"),
|
|
28873
|
+
});
|
|
28874
|
+
}
|
|
28875
|
+
else if ((languages === null || languages === void 0 ? void 0 : languages.length) > 1) {
|
|
28874
28876
|
details.push({
|
|
28875
28877
|
term: 'Additional languages',
|
|
28876
28878
|
detail: '<ul>' +
|
|
@@ -28882,6 +28884,24 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
|
|
|
28882
28884
|
'</ul>',
|
|
28883
28885
|
});
|
|
28884
28886
|
}
|
|
28887
|
+
if ((eligibilities === null || eligibilities === void 0 ? void 0 : eligibilities.length) === 1) {
|
|
28888
|
+
details.push({
|
|
28889
|
+
term: 'Age range',
|
|
28890
|
+
detail: "<span>Suitable for ages from ".concat(transformAge(eligibilities[0].minimum_age, ageInMonths), " to\n ").concat(transformAge(eligibilities[0].maximum_age, ageInMonths), "</span>"),
|
|
28891
|
+
});
|
|
28892
|
+
}
|
|
28893
|
+
else if ((eligibilities === null || eligibilities === void 0 ? void 0 : eligibilities.length) > 1) {
|
|
28894
|
+
details.push({
|
|
28895
|
+
term: 'Age range',
|
|
28896
|
+
detail: '<ul>' +
|
|
28897
|
+
eligibilities
|
|
28898
|
+
.map(function (eligibility) {
|
|
28899
|
+
return "<li>Suitable for ages from ".concat(transformAge(eligibility.minimum_age, ageInMonths), " to \n ").concat(transformAge(eligibility.maximum_age, ageInMonths), "</li>");
|
|
28900
|
+
})
|
|
28901
|
+
.join('') +
|
|
28902
|
+
'</ul>',
|
|
28903
|
+
});
|
|
28904
|
+
}
|
|
28885
28905
|
return details;
|
|
28886
28906
|
};
|
|
28887
28907
|
var transformSnippet = function (description, extractLength) {
|
|
@@ -28900,7 +28920,7 @@ var transformTaxonomies = function (service_taxonomys, taxonomiesToShow) {
|
|
|
28900
28920
|
if (groupedTaxonomies[taxonomy.vocabulary].length === 1) {
|
|
28901
28921
|
details.push({
|
|
28902
28922
|
term: taxonomy.label,
|
|
28903
|
-
detail: '<
|
|
28923
|
+
detail: '<span>' + groupedTaxonomies[taxonomy.vocabulary][0].name + '</span>',
|
|
28904
28924
|
});
|
|
28905
28925
|
}
|
|
28906
28926
|
else {
|
|
@@ -28918,6 +28938,19 @@ var transformTaxonomies = function (service_taxonomys, taxonomiesToShow) {
|
|
|
28918
28938
|
}
|
|
28919
28939
|
});
|
|
28920
28940
|
return details;
|
|
28941
|
+
};
|
|
28942
|
+
var transformAge = function (age, ageInMonths) {
|
|
28943
|
+
if (ageInMonths === void 0) { ageInMonths = false; }
|
|
28944
|
+
if (age === 0) {
|
|
28945
|
+
return age;
|
|
28946
|
+
}
|
|
28947
|
+
if (ageInMonths) {
|
|
28948
|
+
if (age > 36) {
|
|
28949
|
+
return Math.ceil(age / 12) + ' years';
|
|
28950
|
+
}
|
|
28951
|
+
return "".concat(age, " months");
|
|
28952
|
+
}
|
|
28953
|
+
return "".concat(age, " years");
|
|
28921
28954
|
};
|
|
28922
28955
|
|
|
28923
28956
|
const Container$5 = styled.div`
|
|
@@ -29097,9 +29130,9 @@ var getIcon = function (profile) {
|
|
|
29097
29130
|
|
|
29098
29131
|
var DirectoryService = function (_a) {
|
|
29099
29132
|
var _b, _c, _d, _e;
|
|
29100
|
-
var id = _a.id, name = _a.name, accreditations = _a.accreditations, description = _a.description, descriptionElement = _a.descriptionElement, email = _a.email, fees = _a.fees, languages = _a.languages, organization = _a.organization, regular_schedules = _a.regular_schedules, contacts = _a.contacts, service_areas = _a.service_areas, service_at_locations = _a.service_at_locations, service_social_profiles = _a.service_social_profiles, service_taxonomys = _a.service_taxonomys, taxonomiesToShow = _a.taxonomiesToShow, url = _a.url, uploads = _a.uploads, shortListPath = _a.shortListPath;
|
|
29133
|
+
var id = _a.id, name = _a.name, accreditations = _a.accreditations, _f = _a.ageInMonths, ageInMonths = _f === void 0 ? false : _f, description = _a.description, descriptionElement = _a.descriptionElement, eligibilitys = _a.eligibilitys, email = _a.email, fees = _a.fees, languages = _a.languages, organization = _a.organization, regular_schedules = _a.regular_schedules, contacts = _a.contacts, service_areas = _a.service_areas, service_at_locations = _a.service_at_locations, service_social_profiles = _a.service_social_profiles, service_taxonomys = _a.service_taxonomys, taxonomiesToShow = _a.taxonomiesToShow, url = _a.url, uploads = _a.uploads, shortListPath = _a.shortListPath;
|
|
29101
29134
|
var labelLetters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'];
|
|
29102
|
-
var
|
|
29135
|
+
var _g = useState(false), notServer = _g[0], setNotServer = _g[1];
|
|
29103
29136
|
var themeContext = useContext(ThemeContext);
|
|
29104
29137
|
var favourites = useDirectoryShortListContext().favourites.favourites;
|
|
29105
29138
|
useEffect(function () {
|
|
@@ -29173,7 +29206,7 @@ var DirectoryService = function (_a) {
|
|
|
29173
29206
|
React.createElement(Heading, { level: 2, text: "Description" }),
|
|
29174
29207
|
React.createElement("div", null,
|
|
29175
29208
|
React.createElement(React.Fragment, null, descriptionElement)),
|
|
29176
|
-
React.createElement(SummaryList, { terms: transformDescriptionDetails(accreditations, fees, service_areas, languages), hasMargin: false }),
|
|
29209
|
+
React.createElement(SummaryList, { terms: transformDescriptionDetails(accreditations, fees, service_areas, languages, eligibilitys, ageInMonths), hasMargin: false }),
|
|
29177
29210
|
React.createElement(SummaryList, { terms: transformTaxonomies(service_taxonomys, taxonomiesToShow), hasMargin: false })),
|
|
29178
29211
|
regular_schedules.length > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29179
29212
|
React.createElement(Heading, { level: 2, text: "Service hours" }),
|
|
@@ -29185,7 +29218,7 @@ var DirectoryService = function (_a) {
|
|
|
29185
29218
|
React.createElement("th", { scope: "col" }, "Opens"),
|
|
29186
29219
|
React.createElement("th", { scope: "col" }, "Closes"))),
|
|
29187
29220
|
React.createElement("tbody", null, regular_schedules === null || regular_schedules === void 0 ? void 0 : regular_schedules.map(function (schedule, scheduleIndex) { return (React.createElement("tr", { key: scheduleIndex },
|
|
29188
|
-
React.createElement("
|
|
29221
|
+
React.createElement("td", null, schedule.weekday),
|
|
29189
29222
|
React.createElement("td", null, schedule.opens_at),
|
|
29190
29223
|
React.createElement("td", null, schedule.closes_at))); })))))),
|
|
29191
29224
|
(uploads === null || uploads === void 0 ? void 0 : uploads.length) > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
@@ -29780,18 +29813,6 @@ var DirectoryServiceList = function (_a) {
|
|
|
29780
29813
|
};
|
|
29781
29814
|
}),
|
|
29782
29815
|
};
|
|
29783
|
-
var formatAge = function (age) {
|
|
29784
|
-
if (age === 0) {
|
|
29785
|
-
return age;
|
|
29786
|
-
}
|
|
29787
|
-
if (ageInMonths) {
|
|
29788
|
-
if (age > 36) {
|
|
29789
|
-
return Math.ceil(age / 12) + ' years';
|
|
29790
|
-
}
|
|
29791
|
-
return "".concat(age, " months");
|
|
29792
|
-
}
|
|
29793
|
-
return "".concat(age, " years");
|
|
29794
|
-
};
|
|
29795
29816
|
var handleAgeChange = function (e, field) {
|
|
29796
29817
|
var age = e.target.value ? parseInt(e.target.value, 10) : '';
|
|
29797
29818
|
if (typeof age === 'number' && ageInMonths) {
|
|
@@ -29918,10 +29939,10 @@ var DirectoryServiceList = function (_a) {
|
|
|
29918
29939
|
React.createElement(ServiceImage, { src: service.organization.logo, alt: service.name + ' logo', loading: "lazy" })))),
|
|
29919
29940
|
React.createElement(Column, { small: "full", medium: "full", large: "full" }, service.eligibilitys && (React.createElement(React.Fragment, null, service.eligibilitys.map(function (eligibility) { return (React.createElement(Age, { key: eligibility.id },
|
|
29920
29941
|
"Suitable for ages from ",
|
|
29921
|
-
|
|
29942
|
+
transformAge(eligibility.minimum_age, ageInMonths),
|
|
29922
29943
|
" to",
|
|
29923
29944
|
' ',
|
|
29924
|
-
|
|
29945
|
+
transformAge(eligibility.maximum_age, ageInMonths))); })))),
|
|
29925
29946
|
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29926
29947
|
React.createElement(DirectoryAddToShortList, { id: service.id, name: service.name, snippet: snippet, email: service.email, website: service.url, phone: (_f = (_e = (_d = service.contacts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.phones) === null || _f === void 0 ? void 0 : _f.flatMap(function (phone) { return phone.number; }).join(', ') }))))));
|
|
29927
29948
|
}),
|