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
@@ -76,6 +76,7 @@ const FamilyMemberHistory = ({
76
76
  fhirIcons,
77
77
  onClick,
78
78
  rawOnClick,
79
+ customId,
79
80
  }) => {
80
81
  let fhirResourceData = {};
81
82
  try {
@@ -142,6 +143,7 @@ const FamilyMemberHistory = ({
142
143
  bodyContent={<Body tableData={tableData} />}
143
144
  onClick={onClick}
144
145
  rawOnClick={rawOnClick}
146
+ customId={customId}
145
147
  />
146
148
  </Root>
147
149
  );
@@ -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,13 @@ 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, rawOnClick }) => {
7
+ const Generic = ({
8
+ fhirResource,
9
+ fhirIcons,
10
+ onClick,
11
+ rawOnClick,
12
+ customId,
13
+ }) => {
8
14
  const title = fhirResource
9
15
  ? `${fhirResource.resourceType}/${fhirResource.id}`
10
16
  : `Unknown Resource`;
@@ -31,6 +37,7 @@ const Generic = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
31
37
  }
32
38
  onClick={onClick}
33
39
  rawOnClick={rawOnClick}
40
+ customId={customId}
34
41
  />
35
42
  </Root>
36
43
  );
@@ -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
  };
@@ -105,6 +105,7 @@ const Goal = ({
105
105
  fhirIcons,
106
106
  onClick,
107
107
  rawOnClick,
108
+ customId,
108
109
  }) => {
109
110
  let fhirResourceData = {};
110
111
  try {
@@ -235,6 +236,7 @@ const Goal = ({
235
236
  bodyContent={<Body tableData={tableData} />}
236
237
  onClick={onClick}
237
238
  rawOnClick={rawOnClick}
239
+ customId={customId}
238
240
  />
239
241
  </Root>
240
242
  );
@@ -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
  };
@@ -109,6 +109,7 @@ const Immunization = ({
109
109
  fhirIcons,
110
110
  onClick,
111
111
  rawOnClick,
112
+ customId,
112
113
  }) => {
113
114
  const {
114
115
  title,
@@ -248,6 +249,7 @@ const Immunization = ({
248
249
  bodyContent={<Body tableData={tableData} />}
249
250
  onClick={onClick}
250
251
  rawOnClick={rawOnClick}
252
+ customId={customId}
251
253
  />
252
254
  </Root>
253
255
  );
@@ -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
  };
@@ -132,6 +132,7 @@ const List = ({
132
132
  fhirIcons,
133
133
  onClick,
134
134
  rawOnClick,
135
+ customId,
135
136
  }) => {
136
137
  let fhirResourceData = {};
137
138
  try {
@@ -293,6 +294,7 @@ const List = ({
293
294
  }
294
295
  onClick={onClick}
295
296
  rawOnClick={rawOnClick}
297
+ customId={customId}
296
298
  />
297
299
  </Root>
298
300
  );
@@ -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,13 @@ 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, rawOnClick }) => {
12
+ const Location = ({
13
+ fhirResource,
14
+ fhirIcons,
15
+ onClick,
16
+ rawOnClick,
17
+ customId,
18
+ }) => {
13
19
  const name = _get(fhirResource, 'name');
14
20
  const status = _get(fhirResource, 'status');
15
21
  const description = _get(fhirResource, 'description');
@@ -83,6 +89,7 @@ const Location = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
83
89
  bodyContent={<Body tableData={tableData} />}
84
90
  onClick={onClick}
85
91
  rawOnClick={rawOnClick}
92
+ customId={customId}
86
93
  />
87
94
  </Root>
88
95
  );
@@ -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
  };