@ltht-react/diagnosis-summary 2.0.96 → 2.0.97

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/README.md CHANGED
@@ -1,22 +1,22 @@
1
- # DiagnosisSummary
2
-
3
- <!-- STORY -->
4
-
5
- ### Import
6
-
7
- ```js
8
- import DiagnosisSummary from '@ltht-react/diagnosis-summary'
9
- ```
10
-
11
- ### Usage
12
-
13
- ```jsx
14
- <DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
15
- ```
16
-
17
- ### Properties
18
-
19
- | Prop | Required | Default | Type | Description |
20
- | :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
21
- | `conditions` | Yes | | Condition[] | Array of conditions to display |
22
- | `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
1
+ # DiagnosisSummary
2
+
3
+ <!-- STORY -->
4
+
5
+ ### Import
6
+
7
+ ```js
8
+ import DiagnosisSummary from '@ltht-react/diagnosis-summary'
9
+ ```
10
+
11
+ ### Usage
12
+
13
+ ```jsx
14
+ <DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
15
+ ```
16
+
17
+ ### Properties
18
+
19
+ | Prop | Required | Default | Type | Description |
20
+ | :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
21
+ | `conditions` | Yes | | Condition[] | Array of conditions to display |
22
+ | `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
@@ -1,4 +1,4 @@
1
- import { FC, HTMLAttributes } from 'react';
1
+ import { FC, HTMLAttributes, ReactElement } from 'react';
2
2
  import { Condition } from '@ltht-react/types';
3
3
  import { ButtonProps } from '@ltht-react/button';
4
4
  declare const DiagnosisSummary: FC<Props>;
@@ -10,6 +10,7 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
10
10
  isReadOnly: boolean;
11
11
  dateOnlyView?: boolean;
12
12
  controls?: ButtonProps[];
13
+ tags?: ReactElement[];
13
14
  canExtendDiagnosis?: boolean;
14
15
  }
15
16
  export default DiagnosisSummary;
@@ -30,6 +30,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  var jsx_runtime_1 = require("react/jsx-runtime");
33
+ var react_1 = require("react");
33
34
  var styled_1 = __importDefault(require("@emotion/styled"));
34
35
  var types_1 = require("@ltht-react/types");
35
36
  var type_summary_1 = require("@ltht-react/type-summary");
@@ -42,19 +43,19 @@ var diagnosis_redacted_1 = __importDefault(require("../molecules/diagnosis-redac
42
43
  var StyledTitle = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-block;\n"], ["\n display: inline-block;\n"])));
43
44
  var StyledSummary = styled_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n"], ["\n display: flex;\n justify-content: center;\n"])));
44
45
  var StyledDescription = styled_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-grow: 1;\n"], ["\n flex-grow: 1;\n"])));
45
- var StyledLeftContainer = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-grow: 1;\n flex-direction: row;\n\n ", " {\n flex-direction: column;\n }\n"], ["\n display: flex;\n flex-grow: 1;\n flex-direction: row;\n\n ", " {\n flex-direction: column;\n }\n"])), styles_1.MOBILE_MAXIMUM_MEDIA_QUERY);
46
- var StyledControlsContainer = styled_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n margin: auto 10px auto 10px;\n flex-direction: column;\n\n ", " {\n margin: 10px 0 0 0;\n flex-flow: row wrap;\n }\n\n ", " {\n margin: 10px 5px 0 0;\n flex-direction: column;\n }\n"], ["\n display: flex;\n margin: auto 10px auto 10px;\n flex-direction: column;\n\n ", " {\n margin: 10px 0 0 0;\n flex-flow: row wrap;\n }\n\n ", " {\n margin: 10px 5px 0 0;\n flex-direction: column;\n }\n"])), styles_1.MOBILE_MAXIMUM_MEDIA_QUERY, styles_1.SMALL_SCREEN_MAXIMUM_MEDIA_QUERY);
47
- var StyledButton = (0, styled_1.default)(button_1.Button)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin: 2px 0 2px 0;\n font-size: 0.8em !important;\n padding: 1px 5px;\n\n ", " {\n margin: 2px 5px 2px 0;\n width: fit-content;\n }\n\n ", " {\n margin: 2px 0 2px 0;\n width: 100%;\n max-width: 200px;\n }\n"], ["\n margin: 2px 0 2px 0;\n font-size: 0.8em !important;\n padding: 1px 5px;\n\n ", " {\n margin: 2px 5px 2px 0;\n width: fit-content;\n }\n\n ", " {\n margin: 2px 0 2px 0;\n width: 100%;\n max-width: 200px;\n }\n"])), styles_1.MOBILE_MAXIMUM_MEDIA_QUERY, styles_1.SMALL_SCREEN_MAXIMUM_MEDIA_QUERY);
46
+ var StyledLeftContainer = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-grow: 1;\n flex-direction: row;\n gap: 0.3rem;\n\n ", " {\n flex-direction: column;\n }\n"], ["\n display: flex;\n flex-grow: 1;\n flex-direction: row;\n gap: 0.3rem;\n\n ", " {\n flex-direction: column;\n }\n"])), styles_1.MOBILE_MAXIMUM_MEDIA_QUERY);
47
+ var StyledResponsiveContainer = styled_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n margin: 0 10px 0 10px;\n flex-direction: column;\n gap: 0.3rem;\n align-items: center;\n justify-content: center;\n\n ", " {\n margin: 0;\n flex-flow: row wrap;\n justify-content: start;\n\n & > * {\n width: fit-content;\n }\n }\n\n ", " {\n margin: 0;\n flex-direction: column wrap;\n\n & > * {\n width: 100%;\n max-width: 200px;\n display: flex;\n justify-content: center;\n }\n }\n"], ["\n display: flex;\n margin: 0 10px 0 10px;\n flex-direction: column;\n gap: 0.3rem;\n align-items: center;\n justify-content: center;\n\n ", " {\n margin: 0;\n flex-flow: row wrap;\n justify-content: start;\n\n & > * {\n width: fit-content;\n }\n }\n\n ", " {\n margin: 0;\n flex-direction: column wrap;\n\n & > * {\n width: 100%;\n max-width: 200px;\n display: flex;\n justify-content: center;\n }\n }\n"])), styles_1.MOBILE_MAXIMUM_MEDIA_QUERY, styles_1.SMALL_SCREEN_MAXIMUM_MEDIA_QUERY);
48
+ var StyledButton = (0, styled_1.default)(button_1.Button)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: 0.8em !important;\n padding: 1px 5px;\n\n ", " {\n width: fit-content;\n }\n\n ", " {\n width: 100%;\n max-width: 200px;\n }\n"], ["\n font-size: 0.8em !important;\n padding: 1px 5px;\n\n ", " {\n width: fit-content;\n }\n\n ", " {\n width: 100%;\n max-width: 200px;\n }\n"])), styles_1.MOBILE_MAXIMUM_MEDIA_QUERY, styles_1.SMALL_SCREEN_MAXIMUM_MEDIA_QUERY);
48
49
  var StyledDate = styled_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n text-align: left;\n width: 15%;\n"], ["\n text-align: left;\n width: 15%;\n"])));
49
50
  var IconButtonWrapper = (0, styled_1.default)(button_1.Button)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n margin-right: 0.5rem;\n display: inline-block !important;\n margin-left: 0.5rem;\n width: auto;\n"], ["\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n margin-right: 0.5rem;\n display: inline-block !important;\n margin-left: 0.5rem;\n width: auto;\n"])));
50
51
  var IconWrapper = styled_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-left: 0.5rem;\n display: inline-block;\n"], ["\n margin-left: 0.5rem;\n display: inline-block;\n"])));
51
52
  var DiagnosisSummary = function (_a) {
52
- var condition = _a.condition, extendedTemplateDisplayName = _a.extendedTemplateDisplayName, extensionTemplateDisplayName = _a.extensionTemplateDisplayName, extensionClickHandler = _a.extensionClickHandler, _b = _a.isReadOnly, isReadOnly = _b === void 0 ? false : _b, _c = _a.dateOnlyView, dateOnlyView = _c === void 0 ? false : _c, _d = _a.canExtendDiagnosis, canExtendDiagnosis = _d === void 0 ? false : _d, _e = _a.controls, controls = _e === void 0 ? [] : _e, rest = __rest(_a, ["condition", "extendedTemplateDisplayName", "extensionTemplateDisplayName", "extensionClickHandler", "isReadOnly", "dateOnlyView", "canExtendDiagnosis", "controls"]);
53
+ var condition = _a.condition, extendedTemplateDisplayName = _a.extendedTemplateDisplayName, extensionTemplateDisplayName = _a.extensionTemplateDisplayName, extensionClickHandler = _a.extensionClickHandler, _b = _a.isReadOnly, isReadOnly = _b === void 0 ? false : _b, _c = _a.dateOnlyView, dateOnlyView = _c === void 0 ? false : _c, _d = _a.canExtendDiagnosis, canExtendDiagnosis = _d === void 0 ? false : _d, _e = _a.controls, controls = _e === void 0 ? [] : _e, _f = _a.tags, tags = _f === void 0 ? [] : _f, rest = __rest(_a, ["condition", "extendedTemplateDisplayName", "extensionTemplateDisplayName", "extensionClickHandler", "isReadOnly", "dateOnlyView", "canExtendDiagnosis", "controls", "tags"]);
53
54
  if (condition.metadata.isRedacted) {
54
55
  return ((0, jsx_runtime_1.jsx)(StyledSummary, __assign({}, rest, { children: (0, jsx_runtime_1.jsx)(diagnosis_redacted_1.default, { condition: condition }) })));
55
56
  }
56
57
  var enteredInError = condition.verificationStatus === types_1.ConditionVerificationStatus.EnteredInError;
57
- return ((0, jsx_runtime_1.jsxs)(StyledSummary, __assign({}, rest, { children: [(0, jsx_runtime_1.jsxs)(StyledLeftContainer, { children: [(0, jsx_runtime_1.jsxs)(StyledDescription, { children: [(0, jsx_runtime_1.jsx)(StyledTitle, { children: (0, jsx_runtime_1.jsx)(diagnosis_title_1.default, { enteredInError: enteredInError, condition: condition }) }), extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && ((0, jsx_runtime_1.jsx)(IconButtonWrapper, { onClick: extensionClickHandler, type: "button", styling: { buttonStyle: 'clear' }, value: "", icon: (0, jsx_runtime_1.jsx)(icon_1.default, { type: "folder-plus", size: "medium" }), iconPlacement: "center", iconColour: styles_1.BTN_COLOURS.PRIMARY.VALUE, title: "This diagnosis can be extended further using form '".concat(extensionTemplateDisplayName, "' by clicking here") })), extendedTemplateDisplayName && ((0, jsx_runtime_1.jsx)(IconWrapper, { children: (0, jsx_runtime_1.jsx)(icon_1.default, { type: "comment", size: "medium", title: "This diagnosis has been extended beyond standard diagnosis with form '".concat(extendedTemplateDisplayName, "'.\n To view these extra details, click into the full diagnosis detail or edit the existing form.") }) }))] }), !isReadOnly && controls.length > 0 && ((0, jsx_runtime_1.jsx)(StyledControlsContainer, { children: controls.map(function (props, index) { return ((0, jsx_runtime_1.jsx)(StyledButton, __assign({}, props), index)); }) }))] }), (0, jsx_runtime_1.jsxs)(StyledDate, { children: [(0, jsx_runtime_1.jsx)(type_summary_1.DateSummary, { enteredInError: enteredInError, datetime: condition === null || condition === void 0 ? void 0 : condition.assertedDate, dateOnlyView: dateOnlyView }), (0, jsx_runtime_1.jsx)(diagnosis_onset_estimated_1.default, { enteredInError: enteredInError, condition: condition })] })] })));
58
+ return ((0, jsx_runtime_1.jsxs)(StyledSummary, __assign({}, rest, { children: [(0, jsx_runtime_1.jsxs)(StyledLeftContainer, { children: [(0, jsx_runtime_1.jsxs)(StyledDescription, { children: [(0, jsx_runtime_1.jsx)(StyledTitle, { children: (0, jsx_runtime_1.jsx)(diagnosis_title_1.default, { enteredInError: enteredInError, condition: condition }) }), extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && ((0, jsx_runtime_1.jsx)(IconButtonWrapper, { onClick: extensionClickHandler, type: "button", styling: { buttonStyle: 'clear' }, value: "", icon: (0, jsx_runtime_1.jsx)(icon_1.default, { type: "folder-plus", size: "medium" }), iconPlacement: "center", iconColour: styles_1.BTN_COLOURS.PRIMARY.VALUE, title: "This diagnosis can be extended further using form '".concat(extensionTemplateDisplayName, "' by clicking here") })), extendedTemplateDisplayName && ((0, jsx_runtime_1.jsx)(IconWrapper, { children: (0, jsx_runtime_1.jsx)(icon_1.default, { type: "comment", size: "medium", title: "This diagnosis has been extended beyond standard diagnosis with form '".concat(extendedTemplateDisplayName, "'.\n To view these extra details, click into the full diagnosis detail or edit the existing form.") }) }))] }), tags.length > 0 && ((0, jsx_runtime_1.jsx)(StyledResponsiveContainer, { children: tags === null || tags === void 0 ? void 0 : tags.map(function (tag, index) { return (tag.key ? tag : (0, react_1.cloneElement)(tag, { key: index })); }) })), !isReadOnly && controls.length > 0 && ((0, jsx_runtime_1.jsx)(StyledResponsiveContainer, { children: controls.map(function (props, index) { return ((0, jsx_runtime_1.jsx)(StyledButton, __assign({}, props), index)); }) }))] }), (0, jsx_runtime_1.jsxs)(StyledDate, { children: [(0, jsx_runtime_1.jsx)(type_summary_1.DateSummary, { enteredInError: enteredInError, datetime: condition === null || condition === void 0 ? void 0 : condition.assertedDate, dateOnlyView: dateOnlyView }), (0, jsx_runtime_1.jsx)(diagnosis_onset_estimated_1.default, { enteredInError: enteredInError, condition: condition })] })] })));
58
59
  };
59
60
  exports.default = DiagnosisSummary;
60
61
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
@@ -1 +1 @@
1
- {"version":3,"file":"diagnosis-summary.js","sourceRoot":"","sources":["../../src/organisms/diagnosis-summary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2DAAoC;AAEpC,2CAA0E;AAC1E,yDAAsD;AACtD,0DAAmC;AACnC,6CAAwD;AAExD,6CAA8G;AAC9G,6EAA4C;AAC5C,iGAAmE;AACnE,uFAAsD;AAEtD,IAAM,WAAW,GAAG,gBAAM,CAAC,GAAG,iGAAA,8BAE7B,IAAA,CAAA;AACD,IAAM,aAAa,GAAG,gBAAM,CAAC,GAAG,qHAAA,kDAG/B,IAAA,CAAA;AACD,IAAM,iBAAiB,G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B,GAC7G,CACH,EACA,2BAA2B,IAAI,CAC9B,uBAAC,WAAW,cACV,uBAAC,cAAI,IACH,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,gFAAyE,2BAA2B,gHACnB,GACxF,GACU,CACf,IACiB,EAEnB,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAClB,uBAAC,yBAAyB,cACvB,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAC,UAAC,GAAG,EAAE,KAAK,IAAK,OAAA,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,oBAAY,EAAC,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,EAAnD,CAAmD,CAAC,GACrD,CAC7B,EAEA,CAAC,UAAU,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACrC,uBAAC,yBAAyB,cACvB,QAAQ,CAAC,GAAG,CAAC,UAAC,KAAK,EAAE,KAAK,IAAK,OAAA,CAC9B,uBAAC,YAAY,eAAiB,KAAK,GAAhB,KAAK,CAAe,CACxC,EAF+B,CAE/B,CAAC,GACwB,CAC7B,IACmB,EACtB,wBAAC,UAAU,eACT,uBAAC,0BAAW,IAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,YAAY,EAAE,YAAY,EAAE,YAAY,GAAI,EAC9G,uBAAC,mCAAkB,IAAC,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAI,IACjE,KACC,CACjB,CAAA;AACH,CAAC,CAAA;AAcD,kBAAe,gBAAgB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ltht-react/diagnosis-summary",
3
- "version": "2.0.96",
3
+ "version": "2.0.97",
4
4
  "description": "ltht-react clinical DiagnosisSummary component.",
5
5
  "author": "LTHT",
6
6
  "homepage": "",
@@ -28,15 +28,15 @@
28
28
  "dependencies": {
29
29
  "@emotion/react": "^11.0.0",
30
30
  "@emotion/styled": "^11.0.0",
31
- "@ltht-react/button": "^2.0.96",
32
- "@ltht-react/hooks": "^2.0.96",
33
- "@ltht-react/icon": "^2.0.96",
34
- "@ltht-react/list": "^2.0.96",
35
- "@ltht-react/styles": "^2.0.96",
36
- "@ltht-react/type-summary": "^2.0.96",
37
- "@ltht-react/types": "^2.0.96",
38
- "@ltht-react/utils": "^2.0.96",
31
+ "@ltht-react/button": "^2.0.97",
32
+ "@ltht-react/hooks": "^2.0.97",
33
+ "@ltht-react/icon": "^2.0.97",
34
+ "@ltht-react/list": "^2.0.97",
35
+ "@ltht-react/styles": "^2.0.97",
36
+ "@ltht-react/type-summary": "^2.0.97",
37
+ "@ltht-react/types": "^2.0.97",
38
+ "@ltht-react/utils": "^2.0.97",
39
39
  "react": "^18.2.0"
40
40
  },
41
- "gitHead": "c79fddf11b4e822eb00084c266ee2211934edba9"
41
+ "gitHead": "ac3030714c9d13dd6c09878c52b10b7d40bd81ce"
42
42
  }
@@ -1,31 +1,31 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
- import { codeableConceptDisplaySummary } from '@ltht-react/utils'
7
-
8
- const StyledConditionCategory = styled.div<IStyledDescription>`
9
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
- text-align: left;
11
- font-size: smaller;
12
- padding-top: 0.25rem;
13
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
- `
15
-
16
- const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
17
- <StyledConditionCategory enteredInError={enteredInError} {...rest}>
18
- {codeableConceptDisplaySummary(condition.severity)}
19
- </StyledConditionCategory>
20
- )
21
-
22
- interface Props extends HTMLAttributes<HTMLDivElement> {
23
- condition: Condition
24
- enteredInError: boolean
25
- }
26
-
27
- interface IStyledDescription {
28
- enteredInError: boolean
29
- }
30
-
31
- export default DiagnosisCategory
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+ import { codeableConceptDisplaySummary } from '@ltht-react/utils'
7
+
8
+ const StyledConditionCategory = styled.div<IStyledDescription>`
9
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
+ text-align: left;
11
+ font-size: smaller;
12
+ padding-top: 0.25rem;
13
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
+ `
15
+
16
+ const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
17
+ <StyledConditionCategory enteredInError={enteredInError} {...rest}>
18
+ {codeableConceptDisplaySummary(condition.severity)}
19
+ </StyledConditionCategory>
20
+ )
21
+
22
+ interface Props extends HTMLAttributes<HTMLDivElement> {
23
+ condition: Condition
24
+ enteredInError: boolean
25
+ }
26
+
27
+ interface IStyledDescription {
28
+ enteredInError: boolean
29
+ }
30
+
31
+ export default DiagnosisCategory
@@ -1,39 +1,39 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
-
7
- import { getBooleanExtension } from '@ltht-react/utils'
8
-
9
- const StyledOnsetEstimated = styled.div<IStyledDescription>`
10
- color: ${TEXT_COLOURS.INFO};
11
- font-size: x-small;
12
- white-space: pre-wrap;
13
- display: inline-block;
14
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
15
- `
16
-
17
- const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
18
- const onsetDateEstimated = getBooleanExtension(
19
- condition.extension,
20
- 'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
21
- )
22
-
23
- return (
24
- <StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
25
- {onsetDateEstimated ? ' (estimated)' : ''}
26
- </StyledOnsetEstimated>
27
- )
28
- }
29
-
30
- interface Props extends HTMLAttributes<HTMLDivElement> {
31
- condition: Condition
32
- enteredInError: boolean
33
- }
34
-
35
- interface IStyledDescription {
36
- enteredInError: boolean
37
- }
38
-
39
- export default DiagnosisOnsetEstimated
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+
7
+ import { getBooleanExtension } from '@ltht-react/utils'
8
+
9
+ const StyledOnsetEstimated = styled.div<IStyledDescription>`
10
+ color: ${TEXT_COLOURS.INFO};
11
+ font-size: x-small;
12
+ white-space: pre-wrap;
13
+ display: inline-block;
14
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
15
+ `
16
+
17
+ const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
18
+ const onsetDateEstimated = getBooleanExtension(
19
+ condition.extension,
20
+ 'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
21
+ )
22
+
23
+ return (
24
+ <StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
25
+ {onsetDateEstimated ? ' (estimated)' : ''}
26
+ </StyledOnsetEstimated>
27
+ )
28
+ }
29
+
30
+ interface Props extends HTMLAttributes<HTMLDivElement> {
31
+ condition: Condition
32
+ enteredInError: boolean
33
+ }
34
+
35
+ interface IStyledDescription {
36
+ enteredInError: boolean
37
+ }
38
+
39
+ export default DiagnosisOnsetEstimated
@@ -1,38 +1,38 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
- import { titleCase } from '@ltht-react/utils'
7
-
8
- const StyledConditionStatus = styled.div<IStyledDescription>`
9
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
- text-align: left;
11
- font-size: smaller;
12
- padding-top: 0.25rem;
13
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
- `
15
-
16
- const DiagnosisStatus: FC<Props> = ({ condition, enteredInError, ...rest }) => {
17
- const values = []
18
-
19
- if (condition.clinicalStatus) values.push(titleCase(condition.clinicalStatus))
20
- if (condition.verificationStatus) values.push(titleCase(condition.verificationStatus))
21
-
22
- return (
23
- <StyledConditionStatus enteredInError={enteredInError} {...rest}>
24
- {values.length > 0 ? values.join(' - ') : 'Insufficient data provided'}
25
- </StyledConditionStatus>
26
- )
27
- }
28
-
29
- interface Props extends HTMLAttributes<HTMLDivElement> {
30
- condition: Condition
31
- enteredInError: boolean
32
- }
33
-
34
- interface IStyledDescription {
35
- enteredInError: boolean
36
- }
37
-
38
- export default DiagnosisStatus
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+ import { titleCase } from '@ltht-react/utils'
7
+
8
+ const StyledConditionStatus = styled.div<IStyledDescription>`
9
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
+ text-align: left;
11
+ font-size: smaller;
12
+ padding-top: 0.25rem;
13
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
+ `
15
+
16
+ const DiagnosisStatus: FC<Props> = ({ condition, enteredInError, ...rest }) => {
17
+ const values = []
18
+
19
+ if (condition.clinicalStatus) values.push(titleCase(condition.clinicalStatus))
20
+ if (condition.verificationStatus) values.push(titleCase(condition.verificationStatus))
21
+
22
+ return (
23
+ <StyledConditionStatus enteredInError={enteredInError} {...rest}>
24
+ {values.length > 0 ? values.join(' - ') : 'Insufficient data provided'}
25
+ </StyledConditionStatus>
26
+ )
27
+ }
28
+
29
+ interface Props extends HTMLAttributes<HTMLDivElement> {
30
+ condition: Condition
31
+ enteredInError: boolean
32
+ }
33
+
34
+ interface IStyledDescription {
35
+ enteredInError: boolean
36
+ }
37
+
38
+ export default DiagnosisStatus
@@ -1,34 +1,34 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
- import { SNIPPET_HOVER_TEXT } from '../constants'
7
-
8
- const StyledConditionTitle = styled.div<IStyledDescription>`
9
- color: ${TEXT_COLOURS.PRIMARY};
10
- text-align: left;
11
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
12
- `
13
-
14
- const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, ...rest }) => {
15
- const snippetMetadataTag = condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)
16
- const conditionCoding = condition?.code
17
-
18
- return (
19
- <StyledConditionTitle enteredInError={enteredInError} {...rest}>
20
- {snippetMetadataTag?.display || conditionCoding?.text}
21
- </StyledConditionTitle>
22
- )
23
- }
24
-
25
- interface Props extends HTMLAttributes<HTMLDivElement> {
26
- condition: Condition
27
- enteredInError: boolean
28
- }
29
-
30
- interface IStyledDescription {
31
- enteredInError: boolean
32
- }
33
-
34
- export default DiagnosisTitle
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+ import { SNIPPET_HOVER_TEXT } from '../constants'
7
+
8
+ const StyledConditionTitle = styled.div<IStyledDescription>`
9
+ color: ${TEXT_COLOURS.PRIMARY};
10
+ text-align: left;
11
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
12
+ `
13
+
14
+ const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, ...rest }) => {
15
+ const snippetMetadataTag = condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)
16
+ const conditionCoding = condition?.code
17
+
18
+ return (
19
+ <StyledConditionTitle enteredInError={enteredInError} {...rest}>
20
+ {snippetMetadataTag?.display || conditionCoding?.text}
21
+ </StyledConditionTitle>
22
+ )
23
+ }
24
+
25
+ interface Props extends HTMLAttributes<HTMLDivElement> {
26
+ condition: Condition
27
+ enteredInError: boolean
28
+ }
29
+
30
+ interface IStyledDescription {
31
+ enteredInError: boolean
32
+ }
33
+
34
+ export default DiagnosisTitle
package/src/constants.ts CHANGED
@@ -1,5 +1,5 @@
1
- const SNIPPET_HOVER_TEXT = 'https://leedsth.nhs.uk/cds/snippet-hover-text'
2
- const EXTENSION_TEMPLATE_DISPLAY_NAME = 'https://leedsth.nhs.uk/cds/extension-template-display-name'
3
- const EXTENSION_TEMPLATE_VERSION = 'https://leedsth.nhs.uk/cds/extension-template-version'
4
-
5
- export { EXTENSION_TEMPLATE_DISPLAY_NAME, EXTENSION_TEMPLATE_VERSION, SNIPPET_HOVER_TEXT }
1
+ const SNIPPET_HOVER_TEXT = 'https://leedsth.nhs.uk/cds/snippet-hover-text'
2
+ const EXTENSION_TEMPLATE_DISPLAY_NAME = 'https://leedsth.nhs.uk/cds/extension-template-display-name'
3
+ const EXTENSION_TEMPLATE_VERSION = 'https://leedsth.nhs.uk/cds/extension-template-version'
4
+
5
+ export { EXTENSION_TEMPLATE_DISPLAY_NAME, EXTENSION_TEMPLATE_VERSION, SNIPPET_HOVER_TEXT }
package/src/index.tsx CHANGED
@@ -1,3 +1,3 @@
1
- import DiagnosisSummary from './organisms/diagnosis-summary'
2
-
3
- export default DiagnosisSummary
1
+ import DiagnosisSummary from './organisms/diagnosis-summary'
2
+
3
+ export default DiagnosisSummary
@@ -1,31 +1,31 @@
1
- import { FC } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { Condition } from '@ltht-react/types'
5
- import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
6
-
7
- const StyledRedactedDescription = styled.div`
8
- flex-grow: 1;
9
- text-align: left;
10
- `
11
-
12
- const StyledDateSummary = styled.div`
13
- text-align: right;
14
- `
15
-
16
- const DiagnosisRedacted: FC<Props> = ({ condition }) => (
17
- <>
18
- <StyledRedactedDescription>
19
- <RedactedDescription />
20
- </StyledRedactedDescription>
21
- <StyledDateSummary>
22
- <DateSummary datetime={condition?.onset?.dateTime} />
23
- </StyledDateSummary>
24
- </>
25
- )
26
-
27
- interface Props {
28
- condition?: Condition | null
29
- }
30
-
31
- export default DiagnosisRedacted
1
+ import { FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { Condition } from '@ltht-react/types'
5
+ import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
6
+
7
+ const StyledRedactedDescription = styled.div`
8
+ flex-grow: 1;
9
+ text-align: left;
10
+ `
11
+
12
+ const StyledDateSummary = styled.div`
13
+ text-align: right;
14
+ `
15
+
16
+ const DiagnosisRedacted: FC<Props> = ({ condition }) => (
17
+ <>
18
+ <StyledRedactedDescription>
19
+ <RedactedDescription />
20
+ </StyledRedactedDescription>
21
+ <StyledDateSummary>
22
+ <DateSummary datetime={condition?.onset?.dateTime} />
23
+ </StyledDateSummary>
24
+ </>
25
+ )
26
+
27
+ interface Props {
28
+ condition?: Condition | null
29
+ }
30
+
31
+ export default DiagnosisRedacted
@@ -1,163 +1,183 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { Condition, ConditionVerificationStatus } from '@ltht-react/types'
5
- import { DateSummary } from '@ltht-react/type-summary'
6
- import Icon from '@ltht-react/icon'
7
- import { Button, ButtonProps } from '@ltht-react/button'
8
-
9
- import { BTN_COLOURS, MOBILE_MAXIMUM_MEDIA_QUERY, SMALL_SCREEN_MAXIMUM_MEDIA_QUERY } from '@ltht-react/styles'
10
- import Title from '../atoms/diagnosis-title'
11
- import OnsetDateEstimated from '../atoms/diagnosis-onset-estimated'
12
- import Redacted from '../molecules/diagnosis-redacted'
13
-
14
- const StyledTitle = styled.div`
15
- display: inline-block;
16
- `
17
- const StyledSummary = styled.div`
18
- display: flex;
19
- justify-content: center;
20
- `
21
- const StyledDescription = styled.div`
22
- flex-grow: 1;
23
- `
24
- const StyledLeftContainer = styled.div`
25
- display: flex;
26
- flex-grow: 1;
27
- flex-direction: row;
28
-
29
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
30
- flex-direction: column;
31
- }
32
- `
33
- const StyledControlsContainer = styled.div`
34
- display: flex;
35
- margin: auto 10px auto 10px;
36
- flex-direction: column;
37
-
38
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
39
- margin: 10px 0 0 0;
40
- flex-flow: row wrap;
41
- }
42
-
43
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
44
- margin: 10px 5px 0 0;
45
- flex-direction: column;
46
- }
47
- `
48
- const StyledButton = styled(Button)`
49
- margin: 2px 0 2px 0;
50
- font-size: 0.8em !important;
51
- padding: 1px 5px;
52
-
53
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
54
- margin: 2px 5px 2px 0;
55
- width: fit-content;
56
- }
57
-
58
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
59
- margin: 2px 0 2px 0;
60
- width: 100%;
61
- max-width: 200px;
62
- }
63
- `
64
-
65
- const StyledDate = styled.div`
66
- text-align: left;
67
- width: 15%;
68
- `
69
- const IconButtonWrapper = styled(Button)`
70
- -webkit-box-align: center;
71
- align-items: center;
72
- -webkit-box-pack: center;
73
- justify-content: center;
74
- margin-right: 0.5rem;
75
- display: inline-block !important;
76
- margin-left: 0.5rem;
77
- width: auto;
78
- `
79
- const IconWrapper = styled.div`
80
- margin-left: 0.5rem;
81
- display: inline-block;
82
- `
83
-
84
- const DiagnosisSummary: FC<Props> = ({
85
- condition,
86
- extendedTemplateDisplayName,
87
- extensionTemplateDisplayName,
88
- extensionClickHandler,
89
- isReadOnly = false,
90
- dateOnlyView = false,
91
- canExtendDiagnosis = false,
92
- controls = [],
93
- ...rest
94
- }) => {
95
- if (condition.metadata.isRedacted) {
96
- return (
97
- <StyledSummary {...rest}>
98
- <Redacted condition={condition} />
99
- </StyledSummary>
100
- )
101
- }
102
-
103
- const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
104
-
105
- return (
106
- <StyledSummary {...rest}>
107
- <StyledLeftContainer>
108
- <StyledDescription>
109
- <StyledTitle>
110
- <Title enteredInError={enteredInError} condition={condition} />
111
- </StyledTitle>
112
- {extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
113
- <IconButtonWrapper
114
- onClick={extensionClickHandler}
115
- type="button"
116
- styling={{ buttonStyle: 'clear' }}
117
- value=""
118
- icon={<Icon type="folder-plus" size="medium" />}
119
- iconPlacement="center"
120
- iconColour={BTN_COLOURS.PRIMARY.VALUE}
121
- title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
122
- />
123
- )}
124
- {extendedTemplateDisplayName && (
125
- <IconWrapper>
126
- <Icon
127
- type="comment"
128
- size="medium"
129
- title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
130
- To view these extra details, click into the full diagnosis detail or edit the existing form.`}
131
- />
132
- </IconWrapper>
133
- )}
134
- </StyledDescription>
135
-
136
- {!isReadOnly && controls.length > 0 && (
137
- <StyledControlsContainer>
138
- {controls.map((props, index) => (
139
- <StyledButton key={index} {...props} />
140
- ))}
141
- </StyledControlsContainer>
142
- )}
143
- </StyledLeftContainer>
144
- <StyledDate>
145
- <DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
146
- <OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
147
- </StyledDate>
148
- </StyledSummary>
149
- )
150
- }
151
-
152
- interface Props extends HTMLAttributes<HTMLDivElement> {
153
- condition: Condition
154
- extendedTemplateDisplayName?: string | undefined
155
- extensionTemplateDisplayName?: string | undefined
156
- extensionClickHandler?(): void
157
- isReadOnly: boolean
158
- dateOnlyView?: boolean
159
- controls?: ButtonProps[]
160
- canExtendDiagnosis?: boolean
161
- }
162
-
163
- export default DiagnosisSummary
1
+ import { cloneElement, FC, HTMLAttributes, ReactElement } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { Condition, ConditionVerificationStatus } from '@ltht-react/types'
5
+ import { DateSummary } from '@ltht-react/type-summary'
6
+ import Icon from '@ltht-react/icon'
7
+ import { Button, ButtonProps } from '@ltht-react/button'
8
+
9
+ import { BTN_COLOURS, MOBILE_MAXIMUM_MEDIA_QUERY, SMALL_SCREEN_MAXIMUM_MEDIA_QUERY } from '@ltht-react/styles'
10
+ import Title from '../atoms/diagnosis-title'
11
+ import OnsetDateEstimated from '../atoms/diagnosis-onset-estimated'
12
+ import Redacted from '../molecules/diagnosis-redacted'
13
+
14
+ const StyledTitle = styled.div`
15
+ display: inline-block;
16
+ `
17
+ const StyledSummary = styled.div`
18
+ display: flex;
19
+ justify-content: center;
20
+ `
21
+ const StyledDescription = styled.div`
22
+ flex-grow: 1;
23
+ `
24
+ const StyledLeftContainer = styled.div`
25
+ display: flex;
26
+ flex-grow: 1;
27
+ flex-direction: row;
28
+ gap: 0.3rem;
29
+
30
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
31
+ flex-direction: column;
32
+ }
33
+ `
34
+ const StyledResponsiveContainer = styled.div`
35
+ display: flex;
36
+ margin: 0 10px 0 10px;
37
+ flex-direction: column;
38
+ gap: 0.3rem;
39
+ align-items: center;
40
+ justify-content: center;
41
+
42
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
43
+ margin: 0;
44
+ flex-flow: row wrap;
45
+ justify-content: start;
46
+
47
+ & > * {
48
+ width: fit-content;
49
+ }
50
+ }
51
+
52
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
53
+ margin: 0;
54
+ flex-direction: column wrap;
55
+
56
+ & > * {
57
+ width: 100%;
58
+ max-width: 200px;
59
+ display: flex;
60
+ justify-content: center;
61
+ }
62
+ }
63
+ `
64
+ const StyledButton = styled(Button)`
65
+ font-size: 0.8em !important;
66
+ padding: 1px 5px;
67
+
68
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
69
+ width: fit-content;
70
+ }
71
+
72
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
73
+ width: 100%;
74
+ max-width: 200px;
75
+ }
76
+ `
77
+ const StyledDate = styled.div`
78
+ text-align: left;
79
+ width: 15%;
80
+ `
81
+ const IconButtonWrapper = styled(Button)`
82
+ -webkit-box-align: center;
83
+ align-items: center;
84
+ -webkit-box-pack: center;
85
+ justify-content: center;
86
+ margin-right: 0.5rem;
87
+ display: inline-block !important;
88
+ margin-left: 0.5rem;
89
+ width: auto;
90
+ `
91
+ const IconWrapper = styled.div`
92
+ margin-left: 0.5rem;
93
+ display: inline-block;
94
+ `
95
+
96
+ const DiagnosisSummary: FC<Props> = ({
97
+ condition,
98
+ extendedTemplateDisplayName,
99
+ extensionTemplateDisplayName,
100
+ extensionClickHandler,
101
+ isReadOnly = false,
102
+ dateOnlyView = false,
103
+ canExtendDiagnosis = false,
104
+ controls = [],
105
+ tags = [],
106
+ ...rest
107
+ }) => {
108
+ if (condition.metadata.isRedacted) {
109
+ return (
110
+ <StyledSummary {...rest}>
111
+ <Redacted condition={condition} />
112
+ </StyledSummary>
113
+ )
114
+ }
115
+
116
+ const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
117
+
118
+ return (
119
+ <StyledSummary {...rest}>
120
+ <StyledLeftContainer>
121
+ <StyledDescription>
122
+ <StyledTitle>
123
+ <Title enteredInError={enteredInError} condition={condition} />
124
+ </StyledTitle>
125
+ {extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
126
+ <IconButtonWrapper
127
+ onClick={extensionClickHandler}
128
+ type="button"
129
+ styling={{ buttonStyle: 'clear' }}
130
+ value=""
131
+ icon={<Icon type="folder-plus" size="medium" />}
132
+ iconPlacement="center"
133
+ iconColour={BTN_COLOURS.PRIMARY.VALUE}
134
+ title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
135
+ />
136
+ )}
137
+ {extendedTemplateDisplayName && (
138
+ <IconWrapper>
139
+ <Icon
140
+ type="comment"
141
+ size="medium"
142
+ title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
143
+ To view these extra details, click into the full diagnosis detail or edit the existing form.`}
144
+ />
145
+ </IconWrapper>
146
+ )}
147
+ </StyledDescription>
148
+
149
+ {tags.length > 0 && (
150
+ <StyledResponsiveContainer>
151
+ {tags?.map((tag, index) => (tag.key ? tag : cloneElement(tag, { key: index })))}
152
+ </StyledResponsiveContainer>
153
+ )}
154
+
155
+ {!isReadOnly && controls.length > 0 && (
156
+ <StyledResponsiveContainer>
157
+ {controls.map((props, index) => (
158
+ <StyledButton key={index} {...props} />
159
+ ))}
160
+ </StyledResponsiveContainer>
161
+ )}
162
+ </StyledLeftContainer>
163
+ <StyledDate>
164
+ <DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
165
+ <OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
166
+ </StyledDate>
167
+ </StyledSummary>
168
+ )
169
+ }
170
+
171
+ interface Props extends HTMLAttributes<HTMLDivElement> {
172
+ condition: Condition
173
+ extendedTemplateDisplayName?: string | undefined
174
+ extensionTemplateDisplayName?: string | undefined
175
+ extensionClickHandler?(): void
176
+ isReadOnly: boolean
177
+ dateOnlyView?: boolean
178
+ controls?: ButtonProps[]
179
+ tags?: ReactElement[]
180
+ canExtendDiagnosis?: boolean
181
+ }
182
+
183
+ export default DiagnosisSummary