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
  import fhirVersions from '../fhirResourceVersions';
4
4
 
5
5
  import Appointment from './Appointment';
@@ -16,76 +16,65 @@ import example3AppointmentR4 from '../../../fixtures/r4/resources/appointment/ex
16
16
  import fhirIcons from '../../../fixtures/example-icons';
17
17
  import AppointmentIcon from '../../../assets/containers/Appointment/appointment.svg';
18
18
 
19
- export default { title: 'Appointment' };
19
+ export default {
20
+ title: 'Appointment',
21
+ component: Appointment,
22
+ argTypes: {
23
+ ...defaultArgTypes,
24
+ },
25
+ };
26
+
27
+ const Template = args => <Appointment {...args} />;
20
28
 
21
- export const DefaultVisualizationDSTU2 = () => {
22
- const fhirResource = object('Resource', exampleAppointmentDSTU2);
23
- return (
24
- <Appointment
25
- fhirResource={fhirResource}
26
- fhirVersion={fhirVersions.DSTU2}
27
- fhirIcons={require('../../../assets/containers/Appointment/appointment.svg')}
28
- />
29
- );
29
+ export const DefaultVisualizationDSTU2 = Template.bind({});
30
+ DefaultVisualizationDSTU2.args = {
31
+ fhirResource: exampleAppointmentDSTU2,
32
+ fhirVersion: fhirVersions.DSTU2,
33
+ fhirIcons: require('../../../assets/containers/Appointment/appointment.svg'),
30
34
  };
31
35
 
32
- export const Example2OfDSTU2 = () => {
33
- const fhirResource = object('Resource', example2AppointmentDSTU2);
34
- return (
35
- <Appointment
36
- fhirResource={fhirResource}
37
- fhirVersion={fhirVersions.DSTU2}
38
- fhirIcons={AppointmentIcon}
39
- />
40
- );
36
+ export const Example2OfDSTU2 = Template.bind({});
37
+ Example2OfDSTU2.args = {
38
+ fhirResource: example2AppointmentDSTU2,
39
+ fhirVersion: fhirVersions.DSTU2,
40
+ fhirIcons: AppointmentIcon,
41
41
  };
42
42
 
43
- export const Example1OfSTU3 = () => {
44
- const fhirResource = object('Resource', example1AppointmentSTU3);
45
- return (
46
- <Appointment
47
- fhirResource={fhirResource}
48
- fhirVersion={fhirVersions.STU3}
49
- fhirIcons={fhirIcons}
50
- />
51
- );
43
+ export const Example1OfSTU3 = Template.bind({});
44
+ Example1OfSTU3.args = {
45
+ fhirResource: example1AppointmentSTU3,
46
+ fhirVersion: fhirVersions.STU3,
47
+ fhirIcons: fhirIcons,
52
48
  };
53
- export const Example2OfSTU3 = () => {
54
- const fhirResource = object('Resource', example2AppointmentSTU3);
55
- return (
56
- <Appointment
57
- fhirResource={fhirResource}
58
- fhirVersion={fhirVersions.STU3}
59
- fhirIcons={false}
60
- />
61
- );
49
+
50
+ export const Example2OfSTU3 = Template.bind({});
51
+ Example2OfSTU3.args = {
52
+ fhirResource: example2AppointmentSTU3,
53
+ fhirVersion: fhirVersions.STU3,
54
+ fhirIcons: false,
62
55
  };
63
- export const Example3OfSTU3 = () => {
64
- const fhirResource = object('Resource', example3AppointmentSTU3);
65
- return (
66
- <Appointment
67
- fhirResource={fhirResource}
68
- fhirVersion={fhirVersions.STU3}
69
- fhirIcons={'random text'}
70
- />
71
- );
56
+
57
+ export const Example3OfSTU3 = Template.bind({});
58
+ Example3OfSTU3.args = {
59
+ fhirResource: example3AppointmentSTU3,
60
+ fhirVersion: fhirVersions.STU3,
61
+ fhirIcons: 'random text',
72
62
  };
73
63
 
74
- export const Example1OfR4 = () => {
75
- const fhirResource = object('Resource', example1AppointmentR4);
76
- return (
77
- <Appointment fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
78
- );
64
+ export const Example1OfR4 = Template.bind({});
65
+ Example1OfR4.args = {
66
+ fhirResource: example1AppointmentR4,
67
+ fhirVersion: fhirVersions.R4,
79
68
  };
80
- export const Example2OfR4 = () => {
81
- const fhirResource = object('Resource', example2AppointmentR4);
82
- return (
83
- <Appointment fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
84
- );
69
+
70
+ export const Example2OfR4 = Template.bind({});
71
+ Example2OfR4.args = {
72
+ fhirResource: example2AppointmentR4,
73
+ fhirVersion: fhirVersions.R4,
85
74
  };
86
- export const Example3OfR4 = () => {
87
- const fhirResource = object('Resource', example3AppointmentR4);
88
- return (
89
- <Appointment fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
90
- );
75
+
76
+ export const Example3OfR4 = Template.bind({});
77
+ Example3OfR4.args = {
78
+ fhirResource: example3AppointmentR4,
79
+ fhirVersion: fhirVersions.R4,
91
80
  };
@@ -6,7 +6,7 @@ import Accordion from '../../containers/Accordion/Accordion';
6
6
  import { Body, Header } from '../../ui';
7
7
 
8
8
  const Binary = props => {
9
- const { fhirResource, fhirIcons } = props;
9
+ const { fhirResource, fhirIcons, rawOnClick } = props;
10
10
 
11
11
  const loadBinaryFile = () => {
12
12
  switch (fhirResource.contentType) {
@@ -37,6 +37,7 @@ const Binary = props => {
37
37
  />
38
38
  }
39
39
  bodyContent={<Body>{loadBinaryFile()}</Body>}
40
+ rawOnClick={rawOnClick}
40
41
  />
41
42
  </div>
42
43
  );
@@ -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 Binary from './Binary';
5
5
 
@@ -13,34 +13,40 @@ import BinaryIcon from '../../../assets/containers/Binary/binary.svg';
13
13
 
14
14
  export default {
15
15
  title: 'Binary',
16
+ component: Binary,
17
+ argTypes: {
18
+ ...defaultArgTypes,
19
+ },
16
20
  };
17
21
 
18
- export const PdfDSTU2 = () => {
19
- const fhirResource = object('Resource', dstu2ExamplePdf);
20
- return (
21
- <Binary
22
- fhirResource={fhirResource}
23
- fhirIcons={require('../../../assets/containers/Binary/binary.svg')}
24
- />
25
- );
22
+ const Template = args => <Binary {...args} />;
23
+
24
+ export const PdfDSTU2 = Template.bind({});
25
+ PdfDSTU2.args = {
26
+ fhirResource: dstu2ExamplePdf,
27
+ fhirIcons: require('../../../assets/containers/Binary/binary.svg'),
26
28
  };
27
29
 
28
- export const JpegDSTU2 = () => {
29
- const fhirResource = object('Resource', dstu2ExampleJpeg);
30
- return <Binary fhirResource={fhirResource} fhirIcons={BinaryIcon} />;
30
+ export const JpegDSTU2 = Template.bind({});
31
+ JpegDSTU2.args = {
32
+ fhirResource: dstu2ExampleJpeg,
33
+ fhirIcons: BinaryIcon,
31
34
  };
32
35
 
33
- export const PdfSTU3 = () => {
34
- const fhirResource = object('Resource', stu3ExamplePdf);
35
- return <Binary fhirResource={fhirResource} fhirIcons={false} />;
36
+ export const PdfSTU3 = Template.bind({});
37
+ PdfSTU3.args = {
38
+ fhirResource: stu3ExamplePdf,
39
+ fhirIcons: false,
36
40
  };
37
41
 
38
- export const JpegSTU3 = () => {
39
- const fhirResource = object('Resource', stu3ExampleJpeg);
40
- return <Binary fhirResource={fhirResource} fhirIcons={'random text'} />;
42
+ export const JpegSTU3 = Template.bind({});
43
+ JpegSTU3.args = {
44
+ fhirResource: stu3ExampleJpeg,
45
+ fhirIcons: 'random text',
41
46
  };
42
47
 
43
- export const JsonSTU3 = () => {
44
- const fhirResource = object('Resource', stu3ExampleJson);
45
- return <Binary fhirResource={fhirResource} fhirIcons={fhirIcons} />;
48
+ export const JsonSTU3 = Template.bind({});
49
+ JsonSTU3.args = {
50
+ fhirResource: stu3ExampleJson,
51
+ fhirIcons: fhirIcons,
46
52
  };
@@ -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 Bundle from './Bundle';
5
5
 
@@ -19,77 +19,87 @@ import fhirVersions from '../fhirResourceVersions';
19
19
 
20
20
  export default {
21
21
  title: 'Bundle',
22
+ component: Bundle,
23
+ argTypes: {
24
+ ...defaultArgTypes,
25
+ },
22
26
  };
23
27
 
24
- export const Example1OfDSTU2 = () => {
25
- const fhirResource = object('Resource', dstu2Example1);
26
- return (
27
- <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
28
- );
28
+ const Template = args => <Bundle {...args} />;
29
+
30
+ export const Example1OfDSTU2 = Template.bind({});
31
+ Example1OfDSTU2.args = {
32
+ fhirVersion: fhirVersions.DSTU2,
33
+ fhirResource: dstu2Example1,
29
34
  };
30
35
 
31
- export const Example2OfDSTU2 = () => {
32
- const fhirResource = object('Resource', dstu2Example2);
33
- return (
34
- <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
35
- );
36
+ export const Example2OfDSTU2 = Template.bind({});
37
+ Example2OfDSTU2.args = {
38
+ fhirVersion: fhirVersions.DSTU2,
39
+ fhirResource: dstu2Example2,
36
40
  };
37
41
 
38
- export const Example3OfDSTU2 = () => {
39
- const fhirResource = object('Resource', dstu2Example3);
40
- return (
41
- <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
42
- );
42
+ export const Example3OfDSTU2 = Template.bind({});
43
+ Example3OfDSTU2.args = {
44
+ fhirVersion: fhirVersions.DSTU2,
45
+ fhirResource: dstu2Example3,
43
46
  };
44
47
 
45
- export const Example4OfDSTU2 = () => {
46
- const fhirResource = object('Resource', dstu2Example4);
47
- return (
48
- <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
49
- );
48
+ export const Example4OfDSTU2 = Template.bind({});
49
+ Example4OfDSTU2.args = {
50
+ fhirVersion: fhirVersions.DSTU2,
51
+ fhirResource: dstu2Example4,
50
52
  };
51
53
 
52
- export const Example1OfSTU3 = () => {
53
- const fhirResource = object('Resource', stu3Example1);
54
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
54
+ export const Example1OfSTU3 = Template.bind({});
55
+ Example1OfSTU3.args = {
56
+ fhirVersion: fhirVersions.STU3,
57
+ fhirResource: stu3Example1,
55
58
  };
56
59
 
57
- export const Example2OfSTU3 = () => {
58
- const fhirResource = object('Resource', stu3Example2);
59
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
60
+ export const Example2OfSTU3 = Template.bind({});
61
+ Example2OfSTU3.args = {
62
+ fhirVersion: fhirVersions.STU3,
63
+ fhirResource: stu3Example2,
60
64
  };
61
65
 
62
- export const Example3OfSTU3 = () => {
63
- const fhirResource = object('Resource', stu3Example3);
64
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
66
+ export const Example3OfSTU3 = Template.bind({});
67
+ Example3OfSTU3.args = {
68
+ fhirVersion: fhirVersions.STU3,
69
+ fhirResource: stu3Example3,
65
70
  };
66
71
 
67
- export const Example4OfSTU3 = () => {
68
- const fhirResource = object('Resource', stu3Example4);
69
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
72
+ export const Example4OfSTU3 = Template.bind({});
73
+ Example4OfSTU3.args = {
74
+ fhirVersion: fhirVersions.STU3,
75
+ fhirResource: stu3Example4,
70
76
  };
71
77
 
72
- export const Example1OfR4 = () => {
73
- const fhirResource = object('Resource', r4Example1);
74
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
78
+ export const Example1OfR4 = Template.bind({});
79
+ Example1OfR4.args = {
80
+ fhirVersion: fhirVersions.R4,
81
+ fhirResource: r4Example1,
75
82
  };
76
83
 
77
- export const Example2OfR4 = () => {
78
- const fhirResource = object('Resource', r4Example2);
79
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
84
+ export const Example2OfR4 = Template.bind({});
85
+ Example2OfR4.args = {
86
+ fhirVersion: fhirVersions.R4,
87
+ fhirResource: r4Example2,
80
88
  };
81
89
 
82
- export const Example3OfR4 = () => {
83
- const fhirResource = object('Resource', r4Example3);
84
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
90
+ export const Example3OfR4 = Template.bind({});
91
+ Example3OfR4.args = {
92
+ fhirVersion: fhirVersions.R4,
93
+ fhirResource: r4Example3,
85
94
  };
86
95
 
87
- export const Example4OfR4 = () => {
88
- const fhirResource = object('Resource', r4Example4);
89
- return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
96
+ export const Example4OfR4 = Template.bind({});
97
+ Example4OfR4.args = {
98
+ fhirVersion: fhirVersions.R4,
99
+ fhirResource: r4Example4,
90
100
  };
91
101
 
92
- // export const ExampleWithoutFHIRVersionProperty = () => {
93
- // const fhirResource = object('Resource', stu3Example2);
94
- // return <Bundle fhirResource={fhirResource} />;
95
- // };
102
+ export const ExampleWithoutFHIRVersionProperty = Template.bind({});
103
+ ExampleWithoutFHIRVersionProperty.args = {
104
+ fhirResource: stu3Example2,
105
+ };
@@ -162,7 +162,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
162
162
  }
163
163
  };
164
164
 
165
- const CarePlan = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
165
+ const CarePlan = ({
166
+ fhirResource,
167
+ fhirVersion,
168
+ fhirIcons,
169
+ onClick,
170
+ rawOnClick,
171
+ }) => {
166
172
  let fhirResourceData = {};
167
173
  try {
168
174
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -305,6 +311,7 @@ const CarePlan = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
305
311
  </Body>
306
312
  }
307
313
  onClick={onClick}
314
+ rawOnClick={rawOnClick}
308
315
  />
309
316
  </Root>
310
317
  );
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import fhirVersions from '../fhirResourceVersions';
3
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
4
 
4
5
  import CarePlan from './CarePlan';
5
6
 
@@ -9,73 +10,62 @@ import example2CarePlanSTU3 from '../../../fixtures/stu3/resources/carePlan/exam
9
10
  import weightLossCarePlanR4 from '../../../fixtures/r4/resources/carePlan/weightLossPlan.json';
10
11
  import pregnancyCarePlanR4 from '../../../fixtures/r4/resources/carePlan/pregnancyPlan.json';
11
12
  import heartOperationCarePlanR4 from '../../../fixtures/r4/resources/carePlan/heartOperationPlan.json';
12
- import fhirVersions from '../fhirResourceVersions';
13
+
13
14
  import CarePlanIcon from '../../../assets/containers/CarePlan/care-plan.svg';
14
15
  import fhirIcons from '../../../fixtures/example-icons';
15
16
 
16
- export default { title: 'CarePlan' };
17
+ export default {
18
+ title: 'CarePlan',
19
+ component: CarePlan,
20
+ argTypes: {
21
+ ...defaultArgTypes,
22
+ },
23
+ };
24
+
25
+ const Template = args => <CarePlan {...args} />;
17
26
 
18
- export const DefaultVisualizationDSTU2 = () => {
19
- const fhirResource = object('Resource', exampleCarePlanDSTU2);
20
- return (
21
- <CarePlan
22
- fhirVersion={fhirVersions.DSTU2}
23
- fhirResource={fhirResource}
24
- fhirIcons={require('../../../assets/containers/CarePlan/care-plan.svg')}
25
- />
26
- );
27
+ export const DefaultVisualizationDSTU2 = Template.bind({});
28
+ DefaultVisualizationDSTU2.args = {
29
+ fhirVersion: fhirVersions.DSTU2,
30
+ fhirResource: exampleCarePlanDSTU2,
31
+ fhirIcons: require('../../../assets/containers/CarePlan/care-plan.svg'),
27
32
  };
28
33
 
29
- export const ExampleCarePlanSTU3 = () => {
30
- const fhirResource = object('Resource', exampleCarePlanSTU3);
31
- return (
32
- <CarePlan
33
- fhirVersion={fhirVersions.STU3}
34
- fhirResource={fhirResource}
35
- fhirIcons={CarePlanIcon}
36
- />
37
- );
34
+ export const ExampleCarePlanSTU3 = Template.bind({});
35
+ ExampleCarePlanSTU3.args = {
36
+ fhirVersion: fhirVersions.STU3,
37
+ fhirResource: exampleCarePlanSTU3,
38
+ fhirIcons: CarePlanIcon,
38
39
  };
39
40
 
40
- export const Example2CarePlanSTU3 = () => {
41
- const fhirResource = object('Resource', example2CarePlanSTU3);
42
- return (
43
- <CarePlan
44
- fhirVersion={fhirVersions.STU3}
45
- fhirResource={fhirResource}
46
- fhirIcons={fhirIcons}
47
- />
48
- );
41
+ export const Example2CarePlanSTU3 = Template.bind({});
42
+ Example2CarePlanSTU3.args = {
43
+ fhirVersion: fhirVersions.STU3,
44
+ fhirResource: example2CarePlanSTU3,
45
+ fhirIcons: fhirIcons,
49
46
  };
50
47
 
51
- export const WeightLossCarePlanR4 = () => {
52
- const fhirResource = object('Resource', weightLossCarePlanR4);
53
- return (
54
- <CarePlan
55
- fhirVersion={fhirVersions.R4}
56
- fhirResource={fhirResource}
57
- fhirIcons={false}
58
- />
59
- );
48
+ export const WeightLossCarePlanR4 = Template.bind({});
49
+ WeightLossCarePlanR4.args = {
50
+ fhirVersion: fhirVersions.R4,
51
+ fhirResource: weightLossCarePlanR4,
52
+ fhirIcons: false,
60
53
  };
61
54
 
62
- export const PregnancyCarePlanR4 = () => {
63
- const fhirResource = object('Resource', pregnancyCarePlanR4);
64
- return (
65
- <CarePlan
66
- fhirVersion={fhirVersions.R4}
67
- fhirResource={fhirResource}
68
- fhirIcons={'random text'}
69
- />
70
- );
55
+ export const PregnancyCarePlanR4 = Template.bind({});
56
+ PregnancyCarePlanR4.args = {
57
+ fhirVersion: fhirVersions.R4,
58
+ fhirResource: pregnancyCarePlanR4,
59
+ fhirIcons: 'random text',
71
60
  };
72
61
 
73
- export const HeartOperatioCarePlanR4 = () => {
74
- const fhirResource = object('Resource', heartOperationCarePlanR4);
75
- return <CarePlan fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />;
62
+ export const HeartOperatioCarePlanR4 = Template.bind({});
63
+ HeartOperatioCarePlanR4.args = {
64
+ fhirVersion: fhirVersions.R4,
65
+ fhirResource: heartOperationCarePlanR4,
76
66
  };
77
67
 
78
- export const ExampleWithoutFhirVersionProperty = () => {
79
- const fhirResource = object('Resource', example2CarePlanSTU3);
80
- return <CarePlan fhirResource={fhirResource} />;
68
+ export const ExampleWithoutFhirVersionProperty = Template.bind({});
69
+ ExampleWithoutFhirVersionProperty.args = {
70
+ fhirResource: example2CarePlanSTU3,
81
71
  };
@@ -83,7 +83,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
83
83
  }
84
84
  };
85
85
 
86
- const CareTeam = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
86
+ const CareTeam = ({
87
+ fhirResource,
88
+ fhirVersion,
89
+ fhirIcons,
90
+ onClick,
91
+ rawOnClick,
92
+ }) => {
87
93
  const {
88
94
  name,
89
95
  status,
@@ -167,6 +173,7 @@ const CareTeam = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
167
173
  </Body>
168
174
  }
169
175
  onClick={onClick}
176
+ rawOnClick={rawOnClick}
170
177
  />
171
178
  </Root>
172
179
  );
@@ -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 CareTeam from './CareTeam';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -12,37 +12,31 @@ import CareTeamIcon from '../../../assets/containers/CareTeam/care-team.svg';
12
12
 
13
13
  export default {
14
14
  title: 'CareTeam',
15
+ component: CareTeam,
16
+ argTypes: {
17
+ ...defaultArgTypes,
18
+ },
15
19
  };
16
20
 
17
- export const ExampleSTU3 = () => {
18
- const fhirResource = object('Resource', example_STU3);
19
- return (
20
- <CareTeam
21
- fhirResource={fhirResource}
22
- fhirVersion={fhirVersions.STU3}
23
- fhirIcons={CareTeamIcon}
24
- />
25
- );
21
+ const Template = args => <CareTeam {...args} />;
22
+
23
+ export const ExampleSTU3 = Template.bind({});
24
+ ExampleSTU3.args = {
25
+ fhirVersion: fhirVersions.STU3,
26
+ fhirResource: example_STU3,
27
+ fhirIcons: CareTeamIcon,
26
28
  };
27
29
 
28
- export const Example2OfSTU3 = () => {
29
- const fhirResource = object('Resource', example2_STU3);
30
- return (
31
- <CareTeam
32
- fhirResource={fhirResource}
33
- fhirVersion={fhirVersions.STU3}
34
- fhirIcons={fhirIcons}
35
- />
36
- );
30
+ export const Example2OfSTU3 = Template.bind({});
31
+ Example2OfSTU3.args = {
32
+ fhirVersion: fhirVersions.STU3,
33
+ fhirResource: example2_STU3,
34
+ fhirIcons: fhirIcons,
37
35
  };
38
36
 
39
- export const ExampleR4 = () => {
40
- const fhirResource = object('Resource', example_R4);
41
- return (
42
- <CareTeam
43
- fhirResource={fhirResource}
44
- fhirVersion={fhirVersions.R4}
45
- fhirIcons={false}
46
- />
47
- );
37
+ export const ExampleR4 = Template.bind({});
38
+ ExampleR4.args = {
39
+ fhirVersion: fhirVersions.R4,
40
+ fhirResource: example_R4,
41
+ fhirIcons: false,
48
42
  };
@@ -298,7 +298,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
298
298
  }
299
299
  };
300
300
 
301
- const Claim = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
301
+ const Claim = ({
302
+ fhirResource,
303
+ fhirVersion,
304
+ fhirIcons,
305
+ onClick,
306
+ rawOnClick,
307
+ }) => {
302
308
  let fhirResourceData = {};
303
309
  try {
304
310
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -482,6 +488,7 @@ const Claim = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
482
488
  </Body>
483
489
  }
484
490
  onClick={onClick}
491
+ rawOnClick={rawOnClick}
485
492
  />
486
493
  </Root>
487
494
  );