@aehrc/smart-forms-renderer 0.27.2 → 0.27.4

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 (179) hide show
  1. package/.storybook/main.ts +2 -1
  2. package/.storybook/preview.ts +6 -1
  3. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +3 -2
  4. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +9 -17
  5. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -1
  6. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +12 -9
  7. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
  8. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +2 -2
  9. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +7 -9
  10. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -1
  11. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +12 -8
  12. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +2 -1
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +3 -3
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +6 -4
  17. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
  18. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.d.ts +2 -1
  19. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js +3 -3
  20. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js.map +1 -1
  21. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +2 -2
  22. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +5 -7
  23. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
  24. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +4 -4
  25. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
  26. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +2 -1
  27. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +2 -3
  28. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
  29. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +5 -3
  30. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
  31. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.d.ts +2 -1
  32. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js +3 -3
  33. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js.map +1 -1
  34. package/lib/components/FormComponents/DecimalItem/DecimalItem.js +1 -1
  35. package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js +20 -20
  36. package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js.map +1 -1
  37. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +3 -2
  38. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +7 -19
  39. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -1
  40. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +40 -40
  41. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
  42. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +15 -3
  43. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
  44. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +2 -1
  45. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +3 -3
  46. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -1
  47. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +27 -26
  48. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
  49. package/lib/components/FormComponents/StringItem/StringField.js +1 -1
  50. package/lib/components/FormComponents/StringItem/StringField.js.map +1 -1
  51. package/lib/hooks/useInitialiseRenderer.js +1 -1
  52. package/lib/hooks/useInitialiseRenderer.js.map +1 -1
  53. package/lib/hooks/useNextAndPreviousVisibleTabs.d.ts +7 -0
  54. package/lib/hooks/useNextAndPreviousVisibleTabs.js +63 -0
  55. package/lib/hooks/useNextAndPreviousVisibleTabs.js.map +1 -0
  56. package/lib/hooks/useNextPreviousVisibleTabs.d.ts +6 -0
  57. package/lib/hooks/useNextPreviousVisibleTabs.js +63 -0
  58. package/lib/hooks/useNextPreviousVisibleTabs.js.map +1 -0
  59. package/lib/index.d.ts +0 -7
  60. package/lib/index.js +0 -24
  61. package/lib/index.js.map +1 -1
  62. package/lib/utils/choice.d.ts +1 -7
  63. package/lib/utils/choice.js +10 -20
  64. package/lib/utils/choice.js.map +1 -1
  65. package/lib/utils/enableWhen.js +5 -7
  66. package/lib/utils/enableWhen.js.map +1 -1
  67. package/lib/utils/index.d.ts +1 -0
  68. package/lib/utils/index.js +1 -0
  69. package/lib/utils/index.js.map +1 -1
  70. package/lib/utils/openChoice.d.ts +9 -4
  71. package/lib/utils/openChoice.js +47 -78
  72. package/lib/utils/openChoice.js.map +1 -1
  73. package/lib/utils/tabs.d.ts +0 -21
  74. package/lib/utils/tabs.js +0 -51
  75. package/lib/utils/tabs.js.map +1 -1
  76. package/package.json +4 -4
  77. package/src/components/FormComponents/ChoiceItems/CheckboxOptionList.tsx +82 -0
  78. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +23 -52
  79. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +15 -9
  80. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +17 -19
  81. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +13 -8
  82. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +5 -4
  83. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +6 -2
  84. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.tsx +5 -1
  85. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +9 -16
  86. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +4 -4
  87. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +4 -3
  88. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +5 -2
  89. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.tsx +5 -1
  90. package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +1 -1
  91. package/src/components/FormComponents/GroupItem/TabButtonsWrapper.tsx +28 -25
  92. package/src/components/FormComponents/ItemParts/{RadioAnswerOptionButtons.tsx → RadioOptionList.tsx} +7 -7
  93. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +18 -50
  94. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +70 -68
  95. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetFields.tsx +110 -0
  96. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetItem.tsx +188 -0
  97. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +46 -19
  98. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +5 -3
  99. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +37 -29
  100. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetFields.tsx +104 -0
  101. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetItem.tsx +156 -0
  102. package/src/components/FormComponents/StringItem/StringField.tsx +1 -1
  103. package/src/hooks/useInitialiseRenderer.ts +1 -1
  104. package/src/hooks/useNextAndPreviousVisibleTabs.ts +86 -0
  105. package/src/hooks/useOpenLabel.ts +43 -0
  106. package/src/index.ts +0 -21
  107. package/src/stories/BuildFormWrapper.tsx +57 -0
  108. package/src/stories/assets/questionnaires/QAdvancedAdditionalDisplayContent.ts +83 -0
  109. package/src/stories/assets/questionnaires/QAdvancedControlAppearance.ts +294 -0
  110. package/src/stories/assets/questionnaires/QAdvancedOther.ts +495 -0
  111. package/src/stories/assets/questionnaires/QAdvancedTextApperance.ts +188 -0
  112. package/src/stories/assets/questionnaires/QAttachment.ts +38 -0
  113. package/src/stories/assets/questionnaires/QBehaviorCalculations.ts +645 -0
  114. package/src/stories/assets/questionnaires/QBehaviorChoiceRestriction.ts +281 -0
  115. package/src/stories/assets/questionnaires/QBehaviorOther.ts +1149 -0
  116. package/src/stories/assets/questionnaires/QBehaviorValueConstraints.ts +508 -0
  117. package/src/stories/assets/questionnaires/QBoolean.ts +130 -0
  118. package/src/stories/assets/questionnaires/QChoice.ts +137 -0
  119. package/src/stories/assets/questionnaires/QDate.ts +56 -0
  120. package/src/stories/assets/questionnaires/QDateTime.ts +56 -0
  121. package/src/stories/assets/questionnaires/QDecimal.ts +56 -0
  122. package/src/stories/assets/questionnaires/QDisplay.ts +38 -0
  123. package/src/stories/assets/questionnaires/QGroup.ts +52 -0
  124. package/src/stories/assets/questionnaires/QInteger.ts +119 -0
  125. package/src/stories/assets/questionnaires/QItemControlDisplay.ts +114 -0
  126. package/src/stories/assets/questionnaires/QItemControlGroup.ts +419 -0
  127. package/src/stories/assets/questionnaires/QItemControlQuestion.ts +1271 -0
  128. package/src/stories/assets/questionnaires/QOpenChoice.ts +151 -0
  129. package/src/stories/assets/questionnaires/QQuantity.ts +38 -0
  130. package/src/stories/assets/questionnaires/QReference.ts +38 -0
  131. package/src/stories/assets/questionnaires/QSingleItems.ts +251 -0
  132. package/src/stories/assets/questionnaires/QString.ts +131 -0
  133. package/src/stories/assets/questionnaires/QText.ts +169 -0
  134. package/src/stories/assets/questionnaires/QTime.ts +38 -0
  135. package/src/stories/assets/questionnaires/QUrl.ts +38 -0
  136. package/src/stories/assets/questionnaires/index.ts +44 -0
  137. package/src/stories/itemTypes/Attachment.stories.tsx +39 -0
  138. package/src/stories/itemTypes/Boolean.stories.tsx +72 -0
  139. package/src/stories/{MedicalHistoryTable.stories.tsx → itemTypes/Choice.stories.tsx} +32 -26
  140. package/src/stories/itemTypes/Date.stories.tsx +46 -0
  141. package/src/stories/itemTypes/DateTime.stories.tsx +45 -0
  142. package/src/stories/itemTypes/Decimal.stories.tsx +56 -0
  143. package/src/stories/itemTypes/Display.stories.tsx +39 -0
  144. package/src/stories/itemTypes/Group.stories.tsx +39 -0
  145. package/src/stories/itemTypes/Integer.stories.tsx +55 -0
  146. package/src/stories/itemTypes/OpenChoice.stories.tsx +64 -0
  147. package/src/stories/itemTypes/Quantity.stories.tsx +39 -0
  148. package/src/stories/itemTypes/Reference.stories.tsx +39 -0
  149. package/src/stories/itemTypes/String.stories.tsx +51 -0
  150. package/src/stories/itemTypes/Text.stories.tsx +51 -0
  151. package/src/stories/itemTypes/Time.stories.tsx +39 -0
  152. package/src/stories/itemTypes/Url.stories.tsx +39 -0
  153. package/src/stories/sdc/AdvancedAdditionalDisplayContent.stories.tsx +45 -0
  154. package/src/stories/sdc/AdvancedControlAppearance.stories.tsx +51 -0
  155. package/src/stories/sdc/AdvancedOther.stories.tsx +76 -0
  156. package/src/stories/sdc/AdvancedTextAppearance.stories.tsx +69 -0
  157. package/src/stories/sdc/BehaviorCalculations.stories.tsx +69 -0
  158. package/src/stories/sdc/BehaviorChoiceRestriction.stories.tsx +76 -0
  159. package/src/stories/sdc/BehaviorOther.stories.tsx +90 -0
  160. package/src/stories/sdc/BehaviorValueConstraints.stories.tsx +88 -0
  161. package/src/stories/sdc/ItemControlDisplay.stories.tsx +39 -0
  162. package/src/stories/sdc/ItemControlGroup.stories.tsx +55 -0
  163. package/src/stories/sdc/ItemControlQuestion.stories.tsx +118 -0
  164. package/src/utils/buildForm.ts +23 -0
  165. package/src/utils/choice.ts +16 -23
  166. package/src/utils/enableWhen.ts +5 -7
  167. package/src/utils/index.ts +1 -0
  168. package/src/utils/openChoice.ts +83 -98
  169. package/src/utils/tabs.ts +0 -75
  170. package/vite.config.ts +23 -0
  171. package/doctor-storybook.log +0 -18
  172. package/src/stories/SmartFormsRenderer.stories.ts +0 -139
  173. package/src/stories/assets/QItems-and-QRItems/QR_GTableMedicalHistory.json +0 -80
  174. package/src/stories/assets/QItems-and-QRItems/Q_GTableMedicalHistory.json +0 -109
  175. package/src/stories/assets/Qs-and-QRs/Q715.json +0 -15086
  176. package/src/stories/assets/Qs-and-QRs/QDev715.json +0 -16081
  177. package/src/stories/assets/Qs-and-QRs/QTestGrid.json +0 -411
  178. package/src/stories/assets/Qs-and-QRs/R715.json +0 -311
  179. package/src/stories/assets/Qs-and-QRs/RTestGrid.json +0 -34
@@ -0,0 +1,169 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Questionnaire } from 'fhir/r4';
19
+ import { QuestionnaireResponse } from 'fhir/r4';
20
+
21
+ export const qTextBasic: Questionnaire = {
22
+ resourceType: 'Questionnaire',
23
+ id: 'TextBasic',
24
+ name: 'TextBasic',
25
+ title: 'Text Basic',
26
+ version: '0.1.0',
27
+ status: 'draft',
28
+ publisher: 'AEHRC CSIRO',
29
+ date: '2024-05-01',
30
+ url: 'https://smartforms.csiro.au/docs/components/text/basic',
31
+ item: [
32
+ {
33
+ linkId: 'details',
34
+ type: 'text',
35
+ repeats: false,
36
+ text: 'Details of intermittent fasting'
37
+ }
38
+ ]
39
+ };
40
+
41
+ export const qrTextBasicResponse: QuestionnaireResponse = {
42
+ resourceType: 'QuestionnaireResponse',
43
+ status: 'in-progress',
44
+ item: [
45
+ {
46
+ linkId: 'details',
47
+ text: 'Details of intermittent fasting',
48
+ answer: [
49
+ {
50
+ valueString:
51
+ '- 8 hour eating window\n- cup of black coffee in the morning\n- small portions of lunch and dinner'
52
+ }
53
+ ]
54
+ }
55
+ ],
56
+ questionnaire: 'https://smartforms.csiro.au/docs/components/text/basic'
57
+ };
58
+
59
+ export const qTextCalculation: Questionnaire = {
60
+ resourceType: 'Questionnaire',
61
+ id: 'TextCalculation',
62
+ name: 'TextCalculation',
63
+ title: 'Text Calculation',
64
+ version: '0.1.0',
65
+ status: 'draft',
66
+ publisher: 'AEHRC CSIRO',
67
+ date: '2024-05-01',
68
+ url: 'https://smartforms.csiro.au/docs/components/text/calculation',
69
+ extension: [
70
+ {
71
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
72
+ valueExpression: {
73
+ name: 'earHealthDetails',
74
+ language: 'text/fhirpath',
75
+ expression:
76
+ "item.where(linkId = 'ear-health-group').item.where(linkId = 'ear-health-details').answer.value"
77
+ }
78
+ },
79
+ {
80
+ url: 'http://hl7.org/fhir/StructureDefinition/variable',
81
+ valueExpression: {
82
+ name: 'medicationDetails',
83
+ language: 'text/fhirpath',
84
+ expression:
85
+ "item.where(linkId = 'medications-group').item.where(linkId = 'medications-details').answer.value"
86
+ }
87
+ }
88
+ ],
89
+ item: [
90
+ {
91
+ linkId: 'ear-health-group',
92
+ text: 'Ear Health',
93
+ type: 'group',
94
+ repeats: false,
95
+ item: [
96
+ {
97
+ linkId: 'ear-health-other',
98
+ text: '... (other questions)',
99
+ type: 'display',
100
+ readOnly: false
101
+ },
102
+ {
103
+ linkId: 'ear-health-details',
104
+ text: 'Details',
105
+ type: 'text',
106
+ readOnly: false
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ linkId: 'medications-group',
112
+ text: 'Medications',
113
+ type: 'group',
114
+ repeats: false,
115
+ item: [
116
+ {
117
+ linkId: 'medications-other',
118
+ text: '... (other questions)',
119
+ type: 'display',
120
+ readOnly: false
121
+ },
122
+ {
123
+ linkId: 'medications-details',
124
+ text: 'Details',
125
+ type: 'text',
126
+ readOnly: false
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ linkId: 'summaries-group',
132
+ text: 'Health Check Summaries',
133
+ type: 'group',
134
+ repeats: false,
135
+ item: [
136
+ {
137
+ extension: [
138
+ {
139
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression',
140
+ valueExpression: {
141
+ language: 'text/fhirpath',
142
+ expression: '%earHealthDetails'
143
+ }
144
+ }
145
+ ],
146
+ linkId: 'ear-health-summary',
147
+ text: 'Ear Health',
148
+ type: 'text',
149
+ readOnly: true
150
+ },
151
+ {
152
+ extension: [
153
+ {
154
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression',
155
+ valueExpression: {
156
+ language: 'text/fhirpath',
157
+ expression: '%medicationDetails'
158
+ }
159
+ }
160
+ ],
161
+ linkId: 'medication-summary',
162
+ text: 'Medications',
163
+ type: 'text',
164
+ readOnly: true
165
+ }
166
+ ]
167
+ }
168
+ ]
169
+ };
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Questionnaire } from 'fhir/r4';
19
+
20
+ export const qTimeBasic: Questionnaire = {
21
+ resourceType: 'Questionnaire',
22
+ id: 'TimeBasic',
23
+ name: 'TimeBasic',
24
+ title: 'Time Basic',
25
+ version: '0.1.0',
26
+ status: 'draft',
27
+ publisher: 'AEHRC CSIRO',
28
+ date: '2024-05-01',
29
+ url: 'https://smartforms.csiro.au/docs/components/time',
30
+ item: [
31
+ {
32
+ linkId: 'last-meal',
33
+ type: 'time',
34
+ repeats: false,
35
+ text: 'Time of last meal'
36
+ }
37
+ ]
38
+ };
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Questionnaire } from 'fhir/r4';
19
+
20
+ export const qUrlBasic: Questionnaire = {
21
+ resourceType: 'Questionnaire',
22
+ id: 'UrlBasic',
23
+ name: 'UrlBasic',
24
+ title: 'URL Basic',
25
+ version: '0.1.0',
26
+ status: 'draft',
27
+ publisher: 'AEHRC CSIRO',
28
+ date: '2024-05-01',
29
+ url: 'https://smartforms.csiro.au/docs/components/url/basic',
30
+ item: [
31
+ {
32
+ linkId: 'website-url',
33
+ type: 'url',
34
+ repeats: false,
35
+ text: 'Website URL'
36
+ }
37
+ ]
38
+ };
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ export * from './QBoolean';
19
+ export * from './QDecimal';
20
+ export * from './QInteger';
21
+ export * from './QDate';
22
+ export * from './QDateTime';
23
+ export * from './QTime';
24
+ export * from './QString';
25
+ export * from './QText';
26
+ export * from './QUrl';
27
+ export * from './QChoice';
28
+ export * from './QOpenChoice';
29
+ export * from './QAttachment';
30
+ export * from './QReference';
31
+ export * from './QQuantity';
32
+ export * from './QAdvancedAdditionalDisplayContent';
33
+ export * from './QAdvancedControlAppearance';
34
+ export * from './QAdvancedOther';
35
+ export * from './QAdvancedTextApperance';
36
+ export * from './QBehaviorCalculations';
37
+ export * from './QBehaviorChoiceRestriction';
38
+ export * from './QBehaviorOther';
39
+ export * from './QBehaviorValueConstraints';
40
+ export * from './QItemControlDisplay';
41
+ export * from './QItemControlGroup';
42
+ export * from './QItemControlQuestion';
43
+ // export * from './QSingleItems';
44
+ // export * from './QSingleItems';
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Meta, StoryObj } from '@storybook/react';
19
+ import BuildFormWrapper from '../BuildFormWrapper';
20
+ import { qAttachmentBasic } from '../assets/questionnaires';
21
+
22
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
23
+ const meta = {
24
+ title: 'Component/ItemType/Attachment',
25
+ component: BuildFormWrapper,
26
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
27
+ tags: []
28
+ } satisfies Meta<typeof BuildFormWrapper>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
34
+
35
+ export const AttachmentBasic: Story = {
36
+ args: {
37
+ questionnaire: qAttachmentBasic
38
+ }
39
+ };
@@ -0,0 +1,72 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /*
19
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
20
+ * Organisation (CSIRO) ABN 41 687 119 230.
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
34
+
35
+ import type { Meta, StoryObj } from '@storybook/react';
36
+ import {
37
+ qBooleanBasic,
38
+ qBooleanCalculation,
39
+ qrBooleanBasicResponse
40
+ } from '../assets/questionnaires';
41
+ import BuildFormWrapper from '../BuildFormWrapper'; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
42
+
43
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
44
+ const meta = {
45
+ title: 'Component/ItemType/Boolean',
46
+ component: BuildFormWrapper,
47
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
48
+ tags: []
49
+ } satisfies Meta<typeof BuildFormWrapper>;
50
+
51
+ export default meta;
52
+ type Story = StoryObj<typeof meta>;
53
+
54
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
55
+
56
+ export const BooleanBasic: Story = {
57
+ args: {
58
+ questionnaire: qBooleanBasic
59
+ }
60
+ };
61
+ export const BooleanBasicResponse: Story = {
62
+ args: {
63
+ questionnaire: qBooleanBasic,
64
+ questionnaireResponse: qrBooleanBasicResponse
65
+ }
66
+ };
67
+
68
+ export const BooleanCalculation: Story = {
69
+ args: {
70
+ questionnaire: qBooleanCalculation
71
+ }
72
+ };
@@ -15,43 +15,49 @@
15
15
  * limitations under the License.
16
16
  */
17
17
 
18
- import ThemeProvider from '../theme/Theme';
19
18
  import type { Meta, StoryObj } from '@storybook/react';
20
- import { GroupTable } from '../components';
21
- import GTableMedicalHistoryItemJson from './assets/QItems-and-QRItems/Q_GTableMedicalHistory.json';
22
- import GTableMedicalHistoryAnswersJson from './assets/QItems-and-QRItems/QR_GTableMedicalHistory.json';
23
- import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
24
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
19
+ import BuildFormWrapper from '../BuildFormWrapper';
20
+ import {
21
+ qChoiceAnswerOptionBasic,
22
+ qChoiceAnswerValueSetBasic,
23
+ qrChoiceAnswerOptionBasicResponse,
24
+ qrChoiceAnswerValueSetBasicResponse
25
+ } from '../assets/questionnaires';
25
26
 
26
27
  // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
27
28
  const meta = {
28
- title: 'Component/GroupTable',
29
- component: GroupTable,
29
+ title: 'Component/ItemType/Choice',
30
+ component: BuildFormWrapper,
30
31
  // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
31
- tags: [],
32
- decorators: [
33
- (Story) => (
34
- <ThemeProvider>
35
- <QueryClientProvider client={new QueryClient()}>{Story()}</QueryClientProvider>
36
- </ThemeProvider>
37
- )
38
- ]
39
- } satisfies Meta<typeof GroupTable>;
40
-
41
- const GTableMedicalHistoryItem = GTableMedicalHistoryItemJson as QuestionnaireItem;
42
- const GTableMedicalHistoryAnswers = GTableMedicalHistoryAnswersJson as QuestionnaireResponseItem[];
32
+ tags: []
33
+ } satisfies Meta<typeof BuildFormWrapper>;
43
34
 
44
35
  export default meta;
45
36
  type Story = StoryObj<typeof meta>;
46
37
 
47
38
  // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
48
39
 
49
- export const MedicalHistoryTable: Story = {
40
+ export const ChoiceAnswerOptionBasic: Story = {
41
+ args: {
42
+ questionnaire: qChoiceAnswerOptionBasic
43
+ }
44
+ };
45
+ export const ChoiceAnswerOptionBasicResponse: Story = {
46
+ args: {
47
+ questionnaire: qChoiceAnswerOptionBasic,
48
+ questionnaireResponse: qrChoiceAnswerOptionBasicResponse
49
+ }
50
+ };
51
+
52
+ export const ChoiceAnswerValueSetBasic: Story = {
53
+ args: {
54
+ questionnaire: qChoiceAnswerValueSetBasic
55
+ }
56
+ };
57
+
58
+ export const ChoiceAnswerValueSetBasicResponse: Story = {
50
59
  args: {
51
- qItem: GTableMedicalHistoryItem,
52
- qrItems: GTableMedicalHistoryAnswers,
53
- groupCardElevation: 1,
54
- parentIsReadOnly: false,
55
- onQrRepeatGroupChange: () => {}
60
+ questionnaire: qChoiceAnswerValueSetBasic,
61
+ questionnaireResponse: qrChoiceAnswerValueSetBasicResponse
56
62
  }
57
63
  };
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Meta, StoryObj } from '@storybook/react';
19
+ import BuildFormWrapper from '../BuildFormWrapper';
20
+ import { qDateBasic, qrDateBasicResponse } from '../assets/questionnaires';
21
+
22
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
23
+ const meta = {
24
+ title: 'Component/ItemType/Date',
25
+ component: BuildFormWrapper,
26
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
27
+ tags: []
28
+ } satisfies Meta<typeof BuildFormWrapper>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
34
+
35
+ export const DateBasic: Story = {
36
+ args: {
37
+ questionnaire: qDateBasic
38
+ }
39
+ };
40
+
41
+ export const DateBasicResponse: Story = {
42
+ args: {
43
+ questionnaire: qDateBasic,
44
+ questionnaireResponse: qrDateBasicResponse
45
+ }
46
+ };
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Meta, StoryObj } from '@storybook/react';
19
+ import BuildFormWrapper from '../BuildFormWrapper';
20
+ import { qDateTimeBasic, qrDateTimeBasicResponse } from '../assets/questionnaires';
21
+
22
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
23
+ const meta = {
24
+ title: 'Component/ItemType/DateTime',
25
+ component: BuildFormWrapper,
26
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
27
+ tags: []
28
+ } satisfies Meta<typeof BuildFormWrapper>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
34
+
35
+ export const DateTimeBasic: Story = {
36
+ args: {
37
+ questionnaire: qDateTimeBasic
38
+ }
39
+ };
40
+ export const DateTimeBasicResponse: Story = {
41
+ args: {
42
+ questionnaire: qDateTimeBasic,
43
+ questionnaireResponse: qrDateTimeBasicResponse
44
+ }
45
+ };
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Meta, StoryObj } from '@storybook/react';
19
+ import BuildFormWrapper from '../BuildFormWrapper';
20
+ import {
21
+ qCalculatedExpressionBMICalculator,
22
+ qDecimalBasic,
23
+ qrDecimalBasicResponse
24
+ } from '../assets/questionnaires';
25
+
26
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
27
+ const meta = {
28
+ title: 'Component/ItemType/Decimal',
29
+ component: BuildFormWrapper,
30
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
31
+ tags: []
32
+ } satisfies Meta<typeof BuildFormWrapper>;
33
+
34
+ export default meta;
35
+ type Story = StoryObj<typeof meta>;
36
+
37
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
38
+
39
+ export const DecimalBasic: Story = {
40
+ args: {
41
+ questionnaire: qDecimalBasic
42
+ }
43
+ };
44
+
45
+ export const DecimalBasicResponse: Story = {
46
+ args: {
47
+ questionnaire: qDecimalBasic,
48
+ questionnaireResponse: qrDecimalBasicResponse
49
+ }
50
+ };
51
+
52
+ export const DecimalCalculation: Story = {
53
+ args: {
54
+ questionnaire: qCalculatedExpressionBMICalculator
55
+ }
56
+ };
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Meta, StoryObj } from '@storybook/react';
19
+ import BuildFormWrapper from '../BuildFormWrapper';
20
+ import { qDisplayBasic } from '../assets/questionnaires/QDisplay';
21
+
22
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
23
+ const meta = {
24
+ title: 'Component/ItemType/Display',
25
+ component: BuildFormWrapper,
26
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
27
+ tags: []
28
+ } satisfies Meta<typeof BuildFormWrapper>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
34
+
35
+ export const DisplayBasic: Story = {
36
+ args: {
37
+ questionnaire: qDisplayBasic
38
+ }
39
+ };