@ltht-react/diagnosis-summary 2.0.125 → 2.0.127

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 |
@@ -4,5 +4,6 @@ declare const DiagnosisTitle: FC<Props>;
4
4
  interface Props extends HTMLAttributes<HTMLDivElement> {
5
5
  condition: Condition;
6
6
  enteredInError: boolean;
7
+ systemExclusionsFilter?: string[];
7
8
  }
8
9
  export default DiagnosisTitle;
@@ -17,21 +17,21 @@ var StyledConditionTitle = styled_1.default.div(templateObject_1 || (templateObj
17
17
  return (enteredInError ? 'line-through' : 'none');
18
18
  });
19
19
  var DiagnosisTitle = function (_a) {
20
- var condition = _a.condition, enteredInError = _a.enteredInError;
20
+ var condition = _a.condition, enteredInError = _a.enteredInError, systemExclusionsFilter = _a.systemExclusionsFilter;
21
21
  var snippetTagText = extractSnippetTagDisplayValue(condition);
22
22
  if (snippetTagText) {
23
23
  return renderTitle(snippetTagText, enteredInError);
24
24
  }
25
- var conditionText = extractConditionOrFallbackText(condition);
25
+ var conditionText = extractConditionOrFallbackText(condition, systemExclusionsFilter);
26
26
  var conditionStatusText = extractConditionStatusText(condition);
27
27
  var title = conditionStatusText ? "".concat(conditionText, ", ").concat(conditionStatusText) : conditionText;
28
28
  return renderTitle(title, enteredInError);
29
29
  };
30
- var extractConditionOrFallbackText = function (condition) {
30
+ var extractConditionOrFallbackText = function (condition, systemExclusionsFilter) {
31
31
  if (!(condition === null || condition === void 0 ? void 0 : condition.code)) {
32
32
  return (0, utils_1.titleCase)('Unknown Condition');
33
33
  }
34
- var diagnosisTitle = (0, utils_1.codeableConceptDisplaySummary)(condition.code);
34
+ var diagnosisTitle = (0, utils_1.codeableConceptDisplaySummary)(condition.code, systemExclusionsFilter);
35
35
  return (0, utils_1.titleCase)(diagnosisTitle || 'Unknown Condition');
36
36
  };
37
37
  var extractConditionStatusText = function (condition) {
@@ -1 +1 @@
1
- {"version":3,"file":"diagnosis-title.js","sourceRoot":"","sources":["../../src/atoms/diagnosis-title.tsx"],"names":[],"mappings":";;;;;;;;;;AACA,2DAAoC;AACpC,2CAA4E;AAE5E,6CAAiD;AAEjD,0CAAiD;AAEjD,IAAM,oBAAoB,GAAG,gBAAM,CAAC,GAAG,sIAAoB,aAChD,EAAoB,6CAEV,EAAkE,KACtF,KAHU,qBAAY,CAAC,OAAO,EAEV,UAAC,EAAkB;QAAhB,cAAc,oBAAA;IAAO,OAAA,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC;AAA1C,CAA0C,CACtF,CAAA;AAED,IAAM,cAAc,GAAc,UAAC,EAA6B;QAA3B,SAAS,eAAA,EAAE,cAAc,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Q,CAAC,GAAG,0CAAE,IAAI,CAAC,UAAC,MAAM,IAAK,OAAA,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,MAAK,8BAAkB,EAArC,CAAqC,CAAC,0CAAE,OAAO,CAAA,EAAA,CAAA;AAE3F,IAAM,WAAW,GAAG,UAAC,KAAa,EAAE,cAAuB,IAAK,OAAA,CAC9D,uBAAC,oBAAoB,IAAC,cAAc,EAAE,cAAc,YAAG,KAAK,GAAwB,CACrF,EAF+D,CAE/D,CAAA;AAYD,kBAAe,cAAc,CAAA"}
@@ -13,5 +13,6 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
13
13
  tags?: ReactElement[];
14
14
  canExtendDiagnosis?: boolean;
15
15
  extensionClickHandler?(): void;
16
+ systemExclusionsFilter?: string[];
16
17
  }
17
18
  export default DiagnosisSummary;
@@ -51,12 +51,12 @@ var StyledDate = styled_1.default.div(templateObject_7 || (templateObject_7 = __
51
51
  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"])));
52
52
  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"])));
53
53
  var DiagnosisSummary = function (_a) {
54
- 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.displaySource, displaySource = _e === void 0 ? false : _e, _f = _a.controls, controls = _f === void 0 ? [] : _f, _g = _a.tags, tags = _g === void 0 ? [] : _g, rest = __rest(_a, ["condition", "extendedTemplateDisplayName", "extensionTemplateDisplayName", "extensionClickHandler", "isReadOnly", "dateOnlyView", "canExtendDiagnosis", "displaySource", "controls", "tags"]);
54
+ 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.displaySource, displaySource = _e === void 0 ? false : _e, _f = _a.controls, controls = _f === void 0 ? [] : _f, _g = _a.tags, tags = _g === void 0 ? [] : _g, _h = _a.systemExclusionsFilter, systemExclusionsFilter = _h === void 0 ? [] : _h, rest = __rest(_a, ["condition", "extendedTemplateDisplayName", "extensionTemplateDisplayName", "extensionClickHandler", "isReadOnly", "dateOnlyView", "canExtendDiagnosis", "displaySource", "controls", "tags", "systemExclusionsFilter"]);
55
55
  if (condition.metadata.isRedacted) {
56
56
  return ((0, jsx_runtime_1.jsx)(StyledSummary, __assign({}, rest, { children: (0, jsx_runtime_1.jsx)(diagnosis_redacted_1.default, { condition: condition }) })));
57
57
  }
58
58
  var enteredInError = condition.verificationStatus === types_1.ConditionVerificationStatus.EnteredInError;
59
- 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.") }) })), displaySource && (0, jsx_runtime_1.jsx)(diagnosis_data_source_1.default, { condition: condition, enteredInError: enteredInError })] }), 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 })] })] })));
59
+ 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, systemExclusionsFilter: systemExclusionsFilter }) }), 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.") }) })), displaySource && (0, jsx_runtime_1.jsx)(diagnosis_data_source_1.default, { condition: condition, enteredInError: enteredInError })] }), 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 })] })] })));
60
60
  };
61
61
  exports.default = DiagnosisSummary;
62
62
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
@@ -1 +1 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AAE,gFAAyE,2BAA2B,gHACnB,GACxF,GACU,CACf,EAEA,aAAa,IAAI,uBAAC,+BAAmB,IAAC,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,GAAI,IAC7E,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;AAgBD,kBAAe,gBAAgB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ltht-react/diagnosis-summary",
3
- "version": "2.0.125",
3
+ "version": "2.0.127",
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.125",
32
- "@ltht-react/hooks": "^2.0.125",
33
- "@ltht-react/icon": "^2.0.125",
34
- "@ltht-react/list": "^2.0.125",
35
- "@ltht-react/styles": "^2.0.125",
36
- "@ltht-react/type-summary": "^2.0.125",
37
- "@ltht-react/types": "^2.0.125",
38
- "@ltht-react/utils": "^2.0.125",
31
+ "@ltht-react/button": "^2.0.127",
32
+ "@ltht-react/hooks": "^2.0.127",
33
+ "@ltht-react/icon": "^2.0.127",
34
+ "@ltht-react/list": "^2.0.127",
35
+ "@ltht-react/styles": "^2.0.127",
36
+ "@ltht-react/type-summary": "^2.0.127",
37
+ "@ltht-react/types": "^2.0.127",
38
+ "@ltht-react/utils": "^2.0.127",
39
39
  "react": "^18.2.0"
40
40
  },
41
- "gitHead": "6dc6d7e016ad36a963ee10bc4ea2fc140aa7378c"
41
+ "gitHead": "a04846c517f1381d8ab96f7ac6b95ad087016efb"
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,46 +1,46 @@
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
- const StyledConditionStatus = styled.div<IStyledDescription>`
8
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
- text-align: left;
10
- font-size: smaller;
11
- padding-top: 0.25rem;
12
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
13
- `
14
-
15
- const extractDataSourceDisplayNames = (condition: Condition) => {
16
- const dataSourceDisplayNames: string[] = []
17
-
18
- condition?.metadata?.dataSources?.forEach((dataSource, _) => {
19
- if (dataSource?.display) {
20
- dataSourceDisplayNames.push(dataSource.display)
21
- }
22
- })
23
-
24
- return dataSourceDisplayNames.join(', ')
25
- }
26
-
27
- const DiagnosisDataSource: FC<Props> = ({ condition, enteredInError, ...rest }) => {
28
- const dataSourceDisplayNames = extractDataSourceDisplayNames(condition)
29
-
30
- return (
31
- <StyledConditionStatus enteredInError={enteredInError} {...rest}>
32
- {dataSourceDisplayNames ? `Source: ${dataSourceDisplayNames}` : `Source: Unknown`}
33
- </StyledConditionStatus>
34
- )
35
- }
36
-
37
- interface Props extends HTMLAttributes<HTMLDivElement> {
38
- condition: Condition
39
- enteredInError: boolean
40
- }
41
-
42
- interface IStyledDescription {
43
- enteredInError: boolean
44
- }
45
-
46
- export default DiagnosisDataSource
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
+ const StyledConditionStatus = styled.div<IStyledDescription>`
8
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
+ text-align: left;
10
+ font-size: smaller;
11
+ padding-top: 0.25rem;
12
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
13
+ `
14
+
15
+ const extractDataSourceDisplayNames = (condition: Condition) => {
16
+ const dataSourceDisplayNames: string[] = []
17
+
18
+ condition?.metadata?.dataSources?.forEach((dataSource, _) => {
19
+ if (dataSource?.display) {
20
+ dataSourceDisplayNames.push(dataSource.display)
21
+ }
22
+ })
23
+
24
+ return dataSourceDisplayNames.join(', ')
25
+ }
26
+
27
+ const DiagnosisDataSource: FC<Props> = ({ condition, enteredInError, ...rest }) => {
28
+ const dataSourceDisplayNames = extractDataSourceDisplayNames(condition)
29
+
30
+ return (
31
+ <StyledConditionStatus enteredInError={enteredInError} {...rest}>
32
+ {dataSourceDisplayNames ? `Source: ${dataSourceDisplayNames}` : `Source: Unknown`}
33
+ </StyledConditionStatus>
34
+ )
35
+ }
36
+
37
+ interface Props extends HTMLAttributes<HTMLDivElement> {
38
+ condition: Condition
39
+ enteredInError: boolean
40
+ }
41
+
42
+ interface IStyledDescription {
43
+ enteredInError: boolean
44
+ }
45
+
46
+ export default DiagnosisDataSource
@@ -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,69 +1,70 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
- import { titleCase, codeableConceptDisplaySummary } from '@ltht-react/utils'
4
-
5
- import { TEXT_COLOURS } from '@ltht-react/styles'
6
- import { Condition } from '@ltht-react/types'
7
- import { SNIPPET_HOVER_TEXT } from '../constants'
8
-
9
- const StyledConditionTitle = styled.div<IStyledDescription>`
10
- color: ${TEXT_COLOURS.PRIMARY};
11
- text-align: left;
12
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
13
- `
14
-
15
- const DiagnosisTitle: FC<Props> = ({ condition, enteredInError }) => {
16
- const snippetTagText = extractSnippetTagDisplayValue(condition)
17
-
18
- if (snippetTagText) {
19
- return renderTitle(snippetTagText, enteredInError)
20
- }
21
-
22
- const conditionText = extractConditionOrFallbackText(condition)
23
- const conditionStatusText = extractConditionStatusText(condition)
24
- const title = conditionStatusText ? `${conditionText}, ${conditionStatusText}` : conditionText
25
-
26
- return renderTitle(title, enteredInError)
27
- }
28
-
29
- const extractConditionOrFallbackText = (condition: Condition): string => {
30
- if (!condition?.code) {
31
- return titleCase('Unknown Condition')
32
- }
33
-
34
- const diagnosisTitle = codeableConceptDisplaySummary(condition.code)
35
-
36
- return titleCase(diagnosisTitle || 'Unknown Condition')
37
- }
38
-
39
- const extractConditionStatusText = (condition: Condition): string => {
40
- const statusParts: string[] = []
41
-
42
- if (condition?.clinicalStatus) {
43
- statusParts.push(condition?.clinicalStatus)
44
- }
45
-
46
- if (condition?.verificationStatus) {
47
- statusParts.push(condition.verificationStatus)
48
- }
49
-
50
- return titleCase(statusParts.join(', '))
51
- }
52
-
53
- const extractSnippetTagDisplayValue = (condition: Condition) =>
54
- condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)?.display
55
-
56
- const renderTitle = (title: string, enteredInError: boolean) => (
57
- <StyledConditionTitle enteredInError={enteredInError}>{title}</StyledConditionTitle>
58
- )
59
-
60
- interface Props extends HTMLAttributes<HTMLDivElement> {
61
- condition: Condition
62
- enteredInError: boolean
63
- }
64
-
65
- interface IStyledDescription {
66
- enteredInError: boolean
67
- }
68
-
69
- export default DiagnosisTitle
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { titleCase, codeableConceptDisplaySummary } from '@ltht-react/utils'
4
+
5
+ import { TEXT_COLOURS } from '@ltht-react/styles'
6
+ import { Condition } from '@ltht-react/types'
7
+ import { SNIPPET_HOVER_TEXT } from '../constants'
8
+
9
+ const StyledConditionTitle = styled.div<IStyledDescription>`
10
+ color: ${TEXT_COLOURS.PRIMARY};
11
+ text-align: left;
12
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
13
+ `
14
+
15
+ const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, systemExclusionsFilter }) => {
16
+ const snippetTagText = extractSnippetTagDisplayValue(condition)
17
+
18
+ if (snippetTagText) {
19
+ return renderTitle(snippetTagText, enteredInError)
20
+ }
21
+
22
+ const conditionText = extractConditionOrFallbackText(condition, systemExclusionsFilter)
23
+ const conditionStatusText = extractConditionStatusText(condition)
24
+ const title = conditionStatusText ? `${conditionText}, ${conditionStatusText}` : conditionText
25
+
26
+ return renderTitle(title, enteredInError)
27
+ }
28
+
29
+ const extractConditionOrFallbackText = (condition: Condition, systemExclusionsFilter?: string[]): string => {
30
+ if (!condition?.code) {
31
+ return titleCase('Unknown Condition')
32
+ }
33
+
34
+ const diagnosisTitle = codeableConceptDisplaySummary(condition.code, systemExclusionsFilter)
35
+
36
+ return titleCase(diagnosisTitle || 'Unknown Condition')
37
+ }
38
+
39
+ const extractConditionStatusText = (condition: Condition): string => {
40
+ const statusParts: string[] = []
41
+
42
+ if (condition?.clinicalStatus) {
43
+ statusParts.push(condition?.clinicalStatus)
44
+ }
45
+
46
+ if (condition?.verificationStatus) {
47
+ statusParts.push(condition.verificationStatus)
48
+ }
49
+
50
+ return titleCase(statusParts.join(', '))
51
+ }
52
+
53
+ const extractSnippetTagDisplayValue = (condition: Condition) =>
54
+ condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)?.display
55
+
56
+ const renderTitle = (title: string, enteredInError: boolean) => (
57
+ <StyledConditionTitle enteredInError={enteredInError}>{title}</StyledConditionTitle>
58
+ )
59
+
60
+ interface Props extends HTMLAttributes<HTMLDivElement> {
61
+ condition: Condition
62
+ enteredInError: boolean
63
+ systemExclusionsFilter?: string[]
64
+ }
65
+
66
+ interface IStyledDescription {
67
+ enteredInError: boolean
68
+ }
69
+
70
+ 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,189 +1,194 @@
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
- import DiagnosisDataSource from '../atoms/diagnosis-data-source'
14
-
15
- const StyledTitle = styled.div`
16
- display: inline-block;
17
- `
18
- const StyledSummary = styled.div`
19
- display: flex;
20
- justify-content: center;
21
- `
22
- const StyledDescription = styled.div`
23
- flex-grow: 1;
24
- `
25
- const StyledLeftContainer = styled.div`
26
- display: flex;
27
- flex-grow: 1;
28
- flex-direction: row;
29
- gap: 0.3rem;
30
-
31
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
32
- flex-direction: column;
33
- }
34
- `
35
- const StyledResponsiveContainer = styled.div`
36
- display: flex;
37
- margin: 0 10px 0 10px;
38
- flex-direction: column;
39
- gap: 0.3rem;
40
- align-items: center;
41
- justify-content: center;
42
-
43
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
44
- margin: 0;
45
- flex-flow: row wrap;
46
- justify-content: start;
47
-
48
- & > * {
49
- width: fit-content;
50
- }
51
- }
52
-
53
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
54
- margin: 0;
55
- flex-direction: column wrap;
56
-
57
- & > * {
58
- width: 100%;
59
- max-width: 200px;
60
- display: flex;
61
- justify-content: center;
62
- }
63
- }
64
- `
65
- const StyledButton = styled(Button)`
66
- font-size: 0.8em !important;
67
- padding: 1px 5px;
68
-
69
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
70
- width: fit-content;
71
- }
72
-
73
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
74
- width: 100%;
75
- max-width: 200px;
76
- }
77
- `
78
- const StyledDate = styled.div`
79
- text-align: left;
80
- width: 15%;
81
- `
82
- const IconButtonWrapper = styled(Button)`
83
- -webkit-box-align: center;
84
- align-items: center;
85
- -webkit-box-pack: center;
86
- justify-content: center;
87
- margin-right: 0.5rem;
88
- display: inline-block !important;
89
- margin-left: 0.5rem;
90
- width: auto;
91
- `
92
- const IconWrapper = styled.div`
93
- margin-left: 0.5rem;
94
- display: inline-block;
95
- `
96
-
97
- const DiagnosisSummary: FC<Props> = ({
98
- condition,
99
- extendedTemplateDisplayName,
100
- extensionTemplateDisplayName,
101
- extensionClickHandler,
102
- isReadOnly = false,
103
- dateOnlyView = false,
104
- canExtendDiagnosis = false,
105
- displaySource = false,
106
- controls = [],
107
- tags = [],
108
- ...rest
109
- }) => {
110
- if (condition.metadata.isRedacted) {
111
- return (
112
- <StyledSummary {...rest}>
113
- <Redacted condition={condition} />
114
- </StyledSummary>
115
- )
116
- }
117
-
118
- const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
119
-
120
- return (
121
- <StyledSummary {...rest}>
122
- <StyledLeftContainer>
123
- <StyledDescription>
124
- <StyledTitle>
125
- <Title enteredInError={enteredInError} condition={condition} />
126
- </StyledTitle>
127
- {extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
128
- <IconButtonWrapper
129
- onClick={extensionClickHandler}
130
- type="button"
131
- styling={{ buttonStyle: 'clear' }}
132
- value=""
133
- icon={<Icon type="folder-plus" size="medium" />}
134
- iconPlacement="center"
135
- iconColour={BTN_COLOURS.PRIMARY.VALUE}
136
- title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
137
- />
138
- )}
139
- {extendedTemplateDisplayName && (
140
- <IconWrapper>
141
- <Icon
142
- type="comment"
143
- size="medium"
144
- title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
145
- To view these extra details, click into the full diagnosis detail or edit the existing form.`}
146
- />
147
- </IconWrapper>
148
- )}
149
-
150
- {displaySource && <DiagnosisDataSource condition={condition} enteredInError={enteredInError} />}
151
- </StyledDescription>
152
-
153
- {tags.length > 0 && (
154
- <StyledResponsiveContainer>
155
- {tags?.map((tag, index) => (tag.key ? tag : cloneElement(tag, { key: index })))}
156
- </StyledResponsiveContainer>
157
- )}
158
-
159
- {!isReadOnly && controls.length > 0 && (
160
- <StyledResponsiveContainer>
161
- {controls.map((props, index) => (
162
- <StyledButton key={index} {...props} />
163
- ))}
164
- </StyledResponsiveContainer>
165
- )}
166
- </StyledLeftContainer>
167
- <StyledDate>
168
- <DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
169
- <OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
170
- </StyledDate>
171
- </StyledSummary>
172
- )
173
- }
174
-
175
- interface Props extends HTMLAttributes<HTMLDivElement> {
176
- condition: Condition
177
- extendedTemplateDisplayName?: string | undefined
178
- extensionTemplateDisplayName?: string | undefined
179
- isReadOnly: boolean
180
- dateOnlyView?: boolean
181
- displaySource?: boolean
182
- controls?: ButtonProps[]
183
- tags?: ReactElement[]
184
- canExtendDiagnosis?: boolean
185
-
186
- extensionClickHandler?(): void
187
- }
188
-
189
- 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
+ import DiagnosisDataSource from '../atoms/diagnosis-data-source'
14
+
15
+ const StyledTitle = styled.div`
16
+ display: inline-block;
17
+ `
18
+ const StyledSummary = styled.div`
19
+ display: flex;
20
+ justify-content: center;
21
+ `
22
+ const StyledDescription = styled.div`
23
+ flex-grow: 1;
24
+ `
25
+ const StyledLeftContainer = styled.div`
26
+ display: flex;
27
+ flex-grow: 1;
28
+ flex-direction: row;
29
+ gap: 0.3rem;
30
+
31
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
32
+ flex-direction: column;
33
+ }
34
+ `
35
+ const StyledResponsiveContainer = styled.div`
36
+ display: flex;
37
+ margin: 0 10px 0 10px;
38
+ flex-direction: column;
39
+ gap: 0.3rem;
40
+ align-items: center;
41
+ justify-content: center;
42
+
43
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
44
+ margin: 0;
45
+ flex-flow: row wrap;
46
+ justify-content: start;
47
+
48
+ & > * {
49
+ width: fit-content;
50
+ }
51
+ }
52
+
53
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
54
+ margin: 0;
55
+ flex-direction: column wrap;
56
+
57
+ & > * {
58
+ width: 100%;
59
+ max-width: 200px;
60
+ display: flex;
61
+ justify-content: center;
62
+ }
63
+ }
64
+ `
65
+ const StyledButton = styled(Button)`
66
+ font-size: 0.8em !important;
67
+ padding: 1px 5px;
68
+
69
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
70
+ width: fit-content;
71
+ }
72
+
73
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
74
+ width: 100%;
75
+ max-width: 200px;
76
+ }
77
+ `
78
+ const StyledDate = styled.div`
79
+ text-align: left;
80
+ width: 15%;
81
+ `
82
+ const IconButtonWrapper = styled(Button)`
83
+ -webkit-box-align: center;
84
+ align-items: center;
85
+ -webkit-box-pack: center;
86
+ justify-content: center;
87
+ margin-right: 0.5rem;
88
+ display: inline-block !important;
89
+ margin-left: 0.5rem;
90
+ width: auto;
91
+ `
92
+ const IconWrapper = styled.div`
93
+ margin-left: 0.5rem;
94
+ display: inline-block;
95
+ `
96
+
97
+ const DiagnosisSummary: FC<Props> = ({
98
+ condition,
99
+ extendedTemplateDisplayName,
100
+ extensionTemplateDisplayName,
101
+ extensionClickHandler,
102
+ isReadOnly = false,
103
+ dateOnlyView = false,
104
+ canExtendDiagnosis = false,
105
+ displaySource = false,
106
+ controls = [],
107
+ tags = [],
108
+ systemExclusionsFilter = [],
109
+ ...rest
110
+ }) => {
111
+ if (condition.metadata.isRedacted) {
112
+ return (
113
+ <StyledSummary {...rest}>
114
+ <Redacted condition={condition} />
115
+ </StyledSummary>
116
+ )
117
+ }
118
+
119
+ const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
120
+
121
+ return (
122
+ <StyledSummary {...rest}>
123
+ <StyledLeftContainer>
124
+ <StyledDescription>
125
+ <StyledTitle>
126
+ <Title
127
+ enteredInError={enteredInError}
128
+ condition={condition}
129
+ systemExclusionsFilter={systemExclusionsFilter}
130
+ />
131
+ </StyledTitle>
132
+ {extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
133
+ <IconButtonWrapper
134
+ onClick={extensionClickHandler}
135
+ type="button"
136
+ styling={{ buttonStyle: 'clear' }}
137
+ value=""
138
+ icon={<Icon type="folder-plus" size="medium" />}
139
+ iconPlacement="center"
140
+ iconColour={BTN_COLOURS.PRIMARY.VALUE}
141
+ title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
142
+ />
143
+ )}
144
+ {extendedTemplateDisplayName && (
145
+ <IconWrapper>
146
+ <Icon
147
+ type="comment"
148
+ size="medium"
149
+ title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
150
+ To view these extra details, click into the full diagnosis detail or edit the existing form.`}
151
+ />
152
+ </IconWrapper>
153
+ )}
154
+
155
+ {displaySource && <DiagnosisDataSource condition={condition} enteredInError={enteredInError} />}
156
+ </StyledDescription>
157
+
158
+ {tags.length > 0 && (
159
+ <StyledResponsiveContainer>
160
+ {tags?.map((tag, index) => (tag.key ? tag : cloneElement(tag, { key: index })))}
161
+ </StyledResponsiveContainer>
162
+ )}
163
+
164
+ {!isReadOnly && controls.length > 0 && (
165
+ <StyledResponsiveContainer>
166
+ {controls.map((props, index) => (
167
+ <StyledButton key={index} {...props} />
168
+ ))}
169
+ </StyledResponsiveContainer>
170
+ )}
171
+ </StyledLeftContainer>
172
+ <StyledDate>
173
+ <DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
174
+ <OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
175
+ </StyledDate>
176
+ </StyledSummary>
177
+ )
178
+ }
179
+
180
+ interface Props extends HTMLAttributes<HTMLDivElement> {
181
+ condition: Condition
182
+ extendedTemplateDisplayName?: string | undefined
183
+ extensionTemplateDisplayName?: string | undefined
184
+ isReadOnly: boolean
185
+ dateOnlyView?: boolean
186
+ displaySource?: boolean
187
+ controls?: ButtonProps[]
188
+ tags?: ReactElement[]
189
+ canExtendDiagnosis?: boolean
190
+ extensionClickHandler?(): void
191
+ systemExclusionsFilter?: string[]
192
+ }
193
+
194
+ export default DiagnosisSummary