northants-design-system 0.4.0 → 0.4.1
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 +167 -85
- package/build/index.esm.js.map +1 -1
- package/build/index.js +167 -85
- package/build/index.js.map +1 -1
- package/build/library/components/Input/Input.d.ts +2 -1
- package/build/library/components/Input/Input.types.d.ts +7 -1
- package/build/library/directory/DirectoryServiceList/DirectoryServiceList.types.d.ts +4 -4
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -22675,12 +22675,13 @@ const SubmitButton = styled.input`
|
|
|
22675
22675
|
|
|
22676
22676
|
/**
|
|
22677
22677
|
* Primary UI component for user interaction
|
|
22678
|
+
* If value is set then treat as controlled component
|
|
22678
22679
|
*/
|
|
22679
22680
|
var Input = function (_a) {
|
|
22680
|
-
var _b = _a.type, type = _b === void 0 ? 'text' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? '' : _c, _d = _a.isErrored, isErrored = _d === void 0 ? false : _d, errorText = _a.errorText, name = _a.name, maxLength = _a.maxLength, defaultValue = _a.defaultValue, onChange = _a.onChange, id = _a.id;
|
|
22681
|
+
var _b = _a.type, type = _b === void 0 ? 'text' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? '' : _c, _d = _a.isErrored, isErrored = _d === void 0 ? false : _d, errorText = _a.errorText, name = _a.name, maxLength = _a.maxLength, defaultValue = _a.defaultValue, onChange = _a.onChange, id = _a.id, value = _a.value;
|
|
22681
22682
|
return (React.createElement(React.Fragment, null,
|
|
22682
22683
|
errorText && React.createElement(ErrorText$1, null, errorText),
|
|
22683
|
-
React.createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, defaultValue: defaultValue, id: id })));
|
|
22684
|
+
typeof value !== 'undefined' ? (React.createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, value: value, id: id })) : (React.createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, defaultValue: defaultValue, id: id }))));
|
|
22684
22685
|
};
|
|
22685
22686
|
|
|
22686
22687
|
var CustomSearch = function (_a) {
|
|
@@ -28845,7 +28846,10 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
|
|
|
28845
28846
|
if (accreditations) {
|
|
28846
28847
|
details.push({
|
|
28847
28848
|
term: 'Accreditations',
|
|
28848
|
-
detail: accreditations,
|
|
28849
|
+
detail: sanitizeHtml$1(accreditations, {
|
|
28850
|
+
allowedTags: ['p', 'b', 'i', 'em', 'strong', 'a', 'ul', 'li', 'ol'],
|
|
28851
|
+
allowedStyles: {},
|
|
28852
|
+
}),
|
|
28849
28853
|
});
|
|
28850
28854
|
}
|
|
28851
28855
|
if (fees) {
|
|
@@ -28893,16 +28897,24 @@ var transformTaxonomies = function (service_taxonomys, taxonomiesToShow) {
|
|
|
28893
28897
|
var groupedTaxonomies = groupBy(service_taxonomys, 'vocabulary');
|
|
28894
28898
|
taxonomiesToShow.forEach(function (taxonomy, taxonomyIndex) {
|
|
28895
28899
|
if (groupedTaxonomies.hasOwnProperty(taxonomy.vocabulary)) {
|
|
28896
|
-
|
|
28897
|
-
|
|
28898
|
-
|
|
28899
|
-
groupedTaxonomies[taxonomy.vocabulary]
|
|
28900
|
-
|
|
28901
|
-
|
|
28902
|
-
|
|
28903
|
-
|
|
28904
|
-
|
|
28905
|
-
|
|
28900
|
+
if (groupedTaxonomies[taxonomy.vocabulary].length === 1) {
|
|
28901
|
+
details.push({
|
|
28902
|
+
term: taxonomy.label,
|
|
28903
|
+
detail: '<p>' + groupedTaxonomies[taxonomy.vocabulary][0].name + '</p>',
|
|
28904
|
+
});
|
|
28905
|
+
}
|
|
28906
|
+
else {
|
|
28907
|
+
details.push({
|
|
28908
|
+
term: taxonomy.label,
|
|
28909
|
+
detail: '<ul>' +
|
|
28910
|
+
groupedTaxonomies[taxonomy.vocabulary]
|
|
28911
|
+
.map(function (item) {
|
|
28912
|
+
return "<li>".concat(item.name, "</li>");
|
|
28913
|
+
})
|
|
28914
|
+
.join('') +
|
|
28915
|
+
'</ul>',
|
|
28916
|
+
});
|
|
28917
|
+
}
|
|
28906
28918
|
}
|
|
28907
28919
|
});
|
|
28908
28920
|
return details;
|
|
@@ -29154,11 +29166,11 @@ var DirectoryService = function (_a) {
|
|
|
29154
29166
|
}),
|
|
29155
29167
|
} })),
|
|
29156
29168
|
React.createElement(MapLink, { href: "https://www.google.com/maps/search/?api=1&query=".concat(service_at_locations[0].latitude, "%2C").concat(service_at_locations[0].longitude) }, "View in Google Maps"))))))),
|
|
29157
|
-
(email || url || contacts) && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29169
|
+
(email || url || (contacts === null || contacts === void 0 ? void 0 : contacts.length) > 0) && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29158
29170
|
React.createElement(Heading, { level: 2, text: "How to contact this service" }),
|
|
29159
29171
|
React.createElement(ServiceContact, { email: email, website: url, contacts: contacts }))),
|
|
29160
29172
|
React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29161
|
-
React.createElement(Heading, { level: 2, text: "
|
|
29173
|
+
React.createElement(Heading, { level: 2, text: "Description" }),
|
|
29162
29174
|
React.createElement("div", null,
|
|
29163
29175
|
React.createElement(React.Fragment, null, descriptionElement)),
|
|
29164
29176
|
React.createElement(SummaryList, { terms: transformDescriptionDetails(accreditations, fees, service_areas, languages), hasMargin: false }),
|
|
@@ -29188,7 +29200,7 @@ var DirectoryService = function (_a) {
|
|
|
29188
29200
|
.filter(function (location) {
|
|
29189
29201
|
return location.is_visitable == false;
|
|
29190
29202
|
})
|
|
29191
|
-
.map(function (location) { return (React.createElement(Row$1,
|
|
29203
|
+
.map(function (location) { return (React.createElement(Row$1, { key: location.id },
|
|
29192
29204
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third", key: location.id },
|
|
29193
29205
|
React.createElement(Heading, { level: 2, text: location.name }),
|
|
29194
29206
|
location.physical_addresses.map(function (address) { return (React.createElement(PhysicalAddress, { key: address.id },
|
|
@@ -29199,10 +29211,7 @@ var DirectoryService = function (_a) {
|
|
|
29199
29211
|
} }))); }),
|
|
29200
29212
|
(location === null || location === void 0 ? void 0 : location.accessibility_for_disabilities.length) > 0 && (React.createElement(React.Fragment, null,
|
|
29201
29213
|
React.createElement(Heading, { level: 3, text: "Other facilities on site" }),
|
|
29202
|
-
React.createElement("ul", null, location.accessibility_for_disabilities.map(function (accessibility) { return (React.createElement("li", { key: accessibility.id }, accessibility.accessibility)); })))))
|
|
29203
|
-
React.createElement(Column, { small: "full", medium: "one-half", large: "two-thirds" },
|
|
29204
|
-
React.createElement(WarningText, { title: "Please note", isWarning: true },
|
|
29205
|
-
React.createElement("p", null, "This address is not open to visitors."))))); }))))));
|
|
29214
|
+
React.createElement("ul", null, location.accessibility_for_disabilities.map(function (accessibility) { return (React.createElement("li", { key: accessibility.id }, accessibility.accessibility)); }))))))); }))))));
|
|
29206
29215
|
};
|
|
29207
29216
|
|
|
29208
29217
|
const Container$3 = styled.div`
|
|
@@ -29405,7 +29414,13 @@ const AccordionControls = styled.div`
|
|
|
29405
29414
|
justify-content: space-between;
|
|
29406
29415
|
`;
|
|
29407
29416
|
|
|
29408
|
-
const
|
|
29417
|
+
const ClearFilter$1 = styled.div`
|
|
29418
|
+
display: flex;
|
|
29419
|
+
justify-content: flex-end;
|
|
29420
|
+
padding-top: ${(props) => props.theme.theme_vars.spacingSizes.small};
|
|
29421
|
+
`;
|
|
29422
|
+
|
|
29423
|
+
const TextLink$1 = styled.button`
|
|
29409
29424
|
font-size: ${(props) => props.theme.theme_vars.fontSizes.extra_small};
|
|
29410
29425
|
position: relative;
|
|
29411
29426
|
z-index: 1;
|
|
@@ -29661,7 +29676,7 @@ var RadioCheckboxInput = function (_a) {
|
|
|
29661
29676
|
var id = useId();
|
|
29662
29677
|
return (React.createElement(Container$2, { "data-testid": "RadioCheckboxInput" },
|
|
29663
29678
|
React.createElement(Category$1, null,
|
|
29664
|
-
React.createElement(CategoryInput, { type: singleSelection ? 'radio' : 'checkbox', value: value, id: id, name: name,
|
|
29679
|
+
React.createElement(CategoryInput, { type: singleSelection ? 'radio' : 'checkbox', value: value, id: id, name: name, onClick: onChange, defaultChecked: checked }),
|
|
29665
29680
|
React.createElement(CategoryInputLabel, { isChecked: checked, htmlFor: id, singleSelection: singleSelection }, label))));
|
|
29666
29681
|
};
|
|
29667
29682
|
|
|
@@ -29681,6 +29696,9 @@ var DirectoryServiceList = function (_a) {
|
|
|
29681
29696
|
setNotServer(true);
|
|
29682
29697
|
setFiltersActive(hasActiveFilters());
|
|
29683
29698
|
}, []);
|
|
29699
|
+
useEffect(function () {
|
|
29700
|
+
setFiltersActive(hasActiveFilters());
|
|
29701
|
+
}, [minimumAge, maximumAge, categories]);
|
|
29684
29702
|
if (accordions.length === 0) {
|
|
29685
29703
|
var tempAccordions_1 = [];
|
|
29686
29704
|
categories === null || categories === void 0 ? void 0 : categories.forEach(function () {
|
|
@@ -29702,7 +29720,21 @@ var DirectoryServiceList = function (_a) {
|
|
|
29702
29720
|
}
|
|
29703
29721
|
});
|
|
29704
29722
|
setCategories(newCategories);
|
|
29705
|
-
|
|
29723
|
+
};
|
|
29724
|
+
/**
|
|
29725
|
+
* Uncheck all the options for a specific category
|
|
29726
|
+
*/
|
|
29727
|
+
var clearCategory = function (categoryIndex) {
|
|
29728
|
+
var newCategories = __spreadArray([], categories, true);
|
|
29729
|
+
newCategories[categoryIndex].options.forEach(function (option) {
|
|
29730
|
+
option.checked = false;
|
|
29731
|
+
});
|
|
29732
|
+
setCategories(newCategories);
|
|
29733
|
+
};
|
|
29734
|
+
var clearAges = function (e) {
|
|
29735
|
+
e.target.value = '';
|
|
29736
|
+
handleAgeChange(e, 'minimumAge');
|
|
29737
|
+
handleAgeChange(e, 'maximumAge');
|
|
29706
29738
|
};
|
|
29707
29739
|
var from = pageNumber * perPage - (perPage - 1);
|
|
29708
29740
|
var to = from + ((services === null || services === void 0 ? void 0 : services.length) ? services.length - 1 : 0);
|
|
@@ -29761,8 +29793,8 @@ var DirectoryServiceList = function (_a) {
|
|
|
29761
29793
|
return "".concat(age, " years");
|
|
29762
29794
|
};
|
|
29763
29795
|
var handleAgeChange = function (e, field) {
|
|
29764
|
-
var age = e.target.value ? parseInt(e.target.value, 10) :
|
|
29765
|
-
if (
|
|
29796
|
+
var age = e.target.value ? parseInt(e.target.value, 10) : '';
|
|
29797
|
+
if (typeof age === 'number' && ageInMonths) {
|
|
29766
29798
|
age = age * 12;
|
|
29767
29799
|
}
|
|
29768
29800
|
if (field === 'maximumAge') {
|
|
@@ -29773,13 +29805,14 @@ var DirectoryServiceList = function (_a) {
|
|
|
29773
29805
|
}
|
|
29774
29806
|
};
|
|
29775
29807
|
var hasActiveFilters = function () {
|
|
29776
|
-
return
|
|
29777
|
-
|
|
29778
|
-
|
|
29779
|
-
|
|
29780
|
-
|
|
29808
|
+
return (maximumAge !== '' ||
|
|
29809
|
+
minimumAge !== '' ||
|
|
29810
|
+
categories.some(function (category) {
|
|
29811
|
+
return category.options.some(function (option) {
|
|
29812
|
+
return option.checked == true;
|
|
29813
|
+
});
|
|
29814
|
+
}));
|
|
29781
29815
|
};
|
|
29782
|
-
hasActiveFilters();
|
|
29783
29816
|
return (React.createElement(Container$3, { "data-testid": "DirectoryServiceList" },
|
|
29784
29817
|
React.createElement(Row$1, null,
|
|
29785
29818
|
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
@@ -29812,9 +29845,9 @@ var DirectoryServiceList = function (_a) {
|
|
|
29812
29845
|
notServer && (React.createElement(React.Fragment, null,
|
|
29813
29846
|
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29814
29847
|
React.createElement(AccordionControls, null,
|
|
29815
|
-
filtersActive ? (React.createElement(TextLink, { onClick: clearSearch, type: "button" },
|
|
29848
|
+
filtersActive ? (React.createElement(TextLink$1, { onClick: clearSearch, type: "button" },
|
|
29816
29849
|
React.createElement(ButtonText$1, null, "Clear all filters"))) : (React.createElement("div", null)),
|
|
29817
|
-
React.createElement(TextLink, { onClick: toggleAll, type: "button", "aria-expanded": !openAll },
|
|
29850
|
+
React.createElement(TextLink$1, { onClick: toggleAll, type: "button", "aria-expanded": !openAll },
|
|
29818
29851
|
openAll ? 'Open all' : 'Close all',
|
|
29819
29852
|
React.createElement(VisuallyHidden, null, " sections")))),
|
|
29820
29853
|
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
@@ -29824,69 +29857,76 @@ var DirectoryServiceList = function (_a) {
|
|
|
29824
29857
|
"Select age group (years)",
|
|
29825
29858
|
React.createElement(AccordionIcon, { isOpen: accordions[0] }))),
|
|
29826
29859
|
React.createElement(Accordion, { isOpen: accordions[0] },
|
|
29860
|
+
React.createElement(ClearFilter$1, null,
|
|
29861
|
+
React.createElement(TextLink$1, { onClick: function (e) { return clearAges(e); } }, "Clear filter")),
|
|
29827
29862
|
React.createElement(Row$1, null,
|
|
29828
29863
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
29829
29864
|
React.createElement(Label$1, { htmlFor: "minimum_age" }, "From"),
|
|
29830
|
-
React.createElement(Input, { name: "minimum_age", onChange: function (e) { return handleAgeChange(e, 'minimumAge'); },
|
|
29865
|
+
React.createElement(Input, { name: "minimum_age", onChange: function (e) { return handleAgeChange(e, 'minimumAge'); }, value: ageInMonths && typeof minimumAge === 'number' ? minimumAge / 12 : minimumAge, id: "minimum_age", type: "number" })),
|
|
29831
29866
|
React.createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
29832
29867
|
React.createElement(Label$1, { htmlFor: "maximum_age" }, "To"),
|
|
29833
|
-
React.createElement(Input, { name: "maximum_age", onChange: function (e) { return handleAgeChange(e, 'maximumAge'); },
|
|
29868
|
+
React.createElement(Input, { name: "maximum_age", onChange: function (e) { return handleAgeChange(e, 'maximumAge'); }, value: ageInMonths && typeof maximumAge === 'number' ? maximumAge / 12 : maximumAge, id: "maximum_age", type: "number" })))))), categories === null || categories === void 0 ? void 0 :
|
|
29834
29869
|
categories.map(function (category, categoryIndex) { return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: category.label },
|
|
29835
29870
|
React.createElement(Fieldset$1, null,
|
|
29836
29871
|
React.createElement(Legend$1, null,
|
|
29837
29872
|
React.createElement(LegendButton, { onClick: function (e) { return toggleAccordion(categoryIndex + 1); }, type: "button" },
|
|
29838
29873
|
category.label,
|
|
29839
29874
|
React.createElement(AccordionIcon, { isOpen: accordions[categoryIndex + 1] }))),
|
|
29840
|
-
React.createElement(Accordion, { isOpen: accordions[categoryIndex + 1] },
|
|
29841
|
-
React.createElement(
|
|
29875
|
+
React.createElement(Accordion, { isOpen: accordions[categoryIndex + 1] },
|
|
29876
|
+
React.createElement(ClearFilter$1, null,
|
|
29877
|
+
React.createElement(TextLink$1, { onClick: function (e) { return clearCategory(categoryIndex); } }, "Clear filter")),
|
|
29878
|
+
category.options.map(function (taxonomy) { return (React.createElement(Category$2, { key: taxonomy.id },
|
|
29879
|
+
React.createElement(RadioCheckboxInput, { name: taxonomy.vocabulary, value: taxonomy.id, label: taxonomy.name, singleSelection: category.singleSelection, checked: taxonomy.checked, onChange: function (e) { return optionChecked(e, categoryIndex, category.singleSelection); } }))); }))))); })))))),
|
|
29842
29880
|
React.createElement(Column, { small: "full", medium: "two-thirds", large: "two-thirds" },
|
|
29843
|
-
React.createElement(Row$1, null,
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
|
|
29848
|
-
|
|
29849
|
-
|
|
29850
|
-
|
|
29851
|
-
|
|
29852
|
-
|
|
29853
|
-
|
|
29854
|
-
|
|
29855
|
-
React.createElement(
|
|
29856
|
-
|
|
29857
|
-
React.createElement(
|
|
29858
|
-
|
|
29859
|
-
|
|
29860
|
-
|
|
29861
|
-
|
|
29862
|
-
React.createElement(
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
|
|
29869
|
-
|
|
29870
|
-
|
|
29871
|
-
|
|
29872
|
-
|
|
29873
|
-
|
|
29874
|
-
|
|
29875
|
-
|
|
29876
|
-
|
|
29877
|
-
|
|
29878
|
-
|
|
29879
|
-
|
|
29880
|
-
|
|
29881
|
-
|
|
29882
|
-
|
|
29883
|
-
|
|
29884
|
-
|
|
29885
|
-
|
|
29886
|
-
|
|
29887
|
-
|
|
29888
|
-
|
|
29889
|
-
|
|
29881
|
+
React.createElement(Row$1, null, isLoading ? (React.createElement(LoadingContainer$1, null,
|
|
29882
|
+
React.createElement(LoadingSpinner, null),
|
|
29883
|
+
React.createElement("p", null, "Loading"))) : (React.createElement(React.Fragment, null,
|
|
29884
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29885
|
+
(services === null || services === void 0 ? void 0 : services.length) > 0 ? (React.createElement(ResultInfo$1, null,
|
|
29886
|
+
"Showing ",
|
|
29887
|
+
from,
|
|
29888
|
+
" to ",
|
|
29889
|
+
to,
|
|
29890
|
+
" out of ",
|
|
29891
|
+
totalResults.toLocaleString())) : (React.createElement(ResultInfo$1, null, "No results found")),
|
|
29892
|
+
React.createElement(FavouritesContainer, null,
|
|
29893
|
+
(services === null || services === void 0 ? void 0 : services.length) > 0 && (React.createElement(MapToggle, { type: "button", onClick: function (e) { return setShowMap(!showMap); } }, showMap ? "Hide Map" : "Show Map")),
|
|
29894
|
+
React.createElement(Favourites, { href: shortListPath },
|
|
29895
|
+
React.createElement(HeartIcon, { colourFill: themeContext.theme_vars.colours.action }),
|
|
29896
|
+
" Shortlist (",
|
|
29897
|
+
favourites.length,
|
|
29898
|
+
")"))),
|
|
29899
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29900
|
+
React.createElement(Pagination, { currentPage: pageNumber, totalResults: totalResults, resultsPerPage: perPage, postTo: directoryPath, buttonClickOverride: setPageNumber })),
|
|
29901
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" }, notServer && React.createElement(React.Fragment, null, (services === null || services === void 0 ? void 0 : services.length) > 0 && showMap && React.createElement(DirectoryMap, { mapProps: mapProps }))),
|
|
29902
|
+
services.map(function (service, index) {
|
|
29903
|
+
var _a, _b, _c, _d, _e, _f;
|
|
29904
|
+
var snippet = transformSnippet(service.description, extractLength);
|
|
29905
|
+
return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: service.id },
|
|
29906
|
+
React.createElement(ServiceContainer, { resultNumber: index },
|
|
29907
|
+
React.createElement(Row$1, null,
|
|
29908
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29909
|
+
React.createElement(ServiceHeader, null,
|
|
29910
|
+
React.createElement(ServiceLink$1, { href: "".concat(directoryPath, "/").concat(service.id) }, service.name),
|
|
29911
|
+
showMap && (React.createElement(MarkerContainer, null,
|
|
29912
|
+
React.createElement("span", null, labelLetters[index]),
|
|
29913
|
+
React.createElement(PinIcon, { colourFill: themeContext.theme_vars.colours.action_dark }))))),
|
|
29914
|
+
React.createElement(Column, { small: "full", medium: ((_a = service.organization) === null || _a === void 0 ? void 0 : _a.logo) ? 'two-thirds' : 'full', large: ((_b = service.organization) === null || _b === void 0 ? void 0 : _b.logo) ? 'two-thirds' : 'full' },
|
|
29915
|
+
React.createElement("div", null, snippet)),
|
|
29916
|
+
((_c = service.organization) === null || _c === void 0 ? void 0 : _c.logo) && (React.createElement(Column, { small: "full", medium: "one-third", large: "one-third" },
|
|
29917
|
+
React.createElement(ServiceImageContainer, null,
|
|
29918
|
+
React.createElement(ServiceImage, { src: service.organization.logo, alt: service.name + ' logo', loading: "lazy" })))),
|
|
29919
|
+
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
|
+
"Suitable for ages from ",
|
|
29921
|
+
formatAge(eligibility.minimum_age),
|
|
29922
|
+
" to",
|
|
29923
|
+
' ',
|
|
29924
|
+
formatAge(eligibility.maximum_age))); })))),
|
|
29925
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29926
|
+
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
|
+
}),
|
|
29928
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29929
|
+
React.createElement(Pagination, { currentPage: pageNumber, totalResults: totalResults, resultsPerPage: perPage, postTo: directoryPath, buttonClickOverride: setPageNumber })))))))));
|
|
29890
29930
|
};
|
|
29891
29931
|
|
|
29892
29932
|
const Container$1 = styled.div`
|
|
@@ -31449,6 +31489,34 @@ const ResultInfo = styled.div`
|
|
|
31449
31489
|
color: ${(props) => props.theme.theme_vars.colours.grey_dark};
|
|
31450
31490
|
`;
|
|
31451
31491
|
|
|
31492
|
+
const ClearFilter = styled.div`
|
|
31493
|
+
display: flex;
|
|
31494
|
+
justify-content: flex-end;
|
|
31495
|
+
padding-top: ${(props) => props.theme.theme_vars.spacingSizes.small};
|
|
31496
|
+
`;
|
|
31497
|
+
|
|
31498
|
+
const TextLink = styled.button`
|
|
31499
|
+
font-size: ${(props) => props.theme.theme_vars.fontSizes.extra_small};
|
|
31500
|
+
position: relative;
|
|
31501
|
+
z-index: 1;
|
|
31502
|
+
margin: 0;
|
|
31503
|
+
margin-bottom: 15px;
|
|
31504
|
+
padding: 0;
|
|
31505
|
+
border-width: 0;
|
|
31506
|
+
color: ${(props) => props.theme.theme_vars.colours.action};
|
|
31507
|
+
background: none;
|
|
31508
|
+
cursor: pointer;
|
|
31509
|
+
&:hover {
|
|
31510
|
+
${(props) => props.theme.linkStylesHover};
|
|
31511
|
+
}
|
|
31512
|
+
&:focus {
|
|
31513
|
+
${(props) => props.theme.linkStylesFocus};
|
|
31514
|
+
}
|
|
31515
|
+
&:active {
|
|
31516
|
+
${(props) => props.theme.linkStylesActive};
|
|
31517
|
+
}
|
|
31518
|
+
`;
|
|
31519
|
+
|
|
31452
31520
|
const Fieldset = styled.fieldset`
|
|
31453
31521
|
display: block;
|
|
31454
31522
|
border-bottom: 1px solid ${(props) => props.theme.theme_vars.colours.grey};
|
|
@@ -31509,6 +31577,16 @@ var DirectoryDocumentList = function (_a) {
|
|
|
31509
31577
|
});
|
|
31510
31578
|
setCategories(newCategories);
|
|
31511
31579
|
};
|
|
31580
|
+
/**
|
|
31581
|
+
* Uncheck all the options for a specific category
|
|
31582
|
+
*/
|
|
31583
|
+
var clearCategory = function (categoryIndex) {
|
|
31584
|
+
var newCategories = __spreadArray([], categories, true);
|
|
31585
|
+
newCategories[categoryIndex].options.forEach(function (option) {
|
|
31586
|
+
option.checked = false;
|
|
31587
|
+
});
|
|
31588
|
+
setCategories(newCategories);
|
|
31589
|
+
};
|
|
31512
31590
|
var from = pageNumber * perPage - (perPage - 1);
|
|
31513
31591
|
var to = from + ((documents === null || documents === void 0 ? void 0 : documents.length) ? documents.length - 1 : 0);
|
|
31514
31592
|
return (React.createElement(Container, { "data-testid": "DirectoryDocumentList" },
|
|
@@ -31527,7 +31605,9 @@ var DirectoryDocumentList = function (_a) {
|
|
|
31527
31605
|
React.createElement(ButtonContainer, null,
|
|
31528
31606
|
React.createElement(Button, { onClick: submitSearch, type: "submit" },
|
|
31529
31607
|
React.createElement(ButtonText, null, "Search"),
|
|
31530
|
-
React.createElement(IconDownload, { colourFill: "#fff" }))))
|
|
31608
|
+
React.createElement(IconDownload, { colourFill: "#fff" })))),
|
|
31609
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
31610
|
+
React.createElement(Button$4, { url: "".concat(directoryPath, "?search=").concat(searchTerm), text: "View directory", primary: false })))))),
|
|
31531
31611
|
React.createElement(Column, { small: "full", medium: "one-third", large: "one-third" },
|
|
31532
31612
|
React.createElement(Row$1, null,
|
|
31533
31613
|
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
@@ -31535,6 +31615,8 @@ var DirectoryDocumentList = function (_a) {
|
|
|
31535
31615
|
categories.map(function (category, categoryIndex) { return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: category.label },
|
|
31536
31616
|
React.createElement(Fieldset, null,
|
|
31537
31617
|
React.createElement(Legend, null, category.label),
|
|
31618
|
+
React.createElement(ClearFilter, null,
|
|
31619
|
+
React.createElement(TextLink, { onClick: function (e) { return clearCategory(categoryIndex); } }, "Clear filter")),
|
|
31538
31620
|
category.options.map(function (taxonomy) { return (React.createElement(Category, { key: taxonomy.id },
|
|
31539
31621
|
React.createElement(RadioCheckboxInput, { name: taxonomy.vocabulary, value: taxonomy.id, label: taxonomy.name, singleSelection: category.singleSelection, checked: taxonomy.checked, onChange: function (e) { return optionChecked(e, categoryIndex, category.singleSelection); } }))); })))); }))),
|
|
31540
31622
|
React.createElement(Column, { small: "full", medium: "two-thirds", large: "two-thirds" },
|