fhir-react 0.2.4 → 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 (135) 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 +47 -3
  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/Date/Date.js +14 -4
  46. package/src/components/datatypes/DatePeriod/DatePeriod.js +38 -0
  47. package/src/components/datatypes/DatePeriod/index.js +3 -0
  48. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +31 -0
  49. package/src/components/datatypes/HeaderIcon/index.js +3 -0
  50. package/src/components/datatypes/HumanName/HumanName.js +6 -21
  51. package/src/components/datatypes/Reference/Reference.js +3 -6
  52. package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
  53. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +4 -4
  54. package/src/components/resources/Appointment/Appointment.js +91 -65
  55. package/src/components/resources/Appointment/Appointment.test.js +3 -3
  56. package/src/components/resources/Bundle/Bundle.js +2 -2
  57. package/src/components/resources/Bundle/Bundle.stories.js +78 -12
  58. package/src/components/resources/Bundle/Bundle.test.js +3 -0
  59. package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
  60. package/src/components/resources/CareTeam/CareTeam.js +13 -14
  61. package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
  62. package/src/components/resources/Claim/Claim.test.js +6 -6
  63. package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
  64. package/src/components/resources/Condition/Condition.js +63 -47
  65. package/src/components/resources/Condition/Condition.stories.js +41 -8
  66. package/src/components/resources/Condition/Condition.test.js +20 -14
  67. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +5 -7
  68. package/src/components/resources/DocumentReference/DocumentReference.js +1 -1
  69. package/src/components/resources/DocumentReference/DocumentReference.test.js +3 -3
  70. package/src/components/resources/Encounter/Encounter.js +66 -36
  71. package/src/components/resources/Encounter/EncounterParticipants.js +2 -2
  72. package/src/components/resources/ExplanationOfBenefit/CareTeam.js +2 -2
  73. package/src/components/resources/ExplanationOfBenefit/Diagnosis.js +15 -5
  74. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +272 -201
  75. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +79 -62
  76. package/src/components/resources/ExplanationOfBenefit/Items.js +2 -2
  77. package/src/components/resources/ExplanationOfBenefit/PriceLabel.js +20 -0
  78. package/src/components/resources/ExplanationOfBenefit/Related.js +3 -3
  79. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +14 -3
  80. package/src/components/resources/ExplanationOfBenefit/TotalGraph.js +68 -0
  81. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.js +89 -0
  82. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +78 -0
  83. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.test.js +51 -0
  84. package/src/components/resources/ExplanationOfBenefitGraph/index.js +3 -0
  85. package/src/components/resources/Goal/Goal.test.js +1 -1
  86. package/src/components/resources/Immunization/Immunization.js +125 -94
  87. package/src/components/resources/Immunization/Immunization.stories.js +23 -4
  88. package/src/components/resources/Immunization/Immunization.test.js +17 -12
  89. package/src/components/resources/List/List.test.js +3 -3
  90. package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
  91. package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
  92. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
  93. package/src/components/resources/Observation/Observation.js +72 -54
  94. package/src/components/resources/Observation/Observation.test.js +6 -18
  95. package/src/components/resources/Observation/ObservationGraph.js +159 -55
  96. package/src/components/resources/Observation/ObservationGraph.test.js +47 -26
  97. package/src/components/resources/Patient/Patient.js +77 -87
  98. package/src/components/resources/Patient/Patient.test.js +1 -1
  99. package/src/components/resources/Practitioner/Practitioner.js +80 -60
  100. package/src/components/resources/Practitioner/Practitioner.test.js +4 -4
  101. package/src/components/resources/Procedure/Procedure.js +99 -87
  102. package/src/components/resources/Procedure/Procedure.stories.js +8 -6
  103. package/src/components/resources/Procedure/Procedure.test.js +11 -8
  104. package/src/components/resources/Questionnaire/Questionnaire.test.js +3 -3
  105. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +5 -5
  106. package/src/components/resources/ReferralRequest/ReferralRequest.test.js +2 -2
  107. package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
  108. package/src/components/resources/ResourceCategory/ResourceCategory.js +56 -0
  109. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +29 -0
  110. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +101 -0
  111. package/src/components/resources/ResourceCategory/index.js +3 -0
  112. package/src/components/ui/_header.scss +3 -0
  113. package/src/components/ui/bootstrap-reboot.min.css +2 -22
  114. package/src/components/ui/index.js +191 -29
  115. package/src/constants/badge-status.jsx +98 -0
  116. package/src/fixtures/dstu2/resources/condition/condition.svg +35 -0
  117. package/src/fixtures/dstu2/resources/immunization/immunization.svg +10 -0
  118. package/src/fixtures/example-icons.jsx +169 -0
  119. package/src/index.js +6 -1
  120. package/src/style.scss +176 -0
  121. package/src/utils/formatDate.js +21 -0
  122. package/src/utils/formatDate.test.js +22 -0
  123. package/src/utils/getBadgeColor.js +6 -0
  124. package/src/utils/getBadgeColor.test.js +14 -0
  125. package/src/utils/isUrl.js +9 -0
  126. package/src/utils/isUrl.test.js +12 -0
  127. package/src/utils.js +7 -0
  128. package/build/bootstrap-reboot.min.css +0 -414
  129. package/build/index.js +0 -15
  130. package/build/style.css +0 -459
  131. package/src/components/datatypes/HumanName/HumanName.css +0 -15
  132. package/src/components/datatypes/Reference/Reference.css +0 -8
  133. package/src/components/resources/Observation/ObservationGraph.css +0 -51
  134. package/src/components/resources/Patient/Patient.css +0 -19
  135. package/src/components/ui/index.css +0 -123
@@ -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,169 @@
1
+ import React from 'react';
2
+
3
+ export default {
4
+ Condition: (
5
+ <img
6
+ src={require('../assets/containers/Condition/condition.svg')}
7
+ alt="germ"
8
+ />
9
+ ),
10
+ Immunization: (
11
+ <img
12
+ src={require('../assets/containers/Immunization/immunization.svg')}
13
+ alt="syringe"
14
+ />
15
+ ),
16
+ Procedure: (
17
+ <img
18
+ src={require('../assets/containers/Procedure/procedure.svg')}
19
+ alt="block diagram"
20
+ />
21
+ ),
22
+ Practitioner: (
23
+ <img
24
+ src={require('../assets/containers/Practitioner/practitioner.svg')}
25
+ alt="doctor avatar"
26
+ />
27
+ ),
28
+ AllergyIntolerance: (
29
+ <img
30
+ src={require('../assets/containers/AllergyIntolerance/allergy-intolerance.svg')}
31
+ alt="sneezing emoji"
32
+ />
33
+ ),
34
+ Appointment: (
35
+ <img
36
+ src={require('../assets/containers/Appointment/appointment.svg')}
37
+ alt="calendar"
38
+ />
39
+ ),
40
+ CarePlan: (
41
+ <img
42
+ src={require('../assets/containers/CarePlan/care-plan.svg')}
43
+ alt="note with a heart"
44
+ />
45
+ ),
46
+ CareTeam: (
47
+ <img
48
+ src={require('../assets/containers/CareTeam/care-team.svg')}
49
+ alt="group of people"
50
+ />
51
+ ),
52
+ Claim: (
53
+ <img
54
+ src={require('../assets/containers/Claim/claim.svg')}
55
+ alt="clipboard with a symmetrical cross"
56
+ />
57
+ ),
58
+ ClaimResponse: (
59
+ <img
60
+ src={require('../assets/containers/ClaimResponse/claim-response.svg')}
61
+ alt="clipboard with a symmetrical cross and a return arrow"
62
+ />
63
+ ),
64
+ Device: (
65
+ <img
66
+ src={require('../assets/containers/Device/device.svg')}
67
+ alt="computer rack"
68
+ />
69
+ ),
70
+ DiagnosticReport: (
71
+ <img
72
+ src={require('../assets/containers/DiagnosticReport/diagnostic-report.svg')}
73
+ alt="note with shapes"
74
+ />
75
+ ),
76
+ DocumentReference: (
77
+ <img
78
+ src={require('../assets/containers/DocumentReference/document-reference.svg')}
79
+ alt="hand holding a note"
80
+ />
81
+ ),
82
+ Encounter: (
83
+ <img
84
+ src={require('../assets/containers/Encounter/encounter.svg')}
85
+ alt="conversation between two individuals"
86
+ />
87
+ ),
88
+ ExplanationOfBenefit: (
89
+ <img
90
+ src={require('../assets/containers/ExplanationOfBenefit/explanation-of-benefit.svg')}
91
+ alt="percentage sign"
92
+ />
93
+ ),
94
+ FamilyMemberHistory: (
95
+ <img
96
+ src={require('../assets/containers/FamilyMemberHistory/family-member-history.svg')}
97
+ alt="parent and child"
98
+ />
99
+ ),
100
+ Goal: (
101
+ <img
102
+ src={require('../assets/containers/Goal/goal.svg')}
103
+ alt="arrow hits bullseye"
104
+ />
105
+ ),
106
+ List: (
107
+ <img src={require('../assets/containers/List/list.svg')} alt="checklist" />
108
+ ),
109
+ Location: (
110
+ <img
111
+ src={require('../assets/containers/Location/location.svg')}
112
+ alt="location marker"
113
+ />
114
+ ),
115
+ Medication: (
116
+ <img
117
+ src={require('../assets/containers/Medication/medication.svg')}
118
+ alt="some pills"
119
+ />
120
+ ),
121
+ MedicationAdministration: (
122
+ <img
123
+ src={require('../assets/containers/MedicationAdministration/medication-administration.svg')}
124
+ alt="pill gets swallowed"
125
+ />
126
+ ),
127
+ MedicationKnowledge: (
128
+ <img
129
+ src={require('../assets/containers/MedicationKnowledge/medication-knowledge.svg')}
130
+ alt="pill database"
131
+ />
132
+ ),
133
+ MedicationStatement: (
134
+ <img
135
+ src={require('../assets/containers/MedicationStatement/medication-statement.svg')}
136
+ alt="note with symmetrical cross"
137
+ />
138
+ ),
139
+ Observation: (
140
+ <img
141
+ src={require('../assets/containers/Observation/observation.svg')}
142
+ alt="hospital bed"
143
+ />
144
+ ),
145
+ Questionnaire: (
146
+ <img
147
+ src={require('../assets/containers/Questionnaire/questionnaire.svg')}
148
+ alt="clipboard and pen"
149
+ />
150
+ ),
151
+ QuestionnaireResponse: (
152
+ <img
153
+ src={require('../assets/containers/QuestionnaireResponse/questionnaire-response.svg')}
154
+ alt="clipboard and return arrow"
155
+ />
156
+ ),
157
+ ResearchStudy: (
158
+ <img
159
+ src={require('../assets/containers/ResearchStudy/research-study.svg')}
160
+ alt="finger pointing something in a book"
161
+ />
162
+ ),
163
+ ResourceCategoryPlaceholder: (
164
+ <img
165
+ src={require('../assets/containers/ResourceCategory/resource-placeholder.svg')}
166
+ alt="header icon"
167
+ />
168
+ ),
169
+ };
package/src/index.js CHANGED
@@ -1,7 +1,12 @@
1
+ import 'bootstrap/dist/css/bootstrap.min.css';
2
+ import './style.css';
3
+
1
4
  import FhirResource from './components/containers/FhirResource';
2
5
  import fhirVersions from './components/resources/fhirResourceVersions';
3
6
 
4
- import './style.css';
7
+ if (typeof document !== 'undefined') {
8
+ require('bootstrap/dist/js/bootstrap.min.js');
9
+ }
5
10
 
6
11
  export { FhirResource, fhirVersions };
7
12
  export * from './components/supportedFhirResourceList';
package/src/style.scss ADDED
@@ -0,0 +1,176 @@
1
+ @use 'components/ui/header';
2
+
3
+ @import url('https://fonts.googleapis.com/css2?family=Titillium+Web:wght@300;400;600&display=swap');
4
+ @import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600&display=swap');
5
+ @import 'node_modules/bootstrap/scss/functions';
6
+ @import 'node_modules/bootstrap/scss/variables';
7
+ @import 'node_modules/bootstrap/scss/mixins';
8
+ @import 'bootstrap/scss/utilities';
9
+
10
+ $utilities: (
11
+ 'font-family': (
12
+ property: font-family,
13
+ class: font,
14
+ values: (
15
+ monospace: var(--#{$variable-prefix}font-monospace),
16
+ source: Source Sans Pro,
17
+ ),
18
+ ),
19
+ 'width': (
20
+ property: width,
21
+ class: w,
22
+ values: (
23
+ 25: 25%,
24
+ 50: 50%,
25
+ 75: 75%,
26
+ 90: 90%,
27
+ 100: 100%,
28
+ auto: auto,
29
+ max-content: max-content,
30
+ 144: 144px,
31
+ 110: 110px,
32
+ ),
33
+ ),
34
+ );
35
+
36
+ $space: 0.125rem;
37
+
38
+ $spacers: map-merge(
39
+ $spacers,
40
+ (
41
+ half: $space,
42
+ 6: 3.5rem,
43
+ 40: 40px,
44
+ )
45
+ );
46
+
47
+ $font-family-base: 'Titillium Web', system-ui;
48
+
49
+ $font-weight-bold: 600;
50
+
51
+ $font-sizes: (
52
+ 75: 0.75rem,
53
+ 4: 1.125rem,
54
+ );
55
+
56
+ $line-height-lg: 1.75;
57
+ $border-radius-lg: 16px;
58
+ $box-shadow-sm: 0 0 24px rgba(0, 11, 79, 0.04);
59
+
60
+ $body-color: #152536;
61
+
62
+ $table-striped-bg: $gray-100;
63
+
64
+ $secondary: #68717A;
65
+
66
+ $light: #dedddd;
67
+
68
+ $enable-negative-margins: true;
69
+
70
+ .header-icon__placeholder {
71
+ background-color: #a3a3a3;
72
+ }
73
+
74
+ .header-icon__image,
75
+ .header-icon__placeholder {
76
+ width: 24px;
77
+ height: 24px;
78
+ }
79
+
80
+ .header-icon__practitioner-avatar {
81
+ width: 24px;
82
+ height: 24px;
83
+ }
84
+
85
+ .dataTable__value-label {
86
+ width: auto;
87
+ @include media-breakpoint-up(sm) {
88
+ width: 130px;
89
+ }
90
+ }
91
+
92
+ .fhir-ui__Body__data-cell {
93
+ padding-left: 24px !important;
94
+ }
95
+
96
+ .fhir-ui__ValueUnitQty {
97
+ font-size: 28px;
98
+ }
99
+
100
+ .fhir-ui__ValueUnit {
101
+ font-size: 18px;
102
+ }
103
+
104
+ .fhir-ui__Badge {
105
+ width: fit-content;
106
+ }
107
+
108
+ .header__title-row {
109
+ padding-right: 32px;
110
+ }
111
+
112
+ .chevron:hover {
113
+ background-color: $gray-200;
114
+ border-radius: 4px;
115
+ }
116
+
117
+ @include media-breakpoint-up(sm) {
118
+ .w-90.title-width-sm {
119
+ width: 100% !important;
120
+ }
121
+
122
+ .w-110.graph-width-sm {
123
+ width: 144px !important;
124
+ }
125
+
126
+ .badges-max-width-sm {
127
+ max-height: 24px;
128
+ }
129
+
130
+ .graph-width-sm {
131
+ width: 200px !important;
132
+ }
133
+ }
134
+ // adding custom colors to the theme
135
+
136
+ $theme-colors: map-merge(
137
+ $theme-colors,
138
+ (
139
+ 'teal-100': $teal-100,
140
+ 'teal-600': $teal-600,
141
+ 'yellow-100': $yellow-100,
142
+ 'yellow-600': $yellow-600,
143
+ 'red-100': $red-100,
144
+ 'red-600': $red-600,
145
+ 'gray-200': $gray-200,
146
+ 'blue-900': $blue-900,
147
+ 'orange-100': $orange-100,
148
+ 'orange-600': $orange-600,
149
+ 'gray-100': $gray-100,
150
+ 'gray-500': $gray-500,
151
+ 'gray-600': $gray-600,
152
+ 'pink-500': $pink-500,
153
+ 'indigo-100': $indigo-100,
154
+ 'indigo-600': $indigo-600,
155
+ 'cyan-100': $cyan-100,
156
+ 'cyan-600': $cyan-600,
157
+ 'blue-100': $blue-100,
158
+ 'blue-600': $blue-600,
159
+ 'blue-500': $blue-500,
160
+ 'white': $white,
161
+ 'secondary': $secondary,
162
+ )
163
+ );
164
+
165
+ // additional sass map merges to enable bg-xxx in 5.1.1
166
+ $theme-colors-rgb: map-loop($theme-colors, to-rgb, '$value');
167
+ $utilities-colors: map-merge($utilities-colors, $theme-colors-rgb);
168
+ $utilities-text-colors: map-loop(
169
+ $utilities-colors,
170
+ rgba-css-var,
171
+ '$key',
172
+ 'text'
173
+ );
174
+ $utilities-bg-colors: map-loop($utilities-colors, rgba-css-var, '$key', 'bg');
175
+
176
+ @import '~bootstrap/scss/bootstrap.scss';
@@ -0,0 +1,21 @@
1
+ export const formatDate = (date, locale) => {
2
+ const rawDate = new Date(date);
3
+ const usDate = rawDate.toLocaleDateString(locale, whichOptions(date));
4
+ return usDate;
5
+ };
6
+
7
+ const whichOptions = date => {
8
+ const YEAR_FORMAT = 'YYYY';
9
+ const YEAR_MONTH_FORMAT = 'YYYY-MM';
10
+
11
+ if (date.length === YEAR_FORMAT.length) {
12
+ return { year: 'numeric' };
13
+ }
14
+ if (date.length <= YEAR_MONTH_FORMAT.length) {
15
+ return {
16
+ year: 'numeric',
17
+ month: 'long',
18
+ };
19
+ }
20
+ return;
21
+ };
@@ -0,0 +1,22 @@
1
+ import { formatDate } from './formatDate';
2
+
3
+ describe('Date format function', () => {
4
+ const locale = 'en-US';
5
+
6
+ it('should return year', () => {
7
+ const date = '2021';
8
+ expect(formatDate(date, locale)).toEqual('2021');
9
+ });
10
+ it('should return US month and year', () => {
11
+ const date = '2021-03';
12
+ expect(formatDate(date, locale)).toEqual('March 2021');
13
+ });
14
+ it('should return US date format', () => {
15
+ const date = '2021-03-14';
16
+ expect(formatDate(date, locale)).toEqual('3/14/2021');
17
+ });
18
+ it('should return US date format given full timestamp', () => {
19
+ const date = '2021-03-14T13:28:17-05:00';
20
+ expect(formatDate(date, locale)).toEqual('3/14/2021');
21
+ });
22
+ });
@@ -0,0 +1,6 @@
1
+ import _get from 'lodash/get';
2
+ import badgeColors from '../constants/badge-status.jsx';
3
+
4
+ export const getBadgeColor = props => {
5
+ return badgeColors[_get(props, 'children')] || 'bg-gray-200 text-blue-900';
6
+ };
@@ -0,0 +1,14 @@
1
+ import { getBadgeColor } from './getBadgeColor';
2
+
3
+ describe('Badge Color function', () => {
4
+ it('should return two bootstrap classes', () => {
5
+ expect(getBadgeColor({ children: 'active' })).toEqual(
6
+ 'bg-teal-100 text-teal-600',
7
+ );
8
+ });
9
+ it('should return generic classes if status is not valid', () => {
10
+ expect(getBadgeColor({ children: 'asdf' })).toEqual(
11
+ 'bg-gray-200 text-blue-900',
12
+ );
13
+ });
14
+ });
@@ -0,0 +1,9 @@
1
+ export const isUrl = str => {
2
+ let url;
3
+ try {
4
+ url = new URL(str);
5
+ } catch (err) {
6
+ return false;
7
+ }
8
+ return url.protocol === 'http:' || url.protocol === 'https:';
9
+ };
@@ -0,0 +1,12 @@
1
+ import { isUrl } from './isUrl';
2
+
3
+ describe('isUrl function', () => {
4
+ it('should return true if passed a valid Url', () => {
5
+ const str = 'https://placekeanu.com/24/24';
6
+ expect(isUrl(str)).toBeTruthy();
7
+ });
8
+ it('should return false if passed an invalid Url', () => {
9
+ const str = '<div><img/><p>test</p><div>';
10
+ expect(isUrl(str)).toBeFalsy();
11
+ });
12
+ });
package/src/utils.js CHANGED
@@ -6,3 +6,10 @@ export function toTrimedFixedNumber(number, digits = 4) {
6
6
  }
7
7
 
8
8
  export const isNotEmptyArray = data => Array.isArray(data) && data.length > 0;
9
+
10
+ export const parseValueIntoMonetaryValueOfGivenCurrency = (value, currency) => {
11
+ return new Intl.NumberFormat('en-US', {
12
+ style: 'currency',
13
+ currency: currency,
14
+ }).format(Math.round(value * 100) / 100);
15
+ };