northants-design-system 0.4.0 → 0.4.2
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 +218 -104
- package/build/index.esm.js.map +1 -1
- package/build/index.js +218 -104
- 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/DirectoryService/DirectoryService.types.d.ts +4 -0
- package/build/library/directory/DirectoryService/DirectoryServiceTransform.d.ts +3 -2
- package/build/library/directory/DirectoryServiceList/DirectoryServiceList.types.d.ts +4 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -22690,12 +22690,13 @@ const SubmitButton = styled__default["default"].input`
|
|
|
22690
22690
|
|
|
22691
22691
|
/**
|
|
22692
22692
|
* Primary UI component for user interaction
|
|
22693
|
+
* If value is set then treat as controlled component
|
|
22693
22694
|
*/
|
|
22694
22695
|
var Input = function (_a) {
|
|
22695
|
-
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;
|
|
22696
|
+
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;
|
|
22696
22697
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
22697
22698
|
errorText && React__default["default"].createElement(ErrorText$1, null, errorText),
|
|
22698
|
-
React__default["default"].createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, defaultValue: defaultValue, id: id })));
|
|
22699
|
+
typeof value !== 'undefined' ? (React__default["default"].createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, value: value, id: id })) : (React__default["default"].createElement(StyledInput, { onChange: onChange, type: type, placeholder: placeholder, name: name, isErrored: isErrored, maxLength: maxLength, defaultValue: defaultValue, id: id }))));
|
|
22699
22700
|
};
|
|
22700
22701
|
|
|
22701
22702
|
var CustomSearch = function (_a) {
|
|
@@ -28855,12 +28856,16 @@ var transformService = function (email, url, phone) {
|
|
|
28855
28856
|
}
|
|
28856
28857
|
return service;
|
|
28857
28858
|
};
|
|
28858
|
-
var transformDescriptionDetails = function (accreditations, fees, service_areas, languages) {
|
|
28859
|
+
var transformDescriptionDetails = function (accreditations, fees, service_areas, languages, eligibilities, ageInMonths) {
|
|
28860
|
+
if (ageInMonths === void 0) { ageInMonths = false; }
|
|
28859
28861
|
var details = [];
|
|
28860
28862
|
if (accreditations) {
|
|
28861
28863
|
details.push({
|
|
28862
28864
|
term: 'Accreditations',
|
|
28863
|
-
detail: accreditations,
|
|
28865
|
+
detail: sanitizeHtml$1(accreditations, {
|
|
28866
|
+
allowedTags: ['p', 'b', 'i', 'em', 'strong', 'a', 'ul', 'li', 'ol'],
|
|
28867
|
+
allowedStyles: {},
|
|
28868
|
+
}),
|
|
28864
28869
|
});
|
|
28865
28870
|
}
|
|
28866
28871
|
if (fees) {
|
|
@@ -28869,7 +28874,13 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
|
|
|
28869
28874
|
detail: fees,
|
|
28870
28875
|
});
|
|
28871
28876
|
}
|
|
28872
|
-
if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length)
|
|
28877
|
+
if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) === 1) {
|
|
28878
|
+
details.push({
|
|
28879
|
+
term: 'Locality',
|
|
28880
|
+
detail: "<span>".concat(service_areas[0].service_area, "</span>"),
|
|
28881
|
+
});
|
|
28882
|
+
}
|
|
28883
|
+
else if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) > 1) {
|
|
28873
28884
|
details.push({
|
|
28874
28885
|
term: 'Locality',
|
|
28875
28886
|
detail: '<ul>' +
|
|
@@ -28881,7 +28892,13 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
|
|
|
28881
28892
|
'</ul>',
|
|
28882
28893
|
});
|
|
28883
28894
|
}
|
|
28884
|
-
if ((languages === null || languages === void 0 ? void 0 : languages.length)
|
|
28895
|
+
if ((languages === null || languages === void 0 ? void 0 : languages.length) === 1) {
|
|
28896
|
+
details.push({
|
|
28897
|
+
term: 'Additional languages',
|
|
28898
|
+
detail: "<span>".concat(languages[0].language, "</span>"),
|
|
28899
|
+
});
|
|
28900
|
+
}
|
|
28901
|
+
else if ((languages === null || languages === void 0 ? void 0 : languages.length) > 1) {
|
|
28885
28902
|
details.push({
|
|
28886
28903
|
term: 'Additional languages',
|
|
28887
28904
|
detail: '<ul>' +
|
|
@@ -28893,6 +28910,24 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
|
|
|
28893
28910
|
'</ul>',
|
|
28894
28911
|
});
|
|
28895
28912
|
}
|
|
28913
|
+
if ((eligibilities === null || eligibilities === void 0 ? void 0 : eligibilities.length) === 1) {
|
|
28914
|
+
details.push({
|
|
28915
|
+
term: 'Age range',
|
|
28916
|
+
detail: "<span>Suitable for ages from ".concat(transformAge(eligibilities[0].minimum_age, ageInMonths), " to\n ").concat(transformAge(eligibilities[0].maximum_age, ageInMonths), "</span>"),
|
|
28917
|
+
});
|
|
28918
|
+
}
|
|
28919
|
+
else if ((eligibilities === null || eligibilities === void 0 ? void 0 : eligibilities.length) > 1) {
|
|
28920
|
+
details.push({
|
|
28921
|
+
term: 'Age range',
|
|
28922
|
+
detail: '<ul>' +
|
|
28923
|
+
eligibilities
|
|
28924
|
+
.map(function (eligibility) {
|
|
28925
|
+
return "<li>Suitable for ages from ".concat(transformAge(eligibility.minimum_age, ageInMonths), " to \n ").concat(transformAge(eligibility.maximum_age, ageInMonths), "</li>");
|
|
28926
|
+
})
|
|
28927
|
+
.join('') +
|
|
28928
|
+
'</ul>',
|
|
28929
|
+
});
|
|
28930
|
+
}
|
|
28896
28931
|
return details;
|
|
28897
28932
|
};
|
|
28898
28933
|
var transformSnippet = function (description, extractLength) {
|
|
@@ -28908,19 +28943,40 @@ var transformTaxonomies = function (service_taxonomys, taxonomiesToShow) {
|
|
|
28908
28943
|
var groupedTaxonomies = groupBy(service_taxonomys, 'vocabulary');
|
|
28909
28944
|
taxonomiesToShow.forEach(function (taxonomy, taxonomyIndex) {
|
|
28910
28945
|
if (groupedTaxonomies.hasOwnProperty(taxonomy.vocabulary)) {
|
|
28911
|
-
|
|
28912
|
-
|
|
28913
|
-
|
|
28914
|
-
groupedTaxonomies[taxonomy.vocabulary]
|
|
28915
|
-
|
|
28916
|
-
|
|
28917
|
-
|
|
28918
|
-
|
|
28919
|
-
|
|
28920
|
-
|
|
28946
|
+
if (groupedTaxonomies[taxonomy.vocabulary].length === 1) {
|
|
28947
|
+
details.push({
|
|
28948
|
+
term: taxonomy.label,
|
|
28949
|
+
detail: '<span>' + groupedTaxonomies[taxonomy.vocabulary][0].name + '</span>',
|
|
28950
|
+
});
|
|
28951
|
+
}
|
|
28952
|
+
else {
|
|
28953
|
+
details.push({
|
|
28954
|
+
term: taxonomy.label,
|
|
28955
|
+
detail: '<ul>' +
|
|
28956
|
+
groupedTaxonomies[taxonomy.vocabulary]
|
|
28957
|
+
.map(function (item) {
|
|
28958
|
+
return "<li>".concat(item.name, "</li>");
|
|
28959
|
+
})
|
|
28960
|
+
.join('') +
|
|
28961
|
+
'</ul>',
|
|
28962
|
+
});
|
|
28963
|
+
}
|
|
28921
28964
|
}
|
|
28922
28965
|
});
|
|
28923
28966
|
return details;
|
|
28967
|
+
};
|
|
28968
|
+
var transformAge = function (age, ageInMonths) {
|
|
28969
|
+
if (ageInMonths === void 0) { ageInMonths = false; }
|
|
28970
|
+
if (age === 0) {
|
|
28971
|
+
return age;
|
|
28972
|
+
}
|
|
28973
|
+
if (ageInMonths) {
|
|
28974
|
+
if (age > 36) {
|
|
28975
|
+
return Math.ceil(age / 12) + ' years';
|
|
28976
|
+
}
|
|
28977
|
+
return "".concat(age, " months");
|
|
28978
|
+
}
|
|
28979
|
+
return "".concat(age, " years");
|
|
28924
28980
|
};
|
|
28925
28981
|
|
|
28926
28982
|
const Container$5 = styled__default["default"].div`
|
|
@@ -29100,9 +29156,9 @@ var getIcon = function (profile) {
|
|
|
29100
29156
|
|
|
29101
29157
|
var DirectoryService = function (_a) {
|
|
29102
29158
|
var _b, _c, _d, _e;
|
|
29103
|
-
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;
|
|
29159
|
+
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;
|
|
29104
29160
|
var labelLetters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'];
|
|
29105
|
-
var
|
|
29161
|
+
var _g = React.useState(false), notServer = _g[0], setNotServer = _g[1];
|
|
29106
29162
|
var themeContext = React.useContext(styled.ThemeContext);
|
|
29107
29163
|
var favourites = useDirectoryShortListContext().favourites.favourites;
|
|
29108
29164
|
React.useEffect(function () {
|
|
@@ -29169,14 +29225,14 @@ var DirectoryService = function (_a) {
|
|
|
29169
29225
|
}),
|
|
29170
29226
|
} })),
|
|
29171
29227
|
React__default["default"].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"))))))),
|
|
29172
|
-
(email || url || contacts) && (React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29228
|
+
(email || url || (contacts === null || contacts === void 0 ? void 0 : contacts.length) > 0) && (React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29173
29229
|
React__default["default"].createElement(Heading, { level: 2, text: "How to contact this service" }),
|
|
29174
29230
|
React__default["default"].createElement(ServiceContact, { email: email, website: url, contacts: contacts }))),
|
|
29175
29231
|
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29176
|
-
React__default["default"].createElement(Heading, { level: 2, text: "
|
|
29232
|
+
React__default["default"].createElement(Heading, { level: 2, text: "Description" }),
|
|
29177
29233
|
React__default["default"].createElement("div", null,
|
|
29178
29234
|
React__default["default"].createElement(React__default["default"].Fragment, null, descriptionElement)),
|
|
29179
|
-
React__default["default"].createElement(SummaryList, { terms: transformDescriptionDetails(accreditations, fees, service_areas, languages), hasMargin: false }),
|
|
29235
|
+
React__default["default"].createElement(SummaryList, { terms: transformDescriptionDetails(accreditations, fees, service_areas, languages, eligibilitys, ageInMonths), hasMargin: false }),
|
|
29180
29236
|
React__default["default"].createElement(SummaryList, { terms: transformTaxonomies(service_taxonomys, taxonomiesToShow), hasMargin: false })),
|
|
29181
29237
|
regular_schedules.length > 0 && (React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
29182
29238
|
React__default["default"].createElement(Heading, { level: 2, text: "Service hours" }),
|
|
@@ -29188,7 +29244,7 @@ var DirectoryService = function (_a) {
|
|
|
29188
29244
|
React__default["default"].createElement("th", { scope: "col" }, "Opens"),
|
|
29189
29245
|
React__default["default"].createElement("th", { scope: "col" }, "Closes"))),
|
|
29190
29246
|
React__default["default"].createElement("tbody", null, regular_schedules === null || regular_schedules === void 0 ? void 0 : regular_schedules.map(function (schedule, scheduleIndex) { return (React__default["default"].createElement("tr", { key: scheduleIndex },
|
|
29191
|
-
React__default["default"].createElement("
|
|
29247
|
+
React__default["default"].createElement("td", null, schedule.weekday),
|
|
29192
29248
|
React__default["default"].createElement("td", null, schedule.opens_at),
|
|
29193
29249
|
React__default["default"].createElement("td", null, schedule.closes_at))); })))))),
|
|
29194
29250
|
(uploads === null || uploads === void 0 ? void 0 : uploads.length) > 0 && (React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
@@ -29203,7 +29259,7 @@ var DirectoryService = function (_a) {
|
|
|
29203
29259
|
.filter(function (location) {
|
|
29204
29260
|
return location.is_visitable == false;
|
|
29205
29261
|
})
|
|
29206
|
-
.map(function (location) { return (React__default["default"].createElement(Row$1,
|
|
29262
|
+
.map(function (location) { return (React__default["default"].createElement(Row$1, { key: location.id },
|
|
29207
29263
|
React__default["default"].createElement(Column, { small: "full", medium: "one-half", large: "one-third", key: location.id },
|
|
29208
29264
|
React__default["default"].createElement(Heading, { level: 2, text: location.name }),
|
|
29209
29265
|
location.physical_addresses.map(function (address) { return (React__default["default"].createElement(PhysicalAddress, { key: address.id },
|
|
@@ -29214,10 +29270,7 @@ var DirectoryService = function (_a) {
|
|
|
29214
29270
|
} }))); }),
|
|
29215
29271
|
(location === null || location === void 0 ? void 0 : location.accessibility_for_disabilities.length) > 0 && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
29216
29272
|
React__default["default"].createElement(Heading, { level: 3, text: "Other facilities on site" }),
|
|
29217
|
-
React__default["default"].createElement("ul", null, location.accessibility_for_disabilities.map(function (accessibility) { return (React__default["default"].createElement("li", { key: accessibility.id }, accessibility.accessibility)); })))))
|
|
29218
|
-
React__default["default"].createElement(Column, { small: "full", medium: "one-half", large: "two-thirds" },
|
|
29219
|
-
React__default["default"].createElement(WarningText, { title: "Please note", isWarning: true },
|
|
29220
|
-
React__default["default"].createElement("p", null, "This address is not open to visitors."))))); }))))));
|
|
29273
|
+
React__default["default"].createElement("ul", null, location.accessibility_for_disabilities.map(function (accessibility) { return (React__default["default"].createElement("li", { key: accessibility.id }, accessibility.accessibility)); }))))))); }))))));
|
|
29221
29274
|
};
|
|
29222
29275
|
|
|
29223
29276
|
const Container$3 = styled__default["default"].div`
|
|
@@ -29420,7 +29473,13 @@ const AccordionControls = styled__default["default"].div`
|
|
|
29420
29473
|
justify-content: space-between;
|
|
29421
29474
|
`;
|
|
29422
29475
|
|
|
29423
|
-
const
|
|
29476
|
+
const ClearFilter$1 = styled__default["default"].div`
|
|
29477
|
+
display: flex;
|
|
29478
|
+
justify-content: flex-end;
|
|
29479
|
+
padding-top: ${(props) => props.theme.theme_vars.spacingSizes.small};
|
|
29480
|
+
`;
|
|
29481
|
+
|
|
29482
|
+
const TextLink$1 = styled__default["default"].button`
|
|
29424
29483
|
font-size: ${(props) => props.theme.theme_vars.fontSizes.extra_small};
|
|
29425
29484
|
position: relative;
|
|
29426
29485
|
z-index: 1;
|
|
@@ -29676,7 +29735,7 @@ var RadioCheckboxInput = function (_a) {
|
|
|
29676
29735
|
var id = React.useId();
|
|
29677
29736
|
return (React__default["default"].createElement(Container$2, { "data-testid": "RadioCheckboxInput" },
|
|
29678
29737
|
React__default["default"].createElement(Category$1, null,
|
|
29679
|
-
React__default["default"].createElement(CategoryInput, { type: singleSelection ? 'radio' : 'checkbox', value: value, id: id, name: name,
|
|
29738
|
+
React__default["default"].createElement(CategoryInput, { type: singleSelection ? 'radio' : 'checkbox', value: value, id: id, name: name, onClick: onChange, defaultChecked: checked }),
|
|
29680
29739
|
React__default["default"].createElement(CategoryInputLabel, { isChecked: checked, htmlFor: id, singleSelection: singleSelection }, label))));
|
|
29681
29740
|
};
|
|
29682
29741
|
|
|
@@ -29696,6 +29755,9 @@ var DirectoryServiceList = function (_a) {
|
|
|
29696
29755
|
setNotServer(true);
|
|
29697
29756
|
setFiltersActive(hasActiveFilters());
|
|
29698
29757
|
}, []);
|
|
29758
|
+
React.useEffect(function () {
|
|
29759
|
+
setFiltersActive(hasActiveFilters());
|
|
29760
|
+
}, [minimumAge, maximumAge, categories]);
|
|
29699
29761
|
if (accordions.length === 0) {
|
|
29700
29762
|
var tempAccordions_1 = [];
|
|
29701
29763
|
categories === null || categories === void 0 ? void 0 : categories.forEach(function () {
|
|
@@ -29717,7 +29779,21 @@ var DirectoryServiceList = function (_a) {
|
|
|
29717
29779
|
}
|
|
29718
29780
|
});
|
|
29719
29781
|
setCategories(newCategories);
|
|
29720
|
-
|
|
29782
|
+
};
|
|
29783
|
+
/**
|
|
29784
|
+
* Uncheck all the options for a specific category
|
|
29785
|
+
*/
|
|
29786
|
+
var clearCategory = function (categoryIndex) {
|
|
29787
|
+
var newCategories = __spreadArray([], categories, true);
|
|
29788
|
+
newCategories[categoryIndex].options.forEach(function (option) {
|
|
29789
|
+
option.checked = false;
|
|
29790
|
+
});
|
|
29791
|
+
setCategories(newCategories);
|
|
29792
|
+
};
|
|
29793
|
+
var clearAges = function (e) {
|
|
29794
|
+
e.target.value = '';
|
|
29795
|
+
handleAgeChange(e, 'minimumAge');
|
|
29796
|
+
handleAgeChange(e, 'maximumAge');
|
|
29721
29797
|
};
|
|
29722
29798
|
var from = pageNumber * perPage - (perPage - 1);
|
|
29723
29799
|
var to = from + ((services === null || services === void 0 ? void 0 : services.length) ? services.length - 1 : 0);
|
|
@@ -29763,21 +29839,9 @@ var DirectoryServiceList = function (_a) {
|
|
|
29763
29839
|
};
|
|
29764
29840
|
}),
|
|
29765
29841
|
};
|
|
29766
|
-
var formatAge = function (age) {
|
|
29767
|
-
if (age === 0) {
|
|
29768
|
-
return age;
|
|
29769
|
-
}
|
|
29770
|
-
if (ageInMonths) {
|
|
29771
|
-
if (age > 36) {
|
|
29772
|
-
return Math.ceil(age / 12) + ' years';
|
|
29773
|
-
}
|
|
29774
|
-
return "".concat(age, " months");
|
|
29775
|
-
}
|
|
29776
|
-
return "".concat(age, " years");
|
|
29777
|
-
};
|
|
29778
29842
|
var handleAgeChange = function (e, field) {
|
|
29779
|
-
var age = e.target.value ? parseInt(e.target.value, 10) :
|
|
29780
|
-
if (
|
|
29843
|
+
var age = e.target.value ? parseInt(e.target.value, 10) : '';
|
|
29844
|
+
if (typeof age === 'number' && ageInMonths) {
|
|
29781
29845
|
age = age * 12;
|
|
29782
29846
|
}
|
|
29783
29847
|
if (field === 'maximumAge') {
|
|
@@ -29788,13 +29852,14 @@ var DirectoryServiceList = function (_a) {
|
|
|
29788
29852
|
}
|
|
29789
29853
|
};
|
|
29790
29854
|
var hasActiveFilters = function () {
|
|
29791
|
-
return
|
|
29792
|
-
|
|
29793
|
-
|
|
29794
|
-
|
|
29795
|
-
|
|
29855
|
+
return (maximumAge !== '' ||
|
|
29856
|
+
minimumAge !== '' ||
|
|
29857
|
+
categories.some(function (category) {
|
|
29858
|
+
return category.options.some(function (option) {
|
|
29859
|
+
return option.checked == true;
|
|
29860
|
+
});
|
|
29861
|
+
}));
|
|
29796
29862
|
};
|
|
29797
|
-
hasActiveFilters();
|
|
29798
29863
|
return (React__default["default"].createElement(Container$3, { "data-testid": "DirectoryServiceList" },
|
|
29799
29864
|
React__default["default"].createElement(Row$1, null,
|
|
29800
29865
|
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
@@ -29827,9 +29892,9 @@ var DirectoryServiceList = function (_a) {
|
|
|
29827
29892
|
notServer && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
29828
29893
|
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29829
29894
|
React__default["default"].createElement(AccordionControls, null,
|
|
29830
|
-
filtersActive ? (React__default["default"].createElement(TextLink, { onClick: clearSearch, type: "button" },
|
|
29895
|
+
filtersActive ? (React__default["default"].createElement(TextLink$1, { onClick: clearSearch, type: "button" },
|
|
29831
29896
|
React__default["default"].createElement(ButtonText$1, null, "Clear all filters"))) : (React__default["default"].createElement("div", null)),
|
|
29832
|
-
React__default["default"].createElement(TextLink, { onClick: toggleAll, type: "button", "aria-expanded": !openAll },
|
|
29897
|
+
React__default["default"].createElement(TextLink$1, { onClick: toggleAll, type: "button", "aria-expanded": !openAll },
|
|
29833
29898
|
openAll ? 'Open all' : 'Close all',
|
|
29834
29899
|
React__default["default"].createElement(VisuallyHidden, null, " sections")))),
|
|
29835
29900
|
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
@@ -29839,69 +29904,76 @@ var DirectoryServiceList = function (_a) {
|
|
|
29839
29904
|
"Select age group (years)",
|
|
29840
29905
|
React__default["default"].createElement(AccordionIcon, { isOpen: accordions[0] }))),
|
|
29841
29906
|
React__default["default"].createElement(Accordion, { isOpen: accordions[0] },
|
|
29907
|
+
React__default["default"].createElement(ClearFilter$1, null,
|
|
29908
|
+
React__default["default"].createElement(TextLink$1, { onClick: function (e) { return clearAges(e); } }, "Clear filter")),
|
|
29842
29909
|
React__default["default"].createElement(Row$1, null,
|
|
29843
29910
|
React__default["default"].createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
29844
29911
|
React__default["default"].createElement(Label$1, { htmlFor: "minimum_age" }, "From"),
|
|
29845
|
-
React__default["default"].createElement(Input, { name: "minimum_age", onChange: function (e) { return handleAgeChange(e, 'minimumAge'); },
|
|
29912
|
+
React__default["default"].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" })),
|
|
29846
29913
|
React__default["default"].createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
29847
29914
|
React__default["default"].createElement(Label$1, { htmlFor: "maximum_age" }, "To"),
|
|
29848
|
-
React__default["default"].createElement(Input, { name: "maximum_age", onChange: function (e) { return handleAgeChange(e, 'maximumAge'); },
|
|
29915
|
+
React__default["default"].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 :
|
|
29849
29916
|
categories.map(function (category, categoryIndex) { return (React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", key: category.label },
|
|
29850
29917
|
React__default["default"].createElement(Fieldset$1, null,
|
|
29851
29918
|
React__default["default"].createElement(Legend$1, null,
|
|
29852
29919
|
React__default["default"].createElement(LegendButton, { onClick: function (e) { return toggleAccordion(categoryIndex + 1); }, type: "button" },
|
|
29853
29920
|
category.label,
|
|
29854
29921
|
React__default["default"].createElement(AccordionIcon, { isOpen: accordions[categoryIndex + 1] }))),
|
|
29855
|
-
React__default["default"].createElement(Accordion, { isOpen: accordions[categoryIndex + 1] },
|
|
29856
|
-
React__default["default"].createElement(
|
|
29922
|
+
React__default["default"].createElement(Accordion, { isOpen: accordions[categoryIndex + 1] },
|
|
29923
|
+
React__default["default"].createElement(ClearFilter$1, null,
|
|
29924
|
+
React__default["default"].createElement(TextLink$1, { onClick: function (e) { return clearCategory(categoryIndex); } }, "Clear filter")),
|
|
29925
|
+
category.options.map(function (taxonomy) { return (React__default["default"].createElement(Category$2, { key: taxonomy.id },
|
|
29926
|
+
React__default["default"].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); } }))); }))))); })))))),
|
|
29857
29927
|
React__default["default"].createElement(Column, { small: "full", medium: "two-thirds", large: "two-thirds" },
|
|
29858
|
-
React__default["default"].createElement(Row$1, null,
|
|
29859
|
-
|
|
29860
|
-
|
|
29861
|
-
|
|
29862
|
-
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
|
|
29869
|
-
|
|
29870
|
-
React__default["default"].createElement(
|
|
29871
|
-
|
|
29872
|
-
React__default["default"].createElement(
|
|
29873
|
-
|
|
29874
|
-
|
|
29875
|
-
|
|
29876
|
-
|
|
29877
|
-
React__default["default"].createElement(
|
|
29878
|
-
|
|
29879
|
-
|
|
29880
|
-
|
|
29881
|
-
|
|
29882
|
-
|
|
29883
|
-
|
|
29884
|
-
|
|
29885
|
-
|
|
29886
|
-
|
|
29887
|
-
|
|
29888
|
-
|
|
29889
|
-
|
|
29890
|
-
|
|
29891
|
-
|
|
29892
|
-
|
|
29893
|
-
|
|
29894
|
-
|
|
29895
|
-
|
|
29896
|
-
|
|
29897
|
-
|
|
29898
|
-
|
|
29899
|
-
|
|
29900
|
-
|
|
29901
|
-
|
|
29902
|
-
|
|
29903
|
-
|
|
29904
|
-
|
|
29928
|
+
React__default["default"].createElement(Row$1, null, isLoading ? (React__default["default"].createElement(LoadingContainer$1, null,
|
|
29929
|
+
React__default["default"].createElement(LoadingSpinner, null),
|
|
29930
|
+
React__default["default"].createElement("p", null, "Loading"))) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
29931
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29932
|
+
(services === null || services === void 0 ? void 0 : services.length) > 0 ? (React__default["default"].createElement(ResultInfo$1, null,
|
|
29933
|
+
"Showing ",
|
|
29934
|
+
from,
|
|
29935
|
+
" to ",
|
|
29936
|
+
to,
|
|
29937
|
+
" out of ",
|
|
29938
|
+
totalResults.toLocaleString())) : (React__default["default"].createElement(ResultInfo$1, null, "No results found")),
|
|
29939
|
+
React__default["default"].createElement(FavouritesContainer, null,
|
|
29940
|
+
(services === null || services === void 0 ? void 0 : services.length) > 0 && (React__default["default"].createElement(MapToggle, { type: "button", onClick: function (e) { return setShowMap(!showMap); } }, showMap ? "Hide Map" : "Show Map")),
|
|
29941
|
+
React__default["default"].createElement(Favourites, { href: shortListPath },
|
|
29942
|
+
React__default["default"].createElement(HeartIcon, { colourFill: themeContext.theme_vars.colours.action }),
|
|
29943
|
+
" Shortlist (",
|
|
29944
|
+
favourites.length,
|
|
29945
|
+
")"))),
|
|
29946
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29947
|
+
React__default["default"].createElement(Pagination, { currentPage: pageNumber, totalResults: totalResults, resultsPerPage: perPage, postTo: directoryPath, buttonClickOverride: setPageNumber })),
|
|
29948
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" }, notServer && React__default["default"].createElement(React__default["default"].Fragment, null, (services === null || services === void 0 ? void 0 : services.length) > 0 && showMap && React__default["default"].createElement(DirectoryMap, { mapProps: mapProps }))),
|
|
29949
|
+
services.map(function (service, index) {
|
|
29950
|
+
var _a, _b, _c, _d, _e, _f;
|
|
29951
|
+
var snippet = transformSnippet(service.description, extractLength);
|
|
29952
|
+
return (React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", key: service.id },
|
|
29953
|
+
React__default["default"].createElement(ServiceContainer, { resultNumber: index },
|
|
29954
|
+
React__default["default"].createElement(Row$1, null,
|
|
29955
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29956
|
+
React__default["default"].createElement(ServiceHeader, null,
|
|
29957
|
+
React__default["default"].createElement(ServiceLink$1, { href: "".concat(directoryPath, "/").concat(service.id) }, service.name),
|
|
29958
|
+
showMap && (React__default["default"].createElement(MarkerContainer, null,
|
|
29959
|
+
React__default["default"].createElement("span", null, labelLetters[index]),
|
|
29960
|
+
React__default["default"].createElement(PinIcon, { colourFill: themeContext.theme_vars.colours.action_dark }))))),
|
|
29961
|
+
React__default["default"].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' },
|
|
29962
|
+
React__default["default"].createElement("div", null, snippet)),
|
|
29963
|
+
((_c = service.organization) === null || _c === void 0 ? void 0 : _c.logo) && (React__default["default"].createElement(Column, { small: "full", medium: "one-third", large: "one-third" },
|
|
29964
|
+
React__default["default"].createElement(ServiceImageContainer, null,
|
|
29965
|
+
React__default["default"].createElement(ServiceImage, { src: service.organization.logo, alt: service.name + ' logo', loading: "lazy" })))),
|
|
29966
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" }, service.eligibilitys && (React__default["default"].createElement(React__default["default"].Fragment, null, service.eligibilitys.map(function (eligibility) { return (React__default["default"].createElement(Age, { key: eligibility.id },
|
|
29967
|
+
"Suitable for ages from ",
|
|
29968
|
+
transformAge(eligibility.minimum_age, ageInMonths),
|
|
29969
|
+
" to",
|
|
29970
|
+
' ',
|
|
29971
|
+
transformAge(eligibility.maximum_age, ageInMonths))); })))),
|
|
29972
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29973
|
+
React__default["default"].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(', ') }))))));
|
|
29974
|
+
}),
|
|
29975
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
29976
|
+
React__default["default"].createElement(Pagination, { currentPage: pageNumber, totalResults: totalResults, resultsPerPage: perPage, postTo: directoryPath, buttonClickOverride: setPageNumber })))))))));
|
|
29905
29977
|
};
|
|
29906
29978
|
|
|
29907
29979
|
const Container$1 = styled__default["default"].div`
|
|
@@ -31464,6 +31536,34 @@ const ResultInfo = styled__default["default"].div`
|
|
|
31464
31536
|
color: ${(props) => props.theme.theme_vars.colours.grey_dark};
|
|
31465
31537
|
`;
|
|
31466
31538
|
|
|
31539
|
+
const ClearFilter = styled__default["default"].div`
|
|
31540
|
+
display: flex;
|
|
31541
|
+
justify-content: flex-end;
|
|
31542
|
+
padding-top: ${(props) => props.theme.theme_vars.spacingSizes.small};
|
|
31543
|
+
`;
|
|
31544
|
+
|
|
31545
|
+
const TextLink = styled__default["default"].button`
|
|
31546
|
+
font-size: ${(props) => props.theme.theme_vars.fontSizes.extra_small};
|
|
31547
|
+
position: relative;
|
|
31548
|
+
z-index: 1;
|
|
31549
|
+
margin: 0;
|
|
31550
|
+
margin-bottom: 15px;
|
|
31551
|
+
padding: 0;
|
|
31552
|
+
border-width: 0;
|
|
31553
|
+
color: ${(props) => props.theme.theme_vars.colours.action};
|
|
31554
|
+
background: none;
|
|
31555
|
+
cursor: pointer;
|
|
31556
|
+
&:hover {
|
|
31557
|
+
${(props) => props.theme.linkStylesHover};
|
|
31558
|
+
}
|
|
31559
|
+
&:focus {
|
|
31560
|
+
${(props) => props.theme.linkStylesFocus};
|
|
31561
|
+
}
|
|
31562
|
+
&:active {
|
|
31563
|
+
${(props) => props.theme.linkStylesActive};
|
|
31564
|
+
}
|
|
31565
|
+
`;
|
|
31566
|
+
|
|
31467
31567
|
const Fieldset = styled__default["default"].fieldset`
|
|
31468
31568
|
display: block;
|
|
31469
31569
|
border-bottom: 1px solid ${(props) => props.theme.theme_vars.colours.grey};
|
|
@@ -31524,6 +31624,16 @@ var DirectoryDocumentList = function (_a) {
|
|
|
31524
31624
|
});
|
|
31525
31625
|
setCategories(newCategories);
|
|
31526
31626
|
};
|
|
31627
|
+
/**
|
|
31628
|
+
* Uncheck all the options for a specific category
|
|
31629
|
+
*/
|
|
31630
|
+
var clearCategory = function (categoryIndex) {
|
|
31631
|
+
var newCategories = __spreadArray([], categories, true);
|
|
31632
|
+
newCategories[categoryIndex].options.forEach(function (option) {
|
|
31633
|
+
option.checked = false;
|
|
31634
|
+
});
|
|
31635
|
+
setCategories(newCategories);
|
|
31636
|
+
};
|
|
31527
31637
|
var from = pageNumber * perPage - (perPage - 1);
|
|
31528
31638
|
var to = from + ((documents === null || documents === void 0 ? void 0 : documents.length) ? documents.length - 1 : 0);
|
|
31529
31639
|
return (React__default["default"].createElement(Container, { "data-testid": "DirectoryDocumentList" },
|
|
@@ -31542,7 +31652,9 @@ var DirectoryDocumentList = function (_a) {
|
|
|
31542
31652
|
React__default["default"].createElement(ButtonContainer, null,
|
|
31543
31653
|
React__default["default"].createElement(Button, { onClick: submitSearch, type: "submit" },
|
|
31544
31654
|
React__default["default"].createElement(ButtonText, null, "Search"),
|
|
31545
|
-
React__default["default"].createElement(IconDownload, { colourFill: "#fff" }))))
|
|
31655
|
+
React__default["default"].createElement(IconDownload, { colourFill: "#fff" })))),
|
|
31656
|
+
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
31657
|
+
React__default["default"].createElement(Button$4, { url: "".concat(directoryPath, "?search=").concat(searchTerm), text: "View directory", primary: false })))))),
|
|
31546
31658
|
React__default["default"].createElement(Column, { small: "full", medium: "one-third", large: "one-third" },
|
|
31547
31659
|
React__default["default"].createElement(Row$1, null,
|
|
31548
31660
|
React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
@@ -31550,6 +31662,8 @@ var DirectoryDocumentList = function (_a) {
|
|
|
31550
31662
|
categories.map(function (category, categoryIndex) { return (React__default["default"].createElement(Column, { small: "full", medium: "full", large: "full", key: category.label },
|
|
31551
31663
|
React__default["default"].createElement(Fieldset, null,
|
|
31552
31664
|
React__default["default"].createElement(Legend, null, category.label),
|
|
31665
|
+
React__default["default"].createElement(ClearFilter, null,
|
|
31666
|
+
React__default["default"].createElement(TextLink, { onClick: function (e) { return clearCategory(categoryIndex); } }, "Clear filter")),
|
|
31553
31667
|
category.options.map(function (taxonomy) { return (React__default["default"].createElement(Category, { key: taxonomy.id },
|
|
31554
31668
|
React__default["default"].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); } }))); })))); }))),
|
|
31555
31669
|
React__default["default"].createElement(Column, { small: "full", medium: "two-thirds", large: "two-thirds" },
|