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
@@ -112,6 +112,7 @@ const MedicationStatement = ({
112
112
  fhirVersion,
113
113
  fhirIcons,
114
114
  onClick,
115
+ rawOnClick,
115
116
  }) => {
116
117
  let fhirResourceData = {};
117
118
  try {
@@ -205,6 +206,7 @@ const MedicationStatement = ({
205
206
  </Body>
206
207
  }
207
208
  onClick={onClick}
209
+ rawOnClick={rawOnClick}
208
210
  />
209
211
  </Root>
210
212
  );
@@ -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 MedicationStatement from './MedicationStatement';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -14,59 +14,45 @@ import MedicationStatementIcon from '../../../assets/containers/MedicationStatem
14
14
 
15
15
  export default {
16
16
  title: 'MedicationStatement',
17
+ component: MedicationStatement,
18
+ argTypes: {
19
+ ...defaultArgTypes,
20
+ },
17
21
  };
18
22
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', dstu2Example1);
21
- return (
22
- <MedicationStatement
23
- fhirVersion={fhirVersions.DSTU2}
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/MedicationStatement/medication-statement.svg')}
26
- />
27
- );
23
+ const Template = args => <MedicationStatement {...args} />;
24
+
25
+ export const DefaultVisualizationDSTU2 = Template.bind({});
26
+ DefaultVisualizationDSTU2.args = {
27
+ fhirVersion: fhirVersions.DSTU2,
28
+ fhirResource: dstu2Example1,
29
+ fhirIcons: require('../../../assets/containers/MedicationStatement/medication-statement.svg'),
28
30
  };
29
31
 
30
- export const ExampleOfSTU3 = () => {
31
- const fhirResource = object('Resource', stu3Example1);
32
- return (
33
- <MedicationStatement
34
- fhirVersion={fhirVersions.STU3}
35
- fhirResource={fhirResource}
36
- fhirIcons={MedicationStatementIcon}
37
- />
38
- );
32
+ export const ExampleOfSTU3 = Template.bind({});
33
+ ExampleOfSTU3.args = {
34
+ fhirVersion: fhirVersions.STU3,
35
+ fhirResource: stu3Example1,
36
+ fhirIcons: MedicationStatementIcon,
39
37
  };
40
38
 
41
- export const Example2OfSTU3 = () => {
42
- const fhirResource = object('Resource', stu3Example2);
43
- return (
44
- <MedicationStatement
45
- fhirVersion={fhirVersions.STU3}
46
- fhirResource={fhirResource}
47
- fhirIcons={fhirIcons}
48
- />
49
- );
39
+ export const Example2OfSTU3 = Template.bind({});
40
+ Example2OfSTU3.args = {
41
+ fhirVersion: fhirVersions.STU3,
42
+ fhirResource: stu3Example2,
43
+ fhirIcons: fhirIcons,
50
44
  };
51
45
 
52
- export const Example1OfR4 = () => {
53
- const fhirResource = object('Resource', r4Example1);
54
- return (
55
- <MedicationStatement
56
- fhirVersion={fhirVersions.R4}
57
- fhirResource={fhirResource}
58
- fhirIcons={false}
59
- />
60
- );
46
+ export const Example1OfR4 = Template.bind({});
47
+ Example1OfR4.args = {
48
+ fhirVersion: fhirVersions.R4,
49
+ fhirResource: r4Example1,
50
+ fhirIcons: false,
61
51
  };
62
52
 
63
- export const Example2OfR4 = () => {
64
- const fhirResource = object('Resource', r4Example2);
65
- return (
66
- <MedicationStatement
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={'random text'}
70
- />
71
- );
53
+ export const Example2OfR4 = Template.bind({});
54
+ Example2OfR4.args = {
55
+ fhirVersion: fhirVersions.R4,
56
+ fhirResource: r4Example2,
57
+ fhirIcons: 'random text',
72
58
  };
@@ -18,7 +18,7 @@ import {
18
18
  } from '../../ui';
19
19
  import Reference from '../../datatypes/Reference';
20
20
 
21
- const Observation = ({ fhirResource, fhirIcons, onClick }) => {
21
+ const Observation = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
22
22
  const effectiveDate = _get(fhirResource, 'effectiveDateTime');
23
23
  const codeCodingDisplay = _get(fhirResource, 'code.coding.0.display');
24
24
  const codeText = _get(fhirResource, 'code.text', '');
@@ -115,6 +115,7 @@ const Observation = ({ fhirResource, fhirIcons, onClick }) => {
115
115
  </Body>
116
116
  }
117
117
  onClick={onClick}
118
+ rawOnClick={rawOnClick}
118
119
  />
119
120
  </Root>
120
121
  );
@@ -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 Observation from './Observation';
5
5
 
@@ -15,51 +15,57 @@ import example3ObservationExcessR4 from '../../../fixtures/r4/resources/observat
15
15
  import ObservationIcon from '../../../assets/containers/Observation/observation.svg';
16
16
  import fhirIcons from '../../../fixtures/example-icons';
17
17
 
18
- export default { title: 'Observation' };
18
+ export default {
19
+ title: 'Observation',
20
+ component: Observation,
21
+ argTypes: {
22
+ ...defaultArgTypes,
23
+ },
24
+ };
25
+
26
+ const Template = args => <Observation {...args} />;
19
27
 
20
- export const DefaultVisualizationDSTU2 = () => {
21
- const fhirResource = object('Resource', exampleObservationIssued);
22
- return (
23
- <Observation
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/Observation/observation.svg')}
26
- />
27
- );
28
+ export const DefaultVisualizationDSTU2 = Template.bind({});
29
+ DefaultVisualizationDSTU2.args = {
30
+ fhirResource: exampleObservationIssued,
31
+ fhirIcons: require('../../../assets/containers/Observation/observation.svg'),
28
32
  };
29
33
 
30
- export const ExampleWithoutIssuedDSTU2 = () => {
31
- const fhirResource = object('Resource', exampleObservation);
32
- return (
33
- <Observation fhirResource={fhirResource} fhirIcons={ObservationIcon} />
34
- );
34
+ export const ExampleWithoutIssuedDSTU2 = Template.bind({});
35
+ ExampleWithoutIssuedDSTU2.args = {
36
+ fhirResource: exampleObservation,
37
+ fhirIcons: ObservationIcon,
35
38
  };
36
39
 
37
- export const ExampleWithIssuedSTU3 = () => {
38
- const fhirResource = object('Resource', exampleObservationExcessSTU3);
39
- return <Observation fhirResource={fhirResource} fhirIcons={fhirIcons} />;
40
+ export const ExampleWithIssuedSTU3 = Template.bind({});
41
+ ExampleWithIssuedSTU3.args = {
42
+ fhirResource: exampleObservationExcessSTU3,
43
+ fhirIcons: fhirIcons,
40
44
  };
41
45
 
42
- export const ExampleWithoutIssuedSTU3 = () => {
43
- const fhirResource = object('Resource', exampleObservationSTU3);
44
- return <Observation fhirResource={fhirResource} fhirIcons={false} />;
46
+ export const ExampleWithoutIssuedSTU3 = Template.bind({});
47
+ ExampleWithoutIssuedSTU3.args = {
48
+ fhirResource: exampleObservationSTU3,
49
+ fhirIcons: false,
45
50
  };
46
51
 
47
- export const Example3OfSTU3 = () => {
48
- const fhirResource = object('Resource', example3ObservationExcessSTU3);
49
- return <Observation fhirResource={fhirResource} fhirIcons={'random text'} />;
52
+ export const Example3OfSTU3 = Template.bind({});
53
+ Example3OfSTU3.args = {
54
+ fhirResource: example3ObservationExcessSTU3,
55
+ fhirIcons: 'random text',
50
56
  };
51
57
 
52
- export const Example1OfR4 = () => {
53
- const fhirResource = object('Resource', example1ObservationExcessR4);
54
- return <Observation fhirResource={fhirResource} />;
58
+ export const Example1OfR4 = Template.bind({});
59
+ Example1OfR4.args = {
60
+ fhirResource: example1ObservationExcessR4,
55
61
  };
56
62
 
57
- export const Example2OfR4 = () => {
58
- const fhirResource = object('Resource', example2ObservationExcessR4);
59
- return <Observation fhirResource={fhirResource} />;
63
+ export const Example2OfR4 = Template.bind({});
64
+ Example2OfR4.args = {
65
+ fhirResource: example2ObservationExcessR4,
60
66
  };
61
67
 
62
- export const Example3OfR4 = () => {
63
- const fhirResource = object('Resource', example3ObservationExcessR4);
64
- return <Observation fhirResource={fhirResource} />;
68
+ export const Example3OfR4 = Template.bind({});
69
+ Example3OfR4.args = {
70
+ fhirResource: example3ObservationExcessR4,
65
71
  };
@@ -44,7 +44,7 @@ const observationValuePoint = (actualValue, unit, small) => {
44
44
  >
45
45
  {!small && (
46
46
  <span
47
- className={`position-absolute top-0 translate-middle ps-2 ${
47
+ className={`position-absolute top-0 translate-middle ps-sm-2 ps-0 pe-4 pe-sm-0 ${
48
48
  small ? 'pb-4 fs-1' : 'pb-5 fs-4'
49
49
  } w-max-content`}
50
50
  data-testid="valuePoint"
@@ -55,7 +55,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
55
55
  }
56
56
  };
57
57
 
58
- const Organization = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
58
+ const Organization = ({
59
+ fhirResource,
60
+ fhirVersion,
61
+ fhirIcons,
62
+ onClick,
63
+ rawOnClick,
64
+ }) => {
59
65
  let fhirResourceData = {};
60
66
  try {
61
67
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -128,6 +134,7 @@ const Organization = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
128
134
  }
129
135
  bodyContent={<Body tableData={tableData} />}
130
136
  onClick={onClick}
137
+ rawOnClick={rawOnClick}
131
138
  />
132
139
  </Root>
133
140
  );
@@ -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 Organization from './Organization';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -19,69 +19,57 @@ import OrganizationIcon from '../../../assets/containers/Organization/organizati
19
19
 
20
20
  export default {
21
21
  title: 'Organization',
22
+ component: Organization,
23
+ argTypes: {
24
+ ...defaultArgTypes,
25
+ },
22
26
  };
23
27
 
24
- export const DefaultVisualizationDSTU2 = () => {
25
- const fhirResource = object('Resource', dstu2Example1);
26
- return (
27
- <Organization
28
- fhirResource={fhirResource}
29
- fhirVersion={fhirVersions.DSTU2}
30
- fhirIcons={OrganizationIcon}
31
- />
32
- );
28
+ const Template = args => <Organization {...args} />;
29
+
30
+ export const DefaultVisualizationDSTU2 = Template.bind({});
31
+ DefaultVisualizationDSTU2.args = {
32
+ fhirVersion: fhirVersions.DSTU2,
33
+ fhirResource: dstu2Example1,
34
+ fhirIcons: require('../../../assets/containers/Organization/organization.svg'),
33
35
  };
34
36
 
35
- export const Example2OfDSTU2 = () => {
36
- const fhirResource = object('Resource', dstu2Example2);
37
- return (
38
- <Organization
39
- fhirResource={fhirResource}
40
- fhirVersion={fhirVersions.DSTU2}
41
- fhirIcons={fhirIcons}
42
- />
43
- );
37
+ export const Example2OfDSTU2 = Template.bind({});
38
+ Example2OfDSTU2.args = {
39
+ fhirVersion: fhirVersions.DSTU2,
40
+ fhirResource: dstu2Example2,
41
+ fhirIcons: OrganizationIcon,
44
42
  };
45
43
 
46
- export const Example1OfSTU3 = () => {
47
- const fhirResource = object('Resource', stu3Example1);
48
- return (
49
- <Organization
50
- fhirResource={fhirResource}
51
- fhirVersion={fhirVersions.STU3}
52
- fhirIcons={false}
53
- />
54
- );
44
+ export const Example1OfSTU3 = Template.bind({});
45
+ Example1OfSTU3.args = {
46
+ fhirVersion: fhirVersions.STU3,
47
+ fhirResource: stu3Example1,
48
+ fhirIcons: fhirIcons,
55
49
  };
56
50
 
57
- export const Example2OfSTU3 = () => {
58
- const fhirResource = object('Resource', stu3Example2);
59
- return (
60
- <Organization
61
- fhirResource={fhirResource}
62
- fhirVersion={fhirVersions.STU3}
63
- fhirIcons={'random text'}
64
- />
65
- );
51
+ export const Example2OfSTU3 = Template.bind({});
52
+ Example2OfSTU3.args = {
53
+ fhirVersion: fhirVersions.STU3,
54
+ fhirResource: stu3Example2,
55
+ fhirIcons: false,
66
56
  };
67
57
 
68
- export const Example1OfR4 = () => {
69
- const fhirResource = object('Resource', r4Example1);
70
- return (
71
- <Organization fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
72
- );
58
+ export const Example1OfR4 = Template.bind({});
59
+ Example1OfR4.args = {
60
+ fhirVersion: fhirVersions.R4,
61
+ fhirResource: r4Example1,
62
+ fhirIcons: 'random text',
73
63
  };
74
64
 
75
- export const Example2OfR4 = () => {
76
- const fhirResource = object('Resource', r4Example2);
77
- return (
78
- <Organization fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
79
- );
65
+ export const Example2OfR4 = Template.bind({});
66
+ Example2OfR4.args = {
67
+ fhirVersion: fhirVersions.R4,
68
+ fhirResource: r4Example2,
80
69
  };
81
70
 
82
- export const Example3OfR4 = () => {
83
- const fhirResource = object('Resource', r4Example3);
84
- return (
85
- <Organization fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
86
- );
71
+ export const Example3OfR4 = Template.bind({});
72
+ Example3OfR4.args = {
73
+ fhirVersion: fhirVersions.R4,
74
+ fhirResource: r4Example3,
87
75
  };
@@ -47,6 +47,7 @@ function Patient(props) {
47
47
  patientSimple,
48
48
  fhirIcons,
49
49
  onClick,
50
+ rawOnClick,
50
51
  } = props;
51
52
 
52
53
  const id = getId(fhirResource);
@@ -148,6 +149,7 @@ function Patient(props) {
148
149
  }
149
150
  bodyContent={<Body tableData={tableData} />}
150
151
  onClick={onClick}
152
+ rawOnClick={rawOnClick}
151
153
  />
152
154
  </Root>
153
155
  );
@@ -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 Patient from './Patient';
5
5
 
@@ -15,44 +15,52 @@ import example3PatientR4 from '../../../fixtures/r4/resources/patient/example3.j
15
15
  import PatientIcon from '../../../assets/containers/Patient/patient.svg';
16
16
  import fhirIcons from '../../../fixtures/example-icons';
17
17
 
18
- export default { title: 'Patient' };
18
+ export default {
19
+ title: 'Patient',
20
+ component: Patient,
21
+ argTypes: {
22
+ ...defaultArgTypes,
23
+ },
24
+ };
25
+
26
+ const Template = args => <Patient {...args} />;
19
27
 
20
- export const DefaultVisualizationDSTU2 = () => {
21
- const fhirResource = object('Resource', examplePatient);
22
- return (
23
- <Patient
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/Patient/patient.svg')}
26
- />
27
- );
28
+ export const DefaultVisualizationDSTU2 = Template.bind({});
29
+ DefaultVisualizationDSTU2.args = {
30
+ fhirResource: examplePatient,
31
+ fhirIcons: require('../../../assets/containers/Patient/patient.svg'),
28
32
  };
29
33
 
30
- export const Example2OfDSTU2 = () => {
31
- const fhirResource = object('Resource', example2PatientDSTU2);
32
- return <Patient fhirResource={fhirResource} fhirIcons={PatientIcon} />;
34
+ export const Example2OfDSTU2 = Template.bind({});
35
+ Example2OfDSTU2.args = {
36
+ fhirResource: example2PatientDSTU2,
37
+ fhirIcons: PatientIcon,
33
38
  };
34
39
 
35
- export const ExampleSTU3 = () => {
36
- const fhirResource = object('Resource', examplePatientSTU3);
37
- return <Patient fhirResource={fhirResource} fhirIcons={fhirIcons} />;
40
+ export const ExampleSTU3 = Template.bind({});
41
+ ExampleSTU3.args = {
42
+ fhirResource: examplePatientSTU3,
43
+ fhirIcons: fhirIcons,
38
44
  };
39
45
 
40
- export const Example2STU3 = () => {
41
- const fhirResource = object('Resource', example2PatientSTU3);
42
- return <Patient fhirResource={fhirResource} fhirIcons={false} />;
46
+ export const Example2STU3 = Template.bind({});
47
+ Example2STU3.args = {
48
+ fhirResource: example2PatientSTU3,
49
+ fhirIcons: false,
43
50
  };
44
51
 
45
- export const Example1R4 = () => {
46
- const fhirResource = object('Resource', example1PatientR4);
47
- return <Patient fhirResource={fhirResource} fhirIcons={'random text'} />;
52
+ export const Example1R4 = Template.bind({});
53
+ Example1R4.args = {
54
+ fhirResource: example1PatientR4,
55
+ fhirIcons: 'random text',
48
56
  };
49
57
 
50
- export const Example2R4 = () => {
51
- const fhirResource = object('Resource', example2PatientR4);
52
- return <Patient fhirResource={fhirResource} />;
58
+ export const Example2R4 = Template.bind({});
59
+ Example2R4.args = {
60
+ fhirResource: example2PatientR4,
53
61
  };
54
62
 
55
- export const Example3R4 = () => {
56
- const fhirResource = object('Resource', example3PatientR4);
57
- return <Patient fhirResource={fhirResource} />;
63
+ export const Example3R4 = Template.bind({});
64
+ Example3R4.args = {
65
+ fhirResource: example3PatientR4,
58
66
  };
@@ -82,7 +82,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
82
82
  }
83
83
  };
84
84
 
85
- const Practitioner = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
85
+ const Practitioner = ({
86
+ fhirResource,
87
+ fhirVersion,
88
+ fhirIcons,
89
+ onClick,
90
+ rawOnClick,
91
+ }) => {
86
92
  let fhirResourceData = {};
87
93
  try {
88
94
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -161,6 +167,7 @@ const Practitioner = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
161
167
  }
162
168
  bodyContent={<Body tableData={tableData} />}
163
169
  onClick={onClick}
170
+ rawOnClick={rawOnClick}
164
171
  />
165
172
  </Root>
166
173
  );
@@ -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 Practitioner from './Practitioner';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -14,66 +14,53 @@ import r4Example3 from '../../../fixtures/r4/resources/practitioner/example3.jso
14
14
  import PractitionerIcon from '../../../assets/containers/Practitioner/practitioner.svg';
15
15
  import fhirIcons from '../../../fixtures/example-icons';
16
16
 
17
- export default { title: 'Practitioner' };
17
+ export default {
18
+ title: 'Practitioner',
19
+ component: Practitioner,
20
+ argTypes: {
21
+ ...defaultArgTypes,
22
+ },
23
+ };
24
+
25
+ const Template = args => <Practitioner {...args} />;
18
26
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', dstu2Example1);
21
- return (
22
- <Practitioner
23
- fhirVersion={fhirVersions.DSTU2}
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/Practitioner/practitioner.svg')}
26
- />
27
- );
27
+ export const DefaultVisualizationDSTU2 = Template.bind({});
28
+ DefaultVisualizationDSTU2.args = {
29
+ fhirVersion: fhirVersions.DSTU2,
30
+ fhirResource: dstu2Example1,
31
+ fhirIcons: require('../../../assets/containers/Practitioner/practitioner.svg'),
28
32
  };
29
33
 
30
- export const Example2OfDSTU2 = () => {
31
- const fhirResource = object('Resource', dstu2Example2);
32
- return (
33
- <Practitioner
34
- fhirVersion={fhirVersions.DSTU2}
35
- fhirResource={fhirResource}
36
- fhirIcons={PractitionerIcon}
37
- />
38
- );
34
+ export const Example2OfDSTU2 = Template.bind({});
35
+ Example2OfDSTU2.args = {
36
+ fhirVersion: fhirVersions.DSTU2,
37
+ fhirResource: dstu2Example2,
38
+ fhirIcons: PractitionerIcon,
39
39
  };
40
40
 
41
- export const ExampleOfSTU3 = () => {
42
- const fhirResource = object('Resource', stu3Example1);
43
- return (
44
- <Practitioner
45
- fhirVersion={fhirVersions.STU3}
46
- fhirResource={fhirResource}
47
- fhirIcons={fhirIcons}
48
- />
49
- );
41
+ export const ExampleOfSTU3 = Template.bind({});
42
+ ExampleOfSTU3.args = {
43
+ fhirVersion: fhirVersions.STU3,
44
+ fhirResource: stu3Example1,
45
+ fhirIcons: fhirIcons,
50
46
  };
51
47
 
52
- export const Example1OfR4 = () => {
53
- const fhirResource = object('Resource', r4Example1);
54
- return (
55
- <Practitioner
56
- fhirVersion={fhirVersions.R4}
57
- fhirResource={fhirResource}
58
- fhirIcons={false}
59
- />
60
- );
48
+ export const Example1OfR4 = Template.bind({});
49
+ Example1OfR4.args = {
50
+ fhirVersion: fhirVersions.R4,
51
+ fhirResource: r4Example1,
52
+ fhirIcons: false,
61
53
  };
62
54
 
63
- export const Example2OfR4 = () => {
64
- const fhirResource = object('Resource', r4Example2);
65
- return (
66
- <Practitioner
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={'random text'}
70
- />
71
- );
55
+ export const Example2OfR4 = Template.bind({});
56
+ Example2OfR4.args = {
57
+ fhirVersion: fhirVersions.R4,
58
+ fhirResource: r4Example2,
59
+ fhirIcons: 'random text',
72
60
  };
73
61
 
74
- export const Example3OfR4 = () => {
75
- const fhirResource = object('Resource', r4Example3);
76
- return (
77
- <Practitioner fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />
78
- );
62
+ export const Example3OfR4 = Template.bind({});
63
+ Example3OfR4.args = {
64
+ fhirVersion: fhirVersions.R4,
65
+ fhirResource: r4Example3,
79
66
  };
@@ -48,6 +48,7 @@ const PractitionerRole = ({
48
48
  fhirVersion,
49
49
  fhirIcons,
50
50
  onClick,
51
+ rawOnClick,
51
52
  }) => {
52
53
  let fhirResourceData = {};
53
54
  try {
@@ -106,6 +107,7 @@ const PractitionerRole = ({
106
107
  }
107
108
  bodyContent={<Body tableData={tableData} />}
108
109
  onClick={onClick}
110
+ rawOnClick={rawOnClick}
109
111
  />
110
112
  </Root>
111
113
  );