@ltht-react/timeline 2.0.62 → 2.0.64

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.
Files changed (50) hide show
  1. package/README.md +19 -19
  2. package/lib/atoms/time-element.d.ts +11 -0
  3. package/lib/atoms/time-element.js +50 -0
  4. package/lib/atoms/time-element.js.map +1 -0
  5. package/lib/atoms/timeline-author.d.ts +8 -0
  6. package/lib/atoms/timeline-author.js +88 -0
  7. package/lib/atoms/timeline-author.js.map +1 -0
  8. package/lib/atoms/timeline-button.d.ts +7 -0
  9. package/lib/atoms/timeline-button.js +26 -0
  10. package/lib/atoms/timeline-button.js.map +1 -0
  11. package/lib/atoms/timeline-description.d.ts +8 -0
  12. package/lib/atoms/timeline-description.js +67 -0
  13. package/lib/atoms/timeline-description.js.map +1 -0
  14. package/lib/atoms/timeline-time.d.ts +11 -0
  15. package/lib/atoms/timeline-time.js +66 -0
  16. package/lib/atoms/timeline-time.js.map +1 -0
  17. package/lib/atoms/timeline-title-redacted.d.ts +3 -0
  18. package/lib/atoms/timeline-title-redacted.js +28 -0
  19. package/lib/atoms/timeline-title-redacted.js.map +1 -0
  20. package/lib/atoms/timeline-title.d.ts +8 -0
  21. package/lib/atoms/timeline-title.js +55 -0
  22. package/lib/atoms/timeline-title.js.map +1 -0
  23. package/lib/constants.d.ts +2 -0
  24. package/lib/constants.js +5 -0
  25. package/lib/constants.js.map +1 -0
  26. package/lib/index.d.ts +5 -0
  27. package/lib/index.js +11 -0
  28. package/lib/index.js.map +1 -0
  29. package/lib/molecules/timeline-item-redacted.d.ts +3 -0
  30. package/lib/molecules/timeline-item-redacted.js +32 -0
  31. package/lib/molecules/timeline-item-redacted.js.map +1 -0
  32. package/lib/molecules/timeline-item.d.ts +16 -0
  33. package/lib/molecules/timeline-item.js +49 -0
  34. package/lib/molecules/timeline-item.js.map +1 -0
  35. package/lib/organisms/timeline.d.ts +19 -0
  36. package/lib/organisms/timeline.js +207 -0
  37. package/lib/organisms/timeline.js.map +1 -0
  38. package/package.json +10 -10
  39. package/src/atoms/time-element.tsx +52 -52
  40. package/src/atoms/timeline-author.tsx +88 -88
  41. package/src/atoms/timeline-button.tsx +44 -44
  42. package/src/atoms/timeline-description.tsx +52 -52
  43. package/src/atoms/timeline-time.tsx +69 -69
  44. package/src/atoms/timeline-title-redacted.tsx +13 -13
  45. package/src/atoms/timeline-title.tsx +41 -41
  46. package/src/constants.ts +3 -3
  47. package/src/index.tsx +6 -6
  48. package/src/molecules/timeline-item-redacted.tsx +47 -47
  49. package/src/molecules/timeline-item.tsx +130 -130
  50. package/src/organisms/timeline.tsx +419 -419
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+ import { AuditEvent, DocumentReference, Maybe, QuestionnaireResponse, TimelineDomainResourceType } from '@ltht-react/types';
3
+ declare const TimelineItem: FC<IProps>;
4
+ interface IProps {
5
+ timelineItem: Maybe<ITimelineItem>;
6
+ domainResourceType: TimelineDomainResourceType;
7
+ }
8
+ export interface ITimelineItem {
9
+ domainResource?: Maybe<AuditEvent | QuestionnaireResponse | DocumentReference>;
10
+ buttonState: TimeLineItemButtonState;
11
+ itemClickHandler?(): void;
12
+ pointInTimeClickHandler?: (date: Date) => void;
13
+ buttonText?: string;
14
+ }
15
+ type TimeLineItemButtonState = 'no-button' | 'selectable-button' | 'selected-button' | 'permission-denied-button';
16
+ export default TimelineItem;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ var jsx_runtime_1 = require("react/jsx-runtime");
11
+ var styled_1 = __importDefault(require("@emotion/styled"));
12
+ var styles_1 = require("@ltht-react/styles");
13
+ var hooks_1 = require("@ltht-react/hooks");
14
+ var utils_1 = require("@ltht-react/utils");
15
+ var timeline_description_1 = __importDefault(require("../atoms/timeline-description"));
16
+ var timeline_author_1 = __importDefault(require("../atoms/timeline-author"));
17
+ var timeline_title_1 = __importDefault(require("../atoms/timeline-title"));
18
+ var timeline_time_1 = __importDefault(require("../atoms/timeline-time"));
19
+ var timeline_button_1 = __importDefault(require("../atoms/timeline-button"));
20
+ var StyledTimelineItem = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n padding-top: 0.5rem;\n"], ["\n background-color: ", ";\n padding-top: 0.5rem;\n"])), function (_a) {
21
+ var isSelected = _a.isSelected;
22
+ return (isSelected ? styles_1.HIGHLIGHT_GREEN.VALUE : styles_1.TRANSLUCENT_DARK_BLUE);
23
+ });
24
+ var StyledTimelineAuthor = (0, styled_1.default)(timeline_author_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n flex-grow: 1;\n margin-bottom: 0.5rem;\n"], ["\n flex-grow: 1;\n margin-bottom: 0.5rem;\n"])));
25
+ var StyledTimelineTime = (0, styled_1.default)(timeline_time_1.default)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: black;\n"], ["\n color: black;\n"])));
26
+ var StyledTimelineItemTop = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n color: black;\n padding-bottom: 0.25rem;\n margin: 0.5rem;\n"], ["\n display: flex;\n color: black;\n padding-bottom: 0.25rem;\n margin: 0.5rem;\n"])));
27
+ var StyledTimelineItemMiddle = styled_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: black;\n padding-bottom: 1rem;\n margin: 0.5rem;\n"], ["\n color: black;\n padding-bottom: 1rem;\n margin: 0.5rem;\n"])));
28
+ var StyledTimelineItemBottom = styled_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: grey;\n display: flex;\n margin: 0.5rem;\n"], ["\n color: grey;\n display: flex;\n margin: 0.5rem;\n"])));
29
+ var StyledTimelineTitle = (0, styled_1.default)(timeline_title_1.default, {
30
+ shouldForwardProp: function (prop) { return prop !== 'isMobile'; },
31
+ })(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n flex-grow: 1;\n color: black;\n font-size: ", ";\n font-weight: bold;\n"], ["\n flex-grow: 1;\n color: black;\n font-size: ", ";\n font-weight: bold;\n"])), function (_a) {
32
+ var isMobile = _a.isMobile;
33
+ return (isMobile ? 'medium' : 'large');
34
+ });
35
+ var StyledTimelineDescription = (0, styled_1.default)(timeline_description_1.default)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n color: black;\n font-size: small;\n"], ["\n color: black;\n font-size: small;\n"])));
36
+ var TimelineItem = function (_a) {
37
+ var timelineItem = _a.timelineItem, domainResourceType = _a.domainResourceType;
38
+ var width = (0, hooks_1.useWindowSize)().width;
39
+ var isMobile = (0, utils_1.isMobileView)(width);
40
+ if (!(timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource)) {
41
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
42
+ }
43
+ var domainResource = timelineItem.domainResource, buttonState = timelineItem.buttonState;
44
+ var itemKey = "timelineItem_".concat(domainResource.id);
45
+ return ((0, jsx_runtime_1.jsxs)(StyledTimelineItem, { isSelected: buttonState === 'selected-button', children: [(0, jsx_runtime_1.jsxs)(StyledTimelineItemTop, { children: [(0, jsx_runtime_1.jsx)(StyledTimelineTitle, { isMobile: isMobile, domainResource: domainResource, domainResourceType: domainResourceType }), isMobile && ((0, jsx_runtime_1.jsx)(StyledTimelineTime, { domainResource: timelineItem.domainResource, domainResourceType: domainResourceType }))] }), (0, jsx_runtime_1.jsx)(StyledTimelineItemMiddle, { children: (0, jsx_runtime_1.jsx)(StyledTimelineDescription, { domainResource: timelineItem.domainResource, domainResourceType: domainResourceType }) }), (0, jsx_runtime_1.jsx)(StyledTimelineItemBottom, { children: (0, jsx_runtime_1.jsx)(StyledTimelineAuthor, { domainResource: timelineItem.domainResource, domainResourceType: domainResourceType }) }), (0, jsx_runtime_1.jsx)(timeline_button_1.default, { timelineItem: timelineItem })] }, itemKey));
46
+ };
47
+ exports.default = TimelineItem;
48
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
49
+ //# sourceMappingURL=timeline-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-item.js","sourceRoot":"","sources":["../../src/molecules/timeline-item.tsx"],"names":[],"mappings":";;;;;;;;;;AACA,2DAAoC;AACpC,6CAA2E;AAQ3E,2CAAiD;AACjD,2CAAgD;AAChD,uFAA+D;AAC/D,6EAAqD;AACrD,2EAAmD;AACnD,yEAAiD;AACjD,6EAAqD;AAErD,IAAM,kBAAkB,GAAG,gBAAM,CAAC,GAAG,0HAAqB,wBACpC,EAAgF,6BAErG,KAFqB,UAAC,EAAc;QAAZ,UAAU,gBAAA;IAAO,OAAA,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAe,CAAC,KAAK,CAAC,CAAC,CAAC,8BAAqB,CAAC;AAA5D,CAA4D,CAErG,CAAA;AAED,IAAM,oBAAoB,GAAG,IAAA,gBAAM,EAAC,yBAAc,CAAC,kHAAA,+CAGlD,IAAA,CAAA;AAED,IAAM,kBAAkB,GAAG,IAAA,gBAAM,EAAC,uBAAY,CAAC,wFAAA,qBAE9C,IAAA,CAAA;AAED,IAAM,qBAAqB,GAAG,gBAAM,CAAC,GAAG,yJAAA,sFAKvC,IAAA,CAAA;AAED,IAAM,wBAAwB,GAAG,gBAAM,CAAC,GAAG,oIAAA,iEAI1C,IAAA,CAAA;AAED,IAAM,wBAAwB,GAAG,gBAAM,CAAC,GAAG,4HAAA,yDAI1C,IAAA,CAAA;AAED,IAAM,mBAAmB,GAAG,IAAA,gBAAM,EAAC,wBAAa,EAAE;IAChD,iBAAiB,EAAE,UAAC,IAAI,IAAK,OA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AAC,wBAAwB,cACvB,uBAAC,oBAAoB,IAAC,cAAc,EAAE,YAAY,CAAC,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,GAAI,GACpF,EAE3B,uBAAC,yBAAc,IAAC,YAAY,EAAE,YAAY,GAAI,KAvBwB,OAAO,CAwB1D,CACtB,CAAA;AACH,CAAC,CAAA;AAyBD,kBAAe,YAAY,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ import { Maybe, TimelineDomainResourceType } from '@ltht-react/types';
3
+ import { ITimelineItem } from '../molecules/timeline-item';
4
+ declare const Timeline: FC<IProps>;
5
+ interface IProps {
6
+ timelineItems: Maybe<ITimelineItem>[];
7
+ domainResourceType: TimelineDomainResourceType;
8
+ filters?: ITimelineFilter[];
9
+ onFilterChange?: (value: string[]) => void;
10
+ }
11
+ export interface ITimelineFilter {
12
+ label: string;
13
+ options: ITimelineFilterOption[];
14
+ }
15
+ export interface ITimelineFilterOption {
16
+ value?: string;
17
+ label: string;
18
+ }
19
+ export default Timeline;
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __assign = (this && this.__assign) || function () {
7
+ __assign = Object.assign || function(t) {
8
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
+ t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var jsx_runtime_1 = require("react/jsx-runtime");
22
+ var react_1 = require("react");
23
+ var styled_1 = __importDefault(require("@emotion/styled"));
24
+ var icon_1 = __importDefault(require("@ltht-react/icon"));
25
+ var styles_1 = require("@ltht-react/styles");
26
+ var types_1 = require("@ltht-react/types");
27
+ var utils_1 = require("@ltht-react/utils");
28
+ var hooks_1 = require("@ltht-react/hooks");
29
+ var select_1 = __importDefault(require("@ltht-react/select"));
30
+ var timeline_time_1 = __importDefault(require("../atoms/timeline-time"));
31
+ var timeline_item_1 = __importDefault(require("../molecules/timeline-item"));
32
+ var timeline_item_redacted_1 = __importDefault(require("../molecules/timeline-item-redacted"));
33
+ var StyledTimeline = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n margin: -0.75rem;\n"], ["\n position: relative;\n margin: -0.75rem;\n"])));
34
+ var StyledTimelineDayBody = styled_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: white;\n position: relative;\n\n &:before {\n content: '';\n position: absolute;\n z-index: 1;\n height: ", ";\n left: calc(50% - 1px);\n border-width: 0 0 0 2px;\n border-color: ", ";\n border-style: solid;\n }\n"], ["\n background-color: white;\n position: relative;\n\n &:before {\n content: '';\n position: absolute;\n z-index: 1;\n height: ", ";\n left: calc(50% - 1px);\n border-width: 0 0 0 2px;\n border-color: ", ";\n border-style: solid;\n }\n"])), function (_a) {
35
+ var isMobile = _a.isMobile;
36
+ return (isMobile ? '0%' : '100%');
37
+ }, styles_1.TEXT_COLOURS.INFO);
38
+ var StyledTimelineDayHeader = styled_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n padding: 0.5rem;\n text-align: center;\n font-weight: bold;\n"], ["\n background-color: ", ";\n padding: 0.5rem;\n text-align: center;\n font-weight: bold;\n"])), styles_1.BANNER_COLOURS.DEFAULT.BACKGROUND);
39
+ var StyledTimelineDayItem = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: inline-block;\n width: 100%;\n justify-content: center;\n padding: ", ";\n margin: ", ";\n"], ["\n display: inline-block;\n width: 100%;\n justify-content: center;\n padding: ", ";\n margin: ", ";\n"])), function (_a) {
40
+ var isMobile = _a.isMobile;
41
+ return (isMobile ? '' : '0 0.5rem');
42
+ }, function (_a) {
43
+ var isMobile = _a.isMobile;
44
+ return (isMobile ? '0.5rem 0' : '1rem 0');
45
+ });
46
+ var StyledTimelineDayContent = styled_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: ", ";\n padding: 0 0.5rem;\n display: inline-block;\n vertical-align: top;\n"], ["\n width: ", ";\n padding: 0 0.5rem;\n display: inline-block;\n vertical-align: top;\n"])), function (_a) {
47
+ var isMobile = _a.isMobile;
48
+ return (isMobile ? '100%' : '49%');
49
+ });
50
+ var StyledTimelineDayLine = styled_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: 2%;\n vertical-align: top;\n margin-top: 0.125rem;\n display: inline-block;\n text-align: center;\n position: relative;\n height: 100%;\n"], ["\n width: 2%;\n vertical-align: top;\n margin-top: 0.125rem;\n display: inline-block;\n text-align: center;\n position: relative;\n height: 100%;\n"])));
51
+ var StyledTimelineDayTimeLeft = styled_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: 49%;\n padding: 0 0.5rem;\n display: inline-block;\n vertical-align: top;\n text-align: right;\n font-weight: bold;\n"], ["\n width: 49%;\n padding: 0 0.5rem;\n display: inline-block;\n vertical-align: top;\n text-align: right;\n font-weight: bold;\n"])));
52
+ var StyledTimelineDayTimeRight = styled_1.default.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: 49%;\n padding: 0 0.5rem;\n display: inline-block;\n vertical-align: top;\n text-align: left;\n font-weight: bold;\n"], ["\n width: 49%;\n padding: 0 0.5rem;\n display: inline-block;\n vertical-align: top;\n text-align: left;\n font-weight: bold;\n"])));
53
+ var StyledOuterCircle = (0, styled_1.default)(icon_1.default)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: absolute;\n z-index: 1;\n transform: translate(-50%);\n -webkit-transform: translate(-50%);\n -ms-transform: translate(-50%);\n left: 50%;\n color: ", ";\n font-size: 0.75rem;\n"], ["\n position: absolute;\n z-index: 1;\n transform: translate(-50%);\n -webkit-transform: translate(-50%);\n -ms-transform: translate(-50%);\n left: 50%;\n color: ", ";\n font-size: 0.75rem;\n"])), styles_1.TEXT_COLOURS.INFO);
54
+ var StyledInnerCircle = (0, styled_1.default)(icon_1.default)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n position: absolute;\n z-index: 2;\n top: 0.125rem;\n transform: translate(-50%);\n -webkit-transform: translate(-50%);\n -ms-transform: translate(-50%);\n left: 50%;\n color: white;\n font-size: 0.5rem;\n"], ["\n position: absolute;\n z-index: 2;\n top: 0.125rem;\n transform: translate(-50%);\n -webkit-transform: translate(-50%);\n -ms-transform: translate(-50%);\n left: 50%;\n color: white;\n font-size: 0.5rem;\n"])));
55
+ var StyledFilters = styled_1.default.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n position: sticky;\n margin-bottom: 1rem;\n top: 0;\n background-color: ", ";\n z-index: 1000;\n padding: 0.5em;\n display: block;\n\n ", " {\n display: flex;\n padding: 1em;\n }\n"], ["\n position: sticky;\n margin-bottom: 1rem;\n top: 0;\n background-color: ", ";\n z-index: 1000;\n padding: 0.5em;\n display: block;\n\n ", " {\n display: flex;\n padding: 1em;\n }\n"])), styles_1.BANNER_COLOURS.DEFAULT.BACKGROUND, styles_1.TABLET_MINIMUM_MEDIA_QUERY);
56
+ var StyledFilter = styled_1.default.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 0.5rem;\n\n ", " {\n max-width: 200px;\n }\n\n > select {\n min-width: 100px;\n flex: 2;\n\n ", " {\n flex: unset;\n }\n }\n\n > label {\n flex: 1;\n white-space: pre;\n padding-right: 0.5em;\n\n ", " {\n flex: unset;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n padding: 0.5rem;\n\n ", " {\n max-width: 200px;\n }\n\n > select {\n min-width: 100px;\n flex: 2;\n\n ", " {\n flex: unset;\n }\n }\n\n > label {\n flex: 1;\n white-space: pre;\n padding-right: 0.5em;\n\n ", " {\n flex: unset;\n }\n }\n"])), styles_1.TABLET_MINIMUM_MEDIA_QUERY, styles_1.TABLET_MINIMUM_MEDIA_QUERY, styles_1.TABLET_MINIMUM_MEDIA_QUERY);
57
+ var Timeline = function (_a) {
58
+ var timelineItems = _a.timelineItems, domainResourceType = _a.domainResourceType, filters = _a.filters, onFilterChange = _a.onFilterChange;
59
+ var width = (0, hooks_1.useWindowSize)().width;
60
+ var isMobile = (0, utils_1.isMobileView)(width);
61
+ var timelineDates = {};
62
+ var _b = (0, react_1.useState)({}), activeFilters = _b[0], setActiveFilters = _b[1];
63
+ (0, react_1.useEffect)(function () { return setActiveFilters([]); }, [filters]);
64
+ timelineItems === null || timelineItems === void 0 ? void 0 : timelineItems.forEach(function (timelineItem) {
65
+ var _a, _b, _c, _d, _e, _f, _g;
66
+ if (!(timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource)) {
67
+ return;
68
+ }
69
+ var date = '';
70
+ var displayDate = '';
71
+ switch (domainResourceType) {
72
+ case types_1.TimelineDomainResourceType.QuestionnaireResponse: {
73
+ var qr = timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource;
74
+ if (!((_a = qr.authored) === null || _a === void 0 ? void 0 : _a.value)) {
75
+ return;
76
+ }
77
+ date = (0, utils_1.formatDate)(new Date((_b = qr.authored) === null || _b === void 0 ? void 0 : _b.value));
78
+ displayDate = (0, utils_1.formatDateExplicitMonth)(new Date((_c = qr.authored) === null || _c === void 0 ? void 0 : _c.value));
79
+ break;
80
+ }
81
+ case types_1.TimelineDomainResourceType.DocumentReference: {
82
+ var docRef = timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource;
83
+ if (!((_d = docRef.created) === null || _d === void 0 ? void 0 : _d.value)) {
84
+ return;
85
+ }
86
+ date = (0, utils_1.formatDate)(new Date(docRef.created.value));
87
+ displayDate = (0, utils_1.formatDateExplicitMonth)(new Date(docRef.created.value));
88
+ break;
89
+ }
90
+ case types_1.TimelineDomainResourceType.AuditEvent: {
91
+ var audit = timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource;
92
+ if (!((_e = audit.recorded) === null || _e === void 0 ? void 0 : _e.value)) {
93
+ return;
94
+ }
95
+ date = (0, utils_1.formatDate)(new Date((_f = audit.recorded) === null || _f === void 0 ? void 0 : _f.value));
96
+ displayDate = (0, utils_1.formatDateExplicitMonth)(new Date((_g = audit.recorded) === null || _g === void 0 ? void 0 : _g.value));
97
+ break;
98
+ }
99
+ default:
100
+ throw Error('Unrecognised resource type');
101
+ }
102
+ var lookup = timelineDates[date];
103
+ if (!lookup) {
104
+ timelineDates[date] = { item: [timelineItem], formattedDate: displayDate };
105
+ }
106
+ else {
107
+ lookup.item.push(timelineItem);
108
+ timelineDates[date] = lookup;
109
+ }
110
+ });
111
+ var position = 0;
112
+ var handleFilterChange = function (key, filter, value) {
113
+ var newActiveFilters = __assign({}, activeFilters);
114
+ if (value && value.length > 0 && filter.options.some(function (x) { return x.value === value; })) {
115
+ newActiveFilters[key] = value;
116
+ }
117
+ else {
118
+ delete newActiveFilters[key];
119
+ }
120
+ setActiveFilters(newActiveFilters);
121
+ onFilterChange && onFilterChange(Object.values(newActiveFilters).filter(function (x) { return x && x.length > 0; }));
122
+ };
123
+ return ((0, jsx_runtime_1.jsxs)(StyledTimeline, { "data-testid": "timeline", children: [filters && ((0, jsx_runtime_1.jsx)(StyledFilters, { children: filters.map(function (filter, key) { return ((0, jsx_runtime_1.jsxs)(StyledFilter, { children: [(0, jsx_runtime_1.jsxs)("label", { htmlFor: "".concat(filter.label, "-").concat(key), children: [filter.label, ":"] }), (0, jsx_runtime_1.jsx)(select_1.default, { id: "".concat(filter.label, "-").concat(key), options: filter.options, onChange: function (e) { return handleFilterChange(key, filter, e.target.value); } })] }, key)); }) })), Object.entries(timelineDates).map(function (_a) {
124
+ var _b;
125
+ var dateKey = _a[0], value = _a[1];
126
+ position += 1;
127
+ return ((0, jsx_runtime_1.jsxs)("div", { "data-testid": dateKey, children: [(0, jsx_runtime_1.jsx)(StyledTimelineDayHeader, { children: value.formattedDate }), (0, jsx_runtime_1.jsx)(StyledTimelineDayBody, { isMobile: isMobile, children: (_b = value.item) === null || _b === void 0 ? void 0 : _b.map(function (timelineItem, idx) {
128
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
129
+ var content = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
130
+ if (!(timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource)) {
131
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
132
+ }
133
+ var currentTime = '';
134
+ var previousTime = '';
135
+ switch (domainResourceType) {
136
+ case types_1.TimelineDomainResourceType.QuestionnaireResponse: {
137
+ var qr = timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource;
138
+ if (!((_a = qr.authored) === null || _a === void 0 ? void 0 : _a.value)) {
139
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
140
+ }
141
+ currentTime = (0, utils_1.formatTime)(new Date(qr.authored.value));
142
+ previousTime = currentTime;
143
+ if (idx > 0) {
144
+ var previousItem = (_b = value.item[idx - 1]) === null || _b === void 0 ? void 0 : _b.domainResource;
145
+ if (!((_c = previousItem === null || previousItem === void 0 ? void 0 : previousItem.authored) === null || _c === void 0 ? void 0 : _c.value)) {
146
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
147
+ }
148
+ previousTime = (0, utils_1.formatTime)(new Date(previousItem === null || previousItem === void 0 ? void 0 : previousItem.authored.value));
149
+ }
150
+ break;
151
+ }
152
+ case types_1.TimelineDomainResourceType.DocumentReference: {
153
+ var docRef = timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource;
154
+ if (!((_d = docRef.created) === null || _d === void 0 ? void 0 : _d.value)) {
155
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
156
+ }
157
+ currentTime = (0, utils_1.formatTime)(new Date(docRef.created.value));
158
+ previousTime = currentTime;
159
+ if (idx > 0) {
160
+ var previousItem = (_e = value.item[idx - 1]) === null || _e === void 0 ? void 0 : _e.domainResource;
161
+ if (!((_f = previousItem === null || previousItem === void 0 ? void 0 : previousItem.created) === null || _f === void 0 ? void 0 : _f.value)) {
162
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
163
+ }
164
+ previousTime = (0, utils_1.formatTime)(new Date((_g = previousItem === null || previousItem === void 0 ? void 0 : previousItem.created) === null || _g === void 0 ? void 0 : _g.value));
165
+ }
166
+ break;
167
+ }
168
+ case types_1.TimelineDomainResourceType.AuditEvent: {
169
+ var audit = timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource;
170
+ if (!((_h = audit.recorded) === null || _h === void 0 ? void 0 : _h.value)) {
171
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
172
+ }
173
+ currentTime = (0, utils_1.formatTime)(new Date((_j = audit.recorded) === null || _j === void 0 ? void 0 : _j.value));
174
+ previousTime = currentTime;
175
+ if (idx > 0) {
176
+ var previousItem = (_k = value.item[idx - 1]) === null || _k === void 0 ? void 0 : _k.domainResource;
177
+ if (!((_l = previousItem === null || previousItem === void 0 ? void 0 : previousItem.recorded) === null || _l === void 0 ? void 0 : _l.value)) {
178
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
179
+ }
180
+ previousTime = (0, utils_1.formatTime)(new Date((_m = previousItem === null || previousItem === void 0 ? void 0 : previousItem.recorded) === null || _m === void 0 ? void 0 : _m.value));
181
+ }
182
+ break;
183
+ }
184
+ }
185
+ if (currentTime !== previousTime) {
186
+ position += 1;
187
+ }
188
+ var itemKey = "timeline_day_item_".concat(dateKey, "_").concat(currentTime, "_").concat(idx);
189
+ var isRedacted = (_o = timelineItem.domainResource.metadata.isRedacted) !== null && _o !== void 0 ? _o : false;
190
+ if (isMobile) {
191
+ content = ((0, jsx_runtime_1.jsx)(StyledTimelineDayContent, { isMobile: true, children: isRedacted ? ((0, jsx_runtime_1.jsx)(timeline_item_redacted_1.default, {})) : ((0, jsx_runtime_1.jsx)(timeline_item_1.default, { timelineItem: timelineItem, domainResourceType: domainResourceType })) }));
192
+ }
193
+ else if (position % 2 === 1) {
194
+ var contentKey = "content_left_".concat(itemKey);
195
+ content = ((0, jsx_runtime_1.jsxs)("div", { "data-testid": contentKey, children: [(0, jsx_runtime_1.jsx)(StyledTimelineDayContent, { isMobile: false, children: isRedacted ? ((0, jsx_runtime_1.jsx)(timeline_item_redacted_1.default, {})) : ((0, jsx_runtime_1.jsx)(timeline_item_1.default, { timelineItem: timelineItem, domainResourceType: domainResourceType })) }), (0, jsx_runtime_1.jsxs)(StyledTimelineDayLine, { children: [(0, jsx_runtime_1.jsx)(StyledOuterCircle, { type: "circle", color: "info-blue", size: "medium" }), (0, jsx_runtime_1.jsx)(StyledInnerCircle, { type: "circle", color: "info-blue", size: "medium" })] }), (0, jsx_runtime_1.jsx)(StyledTimelineDayTimeRight, { children: (0, jsx_runtime_1.jsx)(timeline_time_1.default, { domainResource: timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource, domainResourceType: domainResourceType, pointInTimeClickHandler: timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.pointInTimeClickHandler, orientation: "right" }) })] }, contentKey));
196
+ }
197
+ else if (position % 2 === 0) {
198
+ var contentKey = "content_right_".concat(itemKey);
199
+ content = ((0, jsx_runtime_1.jsxs)("div", { "data-testid": contentKey, children: [(0, jsx_runtime_1.jsx)(StyledTimelineDayTimeLeft, { children: (0, jsx_runtime_1.jsx)(timeline_time_1.default, { domainResource: timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.domainResource, domainResourceType: domainResourceType, pointInTimeClickHandler: timelineItem === null || timelineItem === void 0 ? void 0 : timelineItem.pointInTimeClickHandler, orientation: "left" }) }), (0, jsx_runtime_1.jsxs)(StyledTimelineDayLine, { children: [(0, jsx_runtime_1.jsx)(StyledOuterCircle, { type: "circle", color: "info-blue", size: "medium" }), (0, jsx_runtime_1.jsx)(StyledInnerCircle, { type: "circle", color: "info-blue", size: "medium" })] }), (0, jsx_runtime_1.jsx)(StyledTimelineDayContent, { isMobile: false, children: isRedacted ? ((0, jsx_runtime_1.jsx)(timeline_item_redacted_1.default, {})) : ((0, jsx_runtime_1.jsx)(timeline_item_1.default, { timelineItem: timelineItem, domainResourceType: domainResourceType })) })] }, contentKey));
200
+ }
201
+ return ((0, jsx_runtime_1.jsx)(StyledTimelineDayItem, { isMobile: isMobile, "data-testid": itemKey, children: content }, itemKey));
202
+ }) })] }, dateKey));
203
+ })] }, "timeline"));
204
+ };
205
+ exports.default = Timeline;
206
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12;
207
+ //# sourceMappingURL=timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/organisms/timeline.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+C;AAC/C,2DAAoC;AACpC,0DAAmC;AACnC,6CAA6F;AAC7F,2CAM0B;AAC1B,2CAAiG;AACjG,2CAAiD;AACjD,8DAAuC;AAEvC,yEAAiD;AACjD,6EAAwE;AACxE,+FAAsE;AAEtE,IAAM,cAAc,GAAG,gBAAM,CAAC,GAAG,mHAAA,gDAGhC,IAAA,CAAA;AAED,IAAM,qBAAqB,GAAG,gBAAM,CAAC,GAAG,2UAAe,+IAQzC,EAA4C,iFAGtC,EAAiB,oCAGpC,KANa,UAAC,EAAY;QAAV,QAAQ,cAAA;IAAO,OAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AAA1B,CAA0B,EAGtC,qBAAY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IhB,OAAO,CA8IX,CACP,CAAA;YACH,CAAC,CAAC,KAlKgB,UAAU,CAmKb,CAClB,CAAA;AACH,CAAC,CAAA;AAuBD,kBAAe,QAAQ,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ltht-react/timeline",
3
- "version": "2.0.62",
3
+ "version": "2.0.64",
4
4
  "description": "> TODO: description",
5
5
  "author": "Jonny Dyson",
6
6
  "homepage": "",
@@ -24,16 +24,16 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@emotion/styled": "^11.0.0",
27
- "@ltht-react/banner": "^2.0.62",
28
- "@ltht-react/button": "^2.0.62",
29
- "@ltht-react/hooks": "^2.0.62",
30
- "@ltht-react/icon": "^2.0.62",
31
- "@ltht-react/select": "^2.0.62",
32
- "@ltht-react/styles": "^2.0.62",
33
- "@ltht-react/types": "^2.0.62",
34
- "@ltht-react/utils": "^2.0.62",
27
+ "@ltht-react/banner": "^2.0.64",
28
+ "@ltht-react/button": "^2.0.64",
29
+ "@ltht-react/hooks": "^2.0.64",
30
+ "@ltht-react/icon": "^2.0.64",
31
+ "@ltht-react/select": "^2.0.64",
32
+ "@ltht-react/styles": "^2.0.64",
33
+ "@ltht-react/types": "^2.0.64",
34
+ "@ltht-react/utils": "^2.0.64",
35
35
  "html-react-parser": "^5.0.6",
36
36
  "react": "^18.2.0"
37
37
  },
38
- "gitHead": "9b18b5726598e1643a8ee1f105773dea28bb1664"
38
+ "gitHead": "0cba014a75df54769f93f6dfa1a2c69a77296a4a"
39
39
  }
@@ -1,52 +1,52 @@
1
- import { FC } from 'react'
2
- import Icon from '@ltht-react/icon'
3
- import styled from '@emotion/styled'
4
- import { formatDateTime, formatTime } from '@ltht-react/utils'
5
- import { Button } from '@ltht-react/button'
6
-
7
- const StyledButton = styled(Button)`
8
- width: auto;
9
- `
10
-
11
- const StyledTimelineTime = styled.div<OrientationProps>`
12
- margin-top: -0.65rem;
13
- display: flex;
14
-
15
- ${(props) => (props.orientation === 'left' ? `justify-content: right` : `justify-content: left`)}
16
- `
17
-
18
- const TimeElement: FC<Props> = ({ date, orientation, pointInTimeClicked, ...rest }) => {
19
- const time = formatTime(date)
20
-
21
- if (!orientation || !pointInTimeClicked) {
22
- return <>{time}</>
23
- }
24
-
25
- const buttonTitle = `Show the dashboard as it was at ${formatDateTime(date)}`
26
-
27
- return (
28
- <StyledTimelineTime orientation={orientation} {...rest}>
29
- <StyledButton
30
- title={buttonTitle}
31
- styling={{ buttonStyle: 'clear' }}
32
- iconColour="black"
33
- icon={<Icon type="clock-rotate-left" size="medium" color="link-blue" />}
34
- onClick={() => pointInTimeClicked(date)}
35
- value={time}
36
- />
37
- </StyledTimelineTime>
38
- )
39
- }
40
-
41
- export type Orientation = 'left' | 'right'
42
-
43
- interface OrientationProps {
44
- orientation?: Orientation
45
- }
46
-
47
- interface Props extends OrientationProps {
48
- date: Date
49
- pointInTimeClicked?: (date: Date) => void
50
- }
51
-
52
- export default TimeElement
1
+ import { FC } from 'react'
2
+ import Icon from '@ltht-react/icon'
3
+ import styled from '@emotion/styled'
4
+ import { formatDateTime, formatTime } from '@ltht-react/utils'
5
+ import { Button } from '@ltht-react/button'
6
+
7
+ const StyledButton = styled(Button)`
8
+ width: auto;
9
+ `
10
+
11
+ const StyledTimelineTime = styled.div<OrientationProps>`
12
+ margin-top: -0.65rem;
13
+ display: flex;
14
+
15
+ ${(props) => (props.orientation === 'left' ? `justify-content: right` : `justify-content: left`)}
16
+ `
17
+
18
+ const TimeElement: FC<Props> = ({ date, orientation, pointInTimeClicked, ...rest }) => {
19
+ const time = formatTime(date)
20
+
21
+ if (!orientation || !pointInTimeClicked) {
22
+ return <>{time}</>
23
+ }
24
+
25
+ const buttonTitle = `Show the dashboard as it was at ${formatDateTime(date)}`
26
+
27
+ return (
28
+ <StyledTimelineTime orientation={orientation} {...rest}>
29
+ <StyledButton
30
+ title={buttonTitle}
31
+ styling={{ buttonStyle: 'clear' }}
32
+ iconColour="black"
33
+ icon={<Icon type="clock-rotate-left" size="medium" color="link-blue" />}
34
+ onClick={() => pointInTimeClicked(date)}
35
+ value={time}
36
+ />
37
+ </StyledTimelineTime>
38
+ )
39
+ }
40
+
41
+ export type Orientation = 'left' | 'right'
42
+
43
+ interface OrientationProps {
44
+ orientation?: Orientation
45
+ }
46
+
47
+ interface Props extends OrientationProps {
48
+ date: Date
49
+ pointInTimeClicked?: (date: Date) => void
50
+ }
51
+
52
+ export default TimeElement