@nnc-digital/nnc-design-system 1.0.0-alpha58 → 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.
package/build/index.d.ts CHANGED
@@ -1,42 +1,42 @@
1
- import Autocomplete from './library/components/Autocomplete/Autocomplete';
2
- import BackToTop from './library/components/BackToTop/BackToTop';
3
- import Button from './library/components/Button/Button';
4
- import BinCollection from './library/components/BinCollection/BinCollection';
5
- import DynamicIcon from './library/components/DynamicIcon/DynamicIcon';
6
- import Heading from './library/components/Heading/Heading';
7
- import HeadingWithIcon from './library/components/HeadingWithIcon/HeadingWithIcon';
8
- import Map from './library/components/Map/Map';
9
- import MapMarker from './library/components/MapMarker/MapMarker';
10
- import Pagination from './library/components/Pagination/Pagination';
11
- import CheckboxListFilter from './library/components/CheckboxListFilter/CheckboxListFilter';
12
- import DropDownFilter from './library/components/DropDownFilter/DropDownFilter';
13
- import PromotedLinks from './library/components/PromotedLinks/PromotedLinks';
14
- import StaticMap from './library/components/StaticMap/StaticMap';
15
- import TextInput from './library/components/TextInput/TextInput';
16
- export { Autocomplete, BackToTop, Button, BinCollection, DynamicIcon, Heading, HeadingWithIcon, Map, MapMarker, Pagination, CheckboxListFilter, DropDownFilter, PromotedLinks, StaticMap, TextInput, };
17
- import Accordion from './library/slices/Accordion/Accordion';
18
- import BlockQuote from './library/slices/BlockQuote/BlockQuote';
19
- import CallToAction from './library/slices/CallToAction/CallToAction';
20
- import CouncilTaxAlphabeticalDirectory from './library/slices/CouncilTaxAlphabeticalDirectory/CouncilTaxAlphabeticalDirectory';
21
- import Cards from './library/slices/Cards/Cards';
22
- import DownloadableFiles from './library/slices/DownloadableFiles/DownloadableFiles';
23
- import Divider from './library/slices/Divider/Divider';
24
- import GoogleMap from './library/slices/GoogleMap/GoogleMap';
25
- import Image from './library/slices/Image/Image';
26
- import ImageAndText from './library/slices/ImageAndText/ImageAndText';
27
- import InquestSchedule from './library/slices/InquestSchedule/InquestSchedule';
28
- import Promotions from './library/slices/Promotions/Promotions';
29
- import SearchBox from './library/slices/SearchBox/SearchBox';
30
- import Video from './library/slices/Video/Video';
31
- import WarningText from './library/slices/WarningText/WarningText';
32
- import WarningTextDisclaimer from './library/slices/WarningTextDisclaimer/WarningTextDisclaimer';
33
- export { Accordion, BlockQuote, CallToAction, Cards, CouncilTaxAlphabeticalDirectory, Divider, DownloadableFiles, GoogleMap, Image, ImageAndText, InquestSchedule, Promotions, SearchBox, Video, WarningText, WarningTextDisclaimer, };
34
- export * from './library/structure/PageStructures';
35
- export { GDS_theme, north_theme, west_theme, lb_theme_north, lb_theme_west } from './themes/theme_generator';
36
- export { GlobalStyleReset } from './themes/GlobalStyleReset.jsx';
37
- import DirectoryService from './library/directory/DirectoryService/DirectoryService';
38
- import DirectoryServiceList from './library/directory/DirectoryServiceList/DirectoryServiceList';
39
- import DirectoryShortList from './library/directory/DirectoryShortList/DirectoryShortList';
40
- import { DirectoryShortListProvider, useDirectoryShortListContext } from './library/contexts/DirectoryShortListProvider/DirectoryShortListProvider';
41
- import DirectoryDocumentList from './library/directory/DirectoryDocumentList/DirectoryDocumentList';
42
- export { DirectoryService, DirectoryServiceList, DirectoryShortList, DirectoryShortListProvider, useDirectoryShortListContext, DirectoryDocumentList, };
1
+ import Autocomplete from './library/components/Autocomplete/Autocomplete';
2
+ import BackToTop from './library/components/BackToTop/BackToTop';
3
+ import Button from './library/components/Button/Button';
4
+ import BinCollection from './library/components/BinCollection/BinCollection';
5
+ import DynamicIcon from './library/components/DynamicIcon/DynamicIcon';
6
+ import Heading from './library/components/Heading/Heading';
7
+ import HeadingWithIcon from './library/components/HeadingWithIcon/HeadingWithIcon';
8
+ import Map from './library/components/Map/Map';
9
+ import MapMarker from './library/components/MapMarker/MapMarker';
10
+ import Pagination from './library/components/Pagination/Pagination';
11
+ import CheckboxListFilter from './library/components/CheckboxListFilter/CheckboxListFilter';
12
+ import DropDownFilter from './library/components/DropDownFilter/DropDownFilter';
13
+ import PromotedLinks from './library/components/PromotedLinks/PromotedLinks';
14
+ import StaticMap from './library/components/StaticMap/StaticMap';
15
+ import TextInput from './library/components/TextInput/TextInput';
16
+ export { Autocomplete, BackToTop, Button, BinCollection, DynamicIcon, Heading, HeadingWithIcon, Map, MapMarker, Pagination, CheckboxListFilter, DropDownFilter, PromotedLinks, StaticMap, TextInput, };
17
+ import Accordion from './library/slices/Accordion/Accordion';
18
+ import BlockQuote from './library/slices/BlockQuote/BlockQuote';
19
+ import CallToAction from './library/slices/CallToAction/CallToAction';
20
+ import CouncilTaxAlphabeticalDirectory from './library/slices/CouncilTaxAlphabeticalDirectory/CouncilTaxAlphabeticalDirectory';
21
+ import Cards from './library/slices/Cards/Cards';
22
+ import DownloadableFiles from './library/slices/DownloadableFiles/DownloadableFiles';
23
+ import Divider from './library/slices/Divider/Divider';
24
+ import GoogleMap from './library/slices/GoogleMap/GoogleMap';
25
+ import Image from './library/slices/Image/Image';
26
+ import ImageAndText from './library/slices/ImageAndText/ImageAndText';
27
+ import InquestSchedule from './library/slices/InquestSchedule/InquestSchedule';
28
+ import Promotions from './library/slices/Promotions/Promotions';
29
+ import SearchBox from './library/slices/SearchBox/SearchBox';
30
+ import Video from './library/slices/Video/Video';
31
+ import WarningText from './library/slices/WarningText/WarningText';
32
+ import WarningTextDisclaimer from './library/slices/WarningTextDisclaimer/WarningTextDisclaimer';
33
+ export { Accordion, BlockQuote, CallToAction, Cards, CouncilTaxAlphabeticalDirectory, Divider, DownloadableFiles, GoogleMap, Image, ImageAndText, InquestSchedule, Promotions, SearchBox, Video, WarningText, WarningTextDisclaimer, };
34
+ export * from './library/structure/PageStructures';
35
+ export { GDS_theme, north_theme, west_theme, lb_theme_north, lb_theme_west } from './themes/theme_generator';
36
+ export { GlobalStyleReset } from './themes/GlobalStyleReset.jsx';
37
+ import DirectoryService from './library/directory/DirectoryService/DirectoryService';
38
+ import DirectoryServiceList from './library/directory/DirectoryServiceList/DirectoryServiceList';
39
+ import DirectoryShortList from './library/directory/DirectoryShortList/DirectoryShortList';
40
+ import { DirectoryShortListProvider, useDirectoryShortListContext } from './library/contexts/DirectoryShortListProvider/DirectoryShortListProvider';
41
+ import DirectoryDocumentList from './library/directory/DirectoryDocumentList/DirectoryDocumentList';
42
+ export { DirectoryService, DirectoryServiceList, DirectoryShortList, DirectoryShortListProvider, useDirectoryShortListContext, DirectoryDocumentList, };
package/build/index.js CHANGED
@@ -23659,8 +23659,46 @@ var ImageAndText = function (_a) {
23659
23659
  React__default.default.createElement(Content$5, { dangerouslySetInnerHTML: { __html: sanitizeHtml$1(textContent) } }))))));
23660
23660
  };
23661
23661
 
23662
+ var CaseAppointmentType;
23663
+ (function (CaseAppointmentType) {
23664
+ CaseAppointmentType["Hearing"] = "hearing";
23665
+ CaseAppointmentType["Opening"] = "opening";
23666
+ CaseAppointmentType["Writing"] = "writing";
23667
+ })(CaseAppointmentType || (CaseAppointmentType = {}));
23668
+
23662
23669
  const Container$I = styled__default.default.div`
23663
23670
  display: block;
23671
+ box-sizing: border-box;
23672
+ `;
23673
+
23674
+ const GroupContainer = styled__default.default.div`
23675
+ display: flex;
23676
+ flex-direction: column;
23677
+ margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.large};
23678
+ `;
23679
+
23680
+ const InquestContainer = styled__default.default.div`
23681
+ display: flex;
23682
+ flex-direction: row;
23683
+ align-items: flex-start;
23684
+ justify-content: flex-start;
23685
+ flex-wrap: wrap;
23686
+
23687
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23688
+ flex-wrap: nowrap;
23689
+ }
23690
+ `;
23691
+
23692
+ const InquestTime = styled__default.default.div`
23693
+ flex-grow: 0;
23694
+ flex-shrink: 0;
23695
+ `;
23696
+
23697
+ const InquestDetails = styled__default.default.div`
23698
+ flex-grow: 1;
23699
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.m}) {
23700
+ padding-left: ${(props) => props.theme.theme_vars.spacingSizes.small};
23701
+ }
23664
23702
  `;
23665
23703
 
23666
23704
  /**
@@ -23668,32 +23706,100 @@ const Container$I = styled__default.default.div`
23668
23706
  */
23669
23707
  var InquestSchedule = function (_a) {
23670
23708
  var caseAppointments = _a.caseAppointments, title = _a.title, _b = _a.error, error = _b === void 0 ? false : _b;
23709
+ var hearings = caseAppointments.filter(function (appointment) {
23710
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Hearing);
23711
+ });
23712
+ var openings = caseAppointments.filter(function (appointment) {
23713
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Opening);
23714
+ });
23715
+ var writings = caseAppointments.filter(function (appointment) {
23716
+ return appointment.appointmentType.toLowerCase().includes(CaseAppointmentType.Writing);
23717
+ });
23718
+ var groupHearingsByDay = function (appointments) {
23719
+ return appointments.reduce(function (acc, inquest) {
23720
+ var inquestDate = new Date(inquest.startDateTime);
23721
+ var inquestISODay = inquestDate.toISOString().substring(0, 10);
23722
+ if (!acc[inquestISODay]) {
23723
+ acc[inquestISODay] = [];
23724
+ }
23725
+ acc[inquestISODay].push(inquest);
23726
+ return acc;
23727
+ }, {});
23728
+ };
23729
+ var hearingDayGrouped = groupHearingsByDay(hearings);
23730
+ var openingDayGrouped = groupHearingsByDay(openings);
23731
+ 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
+ };
23745
+ var transformToSections = function (groupedData) {
23746
+ return Object.keys(groupedData).map(function (day) {
23747
+ var inquestDayDate = new Date(day);
23748
+ return {
23749
+ title: formatDate(inquestDayDate),
23750
+ content: (React__default.default.createElement(Row$1, null, groupedData[day]
23751
+ .sort(function (a, b) {
23752
+ return new Date(a.startDateTime).getTime() - new Date(b.startDateTime).getTime();
23753
+ })
23754
+ .map(function (inquest, key) {
23755
+ var startDateTime = new Date(inquest.startDateTime);
23756
+ var timeOfDeath = new Date(inquest.dateTimeOfDeath);
23757
+ return (React__default.default.createElement(Column, { small: "full", medium: "full", large: "full", key: key },
23758
+ React__default.default.createElement(InquestContainer, null,
23759
+ React__default.default.createElement(InquestTime, null,
23760
+ React__default.default.createElement("strong", null, formatTime(startDateTime))),
23761
+ 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
+ "."))));
23786
+ }))),
23787
+ };
23788
+ });
23789
+ };
23671
23790
  return (React__default.default.createElement(Container$I, { "data-testid": "InquestSchedule" },
23672
- React__default.default.createElement("div", { className: "table-container" },
23673
- React__default.default.createElement("table", null,
23674
- React__default.default.createElement("caption", null, title),
23675
- React__default.default.createElement("thead", null,
23676
- React__default.default.createElement("tr", null,
23677
- React__default.default.createElement("th", { scope: "col" }, "Name"),
23678
- React__default.default.createElement("th", { scope: "col" }, "Age"),
23679
- React__default.default.createElement("th", { scope: "col" }, "Place of death"),
23680
- React__default.default.createElement("th", { scope: "col" }, "Date of death"),
23681
- React__default.default.createElement("th", { scope: "col" }, "Name of coroner"),
23682
- React__default.default.createElement("th", { scope: "col" }, "Location"),
23683
- React__default.default.createElement("th", { scope: "col" }, "Date and time"))),
23684
- React__default.default.createElement("tbody", null,
23685
- caseAppointments.map(function (item, index) { return (React__default.default.createElement("tr", { key: index },
23686
- React__default.default.createElement("td", null, item.fullName),
23687
- React__default.default.createElement("td", null, item.age),
23688
- React__default.default.createElement("td", null, item.placeOfDeath),
23689
- React__default.default.createElement("td", null, new Date(item.dateTimeOfDeath).toLocaleString('en-GB')),
23690
- React__default.default.createElement("td", null, item.coroner),
23691
- React__default.default.createElement("td", null, item.courtroomFullAddress),
23692
- React__default.default.createElement("td", null, new Date(item.startDateTime).toLocaleString('en-GB')))); }),
23693
- caseAppointments.length === 0 && (React__default.default.createElement("tr", null,
23694
- React__default.default.createElement("td", { colSpan: 7 },
23695
- React__default.default.createElement("p", null, "We can't find any results at the moment."),
23696
- 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."))))))))));
23791
+ Object.keys(hearingDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23792
+ React__default.default.createElement(Heading, { level: 2, text: title }),
23793
+ React__default.default.createElement(Accordion$1, { sections: transformToSections(hearingDayGrouped) }))),
23794
+ Object.keys(openingDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23795
+ React__default.default.createElement(Heading, { level: 2, text: "Inquest Openings" }),
23796
+ React__default.default.createElement(Accordion$1, { sections: transformToSections(openingDayGrouped) }))),
23797
+ Object.keys(writingDayGrouped).length > 0 && (React__default.default.createElement(GroupContainer, null,
23798
+ React__default.default.createElement(Heading, { level: 2, text: "Inquests in Writing" }),
23799
+ React__default.default.createElement(Accordion$1, { sections: transformToSections(writingDayGrouped) }))),
23800
+ caseAppointments.length === 0 && (React__default.default.createElement("div", null,
23801
+ React__default.default.createElement("p", null, "We can't find any results at the moment."),
23802
+ 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."))))));
23697
23803
  };
23698
23804
 
23699
23805
  const Container$H = styled__default.default.div`