@aehrc/smart-forms-renderer 0.7.2 → 0.8.0

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 (199) hide show
  1. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +0 -1
  2. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js.map +1 -1
  3. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +12 -0
  4. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +39 -0
  5. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -0
  6. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.d.ts +3 -3
  7. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +14 -27
  8. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
  9. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +13 -0
  10. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +42 -0
  11. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -0
  12. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.d.ts +4 -3
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +14 -22
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.d.ts +2 -2
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +3 -3
  17. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js.map +1 -1
  18. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +12 -0
  19. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +27 -0
  20. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -0
  21. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.d.ts +1 -1
  22. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +9 -24
  23. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
  24. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +14 -0
  25. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +42 -0
  26. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -0
  27. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.d.ts +1 -1
  28. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +8 -21
  29. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
  30. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +10 -0
  31. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +41 -0
  32. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -0
  33. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +7 -23
  34. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
  35. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.d.ts +12 -0
  36. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +42 -0
  37. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -0
  38. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +8 -18
  39. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
  40. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +4 -4
  41. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
  42. package/lib/components/FormComponents/Item.styles.d.ts +2 -2
  43. package/lib/components/FormComponents/Item.styles.js +2 -2
  44. package/lib/components/FormComponents/Item.styles.js.map +1 -1
  45. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.d.ts +8 -0
  46. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js +37 -0
  47. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js.map +1 -0
  48. package/lib/components/FormComponents/ItemParts/RadioButtons.d.ts +8 -0
  49. package/lib/components/FormComponents/ItemParts/RadioButtons.js +37 -0
  50. package/lib/components/FormComponents/ItemParts/RadioButtons.js.map +1 -0
  51. package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.d.ts +8 -0
  52. package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.js +37 -0
  53. package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.js.map +1 -0
  54. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.d.ts +20 -0
  55. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +49 -0
  56. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js.map +1 -0
  57. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.d.ts +0 -0
  58. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.js +2 -0
  59. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.js.map +1 -0
  60. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js +11 -35
  61. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js.map +1 -1
  62. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +17 -0
  63. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +42 -0
  64. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -0
  65. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.d.ts +3 -3
  66. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +23 -36
  67. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
  68. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.d.ts +2 -2
  69. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +3 -3
  70. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
  71. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +15 -0
  72. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +29 -0
  73. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -0
  74. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.d.ts +1 -1
  75. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +3 -23
  76. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
  77. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.d.ts +11 -0
  78. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +14 -0
  79. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -0
  80. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.d.ts +0 -0
  81. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.js +2 -0
  82. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.js.map +1 -0
  83. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js +18 -23
  84. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js.map +1 -1
  85. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.d.ts +12 -0
  86. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js +16 -0
  87. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js.map +1 -0
  88. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js +8 -14
  89. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js.map +1 -1
  90. package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +2 -2
  91. package/lib/components/FormComponents/SingleItem/SingleItem.js +2 -2
  92. package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
  93. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.d.ts +2 -2
  94. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +3 -3
  95. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
  96. package/lib/components/FormComponents/Tables/AddItemButton.d.ts +8 -0
  97. package/lib/components/FormComponents/Tables/AddItemButton.js +28 -0
  98. package/lib/components/FormComponents/Tables/AddItemButton.js.map +1 -0
  99. package/lib/components/FormComponents/Tables/AddRowButton.d.ts +8 -0
  100. package/lib/components/FormComponents/Tables/AddRowButton.js +28 -0
  101. package/lib/components/FormComponents/Tables/AddRowButton.js.map +1 -0
  102. package/lib/components/FormComponents/Tables/GroupTable.d.ts +10 -0
  103. package/lib/components/FormComponents/Tables/GroupTable.js +108 -0
  104. package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -0
  105. package/lib/components/FormComponents/Tables/GroupTableRow.d.ts +10 -0
  106. package/lib/components/FormComponents/Tables/GroupTableRow.js +46 -0
  107. package/lib/components/FormComponents/Tables/GroupTableRow.js.map +1 -0
  108. package/lib/components/FormComponents/Tables/index.d.ts +1 -1
  109. package/lib/components/FormComponents/Tables/index.js +1 -1
  110. package/lib/components/FormComponents/Tables/index.js.map +1 -1
  111. package/lib/components/Renderer/FormBodyTabbed.js +1 -1
  112. package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
  113. package/lib/components/Tabs/FormBodySingleTab.js +1 -1
  114. package/lib/components/Tabs/FormBodySingleTab.js.map +1 -1
  115. package/lib/components/Tabs/FormBodyTabList.d.ts +1 -0
  116. package/lib/components/Tabs/FormBodyTabList.js +3 -4
  117. package/lib/components/Tabs/FormBodyTabList.js.map +1 -1
  118. package/lib/components/Tabs/FormBodyTabListWrapper.d.ts +1 -1
  119. package/lib/components/Tabs/FormBodyTabListWrapper.js +6 -13
  120. package/lib/components/Tabs/FormBodyTabListWrapper.js.map +1 -1
  121. package/lib/components/Tabs/ShowCompletedTabsSection.d.ts +7 -0
  122. package/lib/components/Tabs/ShowCompletedTabsSection.js +34 -0
  123. package/lib/components/Tabs/ShowCompletedTabsSection.js.map +1 -0
  124. package/lib/hooks/useContextDisplayItems.d.ts +6 -0
  125. package/lib/hooks/useContextDisplayItems.js +30 -0
  126. package/lib/hooks/useContextDisplayItems.js.map +1 -0
  127. package/lib/hooks/useInitialiseRenderer.js +2 -2
  128. package/lib/hooks/useInitialiseRenderer.js.map +1 -1
  129. package/lib/hooks/useInitialiseRepeatGroups.d.ts +1 -1
  130. package/lib/hooks/useNumberInput.d.ts +1 -1
  131. package/lib/hooks/useNumberInput.js.map +1 -1
  132. package/lib/hooks/useStringInput.d.ts +1 -1
  133. package/lib/hooks/useStringInput.js.map +1 -1
  134. package/lib/hooks/useTerminologyServerQuery.js +3 -6
  135. package/lib/hooks/useTerminologyServerQuery.js.map +1 -1
  136. package/lib/index.js +2 -2
  137. package/lib/index.js.map +1 -1
  138. package/lib/interfaces/renderProps.interface.d.ts +3 -0
  139. package/lib/stores/useQuestionnaireResponseStore.d.ts +2 -1
  140. package/lib/stores/useQuestionnaireResponseStore.js +5 -3
  141. package/lib/stores/useQuestionnaireResponseStore.js.map +1 -1
  142. package/lib/utils/qrItem.d.ts +2 -3
  143. package/lib/utils/qrItem.js +2 -3
  144. package/lib/utils/qrItem.js.map +1 -1
  145. package/lib/utils/repopulateIntoResponse.d.ts +2 -2
  146. package/lib/utils/repopulateItems.js +0 -1
  147. package/lib/utils/repopulateItems.js.map +1 -1
  148. package/package.json +7 -7
  149. package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +0 -1
  150. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +85 -0
  151. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +35 -58
  152. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +79 -0
  153. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +37 -50
  154. package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +10 -5
  155. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +48 -0
  156. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +25 -53
  157. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +83 -0
  158. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +27 -49
  159. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +81 -0
  160. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +19 -54
  161. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +97 -0
  162. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +22 -60
  163. package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +4 -4
  164. package/src/components/FormComponents/Item.styles.ts +2 -2
  165. package/src/components/FormComponents/ItemParts/RadioAnswerOptionButtons.tsx +72 -0
  166. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +131 -0
  167. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +38 -93
  168. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +112 -0
  169. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +57 -76
  170. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +8 -5
  171. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +72 -0
  172. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +12 -59
  173. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +54 -0
  174. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +40 -64
  175. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.tsx +63 -0
  176. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +22 -50
  177. package/src/components/FormComponents/SingleItem/SingleItem.tsx +6 -3
  178. package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +7 -3
  179. package/src/components/FormComponents/Tables/AddRowButton.tsx +49 -0
  180. package/src/components/FormComponents/Tables/{QItemGroupTable.tsx → GroupTable.tsx} +6 -17
  181. package/src/components/FormComponents/Tables/{QItemGroupTableRow.tsx → GroupTableRow.tsx} +2 -2
  182. package/src/components/FormComponents/Tables/index.ts +1 -1
  183. package/src/components/Renderer/FormBodyTabbed.tsx +1 -1
  184. package/src/components/Tabs/FormBodySingleTab.tsx +1 -1
  185. package/src/components/Tabs/FormBodyTabList.tsx +5 -8
  186. package/src/components/Tabs/FormBodyTabListWrapper.tsx +15 -26
  187. package/src/components/Tabs/ShowCompletedTabsSection.tsx +52 -0
  188. package/src/hooks/useContextDisplayItems.ts +40 -0
  189. package/src/hooks/useInitialiseRenderer.ts +2 -2
  190. package/src/hooks/useInitialiseRepeatGroups.ts +1 -1
  191. package/src/hooks/useNumberInput.ts +2 -1
  192. package/src/hooks/useStringInput.ts +2 -1
  193. package/src/hooks/useTerminologyServerQuery.ts +3 -6
  194. package/src/index.ts +2 -2
  195. package/src/interfaces/renderProps.interface.ts +4 -0
  196. package/src/stores/useQuestionnaireResponseStore.ts +5 -4
  197. package/src/utils/qrItem.ts +4 -3
  198. package/src/utils/repopulateIntoResponse.ts +2 -2
  199. package/src/utils/repopulateItems.ts +0 -1
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright 2023 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
+ import React from 'react';
18
+ import ChoiceRadioSingle from '../ChoiceItems/ChoiceRadioSingle';
19
+ function RadioButtonsAnswerOption(props) {
20
+ var _a;
21
+ const { qItem, readOnly } = props;
22
+ return (React.createElement(React.Fragment, null, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 : _a.map((option) => {
23
+ var _a, _b, _c;
24
+ if (option['valueCoding']) {
25
+ return (React.createElement(ChoiceRadioSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly }));
26
+ }
27
+ if (option['valueString']) {
28
+ return (React.createElement(ChoiceRadioSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly }));
29
+ }
30
+ if (option['valueInteger']) {
31
+ return (React.createElement(ChoiceRadioSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly }));
32
+ }
33
+ return null;
34
+ })));
35
+ }
36
+ export default RadioButtonsAnswerOption;
37
+ //# sourceMappingURL=RadioButtonsAnswerOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioButtonsAnswerOption.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ItemParts/RadioButtonsAnswerOption.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAQjE,SAAS,wBAAwB,CAAC,KAAwB;;IACxD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAElC,OAAO,CACL,0CACG,MAAA,KAAK,CAAC,YAAY,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;QAClC,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EAClC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EACpC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,OAAO,mCAAI,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,EACjE,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;YAC1B,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,YAAY,EACxB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import type { Coding, QuestionnaireItem } from 'fhir/r4';
3
+ import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface';
4
+ import type { AlertColor } from '@mui/material/Alert';
5
+ interface OpenChoiceAutocompleteFieldProps extends PropsWithIsTabledAttribute {
6
+ qItem: QuestionnaireItem;
7
+ options: Coding[];
8
+ valueAutocomplete: string | Coding;
9
+ input: string;
10
+ loading: boolean;
11
+ feedback: {
12
+ message: string;
13
+ color: AlertColor;
14
+ } | null;
15
+ onInputChange: (newInput: string) => void;
16
+ onValueChange: (newValue: Coding | string | null) => void;
17
+ onUnfocus: () => void;
18
+ }
19
+ declare function OpenChoiceAutocompleteField(props: OpenChoiceAutocompleteFieldProps): React.JSX.Element;
20
+ export default OpenChoiceAutocompleteField;
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright 2023 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
+ import React from 'react';
18
+ import Box from '@mui/material/Box';
19
+ import Autocomplete from '@mui/material/Autocomplete';
20
+ import { StandardTextField } from '../Textfield.styles';
21
+ import SearchIcon from '@mui/icons-material/Search';
22
+ import CircularProgress from '@mui/material/CircularProgress';
23
+ import Fade from '@mui/material/Fade';
24
+ import Tooltip from '@mui/material/Tooltip';
25
+ import InfoIcon from '@mui/icons-material/Info';
26
+ import WarningAmberIcon from '@mui/icons-material/WarningAmber';
27
+ import DoneIcon from '@mui/icons-material/Done';
28
+ import ErrorIcon from '@mui/icons-material/Error';
29
+ import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
30
+ function OpenChoiceAutocompleteField(props) {
31
+ const { qItem, options, valueAutocomplete, input, loading, feedback, isTabled, onInputChange, onValueChange, onUnfocus } = props;
32
+ // Get additional rendering extensions
33
+ const { displayUnit, displayPrompt, readOnly, entryFormat } = useRenderingExtensions(qItem);
34
+ return (React.createElement(Box, { display: "flex" },
35
+ React.createElement(Autocomplete, { id: qItem.id, value: valueAutocomplete, options: options, getOptionLabel: (option) => (typeof option === 'string' ? option : `${option.display}`), disabled: readOnly, loading: loading, loadingText: 'Fetching results...', clearOnEscape: true, freeSolo: true, autoHighlight: true, sx: { maxWidth: !isTabled ? 280 : 3000, minWidth: 220, flexGrow: 1 }, placeholder: entryFormat, onChange: (_, newValue) => onValueChange(newValue), filterOptions: (x) => x, renderInput: (params) => (React.createElement(StandardTextField, Object.assign({}, params, { value: input, onBlur: onUnfocus, onChange: (e) => onInputChange(e.target.value), isTabled: isTabled, label: displayPrompt, size: "small", InputProps: Object.assign(Object.assign({}, params.InputProps), { startAdornment: (React.createElement(React.Fragment, null,
36
+ !valueAutocomplete || valueAutocomplete === '' ? (React.createElement(SearchIcon, { fontSize: "small", sx: { ml: 0.5 } })) : null,
37
+ params.InputProps.startAdornment)), endAdornment: (React.createElement(React.Fragment, null,
38
+ loading ? (React.createElement(CircularProgress, { color: "inherit", size: 16 })) : feedback ? (React.createElement(Fade, { in: !!feedback, timeout: 300 },
39
+ React.createElement(Tooltip, { title: feedback.message, arrow: true, sx: { ml: 1 } }, {
40
+ info: React.createElement(InfoIcon, { fontSize: "small", color: "info" }),
41
+ warning: React.createElement(WarningAmberIcon, { fontSize: "small", color: "warning" }),
42
+ success: React.createElement(DoneIcon, { fontSize: "small", color: "success" }),
43
+ error: React.createElement(ErrorIcon, { fontSize: "small", color: "error" })
44
+ }[feedback.color]))) : null,
45
+ params.InputProps.endAdornment,
46
+ displayUnit)) }), "data-test": "q-item-open-choice-autocomplete-field" }))) })));
47
+ }
48
+ export default OpenChoiceAutocompleteField;
49
+ //# sourceMappingURL=OpenChoiceAutocompleteField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenChoiceAutocompleteField.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,QAAQ,MAA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,KAAK,EAAC,SAAS,GAAG;gCACtD,KAAK,EAAE,oBAAC,SAAS,IAAC,QAAQ,EAAC,OAAO,EAAC,KAAK,EAAC,OAAO,GAAG;6BACpD,CAAC,QAAQ,CAAC,KAAK,CAAC,CAEX,CACL,CACR,CAAC,CAAC,CAAC,IAAI;wBACP,MAAM,CAAC,UAAU,CAAC,YAAY;wBAC9B,WAAW,CACX,CACJ,kBAEO,uCAAuC,IACjD,CACH,GACD,CACE,CACP,CAAC;AACJ,CAAC;AAED,eAAe,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=OpenChoiceAutocompleteFieldEndAdornment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenChoiceAutocompleteFieldEndAdornment.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.tsx"],"names":[],"mappings":""}
@@ -15,26 +15,16 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import React, { useState } from 'react';
18
- import Autocomplete from '@mui/material/Autocomplete';
19
- import Box from '@mui/material/Box';
20
- import CircularProgress from '@mui/material/CircularProgress';
21
- import Fade from '@mui/material/Fade';
22
18
  import Grid from '@mui/material/Grid';
23
- import Tooltip from '@mui/material/Tooltip';
24
19
  import { createEmptyQrItem } from '../../../utils/qrItem';
25
- import { StandardTextField } from '../Textfield.styles';
26
20
  import { FullWidthFormComponentBox } from '../../Box.styles';
27
- import SearchIcon from '@mui/icons-material/Search';
28
21
  import useDebounce from '../../../hooks/useDebounce';
29
22
  import useTerminologyServerQuery from '../../../hooks/useTerminologyServerQuery';
30
- import WarningAmberIcon from '@mui/icons-material/WarningAmber';
31
- import InfoIcon from '@mui/icons-material/Info';
32
- import DoneIcon from '@mui/icons-material/Done';
33
- import ErrorIcon from '@mui/icons-material/Error';
34
23
  import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
35
24
  import { AUTOCOMPLETE_DEBOUNCE_DURATION } from '../../../utils/debounce';
36
25
  import DisplayInstructions from '../DisplayItem/DisplayInstructions';
37
26
  import LabelWrapper from '../ItemParts/ItemLabelWrapper';
27
+ import OpenChoiceAutocompleteField from './OpenChoiceAutocompleteField';
38
28
  function OpenChoiceAutocompleteItem(props) {
39
29
  const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
40
30
  const qrOpenChoice = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
@@ -48,8 +38,7 @@ function OpenChoiceAutocompleteItem(props) {
48
38
  valueAutocomplete = '';
49
39
  }
50
40
  // Get additional rendering extensions
51
- const { displayUnit, displayPrompt, displayInstructions, readOnly, entryFormat } = useRenderingExtensions(qItem);
52
- // Query ontoserver for options
41
+ const { displayInstructions } = useRenderingExtensions(qItem);
53
42
  const maxList = 10;
54
43
  const [input, setInput] = useState('');
55
44
  const debouncedInput = useDebounce(input, AUTOCOMPLETE_DEBOUNCE_DURATION);
@@ -58,7 +47,7 @@ function OpenChoiceAutocompleteItem(props) {
58
47
  return null;
59
48
  }
60
49
  // Event handlers
61
- function handleValueChange(_, newValue) {
50
+ function handleValueChange(newValue) {
62
51
  if (newValue === null) {
63
52
  setInput('');
64
53
  newValue = '';
@@ -75,34 +64,21 @@ function OpenChoiceAutocompleteItem(props) {
75
64
  onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueCoding: newValue }] }));
76
65
  }
77
66
  }
78
- const openChoiceAutocomplete = (React.createElement(React.Fragment, null,
79
- React.createElement(Box, { display: "flex" },
80
- React.createElement(Autocomplete, { id: qItem.id, value: valueAutocomplete, options: options, getOptionLabel: (option) => (typeof option === 'string' ? option : `${option.display}`), disabled: readOnly, loading: loading, loadingText: 'Fetching results...', clearOnEscape: true, freeSolo: true, autoHighlight: true, sx: { maxWidth: !isTabled ? 280 : 3000, minWidth: 220, flexGrow: 1 }, placeholder: entryFormat, onChange: handleValueChange, filterOptions: (x) => x, renderInput: (params) => (React.createElement(StandardTextField, Object.assign({}, params, { value: input, onBlur: () => {
81
- // set answer to current input when text field is unfocused
82
- if (!valueAutocomplete && input !== '') {
83
- onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueString: input }] }));
84
- }
85
- }, onChange: (e) => setInput(e.target.value), isTabled: isTabled, label: displayPrompt, size: "small", InputProps: Object.assign(Object.assign({}, params.InputProps), { startAdornment: (React.createElement(React.Fragment, null,
86
- !valueAutocomplete || valueAutocomplete === '' ? (React.createElement(SearchIcon, { fontSize: "small", sx: { ml: 0.5 } })) : null,
87
- params.InputProps.startAdornment)), endAdornment: (React.createElement(React.Fragment, null,
88
- loading ? (React.createElement(CircularProgress, { color: "inherit", size: 16 })) : feedback ? (React.createElement(Fade, { in: !!feedback, timeout: 300 },
89
- React.createElement(Tooltip, { title: feedback.message, arrow: true, sx: { ml: 1 } }, {
90
- info: React.createElement(InfoIcon, { fontSize: "small", color: "info" }),
91
- warning: React.createElement(WarningAmberIcon, { fontSize: "small", color: "warning" }),
92
- success: React.createElement(DoneIcon, { fontSize: "small", color: "success" }),
93
- error: React.createElement(ErrorIcon, { fontSize: "small", color: "error" })
94
- }[feedback.color]))) : null,
95
- params.InputProps.endAdornment,
96
- displayUnit)) }), "data-test": "q-item-open-choice-autocomplete-field" }))) }))));
67
+ function handleUnfocus() {
68
+ // set answer to current input when text field is unfocused
69
+ if (!valueAutocomplete && input !== '') {
70
+ onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueString: input }] }));
71
+ }
72
+ }
97
73
  if (isRepeated) {
98
- return React.createElement(React.Fragment, null, openChoiceAutocomplete);
74
+ return (React.createElement(OpenChoiceAutocompleteField, { qItem: qItem, options: options, valueAutocomplete: valueAutocomplete, input: input, loading: loading, feedback: feedback !== null && feedback !== void 0 ? feedback : null, isTabled: isTabled, onInputChange: (newValue) => setInput(newValue), onValueChange: handleValueChange, onUnfocus: handleUnfocus }));
99
75
  }
100
76
  return (React.createElement(FullWidthFormComponentBox, null,
101
77
  React.createElement(Grid, { container: true, columnSpacing: 6 },
102
78
  React.createElement(Grid, { item: true, xs: 5 },
103
79
  React.createElement(LabelWrapper, { qItem: qItem })),
104
80
  React.createElement(Grid, { item: true, xs: 7 },
105
- openChoiceAutocomplete,
81
+ React.createElement(OpenChoiceAutocompleteField, { qItem: qItem, options: options, valueAutocomplete: valueAutocomplete, input: input, loading: loading, feedback: feedback !== null && feedback !== void 0 ? feedback : null, isTabled: isTabled, onInputChange: (newValue) => setInput(newValue), onValueChange: handleValueChange, onUnfocus: handleUnfocus }),
106
82
  React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
107
83
  }
108
84
  export default OpenChoiceAutocompleteItem;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenChoiceAutocompleteItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,yBAAyB,MAAM,0CAA0C,CAAC;AACjF,OAAO,gBAAgB,MAAM,kCAAkC,CAA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":"OpenChoiceAutocompleteItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAItC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,yBAAyB,MAAM,0CAA0C,CAAC;AACjF,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAM3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,2BAA2B,MAAM,+BAA+B,CAAC;AAUxE,SAAS,0BAA0B,CAAC,KAAsC;IACxE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACtE,MAAM,YAAY,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAExD,mBAAmB;IACnB,IAAI,iBAA8C,CAAC;IACnD,IAAI,YAAY,CAAC,MAAM,EAAE;QACvB,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACtC,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;KAClF;IAED,IAAI,CAAC,iBAAiB,EAAE;QACtB,iBAAiB,GAAG,EAAE,CAAC;KACxB;IAED,sCAAsC;IACtC,MAAM,EAAE,m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ceItemOrientation } from '../../../interfaces/choice.enum';
3
+ import type { QuestionnaireItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
4
+ interface OpenChoiceCheckboxAnswerOptionFieldsProps {
5
+ qItem: QuestionnaireItem;
6
+ answers: QuestionnaireResponseItemAnswer[];
7
+ openLabelText: string | null;
8
+ openLabelValue: string;
9
+ openLabelChecked: boolean;
10
+ readOnly: boolean;
11
+ orientation: ChoiceItemOrientation;
12
+ onValueChange: (changedOptionValue: string | null, changedOpenLabelValue: string | null) => void;
13
+ onOpenLabelCheckedChange: (checked: boolean) => void;
14
+ onOpenLabelInputChange: (input: string) => void;
15
+ }
16
+ declare function OpenChoiceCheckboxAnswerOptionFields(props: OpenChoiceCheckboxAnswerOptionFieldsProps): React.JSX.Element;
17
+ export default OpenChoiceCheckboxAnswerOptionFields;
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright 2023 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
+ import React from 'react';
18
+ import { StyledFormGroup } from '../Item.styles';
19
+ import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
20
+ import CheckboxSingle from '../ItemParts/CheckboxSingle';
21
+ import CheckboxSingleWithOpenLabel from '../ItemParts/CheckboxSingleWithOpenLabel';
22
+ function OpenChoiceCheckboxAnswerOptionFields(props) {
23
+ var _a;
24
+ const { qItem, answers, openLabelText, openLabelValue, openLabelChecked, readOnly, orientation, onValueChange, onOpenLabelCheckedChange, onOpenLabelInputChange } = props;
25
+ return (React.createElement(StyledFormGroup, { row: orientation === ChoiceItemOrientation.Horizontal }, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 :
26
+ _a.map((option) => {
27
+ var _a, _b, _c;
28
+ if (option['valueCoding']) {
29
+ return (React.createElement(CheckboxSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly, isChecked: answers.some((answer) => JSON.stringify(answer) === JSON.stringify(option)), onCheckedChange: (changedValue) => onValueChange(changedValue, null) }));
30
+ }
31
+ if (option['valueString']) {
32
+ return (React.createElement(CheckboxSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly, isChecked: answers.some((answer) => answer.valueString === option.valueString), onCheckedChange: (changedValue) => onValueChange(changedValue, null) }));
33
+ }
34
+ if (option['valueInteger']) {
35
+ return (React.createElement(CheckboxSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly, isChecked: answers.some((answer) => answer.valueInteger === option.valueInteger), onCheckedChange: (changedValue) => onValueChange(changedValue, null) }));
36
+ }
37
+ return null;
38
+ }),
39
+ openLabelText ? (React.createElement(CheckboxSingleWithOpenLabel, { value: openLabelValue, label: openLabelText, isChecked: openLabelChecked, onCheckedChange: onOpenLabelCheckedChange, onInputChange: onOpenLabelInputChange })) : null));
40
+ }
41
+ export default OpenChoiceCheckboxAnswerOptionFields;
42
+ //# sourceMappingURL=OpenChoiceCheckboxAnswerOptionFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenChoiceCheckboxAnswerOptionFields.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,C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CAAC,WAAW,EACvB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,EAC9E,eAAe,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,GACpE,CACH,CAAC;aACH;YAED,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;gBAC1B,OAAO,CACL,oBAAC,cAAc,IACb,GAAG,EAAE,MAAM,CAAC,YAAY,EACxB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,MAAM,CAAC,YAAY,CAAC,EAChF,eAAe,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,GACpE,CACH,CAAC;aACH;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAED,aAAa,CAAC,CAAC,CAAC,CACf,oBAAC,2BAA2B,IAC1B,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,gBAAgB,EAC3B,eAAe,EAAE,wBAAwB,EACzC,aAAa,EAAE,sBAAsB,GACrC,CACH,CAAC,CAAC,CAAC,IAAI,CACQ,CACnB,CAAC;AACJ,CAAC;AAED,eAAe,oCAAoC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
2
+ import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
3
3
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
- import type { PropsWithIsRepeatedAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
5
- interface OpenChoiceCheckboxAnswerOptionItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute {
4
+ import type { PropsWithIsRepeatedAttribute, PropsWithQrItemChangeHandler, PropsWithTextShownAttribute } from '../../../interfaces/renderProps.interface';
5
+ interface OpenChoiceCheckboxAnswerOptionItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithTextShownAttribute {
6
6
  qItem: QuestionnaireItem;
7
7
  qrItem: QuestionnaireResponseItem;
8
8
  orientation: ChoiceItemOrientation;
@@ -16,12 +16,9 @@
16
16
  */
17
17
  import React, { useCallback, useMemo, useState } from 'react';
18
18
  import Grid from '@mui/material/Grid';
19
- import { CheckBoxOption, ChoiceItemOrientation } from '../../../interfaces/choice.enum';
19
+ import { CheckBoxOption } from '../../../interfaces/choice.enum';
20
20
  import { createEmptyQrItem } from '../../../utils/qrItem';
21
- import CheckboxSingle from '../ItemParts/CheckboxSingle';
22
21
  import { getOpenLabelText } from '../../../utils/itemControl';
23
- import CheckboxSingleWithOpenLabel from '../ItemParts/CheckboxSingleWithOpenLabel';
24
- import { QFormGroup } from '../Item.styles';
25
22
  import { getOldOpenLabelAnswer, updateQrOpenChoiceCheckboxAnswers } from '../../../utils/openChoice';
26
23
  import { FullWidthFormComponentBox } from '../../Box.styles';
27
24
  import debounce from 'lodash.debounce';
@@ -29,9 +26,9 @@ import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
29
26
  import { DEBOUNCE_DURATION } from '../../../utils/debounce';
30
27
  import DisplayInstructions from '../DisplayItem/DisplayInstructions';
31
28
  import LabelWrapper from '../ItemParts/ItemLabelWrapper';
29
+ import OpenChoiceCheckboxAnswerOptionFields from './OpenChoiceCheckboxAnswerOptionFields';
32
30
  function OpenChoiceCheckboxAnswerOptionItem(props) {
33
- var _a;
34
- const { qItem, qrItem, isRepeated, onQrItemChange, orientation } = props;
31
+ const { qItem, qrItem, orientation, isRepeated, textShown = true, onQrItemChange } = props;
35
32
  // Init answers
36
33
  const qrOpenChoiceCheckbox = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
37
34
  const answers = useMemo(() => { var _a; return (_a = qrOpenChoiceCheckbox.answer) !== null && _a !== void 0 ? _a : []; }, [qrOpenChoiceCheckbox.answer]);
@@ -70,36 +67,26 @@ function OpenChoiceCheckboxAnswerOptionItem(props) {
70
67
  const updateOpenLabelValueWithDebounce = useCallback(debounce((input) => {
71
68
  handleValueChange(null, input);
72
69
  }, DEBOUNCE_DURATION), [handleValueChange]); // Dependencies are tested, debounce is causing eslint to not recognise dependencies
73
- const openChoiceCheckbox = (React.createElement(QFormGroup, { row: orientation === ChoiceItemOrientation.Horizontal }, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 :
74
- _a.map((option) => {
75
- var _a, _b, _c;
76
- if (option['valueCoding']) {
77
- return (React.createElement(CheckboxSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly, isChecked: answers.some((answer) => JSON.stringify(answer) === JSON.stringify(option)), onCheckedChange: (changedValue) => handleValueChange(changedValue, null) }));
78
- }
79
- else if (option['valueString']) {
80
- return (React.createElement(CheckboxSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly, isChecked: answers.some((answer) => answer.valueString === option.valueString), onCheckedChange: (changedValue) => handleValueChange(changedValue, null) }));
81
- }
82
- else if (option['valueInteger']) {
83
- return (React.createElement(CheckboxSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly, isChecked: answers.some((answer) => answer.valueInteger === option.valueInteger), onCheckedChange: (changedValue) => handleValueChange(changedValue, null) }));
84
- }
85
- else {
86
- return null;
87
- }
88
- }),
89
- openLabelText ? (React.createElement(CheckboxSingleWithOpenLabel, { value: openLabelValue, label: openLabelText, isChecked: openLabelChecked, onCheckedChange: (checked) => {
90
- handleValueChange(null, openLabelValue);
91
- setOpenLabelChecked(checked);
92
- }, onInputChange: (input) => {
93
- setOpenLabelValue(input);
94
- updateOpenLabelValueWithDebounce(input);
95
- } })) : null));
96
- return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-open-choice-checkbox-answer-option-box" },
97
- React.createElement(Grid, { container: true, columnSpacing: 6 },
98
- React.createElement(Grid, { item: true, xs: 5 },
99
- React.createElement(LabelWrapper, { qItem: qItem })),
100
- React.createElement(Grid, { item: true, xs: 7 },
101
- openChoiceCheckbox,
102
- React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
70
+ function handleOpenLabelCheckedChange(checked) {
71
+ handleValueChange(null, openLabelValue);
72
+ setOpenLabelChecked(checked);
73
+ }
74
+ function handleOpenLabelInputChange(newValue) {
75
+ setOpenLabelValue(newValue);
76
+ updateOpenLabelValueWithDebounce(newValue);
77
+ }
78
+ if (textShown) {
79
+ return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-open-choice-checkbox-answer-option-box" },
80
+ React.createElement(Grid, { container: true, columnSpacing: 6 },
81
+ React.createElement(Grid, { item: true, xs: 5 },
82
+ React.createElement(LabelWrapper, { qItem: qItem })),
83
+ React.createElement(Grid, { item: true, xs: 7 },
84
+ React.createElement(OpenChoiceCheckboxAnswerOptionFields, { qItem: qItem, answers: answers, openLabelText: openLabelText, openLabelValue: openLabelValue, openLabelChecked: openLabelChecked, readOnly: readOnly, orientation: orientation, onValueChange: handleValueChange, onOpenLabelCheckedChange: handleOpenLabelCheckedChange, onOpenLabelInputChange: handleOpenLabelInputChange }),
85
+ React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
86
+ }
87
+ return (React.createElement(React.Fragment, null,
88
+ React.createElement(OpenChoiceCheckboxAnswerOptionFields, { qItem: qItem, answers: answers, openLabelText: openLabelText, openLabelValue: openLabelValue, openLabelChecked: openLabelChecked, readOnly: readOnly, orientation: orientation, onValueChange: handleValueChange, onOpenLabelCheckedChange: handleOpenLabelCheckedChange, onOpenLabelInputChange: handleOpenLabelInputChange }),
89
+ React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })));
103
90
  }
104
91
  export default OpenChoiceCheckboxAnswerOptionItem;
105
92
  //# sourceMappingURL=OpenChoiceCheckboxAnswerOptionItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpenChoiceCheckboxAnswerOptionItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,2BAA2B,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,iCAAiC,EAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAK3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAA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AAC,EAChF,eAAe,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAAC,YAAY,EAAE,IAAI,CAAC,GACxE,CACH,CAAC;aACH;iBAAM;gBACL,OAAO,IAAI,CAAC;aACb;QACH,CAAC,CAAC;QAED,aAAa,CAAC,CAAC,CAAC,CACf,oBAAC,2BAA2B,IAC1B,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,gBAAgB,EAC3B,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE;gBAC3B,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;gBACxC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBACzB,gCAAgC,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC,GACD,CACH,CAAC,CAAC,CAAC,IAAI,CACG,CACd,CAAC;IAEF,OAAO,CACL,oBAAC,yBAAyB,iBAAW,+CAA+C;QAClF,oBAAC,IAAI,IAAC,SAAS,QAAC,aAAa,EAAE,CAAC;YAC9B,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACd,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CACzB;YACP,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACb,kBAAkB;gBACnB,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAC5D,CACF,CACmB,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,kCAAkC,CAAC"}
1
+ {"version":3,"file":"OpenChoiceCheckboxAnswerOptionItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,W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O,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,iBAAiB,EAChC,wBAAwB,EAAE,4BAA4B,EACtD,sBAAsB,EAAE,0BAA0B,GAClD;QACF,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAChE,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,kCAAkC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
3
- import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
4
- interface OpenChoiceItemSwitcherProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute {
3
+ import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithQrItemChangeHandler, PropsWithTextShownAttribute } from '../../../interfaces/renderProps.interface';
4
+ interface OpenChoiceItemSwitcherProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithTextShownAttribute {
5
5
  qItem: QuestionnaireItem;
6
6
  qrItem: QuestionnaireResponseItem;
7
7
  }
@@ -25,13 +25,13 @@ import OpenChoiceCheckboxAnswerOptionItem from './OpenChoiceCheckboxAnswerOption
25
25
  import OpenChoiceRadioAnswerOptionItem from './OpenChoiceRadioAnswerOptionItem';
26
26
  function OpenChoiceItemSwitcher(props) {
27
27
  var _a, _b;
28
- const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
28
+ const { qItem, qrItem, isRepeated, isTabled, textShown, onQrItemChange } = props;
29
29
  const orientation = getChoiceOrientation(qItem);
30
30
  switch (getOpenChoiceControlType(qItem)) {
31
31
  case OpenChoiceItemControl.Checkbox:
32
- return (React.createElement(OpenChoiceCheckboxAnswerOptionItem, { qItem: qItem, qrItem: qrItem, isRepeated: (_a = qItem['repeats']) !== null && _a !== void 0 ? _a : false, onQrItemChange: onQrItemChange, orientation: orientation }));
32
+ return (React.createElement(OpenChoiceCheckboxAnswerOptionItem, { qItem: qItem, qrItem: qrItem, orientation: orientation, isRepeated: (_a = qItem['repeats']) !== null && _a !== void 0 ? _a : false, textShown: textShown, onQrItemChange: onQrItemChange }));
33
33
  case OpenChoiceItemControl.Radio:
34
- return (React.createElement(OpenChoiceRadioAnswerOptionItem, { qItem: qItem, qrItem: qrItem, isRepeated: (_b = qItem['repeats']) !== null && _b !== void 0 ? _b : false, onQrItemChange: onQrItemChange, orientation: orientation }));
34
+ return (React.createElement(OpenChoiceRadioAnswerOptionItem, { qItem: qItem, qrItem: qrItem, orientation: orientation, isRepeated: (_b = qItem['repeats']) !== null && _b !== void 0 ? _b : false, onQrItemChange: onQrItemChange }));
35
35
  case OpenChoiceItemControl.Autocomplete:
36
36
  return (React.createElement(OpenChoiceAutocompleteItem, { qItem: qItem, qrItem: qrItem, isRepeated: isRepeated, isTabled: isTabled, onQrItemChange: onQrItemChange }));
37
37
  case OpenChoiceItemControl.Select:
@@ -1 +1 @@
1
- {"version":3,"file":"OpenChoiceItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE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B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;iBAAM;gBACL,OAAO,CACL,oBAAC,gCAAgC,IAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;QACH;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC;AAED,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"OpenChoiceItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAiBhF,SAAS,sBAAsB,CAAC,KAAkC;;IAChE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACjF,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAEhD,QAAQ,wBAAwB,CAAC,KAAK,CAAC,EAAE;QACvC,KAAK,qBAAqB,CAAC,QAAQ;YACjC,OAAO,CACL,oBAAC,kCAAkC,IACjC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAA,KAAK,CAAC,SAAS,CAAC,mCAAI,KAAK,EACrC,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;QACJ,KAAK,qBAAqB,CAAC,KAAK;YAC9B,OAAO,CACL,oBAAC,+BAA+B,IAC9B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAA,KAAK,CAAC,SAAS,CAAC,mCAAI,KAAK,EACrC,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;QACJ,KAAK,qBAAqB,CAAC,YAAY;YACrC,OAAO,CACL,oBAAC,0BAA0B,IACzB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;QACJ,KAAK,qBAAqB,CAAC,MAAM;YAC/B,IAAI,KAAK,CAAC,cAAc,EAAE;gBACxB,OAAO,CACL,oBAAC,kCAAkC,IACjC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;iBAAM;gBACL,OAAO,CACL,oBAAC,gCAAgC,IAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;QACH;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
3
+ import type { QuestionnaireItem } from 'fhir/r4';
4
+ interface OpenChoiceRadioAnswerOptionFieldsProps {
5
+ qItem: QuestionnaireItem;
6
+ valueRadio: string | null;
7
+ openLabelText: string | null;
8
+ openLabelValue: string | null;
9
+ openLabelSelected: boolean;
10
+ orientation: ChoiceItemOrientation;
11
+ readOnly: boolean;
12
+ onValueChange: (changedOptionValue: string | null, changedOpenLabelValue: string | null) => void;
13
+ }
14
+ declare function OpenChoiceRadioAnswerOptionFields(props: OpenChoiceRadioAnswerOptionFieldsProps): React.JSX.Element;
15
+ export default OpenChoiceRadioAnswerOptionFields;
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright 2023 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
+ import React from 'react';
18
+ import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
19
+ import { StyledRadioGroup } from '../Item.styles';
20
+ import RadioButtonWithOpenLabel from '../ItemParts/RadioButtonWithOpenLabel';
21
+ import RadioAnswerOptionButtons from '../ItemParts/RadioAnswerOptionButtons';
22
+ function OpenChoiceRadioAnswerOptionFields(props) {
23
+ const { qItem, valueRadio, openLabelText, openLabelValue, openLabelSelected, orientation, readOnly, onValueChange } = props;
24
+ return (React.createElement(StyledRadioGroup, { row: orientation === ChoiceItemOrientation.Horizontal, name: qItem.text, id: qItem.id, onChange: (e) => onValueChange(e.target.value, null), value: valueRadio, "data-test": "q-item-radio-group" },
25
+ React.createElement(RadioAnswerOptionButtons, { qItem: qItem, readOnly: readOnly }),
26
+ openLabelText ? (React.createElement(RadioButtonWithOpenLabel, { value: openLabelValue, label: openLabelText, readOnly: readOnly, isSelected: openLabelSelected, onInputChange: (input) => onValueChange(null, input) })) : null));
27
+ }
28
+ export default OpenChoiceRadioAnswerOptionFields;
29
+ //# sourceMappingURL=OpenChoiceRadioAnswerOptionFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenChoiceRadioAnswerOptionFields.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAC7E,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAa7E,SAAS,iCAAiC,CAAC,KAA6C;IACtF,MAAM,EACJ,KAAK,EACL,UAAU,EACV,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,aAAa,EACd,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,oBAAC,gBAAgB,IACf,GAAG,EAAE,WAAW,KAAK,qBAAqB,CAAC,UAAU,EACrD,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,EACnF,KAAK,EAAE,UAAU,eACP,oBAAoB;QAC9B,oBAAC,wBAAwB,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI;QAE7D,aAAa,CAAC,CAAC,CAAC,CACf,oBAAC,wBAAwB,IACvB,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,iBAAiB,EAC7B,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,GACpD,CACH,CAAC,CAAC,CAAC,IAAI,CACS,CACpB,CAAC;AACJ,CAAC;AAED,eAAe,iCAAiC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
2
+ import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
3
3
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
4
  import type { PropsWithIsRepeatedAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
5
5
  interface OpenChoiceRadioAnswerOptionItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute {