@nnc-digital/nnc-design-system 1.0.0-alpha57 → 1.0.0-alpha59

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.
@@ -6677,7 +6677,9 @@ var MapMarker = function (options) {
6677
6677
  anchor: new google.maps.Point(40, 60),
6678
6678
  labelOrigin: new google.maps.Point(21, 25),
6679
6679
  };
6680
- var mergedOptions = __assign$2(__assign$2({}, options), { anchorPoint: new google.maps.Point(-5, -40), icon: icon, position: options.position, title: options.title });
6680
+ var mergedOptions = __assign$2(__assign$2({}, options), { anchorPoint: new google.maps.Point(-5, -40), icon: icon, position: options.position, title: options.title, label: options.label ?
6681
+ (typeof options.label === 'string' ?
6682
+ { text: options.label, color: '#FFFFFF' } : __assign$2(__assign$2({}, options.label), { color: '#FFFFFF' })) : undefined });
6681
6683
  for (var key in options) {
6682
6684
  if (key !== 'label' && Object.prototype.hasOwnProperty.call(options, key)) {
6683
6685
  mergedOptions[key] = options[key];
@@ -23644,8 +23646,46 @@ var ImageAndText = function (_a) {
23644
23646
  React.createElement(Content$5, { dangerouslySetInnerHTML: { __html: sanitizeHtml$1(textContent) } }))))));
23645
23647
  };
23646
23648
 
23649
+ var CaseAppointmentType;
23650
+ (function (CaseAppointmentType) {
23651
+ CaseAppointmentType["Hearing"] = "hearing";
23652
+ CaseAppointmentType["Opening"] = "opening";
23653
+ CaseAppointmentType["Writing"] = "writing";
23654
+ })(CaseAppointmentType || (CaseAppointmentType = {}));
23655
+
23647
23656
  const Container$I = styled.div`
23648
23657
  display: block;
23658
+ box-sizing: border-box;
23659
+ `;
23660
+
23661
+ const GroupContainer = styled.div`
23662
+ display: flex;
23663
+ flex-direction: column;
23664
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.large};
23665
+ `;
23666
+
23667
+ const InquestContainer = styled.div`
23668
+ display: flex;
23669
+ flex-direction: row;
23670
+ align-items: flex-start;
23671
+ justify-content: flex-start;
23672
+ flex-wrap: wrap;
23673
+
23674
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23675
+ flex-wrap: nowrap;
23676
+ }
23677
+ `;
23678
+
23679
+ const InquestTime = styled.div`
23680
+ flex-grow: 0;
23681
+ flex-shrink: 0;
23682
+ `;
23683
+
23684
+ const InquestDetails = styled.div`
23685
+ flex-grow: 1;
23686
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23687
+ padding-left: ${(props) => props.theme.theme_vars.spacingSizes.small};
23688
+ }
23649
23689
  `;
23650
23690
 
23651
23691
  /**
@@ -23653,32 +23693,100 @@ const Container$I = styled.div`
23653
23693
  */
23654
23694
  var InquestSchedule = function (_a) {
23655
23695
  var caseAppointments = _a.caseAppointments, title = _a.title, _b = _a.error, error = _b === void 0 ? false : _b;
23696
+ var hearings = caseAppointments.filter(function (appointment) {
23697
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Hearing);
23698
+ });
23699
+ var openings = caseAppointments.filter(function (appointment) {
23700
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Opening);
23701
+ });
23702
+ var writings = caseAppointments.filter(function (appointment) {
23703
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Writing);
23704
+ });
23705
+ var groupHearingsByDay = function (appointments) {
23706
+ return appointments.reduce(function (acc, inquest) {
23707
+ var inquestDate = new Date(inquest.startDateTime);
23708
+ var inquestISODay = inquestDate.toISOString().substring(0, 10);
23709
+ if (!acc[inquestISODay]) {
23710
+ acc[inquestISODay] = [];
23711
+ }
23712
+ acc[inquestISODay].push(inquest);
23713
+ return acc;
23714
+ }, {});
23715
+ };
23716
+ var hearingDayGrouped = groupHearingsByDay(hearings);
23717
+ var openingDayGrouped = groupHearingsByDay(openings);
23718
+ var writingDayGrouped = groupHearingsByDay(writings);
23719
+ var formatDate = function (inquestDay) {
23720
+ return inquestDay
23721
+ .toLocaleDateString('en-GB', {
23722
+ weekday: 'long',
23723
+ day: 'numeric',
23724
+ month: 'long',
23725
+ year: 'numeric',
23726
+ })
23727
+ .replace(',', '');
23728
+ };
23729
+ var formatTime = function (inquestDate) {
23730
+ return inquestDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
23731
+ };
23732
+ var transformToSections = function (groupedData) {
23733
+ return Object.keys(groupedData).map(function (day) {
23734
+ var inquestDayDate = new Date(day);
23735
+ return {
23736
+ title: formatDate(inquestDayDate),
23737
+ content: (React.createElement(Row$1, null, groupedData[day]
23738
+ .sort(function (a, b) {
23739
+ return new Date(a.startDateTime).getTime() - new Date(b.startDateTime).getTime();
23740
+ })
23741
+ .map(function (inquest, key) {
23742
+ var startDateTime = new Date(inquest.startDateTime);
23743
+ var timeOfDeath = new Date(inquest.dateTimeOfDeath);
23744
+ return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: key },
23745
+ React.createElement(InquestContainer, null,
23746
+ React.createElement(InquestTime, null,
23747
+ React.createElement("strong", null, formatTime(startDateTime))),
23748
+ React.createElement(InquestDetails, null,
23749
+ React.createElement("strong", null, "Name:"),
23750
+ " ",
23751
+ inquest.fullName,
23752
+ ".",
23753
+ React.createElement("br", null),
23754
+ React.createElement("strong", null, "Died:"),
23755
+ " ",
23756
+ formatDate(timeOfDeath),
23757
+ " at ",
23758
+ inquest.placeOfDeath,
23759
+ ". Aged ",
23760
+ inquest.age,
23761
+ ' ',
23762
+ "years.",
23763
+ React.createElement("br", null),
23764
+ React.createElement("strong", null, "Court location:"),
23765
+ " ",
23766
+ inquest.courtroomFullAddress,
23767
+ ".",
23768
+ React.createElement("br", null),
23769
+ React.createElement("strong", null, "Coroner:"),
23770
+ " ",
23771
+ inquest.coroner,
23772
+ "."))));
23773
+ }))),
23774
+ };
23775
+ });
23776
+ };
23656
23777
  return (React.createElement(Container$I, { "data-testid": "InquestSchedule" },
23657
- React.createElement("div", { className: "table-container" },
23658
- React.createElement("table", null,
23659
- React.createElement("caption", null, title),
23660
- React.createElement("thead", null,
23661
- React.createElement("tr", null,
23662
- React.createElement("th", { scope: "col" }, "Name"),
23663
- React.createElement("th", { scope: "col" }, "Age"),
23664
- React.createElement("th", { scope: "col" }, "Place of death"),
23665
- React.createElement("th", { scope: "col" }, "Date of death"),
23666
- React.createElement("th", { scope: "col" }, "Name of coroner"),
23667
- React.createElement("th", { scope: "col" }, "Location"),
23668
- React.createElement("th", { scope: "col" }, "Date and time"))),
23669
- React.createElement("tbody", null,
23670
- caseAppointments.map(function (item, index) { return (React.createElement("tr", { key: index },
23671
- React.createElement("td", null, item.fullName),
23672
- React.createElement("td", null, item.age),
23673
- React.createElement("td", null, item.placeOfDeath),
23674
- React.createElement("td", null, new Date(item.dateTimeOfDeath).toLocaleString('en-GB')),
23675
- React.createElement("td", null, item.coroner),
23676
- React.createElement("td", null, item.courtroomFullAddress),
23677
- React.createElement("td", null, new Date(item.startDateTime).toLocaleString('en-GB')))); }),
23678
- caseAppointments.length === 0 && (React.createElement("tr", null,
23679
- React.createElement("td", { colSpan: 7 },
23680
- React.createElement("p", null, "We can't find any results at the moment."),
23681
- error ? (React.createElement("p", null, " The information is currently unavailable.")) : (React.createElement("p", null, "There are no inquests scheduled for next month."))))))))));
23778
+ Object.keys(hearingDayGrouped).length > 0 && (React.createElement(GroupContainer, null,
23779
+ React.createElement(Heading, { level: 2, text: title }),
23780
+ React.createElement(Accordion$1, { sections: transformToSections(hearingDayGrouped) }))),
23781
+ Object.keys(openingDayGrouped).length > 0 && (React.createElement(GroupContainer, null,
23782
+ React.createElement(Heading, { level: 2, text: "Inquest Openings" }),
23783
+ React.createElement(Accordion$1, { sections: transformToSections(openingDayGrouped) }))),
23784
+ Object.keys(writingDayGrouped).length > 0 && (React.createElement(GroupContainer, null,
23785
+ React.createElement(Heading, { level: 2, text: "Inquests in Writing" }),
23786
+ React.createElement(Accordion$1, { sections: transformToSections(writingDayGrouped) }))),
23787
+ caseAppointments.length === 0 && (React.createElement("div", null,
23788
+ React.createElement("p", null, "We can't find any results at the moment."),
23789
+ error ? (React.createElement("p", null, " The information is currently unavailable.")) : (React.createElement("p", null, "There are no inquests scheduled for next month."))))));
23682
23790
  };
23683
23791
 
23684
23792
  const Container$H = styled.div`
@@ -31364,7 +31472,7 @@ var DirectoryServiceList = function (_a) {
31364
31472
  React.createElement(Row$1, null,
31365
31473
  React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
31366
31474
  React.createElement(Label$1, { htmlFor: "directorySearch" }, "What are you looking for?"),
31367
- React.createElement(HintText, { text: "Enter a search word or phrase" }),
31475
+ React.createElement(HintText, { text: "Enter the name of a specific organisation" }),
31368
31476
  React.createElement(Input, { name: "directorySearch", type: "text", defaultValue: searchTerm, id: "directorySearch", onChange: function (e) {
31369
31477
  setSearchTerm(e.target.value);
31370
31478
  } })),
@@ -33269,7 +33377,7 @@ var DirectoryDocumentList = function (_a) {
33269
33377
  React.createElement(Row$1, null,
33270
33378
  React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
33271
33379
  React.createElement(Label, { htmlFor: "directorySearch" }, "What are you looking for?"),
33272
- React.createElement(HintText, { text: "Enter a search word or phrase" }),
33380
+ React.createElement(HintText, { text: "Enter the name of a specific organisation" }),
33273
33381
  React.createElement(Input, { name: "directorySearch", type: "text", defaultValue: searchTerm, id: "directorySearch", onChange: function (e) {
33274
33382
  setSearchTerm(e.target.value);
33275
33383
  } })),