fhir-react 0.2.1 → 0.3.0

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 (163) hide show
  1. package/.github/workflows/publish_npmjs.yml +18 -0
  2. package/.storybook/config.js +9 -3
  3. package/.storybook/presets.js +1 -0
  4. package/.storybook/preview-head.html +4 -0
  5. package/README.md +86 -55
  6. package/package.json +13 -4
  7. package/src/assets/common/chevron-right.svg +3 -0
  8. package/src/assets/containers/AllergyIntolerance/allergy-intolerance.svg +9 -0
  9. package/src/assets/containers/Appointment/appointment.svg +14 -0
  10. package/src/assets/containers/CarePlan/care-plan.svg +10 -0
  11. package/src/assets/containers/CareTeam/care-team.svg +10 -0
  12. package/src/assets/containers/Claim/claim.svg +6 -0
  13. package/src/assets/containers/ClaimResponse/claim-response.svg +7 -0
  14. package/src/assets/containers/Condition/condition.svg +11 -0
  15. package/src/assets/containers/Device/device.svg +8 -0
  16. package/src/assets/containers/DiagnosticReport/diagnostic-report.svg +14 -0
  17. package/src/assets/containers/DocumentReference/document-reference.svg +10 -0
  18. package/src/assets/containers/Encounter/encounter.svg +10 -0
  19. package/src/assets/containers/ExplanationOfBenefit/explanation-of-benefit.svg +3 -0
  20. package/src/assets/containers/FamilyMemberHistory/family-member-history.svg +7 -0
  21. package/src/assets/containers/Goal/goal.svg +11 -0
  22. package/src/assets/containers/Immunization/immunization.svg +7 -0
  23. package/src/assets/containers/List/list.svg +3 -0
  24. package/src/assets/containers/Location/location.svg +4 -0
  25. package/src/assets/containers/Medication/medication.svg +5 -0
  26. package/src/assets/containers/MedicationAdministration/medication-administration.svg +6 -0
  27. package/src/assets/containers/MedicationKnowledge/medication-knowledge.svg +11 -0
  28. package/src/assets/containers/MedicationStatement/medication-statement.svg +5 -0
  29. package/src/assets/containers/Observation/observation.svg +12 -0
  30. package/src/assets/containers/Practitioner/practitioner.svg +5 -0
  31. package/src/assets/containers/Procedure/procedure.svg +9 -0
  32. package/src/assets/containers/Questionnaire/questionnaire.svg +6 -0
  33. package/src/assets/containers/QuestionnaireResponse/questionnaire-response.svg +6 -0
  34. package/src/assets/containers/QustionnaireResponse/questionnaire-response.svg +6 -0
  35. package/src/assets/containers/ResearchStudy/research-study.svg +9 -0
  36. package/src/assets/containers/ResourceCategory/resource-placeholder.svg +3 -0
  37. package/src/components/containers/Accordion/Accordion.js +80 -0
  38. package/src/components/containers/Accordion/Accordion.stories.js +76 -0
  39. package/src/components/containers/Accordion/index.js +3 -0
  40. package/src/components/containers/ResourceContainer/ResourceContainer.css +0 -1
  41. package/src/components/containers/ResourceContainer/ResourceContainer.js +1 -1
  42. package/src/components/datatypes/AccountBalance/AccountBalance.js +33 -0
  43. package/src/components/datatypes/AccountBalance/index.js +3 -0
  44. package/src/components/datatypes/Annotation/Annotation.js +1 -1
  45. package/src/components/datatypes/Coding/Coding.js +1 -1
  46. package/src/components/datatypes/Date/Date.js +14 -4
  47. package/src/components/datatypes/DatePeriod/DatePeriod.js +38 -0
  48. package/src/components/datatypes/DatePeriod/index.js +3 -0
  49. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +31 -0
  50. package/src/components/datatypes/HeaderIcon/index.js +3 -0
  51. package/src/components/datatypes/HumanName/HumanName.js +6 -21
  52. package/src/components/datatypes/Reference/Reference.js +3 -6
  53. package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
  54. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +4 -4
  55. package/src/components/resources/Appointment/Appointment.js +91 -65
  56. package/src/components/resources/Appointment/Appointment.test.js +3 -3
  57. package/src/components/resources/Bundle/Bundle.js +2 -2
  58. package/src/components/resources/Bundle/Bundle.stories.js +78 -12
  59. package/src/components/resources/Bundle/Bundle.test.js +3 -0
  60. package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
  61. package/src/components/resources/CareTeam/CareTeam.js +13 -14
  62. package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
  63. package/src/components/resources/Claim/Claim.test.js +6 -6
  64. package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
  65. package/src/components/resources/Condition/Condition.js +63 -47
  66. package/src/components/resources/Condition/Condition.stories.js +41 -8
  67. package/src/components/resources/Condition/Condition.test.js +20 -14
  68. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +5 -7
  69. package/src/components/resources/DocumentReference/DocumentReference.js +1 -1
  70. package/src/components/resources/DocumentReference/DocumentReference.test.js +3 -3
  71. package/src/components/resources/Encounter/Encounter.js +66 -36
  72. package/src/components/resources/Encounter/EncounterParticipants.js +2 -2
  73. package/src/components/resources/ExplanationOfBenefit/CareTeam.js +2 -2
  74. package/src/components/resources/ExplanationOfBenefit/Diagnosis.js +31 -5
  75. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +272 -201
  76. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +12 -0
  77. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +96 -62
  78. package/src/components/resources/ExplanationOfBenefit/Items.js +2 -2
  79. package/src/components/resources/ExplanationOfBenefit/PriceLabel.js +20 -0
  80. package/src/components/resources/ExplanationOfBenefit/Related.js +3 -3
  81. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +14 -3
  82. package/src/components/resources/ExplanationOfBenefit/TotalGraph.js +68 -0
  83. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.js +89 -0
  84. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +78 -0
  85. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.test.js +51 -0
  86. package/src/components/resources/ExplanationOfBenefitGraph/index.js +3 -0
  87. package/src/components/resources/Goal/Goal.test.js +1 -1
  88. package/src/components/resources/Immunization/Immunization.js +125 -94
  89. package/src/components/resources/Immunization/Immunization.stories.js +23 -4
  90. package/src/components/resources/Immunization/Immunization.test.js +17 -12
  91. package/src/components/resources/List/DrugTierDefinitionExtension.js +139 -0
  92. package/src/components/resources/List/Entries.js +66 -0
  93. package/src/components/resources/List/List.js +262 -0
  94. package/src/components/resources/List/List.stories.js +75 -0
  95. package/src/components/resources/List/List.test.js +95 -0
  96. package/src/components/resources/List/index.js +3 -0
  97. package/src/components/resources/List/utils.js +6 -0
  98. package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
  99. package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
  100. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +217 -0
  101. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +78 -0
  102. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.test.js +69 -0
  103. package/src/components/resources/MedicationKnowledge/index.js +3 -0
  104. package/src/components/resources/MedicationKnowledge/utils.js +8 -0
  105. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
  106. package/src/components/resources/Observation/Observation.js +72 -54
  107. package/src/components/resources/Observation/Observation.test.js +6 -18
  108. package/src/components/resources/Observation/ObservationGraph.js +159 -55
  109. package/src/components/resources/Observation/ObservationGraph.test.js +47 -26
  110. package/src/components/resources/Patient/Patient.js +79 -97
  111. package/src/components/resources/Patient/Patient.test.js +10 -10
  112. package/src/components/resources/Practitioner/Practitioner.js +80 -60
  113. package/src/components/resources/Practitioner/Practitioner.test.js +4 -4
  114. package/src/components/resources/Procedure/Procedure.js +99 -87
  115. package/src/components/resources/Procedure/Procedure.stories.js +8 -6
  116. package/src/components/resources/Procedure/Procedure.test.js +11 -8
  117. package/src/components/resources/Questionnaire/Questionnaire.test.js +3 -3
  118. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +5 -5
  119. package/src/components/resources/ReferralRequest/ReferralRequest.test.js +2 -2
  120. package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
  121. package/src/components/resources/ResourceCategory/ResourceCategory.js +56 -0
  122. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +29 -0
  123. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +101 -0
  124. package/src/components/resources/ResourceCategory/index.js +3 -0
  125. package/src/components/supportedFhirResourceList.js +4 -0
  126. package/src/components/ui/_header.scss +3 -0
  127. package/src/components/ui/bootstrap-reboot.min.css +2 -22
  128. package/src/components/ui/index.js +191 -29
  129. package/src/constants/badge-status.jsx +98 -0
  130. package/src/fixtures/dstu2/resources/condition/condition.svg +35 -0
  131. package/src/fixtures/dstu2/resources/immunization/immunization.svg +10 -0
  132. package/src/fixtures/dstu2/resources/list/example1.json +49 -0
  133. package/src/fixtures/dstu2/resources/list/example2.json +116 -0
  134. package/src/fixtures/dstu2/resources/list/example3.json +380 -0
  135. package/src/fixtures/example-icons.jsx +169 -0
  136. package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExtendedDiagnosis.json +446 -0
  137. package/src/fixtures/r4/resources/list/example1.json +45 -0
  138. package/src/fixtures/r4/resources/list/example2.json +282 -0
  139. package/src/fixtures/r4/resources/list/example3.json +298 -0
  140. package/src/fixtures/r4/resources/medicationKnowledge/example1.json +42 -0
  141. package/src/fixtures/r4/resources/medicationKnowledge/example2.json +59 -0
  142. package/src/fixtures/r4/resources/medicationKnowledge/example3.json +59 -0
  143. package/src/fixtures/r4/resources/medicationKnowledge/example4.json +59 -0
  144. package/src/fixtures/stu3/resources/list/example1.json +46 -0
  145. package/src/fixtures/stu3/resources/list/example2.json +298 -0
  146. package/src/fixtures/stu3/resources/list/example3.json +115 -0
  147. package/src/index.js +6 -1
  148. package/src/style.scss +176 -0
  149. package/src/utils/formatDate.js +21 -0
  150. package/src/utils/formatDate.test.js +22 -0
  151. package/src/utils/getBadgeColor.js +6 -0
  152. package/src/utils/getBadgeColor.test.js +14 -0
  153. package/src/utils/isUrl.js +9 -0
  154. package/src/utils/isUrl.test.js +12 -0
  155. package/src/utils.js +7 -0
  156. package/build/bootstrap-reboot.min.css +0 -414
  157. package/build/index.js +0 -15
  158. package/build/style.css +0 -459
  159. package/src/components/datatypes/HumanName/HumanName.css +0 -15
  160. package/src/components/datatypes/Reference/Reference.css +0 -8
  161. package/src/components/resources/Observation/ObservationGraph.css +0 -51
  162. package/src/components/resources/Patient/Patient.css +0 -19
  163. package/src/components/ui/index.css +0 -123
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import ResourceCategory from './ResourceCategory';
3
+ import fhirIcons from '../../../fixtures/example-icons';
4
+
5
+ export default { title: 'ResourceCategory' };
6
+
7
+ export const ExampleWithAllProperties = () => {
8
+ return (
9
+ <ResourceCategory
10
+ itemsCount={41}
11
+ title="Resource name"
12
+ fhirIcons={fhirIcons}
13
+ />
14
+ );
15
+ };
16
+
17
+ export const ExampleWith1Item = () => {
18
+ return (
19
+ <ResourceCategory
20
+ itemsCount={'1'}
21
+ title="Resource name"
22
+ fhirIcons={fhirIcons}
23
+ />
24
+ );
25
+ };
26
+
27
+ export const ExampleWithoutItemsCount = () => {
28
+ return <ResourceCategory title="Resource name" fhirIcons={fhirIcons} />;
29
+ };
@@ -0,0 +1,101 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+
4
+ import fhirIcons from '../../../fixtures/example-icons';
5
+ import ResourceCategory from './ResourceCategory';
6
+
7
+ describe('should render ResourceCategory component properly', () => {
8
+ const placeholderResource = fhirIcons['ResourceCategoryPlaceholder'].props;
9
+
10
+ it('should render ResourceCategory component with icon and itemsCount > 1 correctly', () => {
11
+ const defaultProps = {
12
+ fhirIcons: fhirIcons,
13
+ itemsCount: '41',
14
+ title: 'Resource name',
15
+ };
16
+
17
+ const { container, getByTestId, getByAltText } = render(
18
+ <ResourceCategory {...defaultProps} />,
19
+ );
20
+ expect(container).not.toBeNull();
21
+
22
+ expect(getByTestId('itemsCount').textContent).toContain('41 items');
23
+ expect(getByTestId('title').textContent).toContain('Resource name');
24
+ const image = getByAltText(placeholderResource.alt);
25
+ expect(image.src).toContain(placeholderResource.src);
26
+ });
27
+
28
+ it('should render ResourceCategory component with icon and itemsCount === 1 correctly', () => {
29
+ const defaultProps = {
30
+ fhirIcons: fhirIcons,
31
+ itemsCount: 1,
32
+ title: 'Resource name',
33
+ };
34
+
35
+ const { container, getByTestId, getByAltText } = render(
36
+ <ResourceCategory {...defaultProps} />,
37
+ );
38
+ expect(container).not.toBeNull();
39
+
40
+ expect(getByTestId('itemsCount').textContent).toContain('1 item');
41
+ expect(getByTestId('title').textContent).toContain('Resource name');
42
+ const image = getByAltText(placeholderResource.alt);
43
+ expect(image.src).toContain(placeholderResource.src);
44
+ });
45
+
46
+ it('should render ResourceCategory correctly with negative number passed as itemsCount', () => {
47
+ const defaultProps = {
48
+ fhirIcons: fhirIcons,
49
+ itemsCount: -1,
50
+ title: 'Resource name',
51
+ };
52
+
53
+ const { container, getByTestId, getByAltText, queryByTestId } = render(
54
+ <ResourceCategory {...defaultProps} />,
55
+ );
56
+ expect(container).not.toBeNull();
57
+
58
+ const item = queryByTestId('itemsCount');
59
+ expect(item).toBeNull();
60
+ expect(getByTestId('title').textContent).toContain('Resource name');
61
+ const image = getByAltText(placeholderResource.alt);
62
+ expect(image.src).toContain(placeholderResource.src);
63
+ });
64
+
65
+ it('should render ResourceCategory correctly with invalid string passed as itemsCount', () => {
66
+ const defaultProps = {
67
+ fhirIcons: fhirIcons,
68
+ itemsCount: 'asdf1',
69
+ title: 'Resource name',
70
+ };
71
+
72
+ const { container, getByTestId, getByAltText, queryByTestId } = render(
73
+ <ResourceCategory {...defaultProps} />,
74
+ );
75
+ expect(container).not.toBeNull();
76
+ const item = queryByTestId('itemsCount');
77
+ expect(item).toBeNull();
78
+ expect(getByTestId('title').textContent).toContain('Resource name');
79
+ const image = getByAltText(placeholderResource.alt);
80
+ expect(image.src).toContain(placeholderResource.src);
81
+ });
82
+
83
+ it('should render ResourceCategory correctly with floating point number passed as text in itemsCount', () => {
84
+ const defaultProps = {
85
+ fhirIcons: fhirIcons,
86
+ itemsCount: '0.5',
87
+ title: 'Resource name',
88
+ };
89
+
90
+ const { container, getByTestId, getByAltText, queryByTestId } = render(
91
+ <ResourceCategory {...defaultProps} />,
92
+ );
93
+ expect(container).not.toBeNull();
94
+
95
+ const item = queryByTestId('itemsCount');
96
+ expect(item).toBeNull();
97
+ expect(getByTestId('title').textContent).toContain('Resource name');
98
+ const image = getByAltText(placeholderResource.alt);
99
+ expect(image.src).toContain(placeholderResource.src);
100
+ });
101
+ });
@@ -0,0 +1,3 @@
1
+ import ResourceCategory from './ResourceCategory';
2
+
3
+ export default ResourceCategory;
@@ -16,8 +16,10 @@ import Encounter from './resources/Encounter';
16
16
  import FamilyMemberHistory from './resources/FamilyMemberHistory';
17
17
  import Goal from './resources/Goal';
18
18
  import Immunization from './resources/Immunization';
19
+ import List from './resources/List';
19
20
  import Location from './resources/Location';
20
21
  import Medication from './resources/Medication';
22
+ import MedicationKnowledge from './resources/MedicationKnowledge';
21
23
  import MedicationOrder from './resources/MedicationOrder';
22
24
  import MedicationStatement from './resources/MedicationStatement';
23
25
  import Observation from './resources/Observation';
@@ -55,8 +57,10 @@ export {
55
57
  FamilyMemberHistory,
56
58
  Goal,
57
59
  Immunization,
60
+ List,
58
61
  Location,
59
62
  Medication,
63
+ MedicationKnowledge,
60
64
  MedicationOrder,
61
65
  MedicationStatement,
62
66
  Observation,
@@ -0,0 +1,3 @@
1
+ .header-rotate {
2
+ transform: rotate(-180deg);
3
+ }
@@ -14,23 +14,9 @@
14
14
  }
15
15
 
16
16
  .fhir-resource {
17
- font-family:
18
- -apple-system,
19
- BlinkMacSystemFont,
20
- 'Segoe UI',
21
- Roboto,
22
- 'Helvetica Neue',
23
- Arial,
24
- 'Noto Sans',
25
- sans-serif,
26
- 'Apple Color Emoji',
27
- 'Segoe UI Emoji',
28
- 'Segoe UI Symbol',
29
- 'Noto Color Emoji';
30
17
  font-size: 1rem;
31
18
  font-weight: 400;
32
19
  line-height: 1.5;
33
- color: #212529;
34
20
  background-color: #fff;
35
21
  -webkit-text-size-adjust: 100%;
36
22
  -webkit-tap-highlight-color: transparent;
@@ -187,14 +173,8 @@ sup {
187
173
  .fhir-resource kbd,
188
174
  .fhir-resource pre,
189
175
  .fhir-resource samp {
190
- font-family:
191
- SFMono-Regular,
192
- Menlo,
193
- Monaco,
194
- Consolas,
195
- 'Liberation Mono',
196
- 'Courier New',
197
- monospace;
176
+ font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
177
+ 'Courier New', monospace;
198
178
  font-size: 1em;
199
179
  }
200
180
 
@@ -1,69 +1,214 @@
1
1
  import React from 'react';
2
2
 
3
- import './index.css';
3
+ import { getBadgeColor } from '../../utils/getBadgeColor';
4
+ import HeaderIcon from '../datatypes/HeaderIcon';
4
5
 
5
- export const Header = props => (
6
- <div className="fhir-ui__Header">{props.children}</div>
7
- );
6
+ export const Header = props => {
7
+ const rightItemsClass = 'align-items-center flex-fill d-flex';
8
+
9
+ return (
10
+ <>
11
+ {// This condition was left due to fact, that to much changes in Header will generate many errors in tests. This condition will be removed after all changes have been made.
12
+ props.children || (
13
+ <div
14
+ className={`fhir-ui__${props.resourceName}-Header w-100 p-4 position-relative`}
15
+ >
16
+ <div
17
+ className={`fhir-ui__${props.resourceName}-Header__title-data ${
18
+ props.isAccordionOpenable ? 'header__title-row' : ''
19
+ } d-flex w-100 flex-column flex-sm-row`}
20
+ >
21
+ <div className="d-flex">
22
+ <div
23
+ className={`fhir-ui__${props.resourceName}-Header__icon flex-shrink-1 m-half me-2`}
24
+ >
25
+ <HeaderIcon headerIcon={props.icon} />
26
+ </div>
27
+ <div
28
+ className={`fhir-ui__${props.resourceName}-Header__title flex-fill text-start`}
29
+ >
30
+ <Title data-testid={props.titleTestID || 'title'}>
31
+ {props.title || ''}
32
+ </Title>
33
+ </div>
34
+ </div>
35
+
36
+ <div
37
+ className={`fhir-ui__${props.resourceName}-Header__badges ps-1 ps-sm-2 mt-3 mt-sm-0 badges-max-width-sm flex-wrap flex-sm-nowrap justify-content-between justify-content-sm-end ${rightItemsClass}`}
38
+ >
39
+ {props.prefixBadge && (
40
+ <div className="me-3">{props.prefixBadge}</div>
41
+ )}
42
+ <div className="d-flex">
43
+ {props.badges}
44
+ {props.additionalBadge && (
45
+ <div className="ms-3">{props.additionalBadge}</div>
46
+ )}
47
+ </div>
48
+ </div>
49
+ </div>
50
+ <div
51
+ className={`fhir-ui__${
52
+ props.resourceName
53
+ }-Header__additional-content w-100 justify-content-start d-flex ${
54
+ props.additionalContent ? ' pt-2' : ''
55
+ }`}
56
+ >
57
+ {props.additionalContent}
58
+ <div
59
+ className={`fhir-ui__${props.resourceName}-Header__rightAdditionalContent justify-content-end ${rightItemsClass}`}
60
+ >
61
+ {props.rightAdditionalContent}
62
+ </div>
63
+ </div>
64
+ </div>
65
+ )}
66
+ </>
67
+ );
68
+ };
8
69
 
9
70
  export const Title = props => (
10
- <h4 className="fhir-ui__Title" data-testid="title">
71
+ <h4
72
+ className="fhir-ui__Title fw-bold fs-4 lh-base mb-0 w-90 title-width-sm"
73
+ data-testid={props['data-testid'] || 'title'}
74
+ >
11
75
  {props.children}
12
76
  </h4>
13
77
  );
14
78
 
15
- export const Badge = props => (
16
- <span className="fhir-ui__Badge" data-testid={props['data-testid']}>
17
- {props.children}
18
- </span>
19
- );
79
+ export const Badge = props => {
80
+ return (
81
+ <small
82
+ className={`fhir-ui__Badge text-capitalize d-flex align-items-center px-2 py-1 rounded-1 fw-bold ${getBadgeColor(
83
+ props,
84
+ )}`}
85
+ data-testid={props['data-testid']}
86
+ >
87
+ {props.children}
88
+ </small>
89
+ );
90
+ };
20
91
 
21
92
  export const BadgeSecondary = props => (
22
- <span className="fhir-ui__BadgeSecondary" data-testid={props['data-testid']}>
93
+ <small
94
+ className={`fhir-ui__BadgeSecondary px-2 py-1 rounded-1 fw-bold ${getBadgeColor(
95
+ props,
96
+ )}`}
97
+ data-testid={props['data-testid']}
98
+ >
23
99
  {props.children}
24
- </span>
100
+ </small>
101
+ );
102
+
103
+ export const ValueUnit = props => (
104
+ <div className="fhir-ui__ValueUnitRoot">
105
+ <span
106
+ data-testid="valueQuantity"
107
+ className="fhir-ui__ValueUnitQty fw-bold me-1"
108
+ >
109
+ {props.valueQty}
110
+ </span>
111
+ <span
112
+ data-testid="valueQuantityUnit"
113
+ className="fhir-ui__ValueUnit fw-bold text-gray-500"
114
+ >
115
+ {props.valueUnit}
116
+ </span>
117
+ </div>
25
118
  );
26
119
 
27
- export const Body = props => <div>{props.children}</div>;
120
+ export const Body = ({ tableData = [], reverseContent, children }) => (
121
+ <div className="fhir-ui__Body">
122
+ {reverseContent ? children : null}
123
+ <div className="row">
124
+ {tableData.map(
125
+ (value, index) =>
126
+ value.status && (
127
+ <div
128
+ className="d-flex flex-column flex-sm-row"
129
+ key={`table-data-item-${index}`}
130
+ >
131
+ <div className="dataTable__value-label ps-0">
132
+ <Label>{value.label}</Label>
133
+ </div>
134
+ <Data data-testid={value.testId}>{value.data}</Data>
135
+ </div>
136
+ ),
137
+ )}
138
+ </div>
139
+ {!reverseContent ? children : null}
140
+ </div>
141
+ );
28
142
 
29
143
  export const Value = props => (
30
- <div className="fhir-ui__Value">
31
- <label className="fhir-ui__Value-label">{props.label}</label>
32
- <div data-testid={props['data-testid']}>{props.children}</div>
144
+ <div
145
+ className={`fhir-ui__Value d-flex align-items-center flex-wrap flex-sm-nowrap pt-3 pb-2 pt-sm-0 pb-sm-0 ${
146
+ props.dirColumn ? 'flex-column align-items-baseline' : ''
147
+ }`}
148
+ >
149
+ <Label>{props.label}</Label>
150
+ <Data data-testid={props['data-testid']}>{props.children}</Data>
33
151
  </div>
34
152
  );
35
153
 
36
- export const Root = props => (
37
- <div className={`fhir-resource fhir-resource__${props.name}`}>
154
+ export const Label = props => (
155
+ <div className="fhir-ui__Label font-source text-secondary lh-lg me-2">
156
+ {props.children}
157
+ </div>
158
+ );
159
+
160
+ export const Data = props => (
161
+ <div
162
+ className="fhir-ui__Data font-source fw-normal lh-lg text-break"
163
+ data-testid={props['data-testid']}
164
+ >
38
165
  {props.children}
39
166
  </div>
40
167
  );
41
168
 
169
+ export const Root = props => (
170
+ <div className={`fhir-resource__${props.name}`}>{props.children}</div>
171
+ );
172
+
42
173
  export const Table = props => (
43
- <table className="fhir-ui__Table">{props.children}</table>
174
+ <div className="table-responsive">
175
+ <table className={`table table-striped mb-0 ${props.className || ''}`}>
176
+ {props.children}
177
+ </table>
178
+ </div>
44
179
  );
45
180
 
46
181
  export const TableHeader = props => {
47
182
  const { expand, noWordWrap } = props;
48
- let className = 'fhir-ui__TableHeader';
49
- if (expand) className += ' fhir-ui__TableHeader--expand';
50
- if (noWordWrap) className += ' fhir-ui__TableHeader--no-word-wrap';
51
- return <th className={className}>{props.children}</th>;
183
+ return (
184
+ <th
185
+ className={`${expand ? 'w-100' : ''} ${
186
+ noWordWrap ? 'text-nowrap' : ''
187
+ } text-gray-500`}
188
+ >
189
+ {props.children}
190
+ </th>
191
+ );
52
192
  };
53
193
 
54
- export const TableRow = props => (
55
- <tr className="fhir-ui__TableRow">{props.children}</tr>
56
- );
194
+ export const TableRow = props => <tr>{props.children}</tr>;
57
195
 
58
196
  export const TableCell = props => (
59
- <td className="fhir-ui__TableCell" data-testid={props['data-testid']}>
197
+ <td className="align-text-top border-0" data-testid={props['data-testid']}>
60
198
  {props.children}
61
199
  </td>
62
200
  );
63
201
 
64
202
  export const ValueSection = props => (
65
- <div className="fhir-ui__ValueSection" data-testid={props['data-testid']}>
66
- <label className="fhir-ui__ValueSection-label">{props.label}</label>
203
+ <div
204
+ className={`fhir-ui__ValueSection ${props.marginTop ? 'mt-40' : ''} ${
205
+ props.marginBottom ? 'mb-40' : ''
206
+ } ${props.className || ''}`}
207
+ data-testid={props['data-testid']}
208
+ >
209
+ <label className="fhir-ui__ValueSection-label fw-bold mb-2">
210
+ {props.label}
211
+ </label>
67
212
  <div className="fhir-ui__ValueSection-body">{props.children}</div>
68
213
  </div>
69
214
  );
@@ -77,3 +222,20 @@ export const NotEnoughData = props => (
77
222
  No additional data
78
223
  </div>
79
224
  );
225
+
226
+ export const Chevron = props => (
227
+ <svg
228
+ width="24"
229
+ height="24"
230
+ viewBox="0 0 24 24"
231
+ fill="none"
232
+ xmlns="http://www.w3.org/2000/svg"
233
+ >
234
+ <path
235
+ d="M20 8L12.3769 15.8393C12.277 15.9422 12.1414 16 12 16C11.8586 16 11.723 15.9422 11.6231 15.8393L4 8"
236
+ stroke={props.strokeColor}
237
+ strokeLinecap="round"
238
+ strokeLinejoin="round"
239
+ />
240
+ </svg>
241
+ );
@@ -0,0 +1,98 @@
1
+ export default {
2
+ // condition
3
+ active: 'bg-teal-100 text-teal-600',
4
+ recurrence: '',
5
+ relapse: 'bg-indigo-100 text-indigo-600',
6
+ inactive:
7
+ 'bg-gray-100 text-gray-600 border border-1 rounded-1 border-gray-200',
8
+ remission: 'bg-cyan-100 text-cyan-600',
9
+ resolved: 'bg-blue-100 text-blue-600',
10
+ // immunization
11
+ 'in-progress': 'bg-orange-100 text-orange-600',
12
+ 'on-hold': 'bg-gray-100 text-pink-500',
13
+ completed: 'bg-teal-100 text-teal-600',
14
+ 'entered-in-error': 'bg-red-100 text-red-600',
15
+ stopped: 'bg-gray-100 text-gray-600',
16
+ 'not-done': 'bg-yellow-100 text-yellow-600',
17
+ // procedure
18
+ preparation: 'border border-1 rounded-1 border-blue-200 text-blue-600',
19
+ suspended: '',
20
+ aborted: '',
21
+ unknown: 'border border-1 rounded-1 border-gray-200 text-gray-600',
22
+ // practitioner
23
+ // allergy intolerance
24
+ unconfirmed: '',
25
+ confirmed: '',
26
+ refuted: '',
27
+ // appointment
28
+ proposed: '',
29
+ pending: '',
30
+ booked: '',
31
+ arrived: '',
32
+ fulfilled: '',
33
+ cancelled: '',
34
+ noshow: '',
35
+ 'checked-in': '',
36
+ waitlist: '',
37
+ // care plan
38
+ draft: '',
39
+ revoked: '',
40
+ // care team
41
+ // claim
42
+ // claim response
43
+ // device
44
+ available: '',
45
+ 'not-available': '',
46
+ // diagnostic report
47
+ registered: '',
48
+ partial: '',
49
+ preliminary: '',
50
+ final: '',
51
+ corrected: '',
52
+ appended: '',
53
+ // document reference
54
+ current: '',
55
+ superseded: '',
56
+ // encounter
57
+ planned: '',
58
+ triaged: '',
59
+ onleave: '',
60
+ finished: '',
61
+ // explanation of benefit
62
+ // family member history
63
+ 'health-unknown': '',
64
+ // goal
65
+ accepted: '',
66
+ rejected: '',
67
+ achieved: '',
68
+ sustaining: '',
69
+ 'on-target': '',
70
+ 'ahead-of-target': '',
71
+ 'behind-target': '',
72
+ // list
73
+ retired: '',
74
+ // location
75
+ // mediacation
76
+ brand: '',
77
+ // medication administration
78
+ // medication knowledge
79
+ // medication statement
80
+ intended: '',
81
+ 'not-taken': '',
82
+ // observation
83
+ amended: '',
84
+ // procedure
85
+ // questionnaire
86
+ published: '',
87
+ // questionnaire response
88
+ // research study
89
+ 'administratively-completed': '',
90
+ approved: '',
91
+ 'closed-to-accrual': '',
92
+ 'closed-to-accrual-and-intervention': '',
93
+ disapproved: '',
94
+ 'in-review': '',
95
+ 'temporarily-closed-to-accrual': '',
96
+ 'temporarily-closed-to-accrual-and-intervention': '',
97
+ withdrawn: '',
98
+ };
@@ -0,0 +1,35 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g id="condition-icon" transform="translate(-28.001 -27.999)">
3
+ <g id="Group_10" data-name="Group 10" transform="translate(46.93 29.733) rotate(41)">
4
+ <path id="Path_8" data-name="Path 8" d="M0,0,1.538.027,1.583,2.6.044,2.576Z" transform="translate(1.052 2.07)" fill="#7cddc8"/>
5
+ <path id="Path_9" data-name="Path 9" d="M.5,0,3.068.044a.536.536,0,0,1,.522.524L3.607,1.6a.493.493,0,0,1-.5.506L.539,2.061a.536.536,0,0,1-.522-.524L0,.506A.493.493,0,0,1,.5,0Z" transform="translate(0 0)" fill="#7cddc8"/>
6
+ </g>
7
+ <g id="Group_11" data-name="Group 11" transform="translate(32.977 49.942) rotate(-139)">
8
+ <path id="Path_10" data-name="Path 10" d="M0,0,1.538.027,1.583,2.6.044,2.576Z" transform="translate(1.052 2.07)" fill="#7cddc8"/>
9
+ <path id="Path_11" data-name="Path 11" d="M.5,0,3.068.044a.536.536,0,0,1,.522.524L3.607,1.6a.493.493,0,0,1-.5.506L.539,2.061a.536.536,0,0,1-.522-.524L0,.506A.493.493,0,0,1,.5,0Z" transform="translate(0 0)" fill="#7cddc8"/>
10
+ </g>
11
+ <g id="Group_12" data-name="Group 12" transform="translate(49.748 47.527) rotate(132)">
12
+ <path id="Path_12" data-name="Path 12" d="M.044.027,1.589,0,1.545,2.565,0,2.592Z" transform="translate(0.977 2.061)" fill="#7cddc8"/>
13
+ <path id="Path_13" data-name="Path 13" d="M.542.044,3.116,0a.493.493,0,0,1,.506.5L3.6,1.53a.536.536,0,0,1-.524.522L.506,2.1A.493.493,0,0,1,0,1.593L.018.566A.536.536,0,0,1,.542.044Z" transform="translate(0 0)" fill="#7cddc8"/>
14
+ </g>
15
+ <path id="Path_14" data-name="Path 14" d="M.044.027,1.589,0,1.545,2.565,0,2.592Z" transform="translate(32.344 33.701) rotate(-48)" fill="#7cddc8"/>
16
+ <path id="Path_15" data-name="Path 15" d="M.542.044,3.116,0a.493.493,0,0,1,.506.5L3.6,1.53a.536.536,0,0,1-.524.522L.506,2.1A.493.493,0,0,1,0,1.593L.018.566A.536.536,0,0,1,.542.044Z" transform="translate(30.159 33.048) rotate(-48)" fill="#7cddc8"/>
17
+ <g id="Group_13" data-name="Group 13" transform="translate(38.427 27.999)">
18
+ <path id="Path_16" data-name="Path 16" d="M0,0,1.522.008l.013,2.6L.013,2.6Z" transform="translate(1.023 2.085)" fill="#7cddc8"/>
19
+ <path id="Path_17" data-name="Path 17" d="M.393-.1,2.93-.086a.521.521,0,0,1,.51.523l.005,1.041a.508.508,0,0,1-.5.518L.4,1.982a.521.521,0,0,1-.51-.523L-.111.418A.508.508,0,0,1,.393-.1Z" transform="translate(0.111 0.1)" fill="#7cddc8"/>
20
+ </g>
21
+ <g id="Group_14" data-name="Group 14" transform="translate(38.427 47.303)">
22
+ <path id="Path_18" data-name="Path 18" d="M0,2.611,1.522,2.6,1.536,0,.013.008Z" transform="translate(1.023 0)" fill="#7cddc8"/>
23
+ <path id="Path_19" data-name="Path 19" d="M.393,2,2.93,1.982a.521.521,0,0,0,.51-.523L3.446.418a.508.508,0,0,0-.5-.518L.4-.086a.521.521,0,0,0-.51.523L-.111,1.478A.508.508,0,0,0,.393,2Z" transform="translate(0.111 2.7)" fill="#7cddc8"/>
24
+ </g>
25
+ <g id="Group_15" data-name="Group 15" transform="translate(52 38.458) rotate(90)">
26
+ <path id="Path_20" data-name="Path 20" d="M0,0,1.559.008l.014,2.541L.014,2.541Z" transform="translate(1.048 2.035)" fill="#7cddc8"/>
27
+ <path id="Path_21" data-name="Path 21" d="M.517,0l2.6.013a.521.521,0,0,1,.523.511l.006,1.016a.508.508,0,0,1-.517.505l-2.6-.013a.521.521,0,0,1-.523-.511L0,.505A.508.508,0,0,1,.517,0Z" transform="translate(0 0)" fill="#7cddc8"/>
28
+ </g>
29
+ <g id="Group_16" data-name="Group 16" transform="translate(32.585 38.458) rotate(90)">
30
+ <path id="Path_22" data-name="Path 22" d="M0,2.549l1.559-.008L1.573,0,.014.008Z" transform="translate(1.048 0)" fill="#7cddc8"/>
31
+ <path id="Path_23" data-name="Path 23" d="M.517,2.046l2.6-.013a.521.521,0,0,0,.523-.511L3.644.505A.508.508,0,0,0,3.127,0L.528.013A.521.521,0,0,0,.006.524L0,1.541A.508.508,0,0,0,.517,2.046Z" transform="translate(0 2.538)" fill="#7cddc8"/>
32
+ </g>
33
+ <path id="Subtraction_1" data-name="Subtraction 1" d="M8,16A8,8,0,0,1,2.343,2.343,8,8,0,0,1,13.657,13.657,7.948,7.948,0,0,1,8,16Zm.774-6.193a1.032,1.032,0,1,0,1.032,1.032A1.033,1.033,0,0,0,8.774,9.807ZM5.161,7.742A1.032,1.032,0,1,0,6.193,8.774,1.033,1.033,0,0,0,5.161,7.742Zm5.677-2.065A1.032,1.032,0,1,0,11.871,6.71,1.033,1.033,0,0,0,10.839,5.677ZM7.226,3.613A1.032,1.032,0,1,0,8.258,4.645,1.034,1.034,0,0,0,7.226,3.613Z" transform="translate(32.15 32.28)" fill="#3fc7a9"/>
34
+ </g>
35
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20.389" height="26.344" viewBox="0 0 20.389 26.344">
2
+ <g id="Group_34" data-name="Group 34" transform="matrix(0.819, 0.574, -0.574, 0.819, -1.32, -42.366)">
3
+ <rect id="Rectangle_15" data-name="Rectangle 15" width="9.6" height="1.028" rx="0.514" transform="translate(35.642 26.763)" fill="rgba(2,110,222,0.53)"/>
4
+ <rect id="Rectangle_16" data-name="Rectangle 16" width="4.8" height="3.598" transform="translate(38.047 27.799)" fill="rgba(2,110,222,0.53)"/>
5
+ <rect id="Rectangle_17" data-name="Rectangle 17" width="12" height="1.088" rx="0.544" transform="translate(34.47 32.134)" fill="#026ede"/>
6
+ <path id="Subtraction_2" data-name="Subtraction 2" d="M5.8,14.97H2a2,2,0,0,1-2-2V0H7.8V12.97A2,2,0,0,1,5.8,14.97ZM.036,8.615V9.684H1.9a.535.535,0,1,0,0-1.069ZM.024,5.882V6.951H1.89a.535.535,0,1,0,0-1.069ZM.014,3.147V4.217H1.878a.535.535,0,0,0,0-1.069Z" transform="translate(36.871 32.355)" fill="#026ede"/>
7
+ <path id="Rectangle_20" data-name="Rectangle 20" d="M0,0H1.626a0,0,0,0,1,0,0V5.829a.813.813,0,0,1-.813.813h0A.813.813,0,0,1,0,5.829V0A0,0,0,0,1,0,0Z" transform="translate(39.957 48.121)" fill="#7ab3ee"/>
8
+ <path id="Rectangle_19" data-name="Rectangle 19" d="M0,0H4.251a0,0,0,0,1,0,0V1.614a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V0A0,0,0,0,1,0,0Z" transform="translate(38.645 46.262)" fill="#026ede"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,49 @@
1
+ {
2
+ "resourceType": "List",
3
+ "id": "example",
4
+ "text": {
5
+ "status": "generated",
6
+ "div": "<div>\n <table>\n <thead>\n <tr>\n <th>Condition</th>\n <th>Severity</th>\n <th>Date</th>\n <th>Location</th>\n <th>Status</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Burnt Ear</td>\n <td>Severe</td>\n <td>24-May 2012</td>\n <td>Left Ear</td>\n <td>deleted</td>\n </tr>\n <tr>\n <td>Asthma</td>\n <td>Mild</td>\n <td>21-Nov 2012</td>\n <td>--</td>\n <td>added</td>\n </tr>\n </tbody>\n </table>\n </div>"
7
+ },
8
+ "identifier": [
9
+ {
10
+ "system": "urn:uuid:a9fcea7c-fcdf-4d17-a5e0-f26dda030b59",
11
+ "value": "23974652"
12
+ }
13
+ ],
14
+ "subject": {
15
+ "fhir_comments": [
16
+ " This list doesn't have a code. In actual fact, \n it's a Condition list produced at the end of an encounter \n to a regular primary care practitioner. But the only way\n to know this is to hunt down the place it is used \n and find out "
17
+ ],
18
+ "reference": "Patient/example"
19
+ },
20
+ "source": {
21
+ "reference": "Patient/example"
22
+ },
23
+ "encounter": {
24
+ "reference": "Encounter/example"
25
+ },
26
+ "status": "current",
27
+ "date": "2012-11-25T22:17:00+11:00",
28
+ "mode": "changes",
29
+ "entry": [
30
+ {
31
+ "flag": {
32
+ "text": "Deleted due to error"
33
+ },
34
+ "deleted": true,
35
+ "item": {
36
+ "reference": "Condition/example"
37
+ }
38
+ },
39
+ {
40
+ "flag": {
41
+ "text": "Added"
42
+ },
43
+ "date": "2012-11-21",
44
+ "item": {
45
+ "reference": "Condition/example2"
46
+ }
47
+ }
48
+ ]
49
+ }