fhir-react 0.3.9 → 0.3.10

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 (53) hide show
  1. package/.storybook/main.js +5 -0
  2. package/.storybook/manager.js +6 -0
  3. package/.storybook/preview.js +7 -0
  4. package/README.md +1 -1
  5. package/package.json +5 -4
  6. package/src/components/containers/Accordion/Accordion.stories.js +74 -58
  7. package/src/components/containers/ResourceContainer/ResourceContainer.stories.js +43 -41
  8. package/src/components/defaultArgTypes.js +12 -0
  9. package/src/components/resources/AdverseEvent/AdverseEvent.stories.js +17 -19
  10. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +46 -70
  11. package/src/components/resources/Appointment/Appointment.stories.js +51 -62
  12. package/src/components/resources/Binary/Binary.stories.js +27 -21
  13. package/src/components/resources/Bundle/Bundle.stories.js +59 -49
  14. package/src/components/resources/CarePlan/CarePlan.stories.js +44 -54
  15. package/src/components/resources/CareTeam/CareTeam.stories.js +22 -28
  16. package/src/components/resources/Claim/Claim.stories.js +36 -49
  17. package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +42 -52
  18. package/src/components/resources/Condition/Condition.stories.js +47 -62
  19. package/src/components/resources/Coverage/Coverage.stories.js +38 -50
  20. package/src/components/resources/Device/Device.stories.js +40 -52
  21. package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +38 -50
  22. package/src/components/resources/DocumentReference/DocumentReference.stories.js +25 -29
  23. package/src/components/resources/Encounter/Encounter.stories.js +43 -59
  24. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +53 -67
  25. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +74 -38
  26. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +22 -28
  27. package/src/components/resources/Generic/Generic.stories.js +21 -12
  28. package/src/components/resources/Goal/Goal.stories.js +35 -49
  29. package/src/components/resources/Immunization/Immunization.stories.js +38 -51
  30. package/src/components/resources/List/List.stories.js +66 -70
  31. package/src/components/resources/Location/Location.stories.js +23 -18
  32. package/src/components/resources/Medication/Medication.stories.js +42 -64
  33. package/src/components/resources/MedicationAdministration/MedicationAdministration.stories.js +32 -46
  34. package/src/components/resources/MedicationDispense/MedicationDispense.stories.js +39 -57
  35. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +49 -58
  36. package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +11 -4
  37. package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +27 -30
  38. package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +32 -46
  39. package/src/components/resources/Observation/Observation.stories.js +39 -33
  40. package/src/components/resources/Organization/Organization.stories.js +40 -52
  41. package/src/components/resources/Patient/Patient.stories.js +36 -28
  42. package/src/components/resources/Practitioner/Practitioner.stories.js +39 -52
  43. package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +43 -63
  44. package/src/components/resources/Procedure/Procedure.stories.js +33 -25
  45. package/src/components/resources/Questionnaire/Questionnaire.stories.js +47 -62
  46. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.stories.js +43 -63
  47. package/src/components/resources/ReferralRequest/ReferralRequest.stories.js +20 -20
  48. package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +26 -30
  49. package/src/components/resources/ResearchStudy/ResearchStudy.stories.js +17 -15
  50. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +40 -27
  51. package/.storybook/addons.js +0 -1
  52. package/.storybook/config.js +0 -26
  53. 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 Practitioner from './Practitioner';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -14,66 +14,53 @@ import r4Example3 from '../../../fixtures/r4/resources/practitioner/example3.jso
14
14
  import PractitionerIcon from '../../../assets/containers/Practitioner/practitioner.svg';
15
15
  import fhirIcons from '../../../fixtures/example-icons';
16
16
 
17
- export default { title: 'Practitioner' };
17
+ export default {
18
+ title: 'Practitioner',
19
+ component: Practitioner,
20
+ argTypes: {
21
+ ...defaultArgTypes,
22
+ },
23
+ };
24
+
25
+ const Template = args => <Practitioner {...args} />;
18
26
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', dstu2Example1);
21
- return (
22
- <Practitioner
23
- fhirVersion={fhirVersions.DSTU2}
24
- fhirResource={fhirResource}
25
- fhirIcons={require('../../../assets/containers/Practitioner/practitioner.svg')}
26
- />
27
- );
27
+ export const DefaultVisualizationDSTU2 = Template.bind({});
28
+ DefaultVisualizationDSTU2.args = {
29
+ fhirVersion: fhirVersions.DSTU2,
30
+ fhirResource: dstu2Example1,
31
+ fhirIcons: require('../../../assets/containers/Practitioner/practitioner.svg'),
28
32
  };
29
33
 
30
- export const Example2OfDSTU2 = () => {
31
- const fhirResource = object('Resource', dstu2Example2);
32
- return (
33
- <Practitioner
34
- fhirVersion={fhirVersions.DSTU2}
35
- fhirResource={fhirResource}
36
- fhirIcons={PractitionerIcon}
37
- />
38
- );
34
+ export const Example2OfDSTU2 = Template.bind({});
35
+ Example2OfDSTU2.args = {
36
+ fhirVersion: fhirVersions.DSTU2,
37
+ fhirResource: dstu2Example2,
38
+ fhirIcons: PractitionerIcon,
39
39
  };
40
40
 
41
- export const ExampleOfSTU3 = () => {
42
- const fhirResource = object('Resource', stu3Example1);
43
- return (
44
- <Practitioner
45
- fhirVersion={fhirVersions.STU3}
46
- fhirResource={fhirResource}
47
- fhirIcons={fhirIcons}
48
- />
49
- );
41
+ export const ExampleOfSTU3 = Template.bind({});
42
+ ExampleOfSTU3.args = {
43
+ fhirVersion: fhirVersions.STU3,
44
+ fhirResource: stu3Example1,
45
+ fhirIcons: fhirIcons,
50
46
  };
51
47
 
52
- export const Example1OfR4 = () => {
53
- const fhirResource = object('Resource', r4Example1);
54
- return (
55
- <Practitioner
56
- fhirVersion={fhirVersions.R4}
57
- fhirResource={fhirResource}
58
- fhirIcons={false}
59
- />
60
- );
48
+ export const Example1OfR4 = Template.bind({});
49
+ Example1OfR4.args = {
50
+ fhirVersion: fhirVersions.R4,
51
+ fhirResource: r4Example1,
52
+ fhirIcons: false,
61
53
  };
62
54
 
63
- export const Example2OfR4 = () => {
64
- const fhirResource = object('Resource', r4Example2);
65
- return (
66
- <Practitioner
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={'random text'}
70
- />
71
- );
55
+ export const Example2OfR4 = Template.bind({});
56
+ Example2OfR4.args = {
57
+ fhirVersion: fhirVersions.R4,
58
+ fhirResource: r4Example2,
59
+ fhirIcons: 'random text',
72
60
  };
73
61
 
74
- export const Example3OfR4 = () => {
75
- const fhirResource = object('Resource', r4Example3);
76
- return (
77
- <Practitioner fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />
78
- );
62
+ export const Example3OfR4 = Template.bind({});
63
+ Example3OfR4.args = {
64
+ fhirVersion: fhirVersions.R4,
65
+ fhirResource: r4Example3,
79
66
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import PractitionerRole from './PractitionerRole';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -15,79 +15,59 @@ import r4Example4 from '../../../fixtures/r4/resources/practitionerRole/example4
15
15
  import fhirIcons from '../../../fixtures/example-icons';
16
16
  import PractitionerRoleIcon from '../../../assets/containers/PractitionerRole/practitioner-role.svg';
17
17
 
18
- export default { title: 'PractitionerRole' };
18
+ export default {
19
+ title: 'PractitionerRole',
20
+ component: PractitionerRole,
21
+ argTypes: {
22
+ ...defaultArgTypes,
23
+ },
24
+ };
25
+
26
+ const Template = args => <PractitionerRole {...args} />;
19
27
 
20
- export const ExampleOfSTU3 = () => {
21
- const fhirResource = object('Resource', stu3Example1);
22
- return (
23
- <PractitionerRole
24
- fhirVersion={fhirVersions.STU3}
25
- fhirResource={fhirResource}
26
- fhirIcons={require('../../../assets/containers/PractitionerRole/practitioner-role.svg')}
27
- />
28
- );
28
+ export const ExampleOfSTU3 = Template.bind({});
29
+ ExampleOfSTU3.args = {
30
+ fhirVersion: fhirVersions.STU3,
31
+ fhirResource: stu3Example1,
32
+ fhirIcons: require('../../../assets/containers/PractitionerRole/practitioner-role.svg'),
29
33
  };
30
34
 
31
- export const Example2OfSTU3 = () => {
32
- const fhirResource = object('Resource', stu3Example2);
33
- return (
34
- <PractitionerRole
35
- fhirVersion={fhirVersions.STU3}
36
- fhirResource={fhirResource}
37
- fhirIcons={PractitionerRoleIcon}
38
- />
39
- );
35
+ export const Example2OfSTU3 = Template.bind({});
36
+ Example2OfSTU3.args = {
37
+ fhirVersion: fhirVersions.STU3,
38
+ fhirResource: stu3Example2,
39
+ fhirIcons: PractitionerRoleIcon,
40
40
  };
41
41
 
42
- export const Example3OfSTU3 = () => {
43
- const fhirResource = object('Resource', stu3Example3);
44
- return (
45
- <PractitionerRole
46
- fhirVersion={fhirVersions.STU3}
47
- fhirResource={fhirResource}
48
- fhirIcons={fhirIcons}
49
- />
50
- );
42
+ export const Example3OfSTU3 = Template.bind({});
43
+ Example3OfSTU3.args = {
44
+ fhirVersion: fhirVersions.STU3,
45
+ fhirResource: stu3Example3,
46
+ fhirIcons: fhirIcons,
51
47
  };
52
48
 
53
- export const Example1OfR4 = () => {
54
- const fhirResource = object('Resource', r4Example1);
55
- return (
56
- <PractitionerRole
57
- fhirVersion={fhirVersions.R4}
58
- fhirResource={fhirResource}
59
- />
60
- );
49
+ export const Example1OfR4 = Template.bind({});
50
+ Example1OfR4.args = {
51
+ fhirVersion: fhirVersions.R4,
52
+ fhirResource: r4Example1,
53
+ fhirIcons: false,
61
54
  };
62
55
 
63
- export const Example2OfR4 = () => {
64
- const fhirResource = object('Resource', r4Example2);
65
- return (
66
- <PractitionerRole
67
- fhirVersion={fhirVersions.R4}
68
- fhirResource={fhirResource}
69
- fhirIcons={false}
70
- />
71
- );
56
+ export const Example2OfR4 = Template.bind({});
57
+ Example2OfR4.args = {
58
+ fhirVersion: fhirVersions.R4,
59
+ fhirResource: r4Example2,
60
+ fhirIcons: 'random text',
72
61
  };
73
62
 
74
- export const Example3OfR4 = () => {
75
- const fhirResource = object('Resource', r4Example3);
76
- return (
77
- <PractitionerRole
78
- fhirVersion={fhirVersions.R4}
79
- fhirResource={fhirResource}
80
- fhirIcons={'random text'}
81
- />
82
- );
63
+ export const Example3OfR4 = Template.bind({});
64
+ Example3OfR4.args = {
65
+ fhirVersion: fhirVersions.R4,
66
+ fhirResource: r4Example3,
83
67
  };
84
68
 
85
- export const Example4OfR4 = () => {
86
- const fhirResource = object('Resource', r4Example4);
87
- return (
88
- <PractitionerRole
89
- fhirVersion={fhirVersions.R4}
90
- fhirResource={fhirResource}
91
- />
92
- );
69
+ export const Example4OfR4 = Template.bind({});
70
+ Example4OfR4.args = {
71
+ fhirVersion: fhirVersions.R4,
72
+ fhirResource: r4Example4,
93
73
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import Procedure from './Procedure';
5
5
 
@@ -14,39 +14,47 @@ import r4Example3 from '../../../fixtures/r4/resources/procedure/example3.json';
14
14
  import fhirIcons from '../../../fixtures/example-icons';
15
15
  import ProcedureIcon from '../../../assets/containers/Procedure/procedure.svg';
16
16
 
17
- export default { title: 'Procedure' };
17
+ export default {
18
+ title: 'Procedure',
19
+ component: Procedure,
20
+ argTypes: {
21
+ ...defaultArgTypes,
22
+ },
23
+ };
24
+
25
+ const Template = args => <Procedure {...args} />;
18
26
 
19
- export const DefaultVisualizationDSTU2 = () => {
20
- const fhirResource = object('Resource', example1);
21
- return (
22
- <Procedure
23
- fhirResource={fhirResource}
24
- fhirIcons={require('../../../assets/containers/Procedure/procedure.svg')}
25
- />
26
- );
27
+ export const DefaultVisualizationDSTU2 = Template.bind({});
28
+ DefaultVisualizationDSTU2.args = {
29
+ fhirResource: example1,
30
+ fhirIcons: require('../../../assets/containers/Procedure/procedure.svg'),
27
31
  };
28
32
 
29
- export const ExampleOfSTU3 = () => {
30
- const fhirResource = object('Resource', stu3Example1);
31
- return <Procedure fhirResource={fhirResource} fhirIcons={ProcedureIcon} />;
33
+ export const ExampleOfSTU3 = Template.bind({});
34
+ ExampleOfSTU3.args = {
35
+ fhirResource: stu3Example1,
36
+ fhirIcons: ProcedureIcon,
32
37
  };
33
38
 
34
- export const Example2OfSTU3 = () => {
35
- const fhirResource = object('Resource', stu3Example2);
36
- return <Procedure fhirResource={fhirResource} fhirIcons={fhirIcons} />;
39
+ export const Example2OfSTU3 = Template.bind({});
40
+ Example2OfSTU3.args = {
41
+ fhirResource: stu3Example2,
42
+ fhirIcons: fhirIcons,
37
43
  };
38
44
 
39
- export const Example1OfR4 = () => {
40
- const fhirResource = object('Resource', r4Example1);
41
- return <Procedure fhirResource={fhirResource} fhirIcons={false} />;
45
+ export const Example1OfR4 = Template.bind({});
46
+ Example1OfR4.args = {
47
+ fhirResource: r4Example1,
48
+ fhirIcons: false,
42
49
  };
43
50
 
44
- export const Example2OfR4 = () => {
45
- const fhirResource = object('Resource', r4Example2);
46
- return <Procedure fhirResource={fhirResource} fhirIcons={'random text'} />;
51
+ export const Example2OfR4 = Template.bind({});
52
+ Example2OfR4.args = {
53
+ fhirResource: r4Example2,
54
+ fhirIcons: 'random text',
47
55
  };
48
56
 
49
- export const Example3OfR4 = () => {
50
- const fhirResource = object('Resource', r4Example3);
51
- return <Procedure fhirResource={fhirResource} />;
57
+ export const Example3OfR4 = Template.bind({});
58
+ Example3OfR4.args = {
59
+ fhirResource: r4Example3,
52
60
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import Questionnaire from './Questionnaire';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -18,80 +18,65 @@ import r4Example3 from '../../../fixtures/r4/resources/questionnaire/example3.js
18
18
  import fhirIcons from '../../../fixtures/example-icons';
19
19
  import QuestionnaireIcon from '../../../assets/containers/Questionnaire/questionnaire.svg';
20
20
 
21
- export default { title: 'Questionnaire' };
21
+ export default {
22
+ title: 'Questionnaire',
23
+ component: Questionnaire,
24
+ argTypes: {
25
+ ...defaultArgTypes,
26
+ },
27
+ };
28
+
29
+ const Template = args => <Questionnaire {...args} />;
22
30
 
23
- export const DefaultVisualizationDSTU2 = () => {
24
- const fhirResource = object('Resource', dstu2Example1);
25
- return (
26
- <Questionnaire
27
- fhirResource={fhirResource}
28
- fhirVersion={fhirVersions.DSTU2}
29
- fhirIcons={require('../../../assets/containers/Questionnaire/questionnaire.svg')}
30
- />
31
- );
31
+ export const DefaultVisualizationDSTU2 = Template.bind({});
32
+ DefaultVisualizationDSTU2.args = {
33
+ fhirVersion: fhirVersions.DSTU2,
34
+ fhirResource: dstu2Example1,
35
+ fhirIcons: require('../../../assets/containers/Questionnaire/questionnaire.svg'),
32
36
  };
33
37
 
34
- export const Example2OfDSTU2 = () => {
35
- const fhirResource = object('Resource', dstu2Example2);
36
- return (
37
- <Questionnaire
38
- fhirResource={fhirResource}
39
- fhirVersion={fhirVersions.DSTU2}
40
- fhirIcons={QuestionnaireIcon}
41
- />
42
- );
38
+ export const Example2OfDSTU2 = Template.bind({});
39
+ Example2OfDSTU2.args = {
40
+ fhirVersion: fhirVersions.DSTU2,
41
+ fhirResource: dstu2Example2,
42
+ fhirIcons: QuestionnaireIcon,
43
43
  };
44
44
 
45
- export const Example3OfDSTU2 = () => {
46
- const fhirResource = object('Resource', dstu2Example3);
47
- return (
48
- <Questionnaire
49
- fhirResource={fhirResource}
50
- fhirVersion={fhirVersions.DSTU2}
51
- fhirIcons={fhirIcons}
52
- />
53
- );
45
+ export const Example3OfDSTU2 = Template.bind({});
46
+ Example3OfDSTU2.args = {
47
+ fhirVersion: fhirVersions.DSTU2,
48
+ fhirResource: dstu2Example3,
49
+ fhirIcons: fhirIcons,
54
50
  };
55
51
 
56
- export const Example1OfSTU3 = () => {
57
- const fhirResource = object('Resource', stu3Example1);
58
- return (
59
- <Questionnaire
60
- fhirResource={fhirResource}
61
- fhirVersion={fhirVersions.STU3}
62
- fhirIcons={false}
63
- />
64
- );
52
+ export const Example1OfSTU3 = Template.bind({});
53
+ Example1OfSTU3.args = {
54
+ fhirVersion: fhirVersions.STU3,
55
+ fhirResource: stu3Example1,
56
+ fhirIcons: false,
65
57
  };
66
58
 
67
- export const Example2OfSTU3 = () => {
68
- const fhirResource = object('Resource', stu3Example2);
69
- return (
70
- <Questionnaire
71
- fhirResource={fhirResource}
72
- fhirVersion={fhirVersions.STU3}
73
- fhirIcons={'random text'}
74
- />
75
- );
59
+ export const Example2OfSTU3 = Template.bind({});
60
+ Example2OfSTU3.args = {
61
+ fhirVersion: fhirVersions.STU3,
62
+ fhirResource: stu3Example2,
63
+ fhirIcons: 'random text',
76
64
  };
77
65
 
78
- export const Example1OfR4 = () => {
79
- const fhirResource = object('Resource', r4Example1);
80
- return (
81
- <Questionnaire fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
82
- );
66
+ export const Example1OfR4 = Template.bind({});
67
+ Example1OfR4.args = {
68
+ fhirVersion: fhirVersions.R4,
69
+ fhirResource: r4Example1,
83
70
  };
84
71
 
85
- export const Example2OfR4 = () => {
86
- const fhirResource = object('Resource', r4Example2);
87
- return (
88
- <Questionnaire fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
89
- );
72
+ export const Example2OfR4 = Template.bind({});
73
+ Example2OfR4.args = {
74
+ fhirVersion: fhirVersions.R4,
75
+ fhirResource: r4Example2,
90
76
  };
91
77
 
92
- export const Example3OfR4 = () => {
93
- const fhirResource = object('Resource', r4Example3);
94
- return (
95
- <Questionnaire fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
96
- );
78
+ export const Example3OfR4 = Template.bind({});
79
+ Example3OfR4.args = {
80
+ fhirVersion: fhirVersions.R4,
81
+ fhirResource: r4Example3,
97
82
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import QuestionnaireResponse from './QuestionnaireResponse';
5
5
  import fhirVersions from '../fhirResourceVersions';
@@ -17,79 +17,59 @@ import r4Example2 from '../../../fixtures/r4/resources/questionnaireResponse/exa
17
17
  import fhirIcons from '../../../fixtures/example-icons';
18
18
  import QuestionnaireResponseIcon from '../../../assets/containers/QuestionnaireResponse/questionnaire-response.svg';
19
19
 
20
- export default { title: 'QuestionnaireResponse' };
20
+ export default {
21
+ title: 'QuestionnaireResponse',
22
+ component: QuestionnaireResponse,
23
+ argTypes: {
24
+ ...defaultArgTypes,
25
+ },
26
+ };
27
+
28
+ const Template = args => <QuestionnaireResponse {...args} />;
21
29
 
22
- export const DefaultVisualizationDSTU2 = () => {
23
- const fhirResource = object('Resource', dstu2Example1);
24
- return (
25
- <QuestionnaireResponse
26
- fhirVersion={fhirVersions.DSTU2}
27
- fhirResource={fhirResource}
28
- fhirIcons={require('../../../assets/containers/QuestionnaireResponse/questionnaire-response.svg')}
29
- />
30
- );
30
+ export const DefaultVisualizationDSTU2 = Template.bind({});
31
+ DefaultVisualizationDSTU2.args = {
32
+ fhirVersion: fhirVersions.DSTU2,
33
+ fhirResource: dstu2Example1,
34
+ fhirIcons: require('../../../assets/containers/QuestionnaireResponse/questionnaire-response.svg'),
31
35
  };
32
36
 
33
- export const Example2OfDSTU2 = () => {
34
- const fhirResource = object('Resource', dstu2Example2);
35
- return (
36
- <QuestionnaireResponse
37
- fhirVersion={fhirVersions.DSTU2}
38
- fhirResource={fhirResource}
39
- fhirIcons={QuestionnaireResponseIcon}
40
- />
41
- );
37
+ export const Example2OfDSTU2 = Template.bind({});
38
+ Example2OfDSTU2.args = {
39
+ fhirVersion: fhirVersions.DSTU2,
40
+ fhirResource: dstu2Example2,
41
+ fhirIcons: QuestionnaireResponseIcon,
42
42
  };
43
43
 
44
- export const Example3OfDSTU2 = () => {
45
- const fhirResource = object('Resource', dstu2Example3);
46
- return (
47
- <QuestionnaireResponse
48
- fhirVersion={fhirVersions.DSTU2}
49
- fhirResource={fhirResource}
50
- fhirIcons={fhirIcons}
51
- />
52
- );
44
+ export const Example3OfDSTU2 = Template.bind({});
45
+ Example3OfDSTU2.args = {
46
+ fhirVersion: fhirVersions.DSTU2,
47
+ fhirResource: dstu2Example3,
48
+ fhirIcons: fhirIcons,
53
49
  };
54
50
 
55
- export const Example1OfSTU3 = () => {
56
- const fhirResource = object('Resource', stu3Example1);
57
- return (
58
- <QuestionnaireResponse
59
- fhirVersion={fhirVersions.STU3}
60
- fhirResource={fhirResource}
61
- fhirIcons={false}
62
- />
63
- );
51
+ export const Example1OfSTU3 = Template.bind({});
52
+ Example1OfSTU3.args = {
53
+ fhirVersion: fhirVersions.STU3,
54
+ fhirResource: stu3Example1,
55
+ fhirIcons: false,
64
56
  };
65
57
 
66
- export const Example2OfSTU3 = () => {
67
- const fhirResource = object('Resource', stu3Example2);
68
- return (
69
- <QuestionnaireResponse
70
- fhirVersion={fhirVersions.STU3}
71
- fhirResource={fhirResource}
72
- fhirIcons="random text"
73
- />
74
- );
58
+ export const Example2OfSTU3 = Template.bind({});
59
+ Example2OfSTU3.args = {
60
+ fhirVersion: fhirVersions.STU3,
61
+ fhirResource: stu3Example2,
62
+ fhirIcons: 'random text',
75
63
  };
76
64
 
77
- export const Example1OfR4 = () => {
78
- const fhirResource = object('Resource', r4Example1);
79
- return (
80
- <QuestionnaireResponse
81
- fhirVersion={fhirVersions.R4}
82
- fhirResource={fhirResource}
83
- />
84
- );
65
+ export const Example1OfR4 = Template.bind({});
66
+ Example1OfR4.args = {
67
+ fhirVersion: fhirVersions.R4,
68
+ fhirResource: r4Example1,
85
69
  };
86
70
 
87
- export const Example2OfR4 = () => {
88
- const fhirResource = object('Resource', r4Example2);
89
- return (
90
- <QuestionnaireResponse
91
- fhirVersion={fhirVersions.R4}
92
- fhirResource={fhirResource}
93
- />
94
- );
71
+ export const Example2OfR4 = Template.bind({});
72
+ Example2OfR4.args = {
73
+ fhirVersion: fhirVersions.R4,
74
+ fhirResource: r4Example2,
95
75
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { object } from '@storybook/addon-knobs';
2
+ import { defaultArgTypes } from '../../defaultArgTypes';
3
3
 
4
4
  import ReferralRequest from './ReferralRequest';
5
5
 
@@ -9,29 +9,29 @@ import fhirVersions from '../fhirResourceVersions';
9
9
 
10
10
  export default {
11
11
  title: 'ReferralRequest',
12
+ component: ReferralRequest,
13
+ argTypes: {
14
+ ...defaultArgTypes,
15
+ },
12
16
  };
13
17
 
14
- export const DefaultVisualizationDSTU2 = () => {
15
- const fhirResource = object('Resource', dstu2Example1);
16
- return (
17
- <ReferralRequest
18
- fhirVersion={fhirVersions.DSTU2}
19
- fhirResource={fhirResource}
20
- />
21
- );
18
+ const Template = args => <ReferralRequest {...args} />;
19
+
20
+ export const DefaultVisualizationDSTU2 = Template.bind({});
21
+ DefaultVisualizationDSTU2.args = {
22
+ fhirVersion: fhirVersions.DSTU2,
23
+ fhirResource: dstu2Example1,
24
+ fhirIcons: require('../../../assets/containers/ReferralRequest/referral-request.svg'),
22
25
  };
23
26
 
24
- export const ExampleOfSTU3 = () => {
25
- const fhirResource = object('Resource', stu3Example1);
26
- return (
27
- <ReferralRequest
28
- fhirVersion={fhirVersions.STU3}
29
- fhirResource={fhirResource}
30
- />
31
- );
27
+ export const ExampleOfSTU3 = Template.bind({});
28
+ ExampleOfSTU3.args = {
29
+ fhirVersion: fhirVersions.STU3,
30
+ fhirResource: stu3Example1,
31
+ fhirIcons: false,
32
32
  };
33
33
 
34
- export const ExampleWithoutFhirVersionProperty = () => {
35
- const fhirResource = object('Resource', stu3Example1);
36
- return <ReferralRequest fhirResource={fhirResource} />;
34
+ export const ExampleWithoutFhirVersionProperty = Template.bind({});
35
+ ExampleWithoutFhirVersionProperty.args = {
36
+ fhirResource: stu3Example1,
37
37
  };