fhir-react 0.3.9 → 0.3.12

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 (95) 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 +17 -1
  5. package/build/index.js +9 -9
  6. package/package.json +5 -4
  7. package/src/components/containers/Accordion/Accordion.js +8 -4
  8. package/src/components/containers/Accordion/Accordion.stories.js +74 -58
  9. package/src/components/containers/ResourceContainer/ResourceContainer.stories.js +43 -41
  10. package/src/components/defaultArgTypes.js +12 -0
  11. package/src/components/resources/AdverseEvent/AdverseEvent.js +2 -0
  12. package/src/components/resources/AdverseEvent/AdverseEvent.stories.js +17 -19
  13. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +4 -0
  14. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +46 -70
  15. package/src/components/resources/Appointment/Appointment.js +2 -0
  16. package/src/components/resources/Appointment/Appointment.stories.js +51 -62
  17. package/src/components/resources/Binary/Binary.js +2 -1
  18. package/src/components/resources/Binary/Binary.stories.js +27 -21
  19. package/src/components/resources/Bundle/Bundle.stories.js +59 -49
  20. package/src/components/resources/CarePlan/CarePlan.js +3 -0
  21. package/src/components/resources/CarePlan/CarePlan.stories.js +44 -54
  22. package/src/components/resources/CareTeam/CareTeam.js +2 -0
  23. package/src/components/resources/CareTeam/CareTeam.stories.js +22 -28
  24. package/src/components/resources/Claim/Claim.js +3 -0
  25. package/src/components/resources/Claim/Claim.stories.js +37 -50
  26. package/src/components/resources/ClaimResponse/ClaimResponse.js +2 -0
  27. package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +42 -52
  28. package/src/components/resources/Condition/Condition.js +2 -0
  29. package/src/components/resources/Condition/Condition.stories.js +47 -62
  30. package/src/components/resources/Coverage/Coverage.js +3 -0
  31. package/src/components/resources/Coverage/Coverage.stories.js +38 -50
  32. package/src/components/resources/Device/Device.js +3 -0
  33. package/src/components/resources/Device/Device.stories.js +40 -52
  34. package/src/components/resources/DiagnosticReport/DiagnosticReport.js +2 -0
  35. package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +38 -50
  36. package/src/components/resources/DocumentReference/DocumentReference.js +2 -0
  37. package/src/components/resources/DocumentReference/DocumentReference.stories.js +25 -29
  38. package/src/components/resources/Encounter/Encounter.js +2 -0
  39. package/src/components/resources/Encounter/Encounter.stories.js +43 -59
  40. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +18 -3
  41. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +53 -67
  42. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +74 -38
  43. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +2 -0
  44. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +23 -29
  45. package/src/components/resources/Generic/Generic.js +8 -1
  46. package/src/components/resources/Generic/Generic.stories.js +21 -12
  47. package/src/components/resources/Goal/Goal.js +2 -0
  48. package/src/components/resources/Goal/Goal.stories.js +35 -49
  49. package/src/components/resources/Immunization/Immunization.js +2 -0
  50. package/src/components/resources/Immunization/Immunization.stories.js +38 -51
  51. package/src/components/resources/List/List.js +2 -0
  52. package/src/components/resources/List/List.stories.js +66 -70
  53. package/src/components/resources/Location/Location.js +8 -1
  54. package/src/components/resources/Location/Location.stories.js +23 -18
  55. package/src/components/resources/Medication/Medication.js +2 -0
  56. package/src/components/resources/Medication/Medication.stories.js +42 -64
  57. package/src/components/resources/MedicationAdministration/MedicationAdministration.js +4 -2
  58. package/src/components/resources/MedicationAdministration/MedicationAdministration.stories.js +32 -46
  59. package/src/components/resources/MedicationDispense/MedicationDispense.js +2 -0
  60. package/src/components/resources/MedicationDispense/MedicationDispense.stories.js +39 -57
  61. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +2 -0
  62. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +49 -58
  63. package/src/components/resources/MedicationOrder/MedicationOrder.js +8 -1
  64. package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +11 -4
  65. package/src/components/resources/MedicationRequest/MedicationRequest.js +2 -0
  66. package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +27 -30
  67. package/src/components/resources/MedicationStatement/MedicationStatement.js +2 -0
  68. package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +32 -46
  69. package/src/components/resources/Observation/Observation.js +8 -1
  70. package/src/components/resources/Observation/Observation.stories.js +39 -33
  71. package/src/components/resources/Organization/Organization.js +2 -0
  72. package/src/components/resources/Organization/Organization.stories.js +40 -52
  73. package/src/components/resources/Patient/Patient.js +2 -0
  74. package/src/components/resources/Patient/Patient.stories.js +36 -28
  75. package/src/components/resources/Practitioner/Practitioner.js +4 -0
  76. package/src/components/resources/Practitioner/Practitioner.stories.js +39 -52
  77. package/src/components/resources/PractitionerRole/PractitionerRole.js +2 -0
  78. package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +43 -63
  79. package/src/components/resources/Procedure/Procedure.js +8 -1
  80. package/src/components/resources/Procedure/Procedure.stories.js +33 -25
  81. package/src/components/resources/Questionnaire/Questionnaire.js +2 -0
  82. package/src/components/resources/Questionnaire/Questionnaire.stories.js +47 -62
  83. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.js +2 -0
  84. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.stories.js +43 -63
  85. package/src/components/resources/ReferralRequest/ReferralRequest.js +2 -0
  86. package/src/components/resources/ReferralRequest/ReferralRequest.stories.js +20 -20
  87. package/src/components/resources/RelatedPerson/RelatedPerson.js +2 -0
  88. package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +26 -30
  89. package/src/components/resources/ResearchStudy/ResearchStudy.js +2 -0
  90. package/src/components/resources/ResearchStudy/ResearchStudy.stories.js +17 -15
  91. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +40 -27
  92. package/src/components/supportedFhirResourceList.js +2 -0
  93. package/.storybook/addons.js +0 -1
  94. package/.storybook/config.js +0 -26
  95. 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 MedicationRequest from './MedicationRequest';
5
5
 
@@ -13,43 +13,40 @@ import MedicationRequestIcon from '../../../assets/containers/MedicationRequest/
13
13
 
14
14
  export default {
15
15
  title: 'MedicationRequest',
16
+ component: MedicationRequest,
17
+ argTypes: {
18
+ ...defaultArgTypes,
19
+ },
16
20
  };
17
21
 
18
- export const DefaultVisualizationSTU3 = () => {
19
- const fhirResource = object('Resource', stu3Example1);
20
- return (
21
- <MedicationRequest
22
- fhirResource={fhirResource}
23
- fhirIcons={require('../../../assets/containers/MedicationRequest/medication-request.svg')}
24
- />
25
- );
22
+ const Template = args => <MedicationRequest {...args} />;
23
+
24
+ export const DefaultVisualizationSTU3 = Template.bind({});
25
+ DefaultVisualizationSTU3.args = {
26
+ fhirResource: stu3Example1,
27
+ fhirIcons: require('../../../assets/containers/MedicationRequest/medication-request.svg'),
26
28
  };
27
29
 
28
- export const Example2OfSTU3 = () => {
29
- const fhirResource = object('Resource', stu3Example2);
30
- return (
31
- <MedicationRequest
32
- fhirResource={fhirResource}
33
- fhirIcons={MedicationRequestIcon}
34
- />
35
- );
30
+ export const Example2OfSTU3 = Template.bind({});
31
+ Example2OfSTU3.args = {
32
+ fhirResource: stu3Example2,
33
+ fhirIcons: MedicationRequestIcon,
36
34
  };
37
35
 
38
- export const Example1OfR4 = () => {
39
- const fhirResource = object('Resource', R4Example1);
40
- return (
41
- <MedicationRequest fhirResource={fhirResource} fhirIcons={fhirIcons} />
42
- );
36
+ export const Example1OfR4 = Template.bind({});
37
+ Example1OfR4.args = {
38
+ fhirResource: R4Example1,
39
+ fhirIcons: fhirIcons,
43
40
  };
44
41
 
45
- export const Example2OfR4 = () => {
46
- const fhirResource = object('Resource', R4Example2);
47
- return <MedicationRequest fhirResource={fhirResource} fhirIcons={false} />;
42
+ export const Example2OfR4 = Template.bind({});
43
+ Example2OfR4.args = {
44
+ fhirResource: R4Example2,
45
+ fhirIcons: false,
48
46
  };
49
47
 
50
- export const Example3OfR4 = () => {
51
- const fhirResource = object('Resource', R4Example3);
52
- return (
53
- <MedicationRequest fhirResource={fhirResource} fhirIcons={'random text'} />
54
- );
48
+ export const Example3OfR4 = Template.bind({});
49
+ Example3OfR4.args = {
50
+ fhirResource: R4Example3,
51
+ fhirIcons: 'random text',
55
52
  };
@@ -113,6 +113,7 @@ const MedicationStatement = ({
113
113
  fhirIcons,
114
114
  onClick,
115
115
  rawOnClick,
116
+ customId,
116
117
  }) => {
117
118
  let fhirResourceData = {};
118
119
  try {
@@ -207,6 +208,7 @@ const MedicationStatement = ({
207
208
  }
208
209
  onClick={onClick}
209
210
  rawOnClick={rawOnClick}
211
+ customId={customId}
210
212
  />
211
213
  </Root>
212
214
  );
@@ -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,13 @@ import {
18
18
  } from '../../ui';
19
19
  import Reference from '../../datatypes/Reference';
20
20
 
21
- const Observation = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
21
+ const Observation = ({
22
+ fhirResource,
23
+ fhirIcons,
24
+ onClick,
25
+ rawOnClick,
26
+ customId,
27
+ }) => {
22
28
  const effectiveDate = _get(fhirResource, 'effectiveDateTime');
23
29
  const codeCodingDisplay = _get(fhirResource, 'code.coding.0.display');
24
30
  const codeText = _get(fhirResource, 'code.text', '');
@@ -116,6 +122,7 @@ const Observation = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
116
122
  }
117
123
  onClick={onClick}
118
124
  rawOnClick={rawOnClick}
125
+ customId={customId}
119
126
  />
120
127
  </Root>
121
128
  );
@@ -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
  };
@@ -61,6 +61,7 @@ const Organization = ({
61
61
  fhirIcons,
62
62
  onClick,
63
63
  rawOnClick,
64
+ customId,
64
65
  }) => {
65
66
  let fhirResourceData = {};
66
67
  try {
@@ -135,6 +136,7 @@ const Organization = ({
135
136
  bodyContent={<Body tableData={tableData} />}
136
137
  onClick={onClick}
137
138
  rawOnClick={rawOnClick}
139
+ customId={customId}
138
140
  />
139
141
  </Root>
140
142
  );
@@ -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
  };
@@ -48,6 +48,7 @@ function Patient(props) {
48
48
  fhirIcons,
49
49
  onClick,
50
50
  rawOnClick,
51
+ customId,
51
52
  } = props;
52
53
 
53
54
  const id = getId(fhirResource);
@@ -150,6 +151,7 @@ function Patient(props) {
150
151
  bodyContent={<Body tableData={tableData} />}
151
152
  onClick={onClick}
152
153
  rawOnClick={rawOnClick}
154
+ customId={customId}
153
155
  />
154
156
  </Root>
155
157
  );
@@ -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
  };
@@ -38,12 +38,14 @@ const commonDTO = fhirResource => {
38
38
  birthDate,
39
39
  };
40
40
  };
41
+
41
42
  const dstu2DTO = fhirResource => {
42
43
  const name = _get(fhirResource, 'name');
43
44
  return {
44
45
  name,
45
46
  };
46
47
  };
48
+
47
49
  const stu3DTO = fhirResource => {
48
50
  const name = _get(fhirResource, 'name.0');
49
51
  const address = _get(fhirResource, 'address.0');
@@ -88,6 +90,7 @@ const Practitioner = ({
88
90
  fhirIcons,
89
91
  onClick,
90
92
  rawOnClick,
93
+ customId,
91
94
  }) => {
92
95
  let fhirResourceData = {};
93
96
  try {
@@ -168,6 +171,7 @@ const Practitioner = ({
168
171
  bodyContent={<Body tableData={tableData} />}
169
172
  onClick={onClick}
170
173
  rawOnClick={rawOnClick}
174
+ customId={customId}
171
175
  />
172
176
  </Root>
173
177
  );