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 FamilyMemberHistory from './FamilyMemberHistory';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -12,38 +12,32 @@ import fhirIcons from '../../../fixtures/example-icons';
12
12
  import FamilyMemberHistoryIcon from '../../../assets/containers/FamilyMemberHistory/family-member-history.svg';
13
13
 
14
14
  export default {
15
- title: 'FamilyMemberHistory',
15
+ title: 'Coverage/FamilyMemberHistory',
16
+ component: FamilyMemberHistory,
17
+ argTypes: {
18
+ ...defaultArgTypes,
19
+ },
16
20
  };
17
21
 
18
- export const DefaultVisualizationDSTU2 = () => {
19
- const fhirResource = object('Resource', example1DSTU2);
20
- return (
21
- <FamilyMemberHistory
22
- fhirVersion={fhirVersions.DSTU2}
23
- fhirResource={fhirResource}
24
- fhirIcons={require('../../../assets/containers/FamilyMemberHistory/family-member-history.svg')}
25
- />
26
- );
22
+ const Template = args => <FamilyMemberHistory {...args} />;
23
+
24
+ export const DefaultVisualizationDSTU2 = Template.bind({});
25
+ DefaultVisualizationDSTU2.args = {
26
+ fhirVersion: fhirVersions.DSTU2,
27
+ fhirResource: example1DSTU2,
28
+ fhirIcons: require('../../../assets/containers/FamilyMemberHistory/family-member-history.svg'),
27
29
  };
28
30
 
29
- export const Example1OfSTU3 = () => {
30
- const fhirResource = object('Resource', example1STU3);
31
- return (
32
- <FamilyMemberHistory
33
- fhirVersion={fhirVersions.STU3}
34
- fhirResource={fhirResource}
35
- fhirIcons={FamilyMemberHistoryIcon}
36
- />
37
- );
31
+ export const Example1OfSTU3 = Template.bind({});
32
+ Example1OfSTU3.args = {
33
+ fhirVersion: fhirVersions.STU3,
34
+ fhirResource: example1STU3,
35
+ fhirIcons: FamilyMemberHistoryIcon,
38
36
  };
39
37
 
40
- export const Example2OfSTU3 = () => {
41
- const fhirResource = object('Resource', example2STU3);
42
- return (
43
- <FamilyMemberHistory
44
- fhirVersion={fhirVersions.STU3}
45
- fhirResource={fhirResource}
46
- fhirIcons={fhirIcons}
47
- />
48
- );
38
+ export const Example2OfSTU3 = Template.bind({});
39
+ Example2OfSTU3.args = {
40
+ fhirVersion: fhirVersions.STU3,
41
+ fhirResource: example2STU3,
42
+ fhirIcons: fhirIcons,
49
43
  };
@@ -4,7 +4,7 @@ import _get from 'lodash/get';
4
4
  import { Root, Header } from '../../ui';
5
5
  import Accordion from '../../containers/Accordion';
6
6
 
7
- const Generic = ({ fhirResource, fhirIcons, onClick }) => {
7
+ const Generic = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
8
8
  const title = fhirResource
9
9
  ? `${fhirResource.resourceType}/${fhirResource.id}`
10
10
  : `Unknown Resource`;
@@ -30,6 +30,7 @@ const Generic = ({ fhirResource, fhirIcons, onClick }) => {
30
30
  />
31
31
  }
32
32
  onClick={onClick}
33
+ rawOnClick={rawOnClick}
33
34
  />
34
35
  </Root>
35
36
  );
@@ -1,19 +1,28 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import Generic from './Generic';
5
5
  import fhirIcons from '../../../fixtures/example-icons';
6
6
 
7
- export default { title: 'Generic' };
7
+ export default {
8
+ title: 'Generic',
9
+ component: Generic,
10
+ argTypes: {
11
+ ...defaultArgTypes,
12
+ },
13
+ };
14
+
15
+ const Template = args => <Generic {...args} />;
8
16
 
9
- export const DefaultVisualization = () => {
10
- const exampleResource = {
11
- resourceType: 'UnknownResource',
12
- id: '12345',
13
- code: {
14
- text: 'Resource code text',
15
- },
16
- };
17
- const fhirResource = object('Resource', exampleResource);
18
- return <Generic fhirResource={fhirResource} fhirIcons={fhirIcons} />;
17
+ const exampleResource = {
18
+ resourceType: 'UnknownResource',
19
+ id: '12345',
20
+ code: {
21
+ text: 'Resource code text',
22
+ },
23
+ };
24
+ export const DefaultVisualization = Template.bind({});
25
+ DefaultVisualization.args = {
26
+ fhirResource: exampleResource,
27
+ fhirIcons: fhirIcons,
19
28
  };
@@ -99,7 +99,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
99
99
  }
100
100
  };
101
101
 
102
- const Goal = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
102
+ const Goal = ({
103
+ fhirResource,
104
+ fhirVersion,
105
+ fhirIcons,
106
+ onClick,
107
+ rawOnClick,
108
+ }) => {
103
109
  let fhirResourceData = {};
104
110
  try {
105
111
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -228,6 +234,7 @@ const Goal = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
228
234
  }
229
235
  bodyContent={<Body tableData={tableData} />}
230
236
  onClick={onClick}
237
+ rawOnClick={rawOnClick}
231
238
  />
232
239
  </Root>
233
240
  );
@@ -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 Goal from './Goal';
5
5
  import fhirIcons from '../../../fixtures/example-icons';
@@ -13,64 +13,50 @@ import GoalIcon from '../../../assets/containers/Goal/goal.svg';
13
13
 
14
14
  export default {
15
15
  title: 'Goal',
16
+ component: Goal,
17
+ argTypes: {
18
+ ...defaultArgTypes,
19
+ },
16
20
  };
17
21
 
18
- export const DefaultVisualizationDSTU2 = () => {
19
- const fhirResource = object('Resource', dstu2Example1);
20
- return (
21
- <Goal
22
- fhirVersion={fhirVersions.DSTU2}
23
- fhirResource={fhirResource}
24
- fhirIcons={require('../../../assets/containers/Goal/goal.svg')}
25
- />
26
- );
22
+ const Template = args => <Goal {...args} />;
23
+
24
+ export const DefaultVisualizationDSTU2 = Template.bind({});
25
+ DefaultVisualizationDSTU2.args = {
26
+ fhirVersion: fhirVersions.DSTU2,
27
+ fhirResource: dstu2Example1,
28
+ fhirIcons: require('../../../assets/containers/Goal/goal.svg'),
27
29
  };
28
30
 
29
- export const Example2OfDSTU2 = () => {
30
- const fhirResource = object('Resource', dstu2Example2);
31
- return (
32
- <Goal
33
- fhirVersion={fhirVersions.DSTU2}
34
- fhirResource={fhirResource}
35
- fhirIcons={GoalIcon}
36
- />
37
- );
31
+ export const Example2OfDSTU2 = Template.bind({});
32
+ Example2OfDSTU2.args = {
33
+ fhirVersion: fhirVersions.DSTU2,
34
+ fhirResource: dstu2Example2,
35
+ fhirIcons: GoalIcon,
38
36
  };
39
37
 
40
- export const ExampleOfSTU3 = () => {
41
- const fhirResource = object('Resource', stu3Example1);
42
- return (
43
- <Goal
44
- fhirVersion={fhirVersions.STU3}
45
- fhirResource={fhirResource}
46
- fhirIcons={fhirIcons}
47
- />
48
- );
38
+ export const ExampleOfSTU3 = Template.bind({});
39
+ ExampleOfSTU3.args = {
40
+ fhirVersion: fhirVersions.STU3,
41
+ fhirResource: stu3Example1,
42
+ fhirIcons: fhirIcons,
49
43
  };
50
44
 
51
- export const Example1OfR4 = () => {
52
- const fhirResource = object('Resource', r4Example1);
53
- return (
54
- <Goal
55
- fhirVersion={fhirVersions.R4}
56
- fhirResource={fhirResource}
57
- fhirIcons={false}
58
- />
59
- );
45
+ export const Example1OfR4 = Template.bind({});
46
+ Example1OfR4.args = {
47
+ fhirVersion: fhirVersions.R4,
48
+ fhirResource: r4Example1,
49
+ fhirIcons: false,
60
50
  };
61
51
 
62
- export const Example2OfR4 = () => {
63
- const fhirResource = object('Resource', r4Example2);
64
- return (
65
- <Goal
66
- fhirVersion={fhirVersions.R4}
67
- fhirResource={fhirResource}
68
- fhirIcons={'random text'}
69
- />
70
- );
52
+ export const Example2OfR4 = Template.bind({});
53
+ Example2OfR4.args = {
54
+ fhirVersion: fhirVersions.R4,
55
+ fhirResource: r4Example2,
56
+ fhirIcons: 'random text',
71
57
  };
72
58
 
73
- export const ExampleWithoutFhirVersionProperty = () => {
74
- const fhirResource = object('Resource', stu3Example1);
75
- return <Goal fhirResource={fhirResource} fhirIcons={fhirIcons} />;
59
+ export const ExampleWithoutFhirVersionProperty = Template.bind({});
60
+ ExampleWithoutFhirVersionProperty.args = {
61
+ fhirResource: stu3Example1,
76
62
  };
@@ -103,7 +103,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
103
103
  }
104
104
  };
105
105
 
106
- const Immunization = ({ fhirVersion, fhirResource, fhirIcons, onClick }) => {
106
+ const Immunization = ({
107
+ fhirVersion,
108
+ fhirResource,
109
+ fhirIcons,
110
+ onClick,
111
+ rawOnClick,
112
+ }) => {
107
113
  const {
108
114
  title,
109
115
  status,
@@ -241,6 +247,7 @@ const Immunization = ({ fhirVersion, fhirResource, fhirIcons, onClick }) => {
241
247
  }
242
248
  bodyContent={<Body tableData={tableData} />}
243
249
  onClick={onClick}
250
+ rawOnClick={rawOnClick}
244
251
  />
245
252
  </Root>
246
253
  );
@@ -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 Immunization from './Immunization';
5
5
 
@@ -15,64 +15,51 @@ import ImmunizationIcon from '../../../assets/containers/Immunization/immunizati
15
15
 
16
16
  export default {
17
17
  title: 'Immunization',
18
+ component: Immunization,
19
+ argTypes: {
20
+ ...defaultArgTypes,
21
+ },
18
22
  };
19
23
 
20
- export const DefaultVisualizationDSTU2 = () => {
21
- const fhirResource = object('Resource', example1);
22
- return (
23
- <Immunization
24
- fhirResource={fhirResource}
25
- fhirVersion={fhirVersions.DSTU2}
26
- fhirIcons={require('../../../assets/containers/Immunization/immunization.svg')}
27
- />
28
- );
24
+ const Template = args => <Immunization {...args} />;
25
+
26
+ export const DefaultVisualizationDSTU2 = Template.bind({});
27
+ DefaultVisualizationDSTU2.args = {
28
+ fhirVersion: fhirVersions.DSTU2,
29
+ fhirResource: example1,
30
+ fhirIcons: require('../../../assets/containers/Immunization/immunization.svg'),
29
31
  };
30
32
 
31
- export const Example2OfDSTU2 = () => {
32
- const fhirResource = object('Resource', example2);
33
- return (
34
- <Immunization
35
- fhirResource={fhirResource}
36
- fhirVersion={fhirVersions.DSTU2}
37
- fhirIcons={ImmunizationIcon}
38
- />
39
- );
33
+ export const Example2OfDSTU2 = Template.bind({});
34
+ Example2OfDSTU2.args = {
35
+ fhirVersion: fhirVersions.DSTU2,
36
+ fhirResource: example2,
37
+ fhirIcons: ImmunizationIcon,
40
38
  };
41
39
 
42
- export const ExampleSTU3 = () => {
43
- const fhirResource = object('Resource', stu3Example);
44
- return (
45
- <Immunization
46
- fhirResource={fhirResource}
47
- fhirVersion={fhirVersions.STU3}
48
- fhirIcons={fhirIcons}
49
- />
50
- );
40
+ export const ExampleSTU3 = Template.bind({});
41
+ ExampleSTU3.args = {
42
+ fhirVersion: fhirVersions.STU3,
43
+ fhirResource: stu3Example,
44
+ fhirIcons: fhirIcons,
51
45
  };
52
46
 
53
- export const Example1R4 = () => {
54
- const fhirResource = object('Resource', r4Example1);
55
- return (
56
- <Immunization
57
- fhirResource={fhirResource}
58
- fhirVersion={fhirVersions.R4}
59
- fhirIcons={false}
60
- />
61
- );
47
+ export const Example1R4 = Template.bind({});
48
+ Example1R4.args = {
49
+ fhirVersion: fhirVersions.R4,
50
+ fhirResource: r4Example1,
51
+ fhirIcons: false,
62
52
  };
63
- export const Example2R4 = () => {
64
- const fhirResource = object('Resource', r4Example2);
65
- return (
66
- <Immunization
67
- fhirResource={fhirResource}
68
- fhirVersion={fhirVersions.R4}
69
- fhirIcons={'random text'}
70
- />
71
- );
53
+
54
+ export const Example2R4 = Template.bind({});
55
+ Example2R4.args = {
56
+ fhirVersion: fhirVersions.R4,
57
+ fhirResource: r4Example2,
58
+ fhirIcons: 'random text',
72
59
  };
73
- export const Example3R4 = () => {
74
- const fhirResource = object('Resource', r4Example3);
75
- return (
76
- <Immunization fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
77
- );
60
+
61
+ export const Example3R4 = Template.bind({});
62
+ Example3R4.args = {
63
+ fhirVersion: fhirVersions.R4,
64
+ fhirResource: r4Example3,
78
65
  };
@@ -131,6 +131,7 @@ const List = ({
131
131
  withDaVinciPDex = false,
132
132
  fhirIcons,
133
133
  onClick,
134
+ rawOnClick,
134
135
  }) => {
135
136
  let fhirResourceData = {};
136
137
  try {
@@ -291,6 +292,7 @@ const List = ({
291
292
  </Body>
292
293
  }
293
294
  onClick={onClick}
295
+ rawOnClick={rawOnClick}
294
296
  />
295
297
  </Root>
296
298
  );
@@ -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 List from './List';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -19,90 +19,86 @@ import ListIcon from '../../../assets/containers/List/list.svg';
19
19
 
20
20
  export default {
21
21
  title: 'List',
22
+ component: List,
23
+ argTypes: {
24
+ ...defaultArgTypes,
25
+ withDaVinciPDex: {
26
+ table: {
27
+ disable: true,
28
+ },
29
+ },
30
+ },
22
31
  };
23
32
 
24
- export const DefaultVisualizationDSTU2 = () => {
25
- const fhirResource = object('Resource', example1Dstu2);
26
- return (
27
- <List
28
- fhirVersion={fhirVersions.DSTU2}
29
- fhirResource={fhirResource}
30
- fhirIcons={require('../../../assets/containers/List/list.svg')}
31
- />
32
- );
33
+ const Template = args => <List {...args} />;
34
+
35
+ export const DefaultVisualizationDSTU2 = Template.bind({});
36
+ DefaultVisualizationDSTU2.args = {
37
+ fhirVersion: fhirVersions.DSTU2,
38
+ fhirResource: example1Dstu2,
39
+ fhirIcons: require('../../../assets/containers/List/list.svg'),
33
40
  };
34
41
 
35
- export const Example2DSTU2 = () => {
36
- const fhirResource = object('Resource', example2Dstu2);
37
- return (
38
- <List
39
- fhirVersion={fhirVersions.DSTU2}
40
- fhirResource={fhirResource}
41
- fhirIcons={ListIcon}
42
- />
43
- );
42
+ export const Example2DSTU2 = Template.bind({});
43
+ Example2DSTU2.args = {
44
+ fhirVersion: fhirVersions.DSTU2,
45
+ fhirResource: example2Dstu2,
46
+ fhirIcons: ListIcon,
44
47
  };
45
- export const Example3DSTU2 = () => {
46
- const fhirResource = object('Resource', example3Dstu2);
47
- return (
48
- <List
49
- fhirVersion={fhirVersions.DSTU2}
50
- fhirResource={fhirResource}
51
- fhirIcons={fhirIcons}
52
- />
53
- );
48
+
49
+ export const Example3DSTU2 = Template.bind({});
50
+ Example3DSTU2.args = {
51
+ fhirVersion: fhirVersions.DSTU2,
52
+ fhirResource: example3Dstu2,
53
+ fhirIcons: fhirIcons,
54
54
  };
55
55
 
56
- export const DefaultVisualizationSTU3 = () => {
57
- const fhirResource = object('Resource', example1Stu3);
58
- return (
59
- <List
60
- fhirVersion={fhirVersions.STU3}
61
- fhirResource={fhirResource}
62
- fhirIcons={false}
63
- />
64
- );
56
+ export const DefaultVisualizationSTU3 = Template.bind({});
57
+ DefaultVisualizationSTU3.args = {
58
+ fhirVersion: fhirVersions.STU3,
59
+ fhirResource: example1Stu3,
60
+ fhirIcons: false,
65
61
  };
66
62
 
67
- export const Example2STU3 = () => {
68
- const fhirResource = object('Resource', example2Stu3);
69
- return (
70
- <List
71
- fhirVersion={fhirVersions.STU3}
72
- fhirResource={fhirResource}
73
- fhirIcons={'random text'}
74
- />
75
- );
63
+ export const Example2STU3 = Template.bind({});
64
+ Example2STU3.args = {
65
+ fhirVersion: fhirVersions.STU3,
66
+ fhirResource: example2Stu3,
67
+ fhirIcons: 'random text',
76
68
  };
77
- export const Example3STU3 = () => {
78
- const fhirResource = object('Resource', example3Stu3);
79
- return <List fhirVersion={fhirVersions.STU3} fhirResource={fhirResource} />;
69
+
70
+ export const Example3STU3 = Template.bind({});
71
+ Example3STU3.args = {
72
+ fhirVersion: fhirVersions.STU3,
73
+ fhirResource: example3Stu3,
80
74
  };
81
75
 
82
- export const DefaultVisualizationR4 = () => {
83
- const fhirResource = object('Resource', example1R4);
84
- return <List fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />;
76
+ export const DefaultVisualizationR4 = Template.bind({});
77
+ DefaultVisualizationR4.args = {
78
+ fhirVersion: fhirVersions.R4,
79
+ fhirResource: example1R4,
85
80
  };
86
- export const ExampleR4WithoutDaVinciPDex = () => {
87
- const fhirResource = object('Resource', example2R4);
88
- return <List fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />;
81
+
82
+ export const ExampleR4WithoutDaVinciPDex = Template.bind({});
83
+ ExampleR4WithoutDaVinciPDex.args = {
84
+ fhirVersion: fhirVersions.R4,
85
+ fhirResource: example2R4,
89
86
  };
90
- export const ExampleR4WithDaVinciPDex = () => {
91
- const fhirResource = object('Resource', example2R4);
92
- return (
93
- <List
94
- fhirVersion={fhirVersions.R4}
95
- fhirResource={fhirResource}
96
- withDaVinciPDex
97
- />
98
- );
87
+
88
+ export const ExampleR4WithDaVinciPDex = Template.bind({});
89
+ ExampleR4WithDaVinciPDex.args = {
90
+ fhirVersion: fhirVersions.R4,
91
+ fhirResource: example2R4,
92
+ withDaVinciPDex: true,
99
93
  };
100
- export const Example2R4 = () => {
101
- const fhirResource = object('Resource', example3R4);
102
- return <List fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />;
94
+
95
+ export const Example2R4 = Template.bind({});
96
+ Example2R4.args = {
97
+ fhirVersion: fhirVersions.R4,
98
+ fhirResource: example3R4,
103
99
  };
104
100
 
105
- export const ExampleWithoutFHIRVersionProperty = () => {
106
- const fhirResource = object('Resource', example3R4);
107
- return <List fhirResource={fhirResource} />;
101
+ export const ExampleWithoutFHIRVersionProperty = Template.bind({});
102
+ ExampleWithoutFHIRVersionProperty.args = {
103
+ fhirResource: example3R4,
108
104
  };
@@ -9,7 +9,7 @@ import CodeableConcept from '../../datatypes/CodeableConcept';
9
9
  import Reference from '../../datatypes/Reference';
10
10
  import Accordion from '../../containers/Accordion';
11
11
 
12
- const Location = ({ fhirResource, fhirIcons, onClick }) => {
12
+ const Location = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
13
13
  const name = _get(fhirResource, 'name');
14
14
  const status = _get(fhirResource, 'status');
15
15
  const description = _get(fhirResource, 'description');
@@ -82,6 +82,7 @@ const Location = ({ fhirResource, fhirIcons, onClick }) => {
82
82
  }
83
83
  bodyContent={<Body tableData={tableData} />}
84
84
  onClick={onClick}
85
+ rawOnClick={rawOnClick}
85
86
  />
86
87
  </Root>
87
88
  );
@@ -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 Location from './Location';
5
5
 
@@ -12,29 +12,34 @@ import LocationIcon from '../../../assets/containers/Location/location.svg';
12
12
 
13
13
  export default {
14
14
  title: 'Location',
15
+ component: Location,
16
+ argTypes: {
17
+ ...defaultArgTypes,
18
+ },
15
19
  };
16
20
 
17
- export const DefaultVisualizationDSTU2 = () => {
18
- const fhirResource = object('Resource', dstu2Example1);
19
- return (
20
- <Location
21
- fhirResource={fhirResource}
22
- fhirIcons={require('../../../assets/containers/Location/location.svg')}
23
- />
24
- );
21
+ const Template = args => <Location {...args} />;
22
+
23
+ export const DefaultVisualizationDSTU2 = Template.bind({});
24
+ DefaultVisualizationDSTU2.args = {
25
+ fhirResource: dstu2Example1,
26
+ fhirIcons: require('../../../assets/containers/Location/location.svg'),
25
27
  };
26
28
 
27
- export const ExampleOfSTU3 = () => {
28
- const fhirResource = object('Resource', stu3Example1);
29
- return <Location fhirResource={fhirResource} fhirIcons={LocationIcon} />;
29
+ export const ExampleOfSTU3 = Template.bind({});
30
+ ExampleOfSTU3.args = {
31
+ fhirResource: stu3Example1,
32
+ fhirIcons: LocationIcon,
30
33
  };
31
34
 
32
- export const Example1OfR4 = () => {
33
- const fhirResource = object('Resource', r4Example1);
34
- return <Location fhirResource={fhirResource} fhirIcons={fhirIcons} />;
35
+ export const Example1OfR4 = Template.bind({});
36
+ Example1OfR4.args = {
37
+ fhirResource: r4Example1,
38
+ fhirIcons: fhirIcons,
35
39
  };
36
40
 
37
- export const Example2OfR4 = () => {
38
- const fhirResource = object('Resource', r4Example2);
39
- return <Location fhirResource={fhirResource} fhirIcons={false} />;
41
+ export const Example2OfR4 = Template.bind({});
42
+ Example2OfR4.args = {
43
+ fhirResource: r4Example2,
44
+ fhirIcons: false,
40
45
  };
@@ -162,7 +162,13 @@ const Ingredient = props => {
162
162
  );
163
163
  };
164
164
 
165
- const Medication = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
165
+ const Medication = ({
166
+ fhirResource,
167
+ fhirVersion,
168
+ fhirIcons,
169
+ onClick,
170
+ rawOnClick,
171
+ }) => {
166
172
  let fhirResourceData = {};
167
173
  try {
168
174
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -274,6 +280,7 @@ const Medication = ({ fhirResource, fhirVersion, fhirIcons, onClick }) => {
274
280
  </Body>
275
281
  }
276
282
  onClick={onClick}
283
+ rawOnClick={rawOnClick}
277
284
  />
278
285
  </Root>
279
286
  );