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,76 +1,92 @@
1
+ import React from 'react';
2
+ import _get from 'lodash/get';
3
+
1
4
  import { BadgeSecondary, Body, MissingValue, Title, Value } from '../../ui';
2
5
 
3
6
  import Accordion from './Accordion';
4
7
  import Annotation from '../../datatypes/Annotation';
5
8
  import Date from '../../datatypes/Date';
6
- import Procedure from '../../resources/Procedure/Procedure';
7
- import React from 'react';
8
9
  import Reference from '../../datatypes/Reference';
9
- import _get from 'lodash/get';
10
+ import Procedure from '../../resources/Procedure/Procedure';
11
+
10
12
  import example1 from '../../../fixtures/dstu2/resources/procedure/example1.json';
11
- import fhirIcons from '../../../fixtures/example-icons';
12
- import { object } from '@storybook/addon-knobs';
13
13
  import stu3Example1 from '../../../fixtures/stu3/resources/procedure/example1.json';
14
+ import fhirIcons from '../../../fixtures/example-icons';
14
15
 
15
16
  export default {
16
17
  title: 'Accordion',
18
+ component: Accordion,
19
+ argTypes: {
20
+ headerContent: {
21
+ table: {
22
+ disable: true,
23
+ },
24
+ },
25
+ bodyContent: {
26
+ table: {
27
+ disable: true,
28
+ },
29
+ },
30
+ },
17
31
  };
18
32
 
19
- export const DefaultVisualization = () => {
20
- const fhirResource = object('Resource', stu3Example1);
21
- const title =
22
- _get(fhirResource, 'code.coding[0].display') ||
23
- _get(fhirResource, 'code.text');
24
- const performedDateTime = _get(fhirResource, 'performedDateTime');
25
- const performer = _get(fhirResource, 'performer', []);
26
- const locationReference = _get(fhirResource, 'location[0]');
27
- const reasonCode = _get(fhirResource, 'reasonCode', []);
28
- const note = _get(fhirResource, 'note', []);
33
+ const Template = args => <Accordion {...args} />;
29
34
 
30
- return (
31
- <Accordion
32
- headerContent={
33
- <div className="">
34
- <Title>{title}</Title>
35
- <div className="pb-3" />
36
- <BadgeSecondary data-testid="performedDateTime">
37
- <Date fhirData={performedDateTime} />
38
- </BadgeSecondary>
39
- </div>
40
- }
41
- bodyContent={
42
- <Body>
43
- <Value label="Performed by">
44
- {performer.map((item, i) => (
45
- <div key={`item-${i}`}>
46
- {_get(item, 'actor.display', <MissingValue />)}
47
- </div>
48
- ))}
49
- </Value>
50
- <Value label="Location" data-testid="location">
51
- <Reference fhirData={locationReference} />
52
- </Value>
53
- <Value label="Reason" data-testid="hasReasonCode">
54
- <Annotation fhirData={reasonCode} />
55
- </Value>
56
- <Value label="Notes" data-testid="hasNote">
57
- <Annotation fhirData={note} />
58
- </Value>
59
- </Body>
60
- }
61
- />
62
- );
35
+ const DefaultVisualizationFhirResource = stu3Example1;
36
+ export const DefaultVisualization = Template.bind({});
37
+ DefaultVisualization.args = {
38
+ headerContent: (
39
+ <div className="">
40
+ <Title>
41
+ {_get(DefaultVisualizationFhirResource, 'code.coding[0].display') ||
42
+ _get(DefaultVisualizationFhirResource, 'code.text')}
43
+ </Title>
44
+ <div className="pb-3" />
45
+ <BadgeSecondary data-testid="performedDateTime">
46
+ <Date
47
+ fhirData={_get(DefaultVisualizationFhirResource, 'performedDateTime')}
48
+ />
49
+ </BadgeSecondary>
50
+ </div>
51
+ ),
52
+ bodyContent: (
53
+ <Body>
54
+ <Value label="Performed by">
55
+ {_get(DefaultVisualizationFhirResource, 'performer', []).map(
56
+ (item, i) => (
57
+ <div key={`item-${i}`}>
58
+ {_get(item, 'actor.display', <MissingValue />)}
59
+ </div>
60
+ ),
61
+ )}
62
+ </Value>
63
+ <Value label="Location" data-testid="location">
64
+ <Reference
65
+ fhirData={_get(DefaultVisualizationFhirResource, 'location[0]')}
66
+ />
67
+ </Value>
68
+ <Value label="Reason" data-testid="hasReasonCode">
69
+ <Annotation
70
+ fhirData={_get(DefaultVisualizationFhirResource, 'reasonCode', [])}
71
+ />
72
+ </Value>
73
+ <Value label="Notes" data-testid="hasNote">
74
+ <Annotation
75
+ fhirData={_get(DefaultVisualizationFhirResource, 'note', [])}
76
+ />
77
+ </Value>
78
+ </Body>
79
+ ),
63
80
  };
64
81
 
65
- export const ProcedureVisualization = () => {
66
- const fhirResource = object('Resource', example1);
67
-
68
- return (
69
- <Accordion
70
- headerContent={<div className=""></div>}
71
- bodyContent={
72
- <Procedure fhirResource={fhirResource} fhirIcons={fhirIcons} />
73
- }
82
+ const ProcedureVisualizationFhirResource = example1;
83
+ export const ProcedureVisualization = Template.bind({});
84
+ ProcedureVisualization.args = {
85
+ headerContent: <div className="" />,
86
+ bodyContent: (
87
+ <Procedure
88
+ fhirResource={ProcedureVisualizationFhirResource}
89
+ fhirIcons={fhirIcons}
74
90
  />
75
- );
91
+ ),
76
92
  };
@@ -20,6 +20,10 @@
20
20
  top: 0.5rem;
21
21
  }
22
22
 
23
+ .fhir-container__ResourceContainer__json-button-wrapper-accordion {
24
+ margin-top: 10px;
25
+ }
26
+
23
27
  .fhir-container__ResourceContainer__json--visible {
24
28
  display: block;
25
29
  padding-top: 10px;
@@ -1,45 +1,36 @@
1
- import React from 'react';
1
+ import React, { Children, cloneElement, useState } from 'react';
2
2
  import CodeBlock from '../CodeBlock';
3
3
  import './ResourceContainer.css';
4
4
 
5
- class ResourceContainer extends React.Component {
6
- constructor(props) {
7
- super(props);
8
- this.state = {
9
- jsonOpen:
10
- typeof this.props.jsonOpen === 'undefined'
11
- ? false
12
- : this.props.jsonOpen,
13
- };
14
- }
5
+ const ResourceContainer = ({ fhirResource, children, jsonOpen }) => {
6
+ const [openJson, setOpenJson] = useState(jsonOpen ?? false);
15
7
 
16
- render() {
17
- return (
18
- <div className="fhir-container__ResourceContainer__card">
19
- <div className="fhir-container__ResourceContainer__card-body">
20
- <div className="fhir-container__ResourceContainer__json-button-wrapper">
21
- <button
22
- type="button"
23
- className="fhir-container__ResourceContainer__json-button"
24
- onClick={() => this.setState({ jsonOpen: !this.state.jsonOpen })}
25
- >
26
- RAW
27
- </button>
28
- </div>
29
- {this.props.children}
30
- <div
31
- className={
32
- this.state.jsonOpen
33
- ? 'fhir-container__ResourceContainer__json--visible'
34
- : 'fhir-container__ResourceContainer__json--hidden'
35
- }
36
- >
37
- <CodeBlock code={this.props.fhirResource} />
38
- </div>
8
+ return (
9
+ <div className="fhir-container__ResourceContainer__card">
10
+ <div className="fhir-container__ResourceContainer__card-body">
11
+ {Children.map(children, child => {
12
+ return cloneElement(
13
+ child,
14
+ {
15
+ rawOnClick: () => {
16
+ setOpenJson(!openJson);
17
+ },
18
+ },
19
+ null,
20
+ );
21
+ })}
22
+ <div
23
+ className={
24
+ openJson
25
+ ? 'fhir-container__ResourceContainer__json--visible'
26
+ : 'fhir-container__ResourceContainer__json--hidden'
27
+ }
28
+ >
29
+ <CodeBlock code={fhirResource} />
39
30
  </div>
40
31
  </div>
41
- );
42
- }
43
- }
32
+ </div>
33
+ );
34
+ };
44
35
 
45
36
  export default ResourceContainer;
@@ -1,37 +1,61 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import ResourceContainer from './ResourceContainer';
5
5
  import Encounter from '../../../components/resources/Encounter';
6
+ import Generic from '../../resources/Generic';
6
7
 
7
8
  import example1 from '../../../fixtures/dstu2/resources/encounter/example.json';
8
9
  import fhirVersions from '../../../components/resources/fhirResourceVersions';
9
10
 
10
11
  export default {
11
12
  title: 'ResourceContainer',
13
+ component: ResourceContainer,
14
+ argTypes: {
15
+ ...defaultArgTypes,
16
+ children: {
17
+ table: {
18
+ disable: true,
19
+ },
20
+ },
21
+ },
12
22
  };
13
23
 
14
- export const DefaultVisualization = () => {
15
- const fhirResource = object('Resource', example1);
16
- const props = {
17
- fhirVersion: fhirVersions.DSTU2,
18
- fhirResource: fhirResource,
19
- };
20
- return (
21
- <ResourceContainer {...props}>
22
- <Encounter {...props} />
23
- </ResourceContainer>
24
- );
24
+ const Template = args => <ResourceContainer {...args} />;
25
+
26
+ const propsRawInsideAccordion = {
27
+ fhirVersion: fhirVersions.DSTU2,
28
+ fhirResource: example1,
29
+ };
30
+ export const DefaultVisualizationWithRawButtonHiddenInsideAccordion = Template.bind(
31
+ {},
32
+ );
33
+ DefaultVisualizationWithRawButtonHiddenInsideAccordion.args = {
34
+ ...propsRawInsideAccordion,
35
+ children: <Encounter {...propsRawInsideAccordion} />,
36
+ };
37
+
38
+ const exampleResource = {
39
+ resourceType: 'UnknownResource',
40
+ id: '12345',
41
+ code: {
42
+ text: 'Resource code text',
43
+ },
44
+ };
45
+ const propsRawOutsideAccordion = { fhirResource: exampleResource };
46
+ export const DefaultVisualizationWithRawButtonVisibleOutsideAccordion = Template.bind(
47
+ {},
48
+ );
49
+ DefaultVisualizationWithRawButtonVisibleOutsideAccordion.args = {
50
+ ...propsRawOutsideAccordion,
51
+ children: <Generic {...propsRawOutsideAccordion} />,
25
52
  };
26
53
 
27
- export const VisualizationWithoutFhirVersion = () => {
28
- const fhirResource = object('Resource', example1);
29
- const props = {
30
- fhirResource: fhirResource,
31
- };
32
- return (
33
- <ResourceContainer {...props}>
34
- <Encounter {...props} />
35
- </ResourceContainer>
36
- );
54
+ const propsWithoutVersion = {
55
+ fhirResource: example1,
56
+ };
57
+ export const VisualizationWithoutFhirVersion = Template.bind({});
58
+ VisualizationWithoutFhirVersion.args = {
59
+ ...propsWithoutVersion,
60
+ children: <Encounter {...propsWithoutVersion} />,
37
61
  };
@@ -0,0 +1,12 @@
1
+ export const defaultArgTypes = {
2
+ fhirVersion: {
3
+ table: {
4
+ disable: true,
5
+ },
6
+ },
7
+ fhirIcons: {
8
+ table: {
9
+ disable: true,
10
+ },
11
+ },
12
+ };
@@ -71,7 +71,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
71
71
  }
72
72
  };
73
73
 
74
- const AdverseEvent = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
74
+ const AdverseEvent = ({
75
+ fhirResource,
76
+ fhirVersion,
77
+ fhirIcons,
78
+ onClick,
79
+ rawOnClick,
80
+ }) => {
75
81
  let fhirResourceData = {};
76
82
  try {
77
83
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -165,6 +171,7 @@ const AdverseEvent = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
165
171
  </Body>
166
172
  }
167
173
  onClick={onClick}
174
+ rawOnClick={rawOnClick}
168
175
  />
169
176
  </Root>
170
177
  );
@@ -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 AdverseEvent from './AdverseEvent';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -11,26 +11,24 @@ import fhirIcons from '../../../fixtures/example-icons';
11
11
 
12
12
  export default {
13
13
  title: 'AdverseEvent',
14
+ component: AdverseEvent,
15
+ argTypes: {
16
+ ...defaultArgTypes,
17
+ },
14
18
  };
15
19
 
16
- export const DefaultVisualizationSTU3 = () => {
17
- const fhirResource = object('Resource', stu3Example1);
18
- return (
19
- <AdverseEvent
20
- fhirResource={fhirResource}
21
- fhirVersion={fhirVersions.STU3}
22
- fhirIcons={fhirIcons}
23
- />
24
- );
20
+ const Template = args => <AdverseEvent {...args} />;
21
+
22
+ export const DefaultVisualizationSTU3 = Template.bind({});
23
+ DefaultVisualizationSTU3.args = {
24
+ fhirVersion: fhirVersions.STU3,
25
+ fhirResource: stu3Example1,
26
+ fhirIcons: fhirIcons,
25
27
  };
26
28
 
27
- export const Example1ofR4 = () => {
28
- const fhirResource = object('Resource', r4Example1);
29
- return (
30
- <AdverseEvent
31
- fhirResource={fhirResource}
32
- fhirVersion={fhirVersions.R4}
33
- fhirIcons={false}
34
- />
35
- );
29
+ export const Example1ofR4 = Template.bind({});
30
+ Example1ofR4.args = {
31
+ fhirVersion: fhirVersions.R4,
32
+ fhirResource: r4Example1,
33
+ fhirIcons: false,
36
34
  };
@@ -128,6 +128,7 @@ const AllergyIntolerance = ({
128
128
  fhirVersion,
129
129
  fhirIcons,
130
130
  onClick,
131
+ rawOnClick,
131
132
  }) => {
132
133
  let fhirResourceData = {};
133
134
  try {
@@ -237,6 +238,7 @@ const AllergyIntolerance = ({
237
238
  }
238
239
  bodyContent={<Body tableData={tableData} />}
239
240
  onClick={onClick}
241
+ rawOnClick={rawOnClick}
240
242
  />
241
243
  </Root>
242
244
  );
@@ -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 AllergyIntolerance from './AllergyIntolerance';
5
5
 
@@ -14,88 +14,64 @@ import fhirIcons from '../../../fixtures/example-icons';
14
14
  import fhirVersions from '../fhirResourceVersions';
15
15
  import AllergyIntoleranceIcon from '../../../assets/containers/AllergyIntolerance/allergy-intolerance.svg';
16
16
 
17
- export default { title: 'AllergyIntolerance' };
17
+ export default {
18
+ title: 'AllergyIntolerance',
19
+ component: AllergyIntolerance,
20
+ argTypes: {
21
+ ...defaultArgTypes,
22
+ },
23
+ };
24
+
25
+ const Template = args => <AllergyIntolerance {...args} />;
18
26
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', exampleAllergyIntoleranceDSTU2);
21
- return (
22
- <AllergyIntolerance
23
- fhirVersion={fhirVersions.DSTU2}
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/AllergyIntolerance/allergy-intolerance.svg')}
26
- />
27
- );
27
+ export const DefaultVisualizationDSTU2 = Template.bind({});
28
+ DefaultVisualizationDSTU2.args = {
29
+ fhirVersion: fhirVersions.DSTU2,
30
+ fhirResource: exampleAllergyIntoleranceDSTU2,
31
+ fhirIcons: require('../../../assets/containers/AllergyIntolerance/allergy-intolerance.svg'),
28
32
  };
29
33
 
30
- export const Example2ofDSTU2 = () => {
31
- const fhirResource = object('Resource', example2AllergyIntoleranceDSTU2);
32
- return (
33
- <AllergyIntolerance
34
- fhirVersion={fhirVersions.DSTU2}
35
- fhirResource={fhirResource}
36
- fhirIcons={AllergyIntoleranceIcon}
37
- />
38
- );
34
+ export const Example2ofDSTU2 = Template.bind({});
35
+ Example2ofDSTU2.args = {
36
+ fhirVersion: fhirVersions.DSTU2,
37
+ fhirResource: example2AllergyIntoleranceDSTU2,
38
+ fhirIcons: AllergyIntoleranceIcon,
39
39
  };
40
40
 
41
- export const ExampleDiagnosticReportSTU3 = () => {
42
- const fhirResource = object('Resource', exampleAllergyIntoleranceSTU3);
43
- return (
44
- <AllergyIntolerance
45
- fhirVersion={fhirVersions.STU3}
46
- fhirResource={fhirResource}
47
- fhirIcons={fhirIcons}
48
- />
49
- );
41
+ export const ExampleDiagnosticReportSTU3 = Template.bind({});
42
+ ExampleDiagnosticReportSTU3.args = {
43
+ fhirVersion: fhirVersions.STU3,
44
+ fhirResource: exampleAllergyIntoleranceSTU3,
45
+ fhirIcons: fhirIcons,
50
46
  };
51
47
 
52
- export const Example2DiagnosticReportSTU3 = () => {
53
- const fhirResource = object('Resource', example2AllergyIntoleranceSTU3);
54
- return (
55
- <AllergyIntolerance
56
- fhirVersion={fhirVersions.STU3}
57
- fhirResource={fhirResource}
58
- fhirIcons={false}
59
- />
60
- );
48
+ export const Example2DiagnosticReportSTU3 = Template.bind({});
49
+ Example2DiagnosticReportSTU3.args = {
50
+ fhirVersion: fhirVersions.STU3,
51
+ fhirResource: example2AllergyIntoleranceSTU3,
52
+ fhirIcons: false,
61
53
  };
62
54
 
63
- export const Example1R4 = () => {
64
- const fhirResource = object('Resource', example1AllergyIntoleranceR4);
65
- return (
66
- <AllergyIntolerance
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={'random text'}
70
- />
71
- );
55
+ export const Example1R4 = Template.bind({});
56
+ Example1R4.args = {
57
+ fhirVersion: fhirVersions.R4,
58
+ fhirResource: example1AllergyIntoleranceR4,
59
+ fhirIcons: 'random text',
72
60
  };
73
61
 
74
- export const Example2R4 = () => {
75
- const fhirResource = object('Resource', example2AllergyIntoleranceR4);
76
- return (
77
- <AllergyIntolerance
78
- fhirVersion={fhirVersions.R4}
79
- fhirResource={fhirResource}
80
- fhirIcons={fhirIcons}
81
- />
82
- );
62
+ export const Example2R4 = Template.bind({});
63
+ Example2R4.args = {
64
+ fhirVersion: fhirVersions.R4,
65
+ fhirResource: example2AllergyIntoleranceR4,
83
66
  };
84
67
 
85
- export const Example3R4 = () => {
86
- const fhirResource = object('Resource', example3AllergyIntoleranceR4);
87
- return (
88
- <AllergyIntolerance
89
- fhirVersion={fhirVersions.R4}
90
- fhirResource={fhirResource}
91
- fhirIcons={fhirIcons}
92
- />
93
- );
68
+ export const Example3R4 = Template.bind({});
69
+ Example3R4.args = {
70
+ fhirVersion: fhirVersions.R4,
71
+ fhirResource: example3AllergyIntoleranceR4,
94
72
  };
95
73
 
96
- export const ExampleWithoutFhirVersionProperty = () => {
97
- const fhirResource = object('Resource', example2AllergyIntoleranceSTU3);
98
- return (
99
- <AllergyIntolerance fhirResource={fhirResource} fhirIcons={fhirIcons} />
100
- );
74
+ export const ExampleWithoutFhirVersionProperty = Template.bind({});
75
+ ExampleWithoutFhirVersionProperty.args = {
76
+ fhirResource: example2AllergyIntoleranceSTU3,
101
77
  };
@@ -144,7 +144,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
144
144
  }
145
145
  };
146
146
 
147
- const Appointment = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
147
+ const Appointment = ({
148
+ fhirResource,
149
+ fhirVersion,
150
+ fhirIcons,
151
+ onClick,
152
+ rawOnClick,
153
+ }) => {
148
154
  const {
149
155
  description,
150
156
  status,
@@ -254,6 +260,7 @@ const Appointment = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
254
260
  </Body>
255
261
  }
256
262
  onClick={onClick}
263
+ rawOnClick={rawOnClick}
257
264
  />
258
265
  </Root>
259
266
  );