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 PractitionerRole from './PractitionerRole';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -15,79 +15,59 @@ import r4Example4 from '../../../fixtures/r4/resources/practitionerRole/example4
15
15
  import fhirIcons from '../../../fixtures/example-icons';
16
16
  import PractitionerRoleIcon from '../../../assets/containers/PractitionerRole/practitioner-role.svg';
17
17
 
18
- export default { title: 'PractitionerRole' };
18
+ export default {
19
+ title: 'Practitioner/PractitionerRole',
20
+ component: PractitionerRole,
21
+ argTypes: {
22
+ ...defaultArgTypes,
23
+ },
24
+ };
25
+
26
+ const Template = args => <PractitionerRole {...args} />;
19
27
 
20
- export const ExampleOfSTU3 = () => {
21
- const fhirResource = object('Resource', stu3Example1);
22
- return (
23
- <PractitionerRole
24
- fhirVersion={fhirVersions.STU3}
25
- fhirResource={fhirResource}
26
- fhirIcons={require('../../../assets/containers/PractitionerRole/practitioner-role.svg')}
27
- />
28
- );
28
+ export const ExampleOfSTU3 = Template.bind({});
29
+ ExampleOfSTU3.args = {
30
+ fhirVersion: fhirVersions.STU3,
31
+ fhirResource: stu3Example1,
32
+ fhirIcons: require('../../../assets/containers/PractitionerRole/practitioner-role.svg'),
29
33
  };
30
34
 
31
- export const Example2OfSTU3 = () => {
32
- const fhirResource = object('Resource', stu3Example2);
33
- return (
34
- <PractitionerRole
35
- fhirVersion={fhirVersions.STU3}
36
- fhirResource={fhirResource}
37
- fhirIcons={PractitionerRoleIcon}
38
- />
39
- );
35
+ export const Example2OfSTU3 = Template.bind({});
36
+ Example2OfSTU3.args = {
37
+ fhirVersion: fhirVersions.STU3,
38
+ fhirResource: stu3Example2,
39
+ fhirIcons: PractitionerRoleIcon,
40
40
  };
41
41
 
42
- export const Example3OfSTU3 = () => {
43
- const fhirResource = object('Resource', stu3Example3);
44
- return (
45
- <PractitionerRole
46
- fhirVersion={fhirVersions.STU3}
47
- fhirResource={fhirResource}
48
- fhirIcons={fhirIcons}
49
- />
50
- );
42
+ export const Example3OfSTU3 = Template.bind({});
43
+ Example3OfSTU3.args = {
44
+ fhirVersion: fhirVersions.STU3,
45
+ fhirResource: stu3Example3,
46
+ fhirIcons: fhirIcons,
51
47
  };
52
48
 
53
- export const Example1OfR4 = () => {
54
- const fhirResource = object('Resource', r4Example1);
55
- return (
56
- <PractitionerRole
57
- fhirVersion={fhirVersions.R4}
58
- fhirResource={fhirResource}
59
- />
60
- );
49
+ export const Example1OfR4 = Template.bind({});
50
+ Example1OfR4.args = {
51
+ fhirVersion: fhirVersions.R4,
52
+ fhirResource: r4Example1,
53
+ fhirIcons: false,
61
54
  };
62
55
 
63
- export const Example2OfR4 = () => {
64
- const fhirResource = object('Resource', r4Example2);
65
- return (
66
- <PractitionerRole
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={false}
70
- />
71
- );
56
+ export const Example2OfR4 = Template.bind({});
57
+ Example2OfR4.args = {
58
+ fhirVersion: fhirVersions.R4,
59
+ fhirResource: r4Example2,
60
+ fhirIcons: 'random text',
72
61
  };
73
62
 
74
- export const Example3OfR4 = () => {
75
- const fhirResource = object('Resource', r4Example3);
76
- return (
77
- <PractitionerRole
78
- fhirVersion={fhirVersions.R4}
79
- fhirResource={fhirResource}
80
- fhirIcons={'random text'}
81
- />
82
- );
63
+ export const Example3OfR4 = Template.bind({});
64
+ Example3OfR4.args = {
65
+ fhirVersion: fhirVersions.R4,
66
+ fhirResource: r4Example3,
83
67
  };
84
68
 
85
- export const Example4OfR4 = () => {
86
- const fhirResource = object('Resource', r4Example4);
87
- return (
88
- <PractitionerRole
89
- fhirVersion={fhirVersions.R4}
90
- fhirResource={fhirResource}
91
- />
92
- );
69
+ export const Example4OfR4 = Template.bind({});
70
+ Example4OfR4.args = {
71
+ fhirVersion: fhirVersions.R4,
72
+ fhirResource: r4Example4,
93
73
  };
@@ -14,7 +14,7 @@ import _has from 'lodash/has';
14
14
  import { isNotEmptyArray } from '../../../utils';
15
15
  import { Value } from '../../ui';
16
16
 
17
- const Procedure = ({ fhirResource, fhirIcons, onClick }) => {
17
+ const Procedure = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
18
18
  const display =
19
19
  _get(fhirResource, 'code.coding[0].display') ||
20
20
  _get(fhirResource, 'code.text');
@@ -125,6 +125,7 @@ const Procedure = ({ fhirResource, fhirIcons, onClick }) => {
125
125
  }
126
126
  bodyContent={<Body tableData={tableData} />}
127
127
  onClick={onClick}
128
+ rawOnClick={rawOnClick}
128
129
  />
129
130
  </Root>
130
131
  );
@@ -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 Procedure from './Procedure';
5
5
 
@@ -14,39 +14,47 @@ import r4Example3 from '../../../fixtures/r4/resources/procedure/example3.json';
14
14
  import fhirIcons from '../../../fixtures/example-icons';
15
15
  import ProcedureIcon from '../../../assets/containers/Procedure/procedure.svg';
16
16
 
17
- export default { title: 'Procedure' };
17
+ export default {
18
+ title: 'Procedure',
19
+ component: Procedure,
20
+ argTypes: {
21
+ ...defaultArgTypes,
22
+ },
23
+ };
24
+
25
+ const Template = args => <Procedure {...args} />;
18
26
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', example1);
21
- return (
22
- <Procedure
23
- fhirResource={fhirResource}
24
- fhirIcons={require('../../../assets/containers/Procedure/procedure.svg')}
25
- />
26
- );
27
+ export const DefaultVisualizationDSTU2 = Template.bind({});
28
+ DefaultVisualizationDSTU2.args = {
29
+ fhirResource: example1,
30
+ fhirIcons: require('../../../assets/containers/Procedure/procedure.svg'),
27
31
  };
28
32
 
29
- export const ExampleOfSTU3 = () => {
30
- const fhirResource = object('Resource', stu3Example1);
31
- return <Procedure fhirResource={fhirResource} fhirIcons={ProcedureIcon} />;
33
+ export const ExampleOfSTU3 = Template.bind({});
34
+ ExampleOfSTU3.args = {
35
+ fhirResource: stu3Example1,
36
+ fhirIcons: ProcedureIcon,
32
37
  };
33
38
 
34
- export const Example2OfSTU3 = () => {
35
- const fhirResource = object('Resource', stu3Example2);
36
- return <Procedure fhirResource={fhirResource} fhirIcons={fhirIcons} />;
39
+ export const Example2OfSTU3 = Template.bind({});
40
+ Example2OfSTU3.args = {
41
+ fhirResource: stu3Example2,
42
+ fhirIcons: fhirIcons,
37
43
  };
38
44
 
39
- export const Example1OfR4 = () => {
40
- const fhirResource = object('Resource', r4Example1);
41
- return <Procedure fhirResource={fhirResource} fhirIcons={false} />;
45
+ export const Example1OfR4 = Template.bind({});
46
+ Example1OfR4.args = {
47
+ fhirResource: r4Example1,
48
+ fhirIcons: false,
42
49
  };
43
50
 
44
- export const Example2OfR4 = () => {
45
- const fhirResource = object('Resource', r4Example2);
46
- return <Procedure fhirResource={fhirResource} fhirIcons={'random text'} />;
51
+ export const Example2OfR4 = Template.bind({});
52
+ Example2OfR4.args = {
53
+ fhirResource: r4Example2,
54
+ fhirIcons: 'random text',
47
55
  };
48
56
 
49
- export const Example3OfR4 = () => {
50
- const fhirResource = object('Resource', r4Example3);
51
- return <Procedure fhirResource={fhirResource} />;
57
+ export const Example3OfR4 = Template.bind({});
58
+ Example3OfR4.args = {
59
+ fhirResource: r4Example3,
52
60
  };
@@ -75,7 +75,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
75
75
  }
76
76
  };
77
77
 
78
- const Questionnaire = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
78
+ const Questionnaire = ({
79
+ fhirResource,
80
+ fhirVersion,
81
+ fhirIcons,
82
+ onClick,
83
+ rawOnClick,
84
+ }) => {
79
85
  let fhirResourceData = {};
80
86
 
81
87
  try {
@@ -114,6 +120,7 @@ const Questionnaire = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
114
120
  </Body>
115
121
  }
116
122
  onClick={onClick}
123
+ rawOnClick={rawOnClick}
117
124
  />
118
125
  </Root>
119
126
  );
@@ -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 Questionnaire from './Questionnaire';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -18,80 +18,65 @@ import r4Example3 from '../../../fixtures/r4/resources/questionnaire/example3.js
18
18
  import fhirIcons from '../../../fixtures/example-icons';
19
19
  import QuestionnaireIcon from '../../../assets/containers/Questionnaire/questionnaire.svg';
20
20
 
21
- export default { title: 'Questionnaire' };
21
+ export default {
22
+ title: 'Questionnaire',
23
+ component: Questionnaire,
24
+ argTypes: {
25
+ ...defaultArgTypes,
26
+ },
27
+ };
28
+
29
+ const Template = args => <Questionnaire {...args} />;
22
30
 
23
- export const DefaultVisualizationDSTU2 = () => {
24
- const fhirResource = object('Resource', dstu2Example1);
25
- return (
26
- <Questionnaire
27
- fhirResource={fhirResource}
28
- fhirVersion={fhirVersions.DSTU2}
29
- fhirIcons={require('../../../assets/containers/Questionnaire/questionnaire.svg')}
30
- />
31
- );
31
+ export const DefaultVisualizationDSTU2 = Template.bind({});
32
+ DefaultVisualizationDSTU2.args = {
33
+ fhirVersion: fhirVersions.DSTU2,
34
+ fhirResource: dstu2Example1,
35
+ fhirIcons: require('../../../assets/containers/Questionnaire/questionnaire.svg'),
32
36
  };
33
37
 
34
- export const Example2OfDSTU2 = () => {
35
- const fhirResource = object('Resource', dstu2Example2);
36
- return (
37
- <Questionnaire
38
- fhirResource={fhirResource}
39
- fhirVersion={fhirVersions.DSTU2}
40
- fhirIcons={QuestionnaireIcon}
41
- />
42
- );
38
+ export const Example2OfDSTU2 = Template.bind({});
39
+ Example2OfDSTU2.args = {
40
+ fhirVersion: fhirVersions.DSTU2,
41
+ fhirResource: dstu2Example2,
42
+ fhirIcons: QuestionnaireIcon,
43
43
  };
44
44
 
45
- export const Example3OfDSTU2 = () => {
46
- const fhirResource = object('Resource', dstu2Example3);
47
- return (
48
- <Questionnaire
49
- fhirResource={fhirResource}
50
- fhirVersion={fhirVersions.DSTU2}
51
- fhirIcons={fhirIcons}
52
- />
53
- );
45
+ export const Example3OfDSTU2 = Template.bind({});
46
+ Example3OfDSTU2.args = {
47
+ fhirVersion: fhirVersions.DSTU2,
48
+ fhirResource: dstu2Example3,
49
+ fhirIcons: fhirIcons,
54
50
  };
55
51
 
56
- export const Example1OfSTU3 = () => {
57
- const fhirResource = object('Resource', stu3Example1);
58
- return (
59
- <Questionnaire
60
- fhirResource={fhirResource}
61
- fhirVersion={fhirVersions.STU3}
62
- fhirIcons={false}
63
- />
64
- );
52
+ export const Example1OfSTU3 = Template.bind({});
53
+ Example1OfSTU3.args = {
54
+ fhirVersion: fhirVersions.STU3,
55
+ fhirResource: stu3Example1,
56
+ fhirIcons: false,
65
57
  };
66
58
 
67
- export const Example2OfSTU3 = () => {
68
- const fhirResource = object('Resource', stu3Example2);
69
- return (
70
- <Questionnaire
71
- fhirResource={fhirResource}
72
- fhirVersion={fhirVersions.STU3}
73
- fhirIcons={'random text'}
74
- />
75
- );
59
+ export const Example2OfSTU3 = Template.bind({});
60
+ Example2OfSTU3.args = {
61
+ fhirVersion: fhirVersions.STU3,
62
+ fhirResource: stu3Example2,
63
+ fhirIcons: 'random text',
76
64
  };
77
65
 
78
- export const Example1OfR4 = () => {
79
- const fhirResource = object('Resource', r4Example1);
80
- return (
81
- <Questionnaire fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
82
- );
66
+ export const Example1OfR4 = Template.bind({});
67
+ Example1OfR4.args = {
68
+ fhirVersion: fhirVersions.R4,
69
+ fhirResource: r4Example1,
83
70
  };
84
71
 
85
- export const Example2OfR4 = () => {
86
- const fhirResource = object('Resource', r4Example2);
87
- return (
88
- <Questionnaire fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
89
- );
72
+ export const Example2OfR4 = Template.bind({});
73
+ Example2OfR4.args = {
74
+ fhirVersion: fhirVersions.R4,
75
+ fhirResource: r4Example2,
90
76
  };
91
77
 
92
- export const Example3OfR4 = () => {
93
- const fhirResource = object('Resource', r4Example3);
94
- return (
95
- <Questionnaire fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
96
- );
78
+ export const Example3OfR4 = Template.bind({});
79
+ Example3OfR4.args = {
80
+ fhirVersion: fhirVersions.R4,
81
+ fhirResource: r4Example3,
97
82
  };
@@ -76,6 +76,7 @@ const QuestionnaireResponse = ({
76
76
  fhirVersion,
77
77
  fhirIcons,
78
78
  onClick,
79
+ rawOnClick,
79
80
  }) => {
80
81
  let fhirResourceData = {};
81
82
 
@@ -139,6 +140,7 @@ const QuestionnaireResponse = ({
139
140
  </Body>
140
141
  }
141
142
  onClick={onClick}
143
+ rawOnClick={rawOnClick}
142
144
  />
143
145
  </Root>
144
146
  );
@@ -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 QuestionnaireResponse from './QuestionnaireResponse';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -17,79 +17,59 @@ import r4Example2 from '../../../fixtures/r4/resources/questionnaireResponse/exa
17
17
  import fhirIcons from '../../../fixtures/example-icons';
18
18
  import QuestionnaireResponseIcon from '../../../assets/containers/QuestionnaireResponse/questionnaire-response.svg';
19
19
 
20
- export default { title: 'QuestionnaireResponse' };
20
+ export default {
21
+ title: 'QuestionnaireResponse',
22
+ component: QuestionnaireResponse,
23
+ argTypes: {
24
+ ...defaultArgTypes,
25
+ },
26
+ };
27
+
28
+ const Template = args => <QuestionnaireResponse {...args} />;
21
29
 
22
- export const DefaultVisualizationDSTU2 = () => {
23
- const fhirResource = object('Resource', dstu2Example1);
24
- return (
25
- <QuestionnaireResponse
26
- fhirVersion={fhirVersions.DSTU2}
27
- fhirResource={fhirResource}
28
- fhirIcons={require('../../../assets/containers/QuestionnaireResponse/questionnaire-response.svg')}
29
- />
30
- );
30
+ export const DefaultVisualizationDSTU2 = Template.bind({});
31
+ DefaultVisualizationDSTU2.args = {
32
+ fhirVersion: fhirVersions.DSTU2,
33
+ fhirResource: dstu2Example1,
34
+ fhirIcons: require('../../../assets/containers/QuestionnaireResponse/questionnaire-response.svg'),
31
35
  };
32
36
 
33
- export const Example2OfDSTU2 = () => {
34
- const fhirResource = object('Resource', dstu2Example2);
35
- return (
36
- <QuestionnaireResponse
37
- fhirVersion={fhirVersions.DSTU2}
38
- fhirResource={fhirResource}
39
- fhirIcons={QuestionnaireResponseIcon}
40
- />
41
- );
37
+ export const Example2OfDSTU2 = Template.bind({});
38
+ Example2OfDSTU2.args = {
39
+ fhirVersion: fhirVersions.DSTU2,
40
+ fhirResource: dstu2Example2,
41
+ fhirIcons: QuestionnaireResponseIcon,
42
42
  };
43
43
 
44
- export const Example3OfDSTU2 = () => {
45
- const fhirResource = object('Resource', dstu2Example3);
46
- return (
47
- <QuestionnaireResponse
48
- fhirVersion={fhirVersions.DSTU2}
49
- fhirResource={fhirResource}
50
- fhirIcons={fhirIcons}
51
- />
52
- );
44
+ export const Example3OfDSTU2 = Template.bind({});
45
+ Example3OfDSTU2.args = {
46
+ fhirVersion: fhirVersions.DSTU2,
47
+ fhirResource: dstu2Example3,
48
+ fhirIcons: fhirIcons,
53
49
  };
54
50
 
55
- export const Example1OfSTU3 = () => {
56
- const fhirResource = object('Resource', stu3Example1);
57
- return (
58
- <QuestionnaireResponse
59
- fhirVersion={fhirVersions.STU3}
60
- fhirResource={fhirResource}
61
- fhirIcons={false}
62
- />
63
- );
51
+ export const Example1OfSTU3 = Template.bind({});
52
+ Example1OfSTU3.args = {
53
+ fhirVersion: fhirVersions.STU3,
54
+ fhirResource: stu3Example1,
55
+ fhirIcons: false,
64
56
  };
65
57
 
66
- export const Example2OfSTU3 = () => {
67
- const fhirResource = object('Resource', stu3Example2);
68
- return (
69
- <QuestionnaireResponse
70
- fhirVersion={fhirVersions.STU3}
71
- fhirResource={fhirResource}
72
- fhirIcons="random text"
73
- />
74
- );
58
+ export const Example2OfSTU3 = Template.bind({});
59
+ Example2OfSTU3.args = {
60
+ fhirVersion: fhirVersions.STU3,
61
+ fhirResource: stu3Example2,
62
+ fhirIcons: 'random text',
75
63
  };
76
64
 
77
- export const Example1OfR4 = () => {
78
- const fhirResource = object('Resource', r4Example1);
79
- return (
80
- <QuestionnaireResponse
81
- fhirVersion={fhirVersions.R4}
82
- fhirResource={fhirResource}
83
- />
84
- );
65
+ export const Example1OfR4 = Template.bind({});
66
+ Example1OfR4.args = {
67
+ fhirVersion: fhirVersions.R4,
68
+ fhirResource: r4Example1,
85
69
  };
86
70
 
87
- export const Example2OfR4 = () => {
88
- const fhirResource = object('Resource', r4Example2);
89
- return (
90
- <QuestionnaireResponse
91
- fhirVersion={fhirVersions.R4}
92
- fhirResource={fhirResource}
93
- />
94
- );
71
+ export const Example2OfR4 = Template.bind({});
72
+ Example2OfR4.args = {
73
+ fhirVersion: fhirVersions.R4,
74
+ fhirResource: r4Example2,
95
75
  };
@@ -70,7 +70,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
70
70
  }
71
71
  };
72
72
 
73
- const ReferralRequest = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
73
+ const ReferralRequest = ({
74
+ fhirResource,
75
+ fhirVersion,
76
+ fhirIcons,
77
+ onClick,
78
+ rawOnClick,
79
+ }) => {
74
80
  let fhirResourceData = {};
75
81
  try {
76
82
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -150,6 +156,7 @@ const ReferralRequest = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
150
156
  </Body>
151
157
  }
152
158
  onClick={onClick}
159
+ rawOnClick={rawOnClick}
153
160
  />
154
161
  </Root>
155
162
  );
@@ -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 ReferralRequest from './ReferralRequest';
5
5
 
@@ -9,29 +9,29 @@ import fhirVersions from '../fhirResourceVersions';
9
9
 
10
10
  export default {
11
11
  title: 'ReferralRequest',
12
+ component: ReferralRequest,
13
+ argTypes: {
14
+ ...defaultArgTypes,
15
+ },
12
16
  };
13
17
 
14
- export const DefaultVisualizationDSTU2 = () => {
15
- const fhirResource = object('Resource', dstu2Example1);
16
- return (
17
- <ReferralRequest
18
- fhirVersion={fhirVersions.DSTU2}
19
- fhirResource={fhirResource}
20
- />
21
- );
18
+ const Template = args => <ReferralRequest {...args} />;
19
+
20
+ export const DefaultVisualizationDSTU2 = Template.bind({});
21
+ DefaultVisualizationDSTU2.args = {
22
+ fhirVersion: fhirVersions.DSTU2,
23
+ fhirResource: dstu2Example1,
24
+ fhirIcons: require('../../../assets/containers/ReferralRequest/referral-request.svg'),
22
25
  };
23
26
 
24
- export const ExampleOfSTU3 = () => {
25
- const fhirResource = object('Resource', stu3Example1);
26
- return (
27
- <ReferralRequest
28
- fhirVersion={fhirVersions.STU3}
29
- fhirResource={fhirResource}
30
- />
31
- );
27
+ export const ExampleOfSTU3 = Template.bind({});
28
+ ExampleOfSTU3.args = {
29
+ fhirVersion: fhirVersions.STU3,
30
+ fhirResource: stu3Example1,
31
+ fhirIcons: false,
32
32
  };
33
33
 
34
- export const ExampleWithoutFhirVersionProperty = () => {
35
- const fhirResource = object('Resource', stu3Example1);
36
- return <ReferralRequest fhirResource={fhirResource} />;
34
+ export const ExampleWithoutFhirVersionProperty = Template.bind({});
35
+ ExampleWithoutFhirVersionProperty.args = {
36
+ fhirResource: stu3Example1,
37
37
  };
@@ -67,7 +67,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
67
67
  }
68
68
  };
69
69
 
70
- const RelatedPerson = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
70
+ const RelatedPerson = ({
71
+ fhirResource,
72
+ fhirVersion,
73
+ fhirIcons,
74
+ onClick,
75
+ rawOnClick,
76
+ }) => {
71
77
  let fhirResourceData = {};
72
78
  try {
73
79
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -139,6 +145,7 @@ const RelatedPerson = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
139
145
  }
140
146
  bodyContent={<Body tableData={tableData} />}
141
147
  onClick={onClick}
148
+ rawOnClick={rawOnClick}
142
149
  />
143
150
  </Root>
144
151
  );