@nnc-digital/nnc-design-system 1.0.0-beta3 → 1.0.0-beta6

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.js CHANGED
@@ -23661,8 +23661,10 @@ var ImageAndText = function (_a) {
23661
23661
 
23662
23662
  var CaseAppointmentType;
23663
23663
  (function (CaseAppointmentType) {
23664
- CaseAppointmentType["Hearing"] = "hearing";
23664
+ CaseAppointmentType["Formal"] = "formal";
23665
+ CaseAppointmentType["Hearing"] = "inquest hearing";
23665
23666
  CaseAppointmentType["Opening"] = "opening";
23667
+ CaseAppointmentType["PreInquest"] = "pre-inquest review";
23666
23668
  CaseAppointmentType["Writing"] = "writing";
23667
23669
  })(CaseAppointmentType || (CaseAppointmentType = {}));
23668
23670
 
@@ -23679,28 +23681,170 @@ const GroupContainer = styled__default.default.div`
23679
23681
 
23680
23682
  const InquestContainer = styled__default.default.div`
23681
23683
  display: flex;
23682
- flex-direction: row;
23684
+ flex-direction: column;
23683
23685
  align-items: flex-start;
23684
23686
  justify-content: flex-start;
23685
23687
  flex-wrap: wrap;
23686
-
23687
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23688
- flex-wrap: nowrap;
23689
- }
23690
23688
  `;
23691
23689
 
23692
- const InquestTime = styled__default.default.div`
23693
- flex-grow: 0;
23690
+ styled__default.default.div`
23691
+ flex-grow: 1;
23694
23692
  flex-shrink: 0;
23693
+
23694
+ strong {
23695
+ display: block;
23696
+ &::first-letter {
23697
+ text-transform: capitalize;
23698
+ }
23699
+ }
23695
23700
  `;
23696
23701
 
23697
23702
  const InquestDetails = styled__default.default.div`
23698
23703
  flex-grow: 1;
23704
+ h3 {
23705
+ display: block;
23706
+ &::first-letter {
23707
+ text-transform: capitalize;
23708
+ }
23709
+ }
23710
+ `;
23711
+
23712
+ const SummaryContainer = styled__default.default.div`
23713
+ border: ${(props) => (props.$hasHeading ? `1px solid ${props.theme.theme_vars.colours.grey}` : `none`)};
23714
+ margin: ${(props) => (props.$hasMargin ? props.theme.theme_vars.spacingSizes.medium : 0)} 0;
23715
+ `;
23716
+
23717
+ const SummaryHeading = styled__default.default.div`
23718
+ background-color: ${(props) => props.theme.theme_vars.colours.grey_light};
23719
+ width: 100%;
23720
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
23721
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.medium};
23722
+
23723
+ h3 {
23724
+ margin: 0;
23725
+ }
23726
+ `;
23727
+
23728
+ const SummaryList$1 = styled__default.default.dl`
23729
+ display: table;
23730
+ width: 100%;
23731
+ table-layout: fixed;
23732
+ border-collapse: collapse;
23733
+ `;
23734
+
23735
+ const SummaryRow = styled__default.default.div`
23736
+ border-bottom: ${(props) => props.$hasBorders ? `1px solid ${props.theme.theme_vars.colours.grey}` : 'none'};
23737
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
23738
+
23699
23739
  @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23700
- padding-left: ${(props) => props.theme.theme_vars.spacingSizes.small};
23740
+ display: table-row;
23741
+ }
23742
+
23743
+ @media print {
23744
+ display: table-row;
23745
+ border-bottom: none;
23746
+ }
23747
+ `;
23748
+
23749
+ const SummaryTerm = styled__default.default.dt`
23750
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
23751
+ font-weight: bold;
23752
+
23753
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23754
+ display: table-cell;
23755
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
23756
+ width: 30%;
23757
+ vertical-align: middle;
23758
+ }
23759
+
23760
+ @media print {
23761
+ display: table-cell;
23762
+ width: 30%;
23701
23763
  }
23702
23764
  `;
23703
23765
 
23766
+ const SummaryDetail = styled__default.default.dd`
23767
+ overflow-wrap: break-word;
23768
+ width: 100%;
23769
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
23770
+
23771
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23772
+ display: table-cell;
23773
+ width: 70%;
23774
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
23775
+ }
23776
+
23777
+ @media print {
23778
+ display: table-cell;
23779
+ width: 70%;
23780
+ }
23781
+ `;
23782
+
23783
+ var SummaryList = function (_a) {
23784
+ var terms = _a.terms, _b = _a.hasMargin, hasMargin = _b === void 0 ? true : _b, _c = _a.hasBorders, hasBorders = _c === void 0 ? true : _c, heading = _a.heading;
23785
+ return (React__default.default.createElement(SummaryContainer, { "$hasHeading": heading, "$hasMargin": hasMargin },
23786
+ heading && (React__default.default.createElement(SummaryHeading, null,
23787
+ React__default.default.createElement(Heading, { level: 3, text: heading }))),
23788
+ React__default.default.createElement(SummaryList$1, { "data-testid": "SummaryList" }, terms.map(function (summaryRow, summaryIndex) { return (React__default.default.createElement(SummaryRow, { key: summaryIndex, "$hasBorders": hasBorders },
23789
+ React__default.default.createElement(SummaryTerm, null, summaryRow.term),
23790
+ React__default.default.createElement(SummaryDetail, { dangerouslySetInnerHTML: { __html: sanitizeHtml$1(summaryRow.detail) } }))); }))));
23791
+ };
23792
+
23793
+ /**
23794
+ * Format a date string to a readable date format
23795
+ * @param {string} dateString - The date string to format
23796
+ * @returns {string} Formatted date
23797
+ */
23798
+ const formatDate = (dateString) => {
23799
+ const date = new Date(dateString);
23800
+ return date
23801
+ .toLocaleDateString('en-GB', {
23802
+ weekday: 'long',
23803
+ day: 'numeric',
23804
+ month: 'long',
23805
+ year: 'numeric',
23806
+ })
23807
+ .replace(',', '');
23808
+ };
23809
+
23810
+ /**
23811
+ * Format a date string to a time format
23812
+ * @param {string} dateString - The date string to format
23813
+ * @returns {string} Formatted time
23814
+ */
23815
+ const formatTime = (dateString) => {
23816
+ const date = new Date(dateString);
23817
+ const hours = date.getHours();
23818
+ const minutes = date.getMinutes();
23819
+
23820
+ // Convert to 12-hour format
23821
+ const hour12 = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
23822
+ const ampm = hours < 12 ? 'am' : 'pm';
23823
+
23824
+ // Only show minutes if not zero
23825
+ if (minutes === 0) {
23826
+ return `${hour12}${ampm}`;
23827
+ } else {
23828
+ return `${hour12}:${minutes.toString().padStart(2, '0')}${ampm}`;
23829
+ }
23830
+ };
23831
+
23832
+ /**
23833
+ * Format a date string to a date and time format
23834
+ * @param {string} dateString - The date string to format
23835
+ * @returns {string} Formatted date and time
23836
+ */
23837
+ const formatDateTime = (dateString) => {
23838
+ const date = new Date(dateString);
23839
+ return date.toLocaleDateString('en-GB', {
23840
+ day: 'numeric',
23841
+ month: 'long',
23842
+ year: 'numeric',
23843
+ hour: '2-digit',
23844
+ minute: '2-digit',
23845
+ });
23846
+ };
23847
+
23704
23848
  /**
23705
23849
  * A table displaying a schedule of inquests
23706
23850
  */
@@ -23709,12 +23853,18 @@ var InquestSchedule = function (_a) {
23709
23853
  var hearings = caseAppointments.filter(function (appointment) {
23710
23854
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Hearing);
23711
23855
  });
23856
+ var preInquest = caseAppointments.filter(function (appointment) {
23857
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.PreInquest);
23858
+ });
23712
23859
  var openings = caseAppointments.filter(function (appointment) {
23713
23860
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Opening);
23714
23861
  });
23715
23862
  var writings = caseAppointments.filter(function (appointment) {
23716
23863
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Writing);
23717
23864
  });
23865
+ var formal = caseAppointments.filter(function (appointment) {
23866
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Formal);
23867
+ });
23718
23868
  var groupHearingsByDay = function (appointments) {
23719
23869
  return appointments.reduce(function (acc, inquest) {
23720
23870
  var inquestDate = new Date(inquest.startDateTime);
@@ -23727,62 +23877,52 @@ var InquestSchedule = function (_a) {
23727
23877
  }, {});
23728
23878
  };
23729
23879
  var hearingDayGrouped = groupHearingsByDay(hearings);
23880
+ var preInquestDayGrouped = groupHearingsByDay(preInquest);
23730
23881
  var openingDayGrouped = groupHearingsByDay(openings);
23731
23882
  var writingDayGrouped = groupHearingsByDay(writings);
23732
- var formatDate = function (inquestDay) {
23733
- return inquestDay
23734
- .toLocaleDateString('en-GB', {
23735
- weekday: 'long',
23736
- day: 'numeric',
23737
- month: 'long',
23738
- year: 'numeric',
23739
- })
23740
- .replace(',', '');
23741
- };
23742
- var formatTime = function (inquestDate) {
23743
- return inquestDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
23744
- };
23883
+ var formalDayGrouped = groupHearingsByDay(formal);
23745
23884
  var transformToSections = function (groupedData) {
23746
23885
  return Object.keys(groupedData).map(function (day) {
23747
- var inquestDayDate = new Date(day);
23748
23886
  return {
23749
- title: formatDate(inquestDayDate),
23887
+ title: formatDate(day),
23750
23888
  content: (React__default.default.createElement(Row$1, null, groupedData[day]
23751
23889
  .sort(function (a, b) {
23752
23890
  return new Date(a.startDateTime).getTime() - new Date(b.startDateTime).getTime();
23753
23891
  })
23754
23892
  .map(function (inquest, key) {
23755
- var startDateTime = new Date(inquest.startDateTime);
23756
- var timeOfDeath = new Date(inquest.dateTimeOfDeath);
23893
+ var terms = [
23894
+ {
23895
+ term: 'Name',
23896
+ detail: inquest.fullName,
23897
+ },
23898
+ {
23899
+ term: 'Died',
23900
+ detail: formatDate(inquest.dateTimeOfDeath) +
23901
+ ' at ' +
23902
+ inquest.placeOfDeath +
23903
+ '. Aged ' +
23904
+ inquest.age +
23905
+ ' years.',
23906
+ },
23907
+ {
23908
+ term: 'Court location',
23909
+ detail: inquest.courtroomFullAddress + '.',
23910
+ },
23911
+ {
23912
+ term: 'Coroner',
23913
+ detail: inquest.coroner + '.',
23914
+ },
23915
+ ];
23916
+ if (inquest.endDateTime) {
23917
+ terms.push({
23918
+ term: 'End date',
23919
+ detail: formatDateTime(inquest.endDateTime) + '.',
23920
+ });
23921
+ }
23757
23922
  return (React__default.default.createElement(Column, { small: "full", medium: "full", large: "full", key: key },
23758
23923
  React__default.default.createElement(InquestContainer, null,
23759
- React__default.default.createElement(InquestTime, null,
23760
- React__default.default.createElement("strong", null, formatTime(startDateTime))),
23761
23924
  React__default.default.createElement(InquestDetails, null,
23762
- React__default.default.createElement("strong", null, "Name:"),
23763
- " ",
23764
- inquest.fullName,
23765
- ".",
23766
- React__default.default.createElement("br", null),
23767
- React__default.default.createElement("strong", null, "Died:"),
23768
- " ",
23769
- formatDate(timeOfDeath),
23770
- " at ",
23771
- inquest.placeOfDeath,
23772
- ". Aged ",
23773
- inquest.age,
23774
- ' ',
23775
- "years.",
23776
- React__default.default.createElement("br", null),
23777
- React__default.default.createElement("strong", null, "Court location:"),
23778
- " ",
23779
- inquest.courtroomFullAddress,
23780
- ".",
23781
- React__default.default.createElement("br", null),
23782
- React__default.default.createElement("strong", null, "Coroner:"),
23783
- " ",
23784
- inquest.coroner,
23785
- "."))));
23925
+ React__default.default.createElement(SummaryList, { terms: terms, hasBorders: false, heading: formatTime(inquest.startDateTime) })))));
23786
23926
  }))),
23787
23927
  };
23788
23928
  });
@@ -23794,9 +23934,15 @@ var InquestSchedule = function (_a) {
23794
23934
  Object.keys(openingDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23795
23935
  React__default.default.createElement(Heading, { level: 2, text: "Inquest Openings" }),
23796
23936
  React__default.default.createElement(Accordion$1, { sections: transformToSections(openingDayGrouped) }))),
23937
+ Object.keys(preInquestDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23938
+ React__default.default.createElement(Heading, { level: 2, text: "Pre-inquest Review Hearings" }),
23939
+ React__default.default.createElement(Accordion$1, { sections: transformToSections(preInquestDayGrouped) }))),
23797
23940
  Object.keys(writingDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23798
23941
  React__default.default.createElement(Heading, { level: 2, text: "Inquests in Writing" }),
23799
23942
  React__default.default.createElement(Accordion$1, { sections: transformToSections(writingDayGrouped) }))),
23943
+ Object.keys(formalDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23944
+ React__default.default.createElement(Heading, { level: 2, text: "Formal Suspension Hearings" }),
23945
+ React__default.default.createElement(Accordion$1, { sections: transformToSections(formalDayGrouped) }))),
23800
23946
  caseAppointments.length === 0 && (React__default.default.createElement("div", null,
23801
23947
  React__default.default.createElement("p", null, "We can't find any results at the moment."),
23802
23948
  error ? (React__default.default.createElement("p", null, " The information is currently unavailable.")) : (React__default.default.createElement("p", null, "There are no inquests scheduled for next month."))))));
@@ -24171,6 +24317,10 @@ var Input = function (_a) {
24171
24317
  var RoadworksList = function (_a) {
24172
24318
  var roadworks = _a.roadworks, title = _a.title;
24173
24319
  var _b = React.useState(roadworks), filteredRoadworks = _b[0], setFilteredRoadworks = _b[1];
24320
+ // Helper function to remove trailing dot if it's the last character
24321
+ var removeTrailingDot = function (text) {
24322
+ return (text === null || text === void 0 ? void 0 : text.endsWith('.')) ? text.slice(0, -1) : text;
24323
+ };
24174
24324
  var handleSearch = function (e) {
24175
24325
  var searchTerm = e.target.value.toLowerCase();
24176
24326
  if (searchTerm != '') {
@@ -24232,7 +24382,7 @@ var RoadworksList = function (_a) {
24232
24382
  React__default.default.createElement(IconContainer$2, null,
24233
24383
  React__default.default.createElement(DynamicIcon, { icon: "mappin" }),
24234
24384
  React__default.default.createElement(IconText, null,
24235
- React__default.default.createElement(Heading, { text: roadwork.detailedLocation, level: 3 }))),
24385
+ React__default.default.createElement(Heading, { text: removeTrailingDot(roadwork.detailedLocation), level: 3 }))),
24236
24386
  React__default.default.createElement(IconContainer$2, null,
24237
24387
  React__default.default.createElement(DynamicIcon, { icon: "events" }),
24238
24388
  React__default.default.createElement(IconText, null,
@@ -24240,11 +24390,11 @@ var RoadworksList = function (_a) {
24240
24390
  React__default.default.createElement(IconContainer$2, null,
24241
24391
  React__default.default.createElement(DynamicIcon, { icon: "roadworks" }),
24242
24392
  React__default.default.createElement(IconText, null,
24243
- React__default.default.createElement("span", null, roadwork.description))),
24393
+ React__default.default.createElement("span", null, removeTrailingDot(roadwork.description)))),
24244
24394
  React__default.default.createElement(IconContainer$2, null,
24245
24395
  React__default.default.createElement(DynamicIcon, { icon: "bollard" }),
24246
24396
  React__default.default.createElement(IconText, null,
24247
- React__default.default.createElement("span", null, roadwork.trafficManagement)))));
24397
+ React__default.default.createElement("span", null, removeTrailingDot(roadwork.trafficManagement))))));
24248
24398
  })),
24249
24399
  roadworks.length > 0 && filteredRoadworks.length === 0 && (React__default.default.createElement(NoMatches, null, "We couldn't find any results for your search term. Please try a different search.")),
24250
24400
  roadworks.length == 0 && (React__default.default.createElement(NoMatches, null, "Sorry, we're not able to find any results at the moment. Please try again later."))));
@@ -28239,9 +28389,9 @@ const focusListItem = styled.css`
28239
28389
  color: ${(props) => props.theme.theme_vars.colours.black};
28240
28390
  background-color: ${(props) => props.theme.theme_vars.colours.focus};
28241
28391
  outline: none;
28242
- box-shadow: 0px -2px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
28243
- -webkit-box-shadow: 0px -2px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
28244
- -moz-box-shadow: 0px -2px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
28392
+ box-shadow: 0 0 0 2px ${(props) => props.theme.theme_vars.colours.focus}, 0 0 0 4px ${(props) => props.theme.theme_vars.colours.black};
28393
+ -webkit-box-shadow: 0 0 0 2px ${(props) => props.theme.theme_vars.colours.focus}, 0 0 0 4px ${(props) => props.theme.theme_vars.colours.black};
28394
+ -moz-box-shadow: 0 0 0 2px ${(props) => props.theme.theme_vars.colours.focus}, 0 0 0 4px ${(props) => props.theme.theme_vars.colours.black};
28245
28395
  `;
28246
28396
 
28247
28397
  const ListItem = styled__default.default.li`
@@ -30481,69 +30631,6 @@ var ServiceContact = function (_a) {
30481
30631
  contact.phones.map(function (phone, phoneIndex) { return (React__default.default.createElement(ContactLink, { href: "tel:".concat(phone.number), key: phoneIndex }, phone.number)); }))); })))))));
30482
30632
  };
30483
30633
 
30484
- const SummaryList$1 = styled__default.default.dl`
30485
- display: table;
30486
- width: 100%;
30487
- table-layout: fixed;
30488
- border-collapse: collapse;
30489
- margin: ${(props) => (props.$hasMargin ? props.theme.theme_vars.spacingSizes.medium : 0)} 0;
30490
- `;
30491
-
30492
- const SummaryRow = styled__default.default.div`
30493
- border-bottom: 1px solid ${(props) => props.theme.theme_vars.colours.grey};
30494
- margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
30495
-
30496
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
30497
- display: table-row;
30498
- }
30499
-
30500
- @media print {
30501
- display: table-row;
30502
- border-bottom: none;
30503
- }
30504
- `;
30505
-
30506
- const SummaryTerm = styled__default.default.dt`
30507
- margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
30508
- font-weight: bold;
30509
-
30510
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
30511
- display: table-cell;
30512
- padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
30513
- width: 30%;
30514
- vertical-align: middle;
30515
- }
30516
-
30517
- @media print {
30518
- display: table-cell;
30519
- width: 30%;
30520
- }
30521
- `;
30522
-
30523
- const SummaryDetail = styled__default.default.dd`
30524
- overflow-wrap: break-word;
30525
- width: 100%;
30526
- margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
30527
-
30528
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
30529
- display: table-cell;
30530
- width: 70%;
30531
- padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
30532
- }
30533
-
30534
- @media print {
30535
- display: table-cell;
30536
- width: 70%;
30537
- }
30538
- `;
30539
-
30540
- var SummaryList = function (_a) {
30541
- var terms = _a.terms, _b = _a.hasMargin, hasMargin = _b === void 0 ? true : _b;
30542
- return (React__default.default.createElement(SummaryList$1, { "data-testid": "SummaryList", "$hasMargin": hasMargin }, terms.map(function (summaryRow, summaryIndex) { return (React__default.default.createElement(SummaryRow, { key: summaryIndex },
30543
- React__default.default.createElement(SummaryTerm, null, summaryRow.term),
30544
- React__default.default.createElement(SummaryDetail, { dangerouslySetInnerHTML: { __html: sanitizeHtml$1(summaryRow.detail) } }))); })));
30545
- };
30546
-
30547
30634
  /**
30548
30635
  * Group an array of items by the key
30549
30636
  */