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

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,158 @@ 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;
23701
23746
  }
23702
23747
  `;
23703
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%;
23763
+ }
23764
+ `;
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
+ return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
23818
+ };
23819
+
23820
+ /**
23821
+ * Format a date string to a date and time format
23822
+ * @param {string} dateString - The date string to format
23823
+ * @returns {string} Formatted date and time
23824
+ */
23825
+ const formatDateTime = (dateString) => {
23826
+ const date = new Date(dateString);
23827
+ return date.toLocaleDateString('en-GB', {
23828
+ day: 'numeric',
23829
+ month: 'long',
23830
+ year: 'numeric',
23831
+ hour: '2-digit',
23832
+ minute: '2-digit',
23833
+ });
23834
+ };
23835
+
23704
23836
  /**
23705
23837
  * A table displaying a schedule of inquests
23706
23838
  */
@@ -23709,12 +23841,18 @@ var InquestSchedule = function (_a) {
23709
23841
  var hearings = caseAppointments.filter(function (appointment) {
23710
23842
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Hearing);
23711
23843
  });
23844
+ var preInquest = caseAppointments.filter(function (appointment) {
23845
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.PreInquest);
23846
+ });
23712
23847
  var openings = caseAppointments.filter(function (appointment) {
23713
23848
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Opening);
23714
23849
  });
23715
23850
  var writings = caseAppointments.filter(function (appointment) {
23716
23851
  return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Writing);
23717
23852
  });
23853
+ var formal = caseAppointments.filter(function (appointment) {
23854
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Formal);
23855
+ });
23718
23856
  var groupHearingsByDay = function (appointments) {
23719
23857
  return appointments.reduce(function (acc, inquest) {
23720
23858
  var inquestDate = new Date(inquest.startDateTime);
@@ -23727,62 +23865,52 @@ var InquestSchedule = function (_a) {
23727
23865
  }, {});
23728
23866
  };
23729
23867
  var hearingDayGrouped = groupHearingsByDay(hearings);
23868
+ var preInquestDayGrouped = groupHearingsByDay(preInquest);
23730
23869
  var openingDayGrouped = groupHearingsByDay(openings);
23731
23870
  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
- };
23871
+ var formalDayGrouped = groupHearingsByDay(formal);
23745
23872
  var transformToSections = function (groupedData) {
23746
23873
  return Object.keys(groupedData).map(function (day) {
23747
- var inquestDayDate = new Date(day);
23748
23874
  return {
23749
- title: formatDate(inquestDayDate),
23875
+ title: formatDate(day),
23750
23876
  content: (React__default.default.createElement(Row$1, null, groupedData[day]
23751
23877
  .sort(function (a, b) {
23752
23878
  return new Date(a.startDateTime).getTime() - new Date(b.startDateTime).getTime();
23753
23879
  })
23754
23880
  .map(function (inquest, key) {
23755
- var startDateTime = new Date(inquest.startDateTime);
23756
- var timeOfDeath = new Date(inquest.dateTimeOfDeath);
23881
+ var terms = [
23882
+ {
23883
+ term: 'Name',
23884
+ detail: inquest.fullName,
23885
+ },
23886
+ {
23887
+ term: 'Died',
23888
+ detail: formatDate(inquest.dateTimeOfDeath) +
23889
+ ' at ' +
23890
+ inquest.placeOfDeath +
23891
+ '. Aged ' +
23892
+ inquest.age +
23893
+ ' years.',
23894
+ },
23895
+ {
23896
+ term: 'Court location',
23897
+ detail: inquest.courtroomFullAddress + '.',
23898
+ },
23899
+ {
23900
+ term: 'Coroner',
23901
+ detail: inquest.coroner + '.',
23902
+ },
23903
+ ];
23904
+ if (inquest.endDateTime) {
23905
+ terms.push({
23906
+ term: 'End date',
23907
+ detail: formatDateTime(inquest.endDateTime) + '.',
23908
+ });
23909
+ }
23757
23910
  return (React__default.default.createElement(Column, { small: "full", medium: "full", large: "full", key: key },
23758
23911
  React__default.default.createElement(InquestContainer, null,
23759
- React__default.default.createElement(InquestTime, null,
23760
- React__default.default.createElement("strong", null, formatTime(startDateTime))),
23761
23912
  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
- "."))));
23913
+ React__default.default.createElement(SummaryList, { terms: terms, hasBorders: false, heading: formatTime(inquest.startDateTime) })))));
23786
23914
  }))),
23787
23915
  };
23788
23916
  });
@@ -23794,9 +23922,15 @@ var InquestSchedule = function (_a) {
23794
23922
  Object.keys(openingDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23795
23923
  React__default.default.createElement(Heading, { level: 2, text: "Inquest Openings" }),
23796
23924
  React__default.default.createElement(Accordion$1, { sections: transformToSections(openingDayGrouped) }))),
23925
+ Object.keys(preInquestDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23926
+ React__default.default.createElement(Heading, { level: 2, text: "Pre-inquest Review Hearings" }),
23927
+ React__default.default.createElement(Accordion$1, { sections: transformToSections(preInquestDayGrouped) }))),
23797
23928
  Object.keys(writingDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23798
23929
  React__default.default.createElement(Heading, { level: 2, text: "Inquests in Writing" }),
23799
23930
  React__default.default.createElement(Accordion$1, { sections: transformToSections(writingDayGrouped) }))),
23931
+ Object.keys(formalDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23932
+ React__default.default.createElement(Heading, { level: 2, text: "Formal Suspension Hearings" }),
23933
+ React__default.default.createElement(Accordion$1, { sections: transformToSections(formalDayGrouped) }))),
23800
23934
  caseAppointments.length === 0 && (React__default.default.createElement("div", null,
23801
23935
  React__default.default.createElement("p", null, "We can't find any results at the moment."),
23802
23936
  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."))))));
@@ -28239,9 +28373,9 @@ const focusListItem = styled.css`
28239
28373
  color: ${(props) => props.theme.theme_vars.colours.black};
28240
28374
  background-color: ${(props) => props.theme.theme_vars.colours.focus};
28241
28375
  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;
28376
+ box-shadow: 0 0 0 2px ${(props) => props.theme.theme_vars.colours.focus}, 0 0 0 4px ${(props) => props.theme.theme_vars.colours.black};
28377
+ -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};
28378
+ -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
28379
  `;
28246
28380
 
28247
28381
  const ListItem = styled__default.default.li`
@@ -30481,69 +30615,6 @@ var ServiceContact = function (_a) {
30481
30615
  contact.phones.map(function (phone, phoneIndex) { return (React__default.default.createElement(ContactLink, { href: "tel:".concat(phone.number), key: phoneIndex }, phone.number)); }))); })))))));
30482
30616
  };
30483
30617
 
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
30618
  /**
30548
30619
  * Group an array of items by the key
30549
30620
  */