northants-design-system 0.4.1 → 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.
@@ -28841,7 +28841,8 @@ var transformService = function (email, url, phone) {
28841
28841
  }
28842
28842
  return service;
28843
28843
  };
28844
- var transformDescriptionDetails = function (accreditations, fees, service_areas, languages) {
28844
+ var transformDescriptionDetails = function (accreditations, fees, service_areas, languages, eligibilities, ageInMonths) {
28845
+ if (ageInMonths === void 0) { ageInMonths = false; }
28845
28846
  var details = [];
28846
28847
  if (accreditations) {
28847
28848
  details.push({
@@ -28858,7 +28859,13 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
28858
28859
  detail: fees,
28859
28860
  });
28860
28861
  }
28861
- if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) > 0) {
28862
+ if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) === 1) {
28863
+ details.push({
28864
+ term: 'Locality',
28865
+ detail: "<span>".concat(service_areas[0].service_area, "</span>"),
28866
+ });
28867
+ }
28868
+ else if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) > 1) {
28862
28869
  details.push({
28863
28870
  term: 'Locality',
28864
28871
  detail: '<ul>' +
@@ -28870,7 +28877,13 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
28870
28877
  '</ul>',
28871
28878
  });
28872
28879
  }
28873
- if ((languages === null || languages === void 0 ? void 0 : languages.length) > 0) {
28880
+ if ((languages === null || languages === void 0 ? void 0 : languages.length) === 1) {
28881
+ details.push({
28882
+ term: 'Additional languages',
28883
+ detail: "<span>".concat(languages[0].language, "</span>"),
28884
+ });
28885
+ }
28886
+ else if ((languages === null || languages === void 0 ? void 0 : languages.length) > 1) {
28874
28887
  details.push({
28875
28888
  term: 'Additional languages',
28876
28889
  detail: '<ul>' +
@@ -28882,6 +28895,24 @@ var transformDescriptionDetails = function (accreditations, fees, service_areas,
28882
28895
  '</ul>',
28883
28896
  });
28884
28897
  }
28898
+ if ((eligibilities === null || eligibilities === void 0 ? void 0 : eligibilities.length) === 1) {
28899
+ details.push({
28900
+ term: 'Age range',
28901
+ detail: "<span>Suitable for ages from ".concat(transformAge(eligibilities[0].minimum_age, ageInMonths), " to\n ").concat(transformAge(eligibilities[0].maximum_age, ageInMonths), "</span>"),
28902
+ });
28903
+ }
28904
+ else if ((eligibilities === null || eligibilities === void 0 ? void 0 : eligibilities.length) > 1) {
28905
+ details.push({
28906
+ term: 'Age range',
28907
+ detail: '<ul>' +
28908
+ eligibilities
28909
+ .map(function (eligibility) {
28910
+ return "<li>Suitable for ages from ".concat(transformAge(eligibility.minimum_age, ageInMonths), " to \n ").concat(transformAge(eligibility.maximum_age, ageInMonths), "</li>");
28911
+ })
28912
+ .join('') +
28913
+ '</ul>',
28914
+ });
28915
+ }
28885
28916
  return details;
28886
28917
  };
28887
28918
  var transformSnippet = function (description, extractLength) {
@@ -28900,7 +28931,7 @@ var transformTaxonomies = function (service_taxonomys, taxonomiesToShow) {
28900
28931
  if (groupedTaxonomies[taxonomy.vocabulary].length === 1) {
28901
28932
  details.push({
28902
28933
  term: taxonomy.label,
28903
- detail: '<p>' + groupedTaxonomies[taxonomy.vocabulary][0].name + '</p>',
28934
+ detail: '<span>' + groupedTaxonomies[taxonomy.vocabulary][0].name + '</span>',
28904
28935
  });
28905
28936
  }
28906
28937
  else {
@@ -28918,6 +28949,19 @@ var transformTaxonomies = function (service_taxonomys, taxonomiesToShow) {
28918
28949
  }
28919
28950
  });
28920
28951
  return details;
28952
+ };
28953
+ var transformAge = function (age, ageInMonths) {
28954
+ if (ageInMonths === void 0) { ageInMonths = false; }
28955
+ if (age === 0) {
28956
+ return age;
28957
+ }
28958
+ if (ageInMonths) {
28959
+ if (age > 36) {
28960
+ return Math.ceil(age / 12) + ' years';
28961
+ }
28962
+ return "".concat(age, " months");
28963
+ }
28964
+ return "".concat(age, " years");
28921
28965
  };
28922
28966
 
28923
28967
  const Container$5 = styled.div`
@@ -29097,9 +29141,9 @@ var getIcon = function (profile) {
29097
29141
 
29098
29142
  var DirectoryService = function (_a) {
29099
29143
  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;
29144
+ 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
29145
  var labelLetters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'];
29102
- var _f = useState(false), notServer = _f[0], setNotServer = _f[1];
29146
+ var _g = useState(false), notServer = _g[0], setNotServer = _g[1];
29103
29147
  var themeContext = useContext(ThemeContext);
29104
29148
  var favourites = useDirectoryShortListContext().favourites.favourites;
29105
29149
  useEffect(function () {
@@ -29173,7 +29217,7 @@ var DirectoryService = function (_a) {
29173
29217
  React.createElement(Heading, { level: 2, text: "Description" }),
29174
29218
  React.createElement("div", null,
29175
29219
  React.createElement(React.Fragment, null, descriptionElement)),
29176
- React.createElement(SummaryList, { terms: transformDescriptionDetails(accreditations, fees, service_areas, languages), hasMargin: false }),
29220
+ React.createElement(SummaryList, { terms: transformDescriptionDetails(accreditations, fees, service_areas, languages, eligibilitys, ageInMonths), hasMargin: false }),
29177
29221
  React.createElement(SummaryList, { terms: transformTaxonomies(service_taxonomys, taxonomiesToShow), hasMargin: false })),
29178
29222
  regular_schedules.length > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
29179
29223
  React.createElement(Heading, { level: 2, text: "Service hours" }),
@@ -29185,7 +29229,7 @@ var DirectoryService = function (_a) {
29185
29229
  React.createElement("th", { scope: "col" }, "Opens"),
29186
29230
  React.createElement("th", { scope: "col" }, "Closes"))),
29187
29231
  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("th", null, schedule.weekday),
29232
+ React.createElement("td", null, schedule.weekday),
29189
29233
  React.createElement("td", null, schedule.opens_at),
29190
29234
  React.createElement("td", null, schedule.closes_at))); })))))),
29191
29235
  (uploads === null || uploads === void 0 ? void 0 : uploads.length) > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
@@ -29780,18 +29824,6 @@ var DirectoryServiceList = function (_a) {
29780
29824
  };
29781
29825
  }),
29782
29826
  };
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
29827
  var handleAgeChange = function (e, field) {
29796
29828
  var age = e.target.value ? parseInt(e.target.value, 10) : '';
29797
29829
  if (typeof age === 'number' && ageInMonths) {
@@ -29918,10 +29950,10 @@ var DirectoryServiceList = function (_a) {
29918
29950
  React.createElement(ServiceImage, { src: service.organization.logo, alt: service.name + ' logo', loading: "lazy" })))),
29919
29951
  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
29952
  "Suitable for ages from ",
29921
- formatAge(eligibility.minimum_age),
29953
+ transformAge(eligibility.minimum_age, ageInMonths),
29922
29954
  " to",
29923
29955
  ' ',
29924
- formatAge(eligibility.maximum_age))); })))),
29956
+ transformAge(eligibility.maximum_age, ageInMonths))); })))),
29925
29957
  React.createElement(Column, { small: "full", medium: "full", large: "full" },
29926
29958
  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
29959
  }),