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
  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, rawOnClick } = props;
9
+ const { fhirResource, fhirIcons, rawOnClick, customId } = props;
10
10
 
11
11
  const loadBinaryFile = () => {
12
12
  switch (fhirResource.contentType) {
@@ -38,6 +38,7 @@ const Binary = props => {
38
38
  }
39
39
  bodyContent={<Body>{loadBinaryFile()}</Body>}
40
40
  rawOnClick={rawOnClick}
41
+ customId={customId}
41
42
  />
42
43
  </div>
43
44
  );
@@ -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
+ };
@@ -75,6 +75,7 @@ const dstu2DTO = fhirResource => {
75
75
  hasActivity,
76
76
  };
77
77
  };
78
+
78
79
  const stu3DTO = fhirResource => {
79
80
  let activity = _get(fhirResource, 'activity');
80
81
  const hasActivity = Array.isArray(activity);
@@ -168,6 +169,7 @@ const CarePlan = ({
168
169
  fhirIcons,
169
170
  onClick,
170
171
  rawOnClick,
172
+ customId,
171
173
  }) => {
172
174
  let fhirResourceData = {};
173
175
  try {
@@ -312,6 +314,7 @@ const CarePlan = ({
312
314
  }
313
315
  onClick={onClick}
314
316
  rawOnClick={rawOnClick}
317
+ customId={customId}
315
318
  />
316
319
  </Root>
317
320
  );
@@ -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
  };
@@ -89,6 +89,7 @@ const CareTeam = ({
89
89
  fhirIcons,
90
90
  onClick,
91
91
  rawOnClick,
92
+ customId,
92
93
  }) => {
93
94
  const {
94
95
  name,
@@ -174,6 +175,7 @@ const CareTeam = ({
174
175
  }
175
176
  onClick={onClick}
176
177
  rawOnClick={rawOnClick}
178
+ customId={customId}
177
179
  />
178
180
  </Root>
179
181
  );
@@ -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
  };
@@ -105,6 +105,7 @@ const dstu2DTO = fhirResource => {
105
105
  items,
106
106
  };
107
107
  };
108
+
108
109
  const stu3DTO = fhirResource => {
109
110
  const status = _get(fhirResource, 'status');
110
111
  const typeCoding = _get(fhirResource, 'type.coding[0]');
@@ -304,6 +305,7 @@ const Claim = ({
304
305
  fhirIcons,
305
306
  onClick,
306
307
  rawOnClick,
308
+ customId,
307
309
  }) => {
308
310
  let fhirResourceData = {};
309
311
  try {
@@ -489,6 +491,7 @@ const Claim = ({
489
491
  }
490
492
  onClick={onClick}
491
493
  rawOnClick={rawOnClick}
494
+ customId={customId}
492
495
  />
493
496
  </Root>
494
497
  );