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
 
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
  };
@@ -49,6 +49,7 @@ const PractitionerRole = ({
49
49
  fhirIcons,
50
50
  onClick,
51
51
  rawOnClick,
52
+ customId,
52
53
  }) => {
53
54
  let fhirResourceData = {};
54
55
  try {
@@ -108,6 +109,7 @@ const PractitionerRole = ({
108
109
  bodyContent={<Body tableData={tableData} />}
109
110
  onClick={onClick}
110
111
  rawOnClick={rawOnClick}
112
+ customId={customId}
111
113
  />
112
114
  </Root>
113
115
  );
@@ -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: 'Practitioner/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
  };
@@ -14,7 +14,13 @@ import _has from 'lodash/has';
14
14
  import { isNotEmptyArray } from '../../../utils';
15
15
  import { Value } from '../../ui';
16
16
 
17
- const Procedure = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
17
+ const Procedure = ({
18
+ fhirResource,
19
+ fhirIcons,
20
+ onClick,
21
+ rawOnClick,
22
+ customId,
23
+ }) => {
18
24
  const display =
19
25
  _get(fhirResource, 'code.coding[0].display') ||
20
26
  _get(fhirResource, 'code.text');
@@ -126,6 +132,7 @@ const Procedure = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
126
132
  bodyContent={<Body tableData={tableData} />}
127
133
  onClick={onClick}
128
134
  rawOnClick={rawOnClick}
135
+ customId={customId}
129
136
  />
130
137
  </Root>
131
138
  );
@@ -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
  };
@@ -81,6 +81,7 @@ const Questionnaire = ({
81
81
  fhirIcons,
82
82
  onClick,
83
83
  rawOnClick,
84
+ customId,
84
85
  }) => {
85
86
  let fhirResourceData = {};
86
87
 
@@ -121,6 +122,7 @@ const Questionnaire = ({
121
122
  }
122
123
  onClick={onClick}
123
124
  rawOnClick={rawOnClick}
125
+ customId={customId}
124
126
  />
125
127
  </Root>
126
128
  );
@@ -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
  };
@@ -77,6 +77,7 @@ const QuestionnaireResponse = ({
77
77
  fhirIcons,
78
78
  onClick,
79
79
  rawOnClick,
80
+ customId,
80
81
  }) => {
81
82
  let fhirResourceData = {};
82
83
 
@@ -141,6 +142,7 @@ const QuestionnaireResponse = ({
141
142
  }
142
143
  onClick={onClick}
143
144
  rawOnClick={rawOnClick}
145
+ customId={customId}
144
146
  />
145
147
  </Root>
146
148
  );
@@ -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
  };
@@ -76,6 +76,7 @@ const ReferralRequest = ({
76
76
  fhirIcons,
77
77
  onClick,
78
78
  rawOnClick,
79
+ customId,
79
80
  }) => {
80
81
  let fhirResourceData = {};
81
82
  try {
@@ -157,6 +158,7 @@ const ReferralRequest = ({
157
158
  }
158
159
  onClick={onClick}
159
160
  rawOnClick={rawOnClick}
161
+ customId={customId}
160
162
  />
161
163
  </Root>
162
164
  );