fhir-react 0.3.8 → 0.3.11

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 (102) hide show
  1. package/.storybook/main.js +5 -0
  2. package/.storybook/manager.js +6 -0
  3. package/.storybook/preview.js +56 -0
  4. package/README.md +1 -1
  5. package/build/index.js +8 -8
  6. package/build/style.css +2 -2
  7. package/package.json +5 -4
  8. package/src/components/containers/Accordion/Accordion.js +24 -1
  9. package/src/components/containers/Accordion/Accordion.stories.js +74 -58
  10. package/src/components/containers/ResourceContainer/ResourceContainer.css +4 -0
  11. package/src/components/containers/ResourceContainer/ResourceContainer.js +28 -37
  12. package/src/components/containers/ResourceContainer/ResourceContainer.stories.js +46 -22
  13. package/src/components/defaultArgTypes.js +12 -0
  14. package/src/components/resources/AdverseEvent/AdverseEvent.js +8 -1
  15. package/src/components/resources/AdverseEvent/AdverseEvent.stories.js +17 -19
  16. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +2 -0
  17. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +46 -70
  18. package/src/components/resources/Appointment/Appointment.js +8 -1
  19. package/src/components/resources/Appointment/Appointment.stories.js +51 -62
  20. package/src/components/resources/Binary/Binary.js +2 -1
  21. package/src/components/resources/Binary/Binary.stories.js +27 -21
  22. package/src/components/resources/Bundle/Bundle.stories.js +59 -49
  23. package/src/components/resources/CarePlan/CarePlan.js +8 -1
  24. package/src/components/resources/CarePlan/CarePlan.stories.js +44 -54
  25. package/src/components/resources/CareTeam/CareTeam.js +8 -1
  26. package/src/components/resources/CareTeam/CareTeam.stories.js +22 -28
  27. package/src/components/resources/Claim/Claim.js +8 -1
  28. package/src/components/resources/Claim/Claim.stories.js +37 -50
  29. package/src/components/resources/ClaimResponse/ClaimResponse.js +8 -1
  30. package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +42 -52
  31. package/src/components/resources/Condition/Condition.js +8 -1
  32. package/src/components/resources/Condition/Condition.stories.js +47 -62
  33. package/src/components/resources/Coverage/Coverage.js +8 -1
  34. package/src/components/resources/Coverage/Coverage.stories.js +38 -50
  35. package/src/components/resources/Device/Device.js +8 -1
  36. package/src/components/resources/Device/Device.stories.js +40 -52
  37. package/src/components/resources/DiagnosticReport/DiagnosticReport.js +2 -0
  38. package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +38 -50
  39. package/src/components/resources/DocumentReference/DocumentReference.js +2 -0
  40. package/src/components/resources/DocumentReference/DocumentReference.stories.js +25 -29
  41. package/src/components/resources/Encounter/Encounter.js +8 -1
  42. package/src/components/resources/Encounter/Encounter.stories.js +43 -59
  43. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +2 -0
  44. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +53 -67
  45. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +74 -38
  46. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +2 -0
  47. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +23 -29
  48. package/src/components/resources/Generic/Generic.js +2 -1
  49. package/src/components/resources/Generic/Generic.stories.js +21 -12
  50. package/src/components/resources/Goal/Goal.js +8 -1
  51. package/src/components/resources/Goal/Goal.stories.js +35 -49
  52. package/src/components/resources/Immunization/Immunization.js +8 -1
  53. package/src/components/resources/Immunization/Immunization.stories.js +38 -51
  54. package/src/components/resources/List/List.js +2 -0
  55. package/src/components/resources/List/List.stories.js +66 -70
  56. package/src/components/resources/Location/Location.js +2 -1
  57. package/src/components/resources/Location/Location.stories.js +23 -18
  58. package/src/components/resources/Medication/Medication.js +8 -1
  59. package/src/components/resources/Medication/Medication.stories.js +42 -64
  60. package/src/components/resources/MedicationAdministration/MedicationAdministration.js +2 -0
  61. package/src/components/resources/MedicationAdministration/MedicationAdministration.stories.js +32 -46
  62. package/src/components/resources/MedicationDispense/MedicationDispense.js +2 -0
  63. package/src/components/resources/MedicationDispense/MedicationDispense.stories.js +39 -57
  64. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +2 -0
  65. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +49 -58
  66. package/src/components/resources/MedicationOrder/MedicationOrder.js +2 -1
  67. package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +11 -4
  68. package/src/components/resources/MedicationRequest/MedicationRequest.js +7 -1
  69. package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +27 -30
  70. package/src/components/resources/MedicationStatement/MedicationStatement.js +2 -0
  71. package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +32 -46
  72. package/src/components/resources/Observation/Observation.js +2 -1
  73. package/src/components/resources/Observation/Observation.stories.js +39 -33
  74. package/src/components/resources/Observation/ObservationGraph.js +1 -1
  75. package/src/components/resources/Organization/Organization.js +8 -1
  76. package/src/components/resources/Organization/Organization.stories.js +40 -52
  77. package/src/components/resources/Patient/Patient.js +2 -0
  78. package/src/components/resources/Patient/Patient.stories.js +36 -28
  79. package/src/components/resources/Practitioner/Practitioner.js +8 -1
  80. package/src/components/resources/Practitioner/Practitioner.stories.js +39 -52
  81. package/src/components/resources/PractitionerRole/PractitionerRole.js +2 -0
  82. package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +43 -63
  83. package/src/components/resources/Procedure/Procedure.js +2 -1
  84. package/src/components/resources/Procedure/Procedure.stories.js +33 -25
  85. package/src/components/resources/Questionnaire/Questionnaire.js +8 -1
  86. package/src/components/resources/Questionnaire/Questionnaire.stories.js +47 -62
  87. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.js +2 -0
  88. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.stories.js +43 -63
  89. package/src/components/resources/ReferralRequest/ReferralRequest.js +8 -1
  90. package/src/components/resources/ReferralRequest/ReferralRequest.stories.js +20 -20
  91. package/src/components/resources/RelatedPerson/RelatedPerson.js +8 -1
  92. package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +26 -30
  93. package/src/components/resources/ResearchStudy/ResearchStudy.js +8 -1
  94. package/src/components/resources/ResearchStudy/ResearchStudy.stories.js +17 -15
  95. package/src/components/resources/ResourceCategory/ResourceCategory.js +1 -1
  96. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +40 -27
  97. package/src/components/supportedFhirResourceList.js +2 -0
  98. package/src/components/ui/index.js +27 -23
  99. package/src/style.scss +11 -0
  100. package/.storybook/addons.js +0 -1
  101. package/.storybook/config.js +0 -26
  102. package/.storybook/presets.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import RelatedPerson from './RelatedPerson';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -10,37 +10,33 @@ import exampleR4 from '../../../fixtures/r4/resources/relatedPerson/example1.jso
10
10
 
11
11
  import fhirIcons from '../../../fixtures/example-icons';
12
12
 
13
- export default { title: 'RelatedPerson' };
14
-
15
- export const ExampleDSTU2 = () => {
16
- const fhirResource = object('Resource', exampleDSTU2);
17
- return (
18
- <RelatedPerson
19
- fhirResource={fhirResource}
20
- fhirVersion={fhirVersions.DSTU2}
21
- fhirIcons={fhirIcons}
22
- />
23
- );
13
+ export default {
14
+ title: 'Coverage/RelatedPerson',
15
+ component: RelatedPerson,
16
+ argTypes: {
17
+ ...defaultArgTypes,
18
+ },
24
19
  };
25
20
 
26
- export const ExampleSTU3 = () => {
27
- const fhirResource = object('Resource', exampleSTU3);
28
- return (
29
- <RelatedPerson
30
- fhirResource={fhirResource}
31
- fhirVersion={fhirVersions.STU3}
32
- fhirIcons={false}
33
- />
34
- );
21
+ const Template = args => <RelatedPerson {...args} />;
22
+
23
+ export const ExampleDSTU2 = Template.bind({});
24
+ ExampleDSTU2.args = {
25
+ fhirVersion: fhirVersions.DSTU2,
26
+ fhirResource: exampleDSTU2,
27
+ fhirIcons: fhirIcons,
28
+ };
29
+
30
+ export const ExampleSTU3 = Template.bind({});
31
+ ExampleSTU3.args = {
32
+ fhirVersion: fhirVersions.STU3,
33
+ fhirResource: exampleSTU3,
34
+ fhirIcons: false,
35
35
  };
36
36
 
37
- export const ExampleR4 = () => {
38
- const fhirResource = object('Resource', exampleR4);
39
- return (
40
- <RelatedPerson
41
- fhirResource={fhirResource}
42
- fhirVersion={fhirVersions.R4}
43
- fhirIcons={'random text'}
44
- />
45
- );
37
+ export const ExampleR4 = Template.bind({});
38
+ ExampleR4.args = {
39
+ fhirVersion: fhirVersions.R4,
40
+ fhirResource: exampleR4,
41
+ fhirIcons: 'random text',
46
42
  };
@@ -94,7 +94,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
94
94
  }
95
95
  };
96
96
 
97
- const ResearchStudy = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
97
+ const ResearchStudy = ({
98
+ fhirResource,
99
+ fhirVersion,
100
+ fhirIcons,
101
+ onClick,
102
+ rawOnClick,
103
+ }) => {
98
104
  let fhirResourceData = {};
99
105
  try {
100
106
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -289,6 +295,7 @@ const ResearchStudy = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
289
295
  }
290
296
  bodyContent={<Body tableData={tableData} />}
291
297
  onClick={onClick}
298
+ rawOnClick={rawOnClick}
292
299
  />
293
300
  </Root>
294
301
  );
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import ResearchStudy from './ResearchStudy';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -10,22 +10,24 @@ import fhirIcons from '../../../fixtures/example-icons';
10
10
 
11
11
  export default {
12
12
  title: 'ResearchStudy',
13
+ component: ResearchStudy,
14
+ argTypes: {
15
+ ...defaultArgTypes,
16
+ },
13
17
  };
14
18
 
15
- export const ExampleOfSTU3 = () => {
16
- const fhirResource = object('Resource', stu3Example1);
17
- return (
18
- <ResearchStudy
19
- fhirVersion={fhirVersions.STU3}
20
- fhirResource={fhirResource}
21
- fhirIcons={fhirIcons}
22
- />
23
- );
19
+ const Template = args => <ResearchStudy {...args} />;
20
+
21
+ export const ExampleOfSTU3 = Template.bind({});
22
+ ExampleOfSTU3.args = {
23
+ fhirVersion: fhirVersions.STU3,
24
+ fhirResource: stu3Example1,
25
+ fhirIcons: fhirIcons,
24
26
  };
25
27
 
26
- export const ExampleOfR4 = () => {
27
- const fhirResource = object('Resource', r4Example1);
28
- return (
29
- <ResearchStudy fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />
30
- );
28
+ export const ExampleOfR4 = Template.bind({});
29
+ ExampleOfR4.args = {
30
+ fhirVersion: fhirVersions.R4,
31
+ fhirResource: r4Example1,
32
+ fhirIcons: false,
31
33
  };
@@ -15,7 +15,7 @@ const ResourceCategory = ({ title, itemsCount, fhirIcons }) => {
15
15
  <Root name="ResourceCategory">
16
16
  <button
17
17
  type="button"
18
- className="btn d-flex align-items-center justify-content-between w-100 py-4 px-4 bg-white"
18
+ className="btn d-flex align-items-center justify-content-between w-100 px-md-4 py-md-4 bg-white"
19
19
  >
20
20
  <div className="d-flex gap-2">
21
21
  <Header
@@ -1,40 +1,53 @@
1
1
  import React from 'react';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
+
2
4
  import ResourceCategory from './ResourceCategory';
3
5
  import fhirIcons from '../../../fixtures/example-icons';
4
6
  import ResourceCategoryIcon from '../../../assets/containers/ResourceCategory/resource-category.svg';
5
7
 
6
- export default { title: 'ResourceCategory' };
8
+ export default {
9
+ title: 'ResourceCategory',
10
+ component: ResourceCategory,
11
+ argTypes: {
12
+ ...defaultArgTypes,
13
+ itemsCount: {
14
+ table: {
15
+ disable: true,
16
+ },
17
+ },
18
+ title: {
19
+ table: {
20
+ disable: true,
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ const Template = args => <ResourceCategory {...args} />;
7
27
 
8
- export const ExampleWithAllProperties = () => {
9
- return (
10
- <ResourceCategory
11
- itemsCount={41}
12
- title="Resource name"
13
- fhirIcons={require('../../../assets/containers/ResourceCategory/resource-category.svg')}
14
- />
15
- );
28
+ export const ExampleWithAllProperties = Template.bind({});
29
+ ExampleWithAllProperties.args = {
30
+ itemsCount: 41,
31
+ title: 'Resource name',
32
+ fhirIcons: require('../../../assets/containers/ResourceCategory/resource-category.svg'),
16
33
  };
17
34
 
18
- export const ExampleWith1Item = () => {
19
- return (
20
- <ResourceCategory
21
- itemsCount={'1'}
22
- title="Resource name"
23
- fhirIcons={ResourceCategoryIcon}
24
- />
25
- );
35
+ export const ExampleWith1Item = Template.bind({});
36
+ ExampleWith1Item.args = {
37
+ itemsCount: '1',
38
+ title: 'Resource name',
39
+ fhirIcons: ResourceCategoryIcon,
26
40
  };
27
41
 
28
- export const ExampleWithoutItemsCount = () => {
29
- return <ResourceCategory title="Resource name" fhirIcons={fhirIcons} />;
42
+ export const ExampleWithoutItemsCount = Template.bind({});
43
+ ExampleWithoutItemsCount.args = {
44
+ title: 'Resource name',
45
+ fhirIcons: fhirIcons,
30
46
  };
31
47
 
32
- export const ExampleWith1ItemAndDisableIcon = () => {
33
- return (
34
- <ResourceCategory
35
- itemsCount={'1'}
36
- title="Resource name"
37
- fhirIcons={false}
38
- />
39
- );
48
+ export const ExampleWith1ItemAndDisableIcon = Template.bind({});
49
+ ExampleWith1ItemAndDisableIcon.args = {
50
+ itemsCount: '1',
51
+ title: 'Resource name',
52
+ fhirIcons: false,
40
53
  };
@@ -36,6 +36,7 @@ import MedicationAdministration from './resources/MedicationAdministration';
36
36
  import Questionnaire from './resources/Questionnaire';
37
37
  import QuestionnaireResponse from './resources/QuestionnaireResponse';
38
38
  import ReferralRequest from './resources/ReferralRequest';
39
+ import RelatedPerson from './resources/RelatedPerson';
39
40
  import ResearchStudy from './resources/ResearchStudy';
40
41
  import ResourceCategory from './resources/ResourceCategory';
41
42
 
@@ -78,6 +79,7 @@ export {
78
79
  Questionnaire,
79
80
  QuestionnaireResponse,
80
81
  ReferralRequest,
82
+ RelatedPerson,
81
83
  ResearchStudy,
82
84
  ResourceCategory,
83
85
  };
@@ -32,7 +32,7 @@ export const Header = ({
32
32
  isAccordionOpenable ? 'header__title-row' : ''
33
33
  } d-flex w-100 flex-column flex-sm-row`}
34
34
  >
35
- <div className="d-flex">
35
+ <div className="d-flex align-items-center">
36
36
  {!isNoIcon && (
37
37
  <div
38
38
  className={`fhir-ui__${resourceName}-Header__icon d-flex align-items-center flex-shrink-1 m-half me-2`}
@@ -52,30 +52,34 @@ export const Header = ({
52
52
  </div>
53
53
  </div>
54
54
 
55
- <div
56
- className={`fhir-ui__${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}`}
57
- >
58
- {prefixBadge && <div className="me-3">{prefixBadge}</div>}
59
- <div className="d-flex">
60
- {badges}
61
- {additionalBadge && (
62
- <div className="ms-3">{additionalBadge}</div>
63
- )}
55
+ {(prefixBadge || badges || additionalBadge) && (
56
+ <div
57
+ className={`fhir-ui__${resourceName}-Header__badges 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}`}
58
+ >
59
+ {prefixBadge && <div className="me-3">{prefixBadge}</div>}
60
+ <div className="d-flex align-items-center">
61
+ {badges}
62
+ {additionalBadge && (
63
+ <div className="ms-3">{additionalBadge}</div>
64
+ )}
65
+ </div>
64
66
  </div>
65
- </div>
67
+ )}
66
68
  </div>
67
- <div
68
- className={`fhir-ui__${resourceName}-Header__additional-content w-100 justify-content-start d-flex ${
69
- additionalContent ? ' pt-2' : ''
70
- }`}
71
- >
72
- {additionalContent}
69
+ {(additionalContent || rightAdditionalContent) && (
73
70
  <div
74
- className={`fhir-ui__${resourceName}-Header__rightAdditionalContent justify-content-end ${rightItemsClass}`}
71
+ className={`fhir-ui__${resourceName}-Header__additional-content w-100 justify-content-start d-flex ${
72
+ additionalContent ? ' pt-2' : ''
73
+ }`}
75
74
  >
76
- {rightAdditionalContent}
75
+ {additionalContent}
76
+ <div
77
+ className={`fhir-ui__${resourceName}-Header__rightAdditionalContent justify-content-md-end mx-0 ${rightItemsClass}`}
78
+ >
79
+ {rightAdditionalContent}
80
+ </div>
77
81
  </div>
78
- </div>
82
+ )}
79
83
  </div>
80
84
  )}
81
85
  </>
@@ -84,7 +88,7 @@ export const Header = ({
84
88
 
85
89
  export const Title = props => (
86
90
  <h4
87
- className={`fhir-ui__Title fw-bold fs-4 lh-base mb-0 w-90 title-width-sm ${
91
+ className={`fhir-ui__Title fw-bold lh-base mb-0 text-break d-flex ${
88
92
  props.capitalize ? 'text-capitalize' : ''
89
93
  }`}
90
94
  data-testid={props['data-testid'] || 'title'}
@@ -96,7 +100,7 @@ export const Title = props => (
96
100
  export const Badge = props => {
97
101
  return (
98
102
  <small
99
- className={`fhir-ui__Badge text-capitalize d-flex align-items-center mx-1 px-2 py-1 rounded-1 fw-bold ${getBadgeColor(
103
+ className={`fhir-ui__Badge text-capitalize d-flex align-items-center px-2 py-1 rounded-1 fw-bold ${getBadgeColor(
100
104
  props,
101
105
  )}`}
102
106
  data-testid={props['data-testid']}
@@ -108,7 +112,7 @@ export const Badge = props => {
108
112
 
109
113
  export const BadgeSecondary = props => (
110
114
  <small
111
- className={`fhir-ui__BadgeSecondary px-2 py-1 rounded-1 fw-bold ${getBadgeColor(
115
+ className={`fhir-ui__BadgeSecondary px-2 py-1 rounded-1 fw-bold d-flex align-items-center ${getBadgeColor(
112
116
  props,
113
117
  )}`}
114
118
  data-testid={props['data-testid']}
package/src/style.scss CHANGED
@@ -106,6 +106,17 @@ $enable-negative-margins: true;
106
106
 
107
107
  .fhir-ui__Badge {
108
108
  width: fit-content;
109
+ margin: 0 4px;
110
+ @include media-breakpoint-down(sm) {
111
+ margin: 4px 0;
112
+ }
113
+ }
114
+
115
+ .fhir-ui__Title {
116
+ font-size: 1.125rem;
117
+ @include media-breakpoint-down(sm) {
118
+ font-size: 1rem !important;
119
+ }
109
120
  }
110
121
 
111
122
  .header__title-row {
@@ -1 +0,0 @@
1
- import '@storybook/addon-knobs/register';
@@ -1,26 +0,0 @@
1
- import '../src/components/ui/bootstrap-reboot.min.css';
2
- import '../src/style.css';
3
- import '../src/style.scss';
4
-
5
- import { addDecorator, addParameters, configure } from '@storybook/react';
6
-
7
- import { withKnobs } from '@storybook/addon-knobs';
8
-
9
- if (typeof document !== 'undefined') {
10
- require('bootstrap/dist/js/bootstrap.min.js');
11
- }
12
-
13
- addParameters({
14
- options: {
15
- name: 'FHIR-REACT storybook',
16
- showRoots: true,
17
- },
18
- });
19
-
20
- addDecorator(
21
- withKnobs({
22
- escapeHTML: false,
23
- }),
24
- );
25
-
26
- configure(require.context('../src', true, /\.stories\.js$/), module);
@@ -1 +0,0 @@
1
- module.exports = ['@storybook/preset-scss'];