@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.
@@ -23648,8 +23648,10 @@ var ImageAndText = function (_a) {
23648
23648
 
23649
23649
  var CaseAppointmentType;
23650
23650
  (function (CaseAppointmentType) {
23651
- CaseAppointmentType["Hearing"] = "hearing";
23651
+ CaseAppointmentType["Formal"] = "formal";
23652
+ CaseAppointmentType["Hearing"] = "inquest hearing";
23652
23653
  CaseAppointmentType["Opening"] = "opening";
23654
+ CaseAppointmentType["PreInquest"] = "pre-inquest review";
23653
23655
  CaseAppointmentType["Writing"] = "writing";
23654
23656
  })(CaseAppointmentType || (CaseAppointmentType = {}));
23655
23657
 
@@ -23666,28 +23668,170 @@ const GroupContainer = styled.div`
23666
23668
 
23667
23669
  const InquestContainer = styled.div`
23668
23670
  display: flex;
23669
- flex-direction: row;
23671
+ flex-direction: column;
23670
23672
  align-items: flex-start;
23671
23673
  justify-content: flex-start;
23672
23674
  flex-wrap: wrap;
23673
-
23674
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23675
- flex-wrap: nowrap;
23676
- }
23677
23675
  `;
23678
23676
 
23679
- const InquestTime = styled.div`
23680
- flex-grow: 0;
23677
+ styled.div`
23678
+ flex-grow: 1;
23681
23679
  flex-shrink: 0;
23680
+
23681
+ strong {
23682
+ display: block;
23683
+ &::first-letter {
23684
+ text-transform: capitalize;
23685
+ }
23686
+ }
23682
23687
  `;
23683
23688
 
23684
23689
  const InquestDetails = styled.div`
23685
23690
  flex-grow: 1;
23691
+ h3 {
23692
+ display: block;
23693
+ &::first-letter {
23694
+ text-transform: capitalize;
23695
+ }
23696
+ }
23697
+ `;
23698
+
23699
+ const SummaryContainer = styled.div`
23700
+ border: ${(props) => (props.$hasHeading ? `1px solid ${props.theme.theme_vars.colours.grey}` : `none`)};
23701
+ margin: ${(props) => (props.$hasMargin ? props.theme.theme_vars.spacingSizes.medium : 0)} 0;
23702
+ `;
23703
+
23704
+ const SummaryHeading = styled.div`
23705
+ background-color: ${(props) => props.theme.theme_vars.colours.grey_light};
23706
+ width: 100%;
23707
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
23708
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.medium};
23709
+
23710
+ h3 {
23711
+ margin: 0;
23712
+ }
23713
+ `;
23714
+
23715
+ const SummaryList$1 = styled.dl`
23716
+ display: table;
23717
+ width: 100%;
23718
+ table-layout: fixed;
23719
+ border-collapse: collapse;
23720
+ `;
23721
+
23722
+ const SummaryRow = styled.div`
23723
+ border-bottom: ${(props) => props.$hasBorders ? `1px solid ${props.theme.theme_vars.colours.grey}` : 'none'};
23724
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
23725
+
23686
23726
  @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23687
- padding-left: ${(props) => props.theme.theme_vars.spacingSizes.small};
23727
+ display: table-row;
23728
+ }
23729
+
23730
+ @media print {
23731
+ display: table-row;
23732
+ border-bottom: none;
23733
+ }
23734
+ `;
23735
+
23736
+ const SummaryTerm = styled.dt`
23737
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
23738
+ font-weight: bold;
23739
+
23740
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23741
+ display: table-cell;
23742
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
23743
+ width: 30%;
23744
+ vertical-align: middle;
23745
+ }
23746
+
23747
+ @media print {
23748
+ display: table-cell;
23749
+ width: 30%;
23688
23750
  }
23689
23751
  `;
23690
23752
 
23753
+ const SummaryDetail = styled.dd`
23754
+ overflow-wrap: break-word;
23755
+ width: 100%;
23756
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
23757
+
23758
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23759
+ display: table-cell;
23760
+ width: 70%;
23761
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
23762
+ }
23763
+
23764
+ @media print {
23765
+ display: table-cell;
23766
+ width: 70%;
23767
+ }
23768
+ `;
23769
+
23770
+ var SummaryList = function (_a) {
23771
+ 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;
23772
+ return (React.createElement(SummaryContainer, { "$hasHeading": heading, "$hasMargin": hasMargin },
23773
+ heading && (React.createElement(SummaryHeading, null,
23774
+ React.createElement(Heading, { level: 3, text: heading }))),
23775
+ React.createElement(SummaryList$1, { "data-testid": "SummaryList" }, terms.map(function (summaryRow, summaryIndex) { return (React.createElement(SummaryRow, { key: summaryIndex, "$hasBorders": hasBorders },
23776
+ React.createElement(SummaryTerm, null, summaryRow.term),
23777
+ React.createElement(SummaryDetail, { dangerouslySetInnerHTML: { __html: sanitizeHtml$1(summaryRow.detail) } }))); }))));
23778
+ };
23779
+
23780
+ /**
23781
+ * Format a date string to a readable date format
23782
+ * @param {string} dateString - The date string to format
23783
+ * @returns {string} Formatted date
23784
+ */
23785
+ const formatDate = (dateString) => {
23786
+ const date = new Date(dateString);
23787
+ return date
23788
+ .toLocaleDateString('en-GB', {
23789
+ weekday: 'long',
23790
+ day: 'numeric',
23791
+ month: 'long',
23792
+ year: 'numeric',
23793
+ })
23794
+ .replace(',', '');
23795
+ };
23796
+
23797
+ /**
23798
+ * Format a date string to a time format
23799
+ * @param {string} dateString - The date string to format
23800
+ * @returns {string} Formatted time
23801
+ */
23802
+ const formatTime = (dateString) => {
23803
+ const date = new Date(dateString);
23804
+ const hours = date.getHours();
23805
+ const minutes = date.getMinutes();
23806
+
23807
+ // Convert to 12-hour format
23808
+ const hour12 = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
23809
+ const ampm = hours < 12 ? 'am' : 'pm';
23810
+
23811
+ // Only show minutes if not zero
23812
+ if (minutes === 0) {
23813
+ return `${hour12}${ampm}`;
23814
+ } else {
23815
+ return `${hour12}:${minutes.toString().padStart(2, '0')}${ampm}`;
23816
+ }
23817
+ };
23818
+
23819
+ /**
23820
+ * Format a date string to a date and time format
23821
+ * @param {string} dateString - The date string to format
23822
+ * @returns {string} Formatted date and time
23823
+ */
23824
+ const formatDateTime = (dateString) => {
23825
+ const date = new Date(dateString);
23826
+ return date.toLocaleDateString('en-GB', {
23827
+ day: 'numeric',
23828
+ month: 'long',
23829
+ year: 'numeric',
23830
+ hour: '2-digit',
23831
+ minute: '2-digit',
23832
+ });
23833
+ };
23834
+
23691
23835
  /**
23692
23836
  * A table displaying a schedule of inquests
23693
23837
  */
@@ -23696,12 +23840,18 @@ var InquestSchedule = function (_a) {
23696
23840
  var hearings = caseAppointments.filter(function (appointment) {
23697
23841
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Hearing);
23698
23842
  });
23843
+ var preInquest = caseAppointments.filter(function (appointment) {
23844
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.PreInquest);
23845
+ });
23699
23846
  var openings = caseAppointments.filter(function (appointment) {
23700
23847
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Opening);
23701
23848
  });
23702
23849
  var writings = caseAppointments.filter(function (appointment) {
23703
23850
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Writing);
23704
23851
  });
23852
+ var formal = caseAppointments.filter(function (appointment) {
23853
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Formal);
23854
+ });
23705
23855
  var groupHearingsByDay = function (appointments) {
23706
23856
  return appointments.reduce(function (acc, inquest) {
23707
23857
  var inquestDate = new Date(inquest.startDateTime);
@@ -23714,62 +23864,52 @@ var InquestSchedule = function (_a) {
23714
23864
  }, {});
23715
23865
  };
23716
23866
  var hearingDayGrouped = groupHearingsByDay(hearings);
23867
+ var preInquestDayGrouped = groupHearingsByDay(preInquest);
23717
23868
  var openingDayGrouped = groupHearingsByDay(openings);
23718
23869
  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
- };
23870
+ var formalDayGrouped = groupHearingsByDay(formal);
23732
23871
  var transformToSections = function (groupedData) {
23733
23872
  return Object.keys(groupedData).map(function (day) {
23734
- var inquestDayDate = new Date(day);
23735
23873
  return {
23736
- title: formatDate(inquestDayDate),
23874
+ title: formatDate(day),
23737
23875
  content: (React.createElement(Row$1, null, groupedData[day]
23738
23876
  .sort(function (a, b) {
23739
23877
  return new Date(a.startDateTime).getTime() - new Date(b.startDateTime).getTime();
23740
23878
  })
23741
23879
  .map(function (inquest, key) {
23742
- var startDateTime = new Date(inquest.startDateTime);
23743
- var timeOfDeath = new Date(inquest.dateTimeOfDeath);
23880
+ var terms = [
23881
+ {
23882
+ term: 'Name',
23883
+ detail: inquest.fullName,
23884
+ },
23885
+ {
23886
+ term: 'Died',
23887
+ detail: formatDate(inquest.dateTimeOfDeath) +
23888
+ ' at ' +
23889
+ inquest.placeOfDeath +
23890
+ '. Aged ' +
23891
+ inquest.age +
23892
+ ' years.',
23893
+ },
23894
+ {
23895
+ term: 'Court location',
23896
+ detail: inquest.courtroomFullAddress + '.',
23897
+ },
23898
+ {
23899
+ term: 'Coroner',
23900
+ detail: inquest.coroner + '.',
23901
+ },
23902
+ ];
23903
+ if (inquest.endDateTime) {
23904
+ terms.push({
23905
+ term: 'End date',
23906
+ detail: formatDateTime(inquest.endDateTime) + '.',
23907
+ });
23908
+ }
23744
23909
  return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: key },
23745
23910
  React.createElement(InquestContainer, null,
23746
- React.createElement(InquestTime, null,
23747
- React.createElement("strong", null, formatTime(startDateTime))),
23748
23911
  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
- "."))));
23912
+ React.createElement(SummaryList, { terms: terms, hasBorders: false, heading: formatTime(inquest.startDateTime) })))));
23773
23913
  }))),
23774
23914
  };
23775
23915
  });
@@ -23781,9 +23921,15 @@ var InquestSchedule = function (_a) {
23781
23921
  Object.keys(openingDayGrouped).length > 0 && (React.createElement(GroupContainer, null,
23782
23922
  React.createElement(Heading, { level: 2, text: "Inquest Openings" }),
23783
23923
  React.createElement(Accordion$1, { sections: transformToSections(openingDayGrouped) }))),
23924
+ Object.keys(preInquestDayGrouped).length > 0 && (React.createElement(GroupContainer, null,
23925
+ React.createElement(Heading, { level: 2, text: "Pre-inquest Review Hearings" }),
23926
+ React.createElement(Accordion$1, { sections: transformToSections(preInquestDayGrouped) }))),
23784
23927
  Object.keys(writingDayGrouped).length > 0 && (React.createElement(GroupContainer, null,
23785
23928
  React.createElement(Heading, { level: 2, text: "Inquests in Writing" }),
23786
23929
  React.createElement(Accordion$1, { sections: transformToSections(writingDayGrouped) }))),
23930
+ Object.keys(formalDayGrouped).length > 0 && (React.createElement(GroupContainer, null,
23931
+ React.createElement(Heading, { level: 2, text: "Formal Suspension Hearings" }),
23932
+ React.createElement(Accordion$1, { sections: transformToSections(formalDayGrouped) }))),
23787
23933
  caseAppointments.length === 0 && (React.createElement("div", null,
23788
23934
  React.createElement("p", null, "We can't find any results at the moment."),
23789
23935
  error ? (React.createElement("p", null, " The information is currently unavailable.")) : (React.createElement("p", null, "There are no inquests scheduled for next month."))))));
@@ -24158,6 +24304,10 @@ var Input = function (_a) {
24158
24304
  var RoadworksList = function (_a) {
24159
24305
  var roadworks = _a.roadworks, title = _a.title;
24160
24306
  var _b = useState(roadworks), filteredRoadworks = _b[0], setFilteredRoadworks = _b[1];
24307
+ // Helper function to remove trailing dot if it's the last character
24308
+ var removeTrailingDot = function (text) {
24309
+ return (text === null || text === void 0 ? void 0 : text.endsWith('.')) ? text.slice(0, -1) : text;
24310
+ };
24161
24311
  var handleSearch = function (e) {
24162
24312
  var searchTerm = e.target.value.toLowerCase();
24163
24313
  if (searchTerm != '') {
@@ -24219,7 +24369,7 @@ var RoadworksList = function (_a) {
24219
24369
  React.createElement(IconContainer$2, null,
24220
24370
  React.createElement(DynamicIcon, { icon: "mappin" }),
24221
24371
  React.createElement(IconText, null,
24222
- React.createElement(Heading, { text: roadwork.detailedLocation, level: 3 }))),
24372
+ React.createElement(Heading, { text: removeTrailingDot(roadwork.detailedLocation), level: 3 }))),
24223
24373
  React.createElement(IconContainer$2, null,
24224
24374
  React.createElement(DynamicIcon, { icon: "events" }),
24225
24375
  React.createElement(IconText, null,
@@ -24227,11 +24377,11 @@ var RoadworksList = function (_a) {
24227
24377
  React.createElement(IconContainer$2, null,
24228
24378
  React.createElement(DynamicIcon, { icon: "roadworks" }),
24229
24379
  React.createElement(IconText, null,
24230
- React.createElement("span", null, roadwork.description))),
24380
+ React.createElement("span", null, removeTrailingDot(roadwork.description)))),
24231
24381
  React.createElement(IconContainer$2, null,
24232
24382
  React.createElement(DynamicIcon, { icon: "bollard" }),
24233
24383
  React.createElement(IconText, null,
24234
- React.createElement("span", null, roadwork.trafficManagement)))));
24384
+ React.createElement("span", null, removeTrailingDot(roadwork.trafficManagement))))));
24235
24385
  })),
24236
24386
  roadworks.length > 0 && filteredRoadworks.length === 0 && (React.createElement(NoMatches, null, "We couldn't find any results for your search term. Please try a different search.")),
24237
24387
  roadworks.length == 0 && (React.createElement(NoMatches, null, "Sorry, we're not able to find any results at the moment. Please try again later."))));
@@ -28226,9 +28376,9 @@ const focusListItem = css`
28226
28376
  color: ${(props) => props.theme.theme_vars.colours.black};
28227
28377
  background-color: ${(props) => props.theme.theme_vars.colours.focus};
28228
28378
  outline: none;
28229
- box-shadow: 0px -2px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
28230
- -webkit-box-shadow: 0px -2px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
28231
- -moz-box-shadow: 0px -2px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
28379
+ box-shadow: 0 0 0 2px ${(props) => props.theme.theme_vars.colours.focus}, 0 0 0 4px ${(props) => props.theme.theme_vars.colours.black};
28380
+ -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};
28381
+ -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};
28232
28382
  `;
28233
28383
 
28234
28384
  const ListItem = styled.li`
@@ -30468,69 +30618,6 @@ var ServiceContact = function (_a) {
30468
30618
  contact.phones.map(function (phone, phoneIndex) { return (React.createElement(ContactLink, { href: "tel:".concat(phone.number), key: phoneIndex }, phone.number)); }))); })))))));
30469
30619
  };
30470
30620
 
30471
- const SummaryList$1 = styled.dl`
30472
- display: table;
30473
- width: 100%;
30474
- table-layout: fixed;
30475
- border-collapse: collapse;
30476
- margin: ${(props) => (props.$hasMargin ? props.theme.theme_vars.spacingSizes.medium : 0)} 0;
30477
- `;
30478
-
30479
- const SummaryRow = styled.div`
30480
- border-bottom: 1px solid ${(props) => props.theme.theme_vars.colours.grey};
30481
- margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
30482
-
30483
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
30484
- display: table-row;
30485
- }
30486
-
30487
- @media print {
30488
- display: table-row;
30489
- border-bottom: none;
30490
- }
30491
- `;
30492
-
30493
- const SummaryTerm = styled.dt`
30494
- margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
30495
- font-weight: bold;
30496
-
30497
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
30498
- display: table-cell;
30499
- padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
30500
- width: 30%;
30501
- vertical-align: middle;
30502
- }
30503
-
30504
- @media print {
30505
- display: table-cell;
30506
- width: 30%;
30507
- }
30508
- `;
30509
-
30510
- const SummaryDetail = styled.dd`
30511
- overflow-wrap: break-word;
30512
- width: 100%;
30513
- margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
30514
-
30515
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
30516
- display: table-cell;
30517
- width: 70%;
30518
- padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
30519
- }
30520
-
30521
- @media print {
30522
- display: table-cell;
30523
- width: 70%;
30524
- }
30525
- `;
30526
-
30527
- var SummaryList = function (_a) {
30528
- var terms = _a.terms, _b = _a.hasMargin, hasMargin = _b === void 0 ? true : _b;
30529
- return (React.createElement(SummaryList$1, { "data-testid": "SummaryList", "$hasMargin": hasMargin }, terms.map(function (summaryRow, summaryIndex) { return (React.createElement(SummaryRow, { key: summaryIndex },
30530
- React.createElement(SummaryTerm, null, summaryRow.term),
30531
- React.createElement(SummaryDetail, { dangerouslySetInnerHTML: { __html: sanitizeHtml$1(summaryRow.detail) } }))); })));
30532
- };
30533
-
30534
30621
  /**
30535
30622
  * Group an array of items by the key
30536
30623
  */