@aehrc/smart-forms-renderer 0.8.1 → 0.9.1

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 (355) hide show
  1. package/README.md +4 -2
  2. package/lib/components/FormComponents/BooleanItem/BooleanItem.d.ts +2 -2
  3. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.d.ts +2 -2
  4. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.d.ts +3 -3
  5. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +12 -12
  6. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
  7. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.d.ts +3 -3
  8. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +12 -12
  9. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
  10. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.d.ts +3 -4
  11. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +3 -3
  12. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js.map +1 -1
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.d.ts +2 -2
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.d.ts +2 -2
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.d.ts +2 -2
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.d.ts +2 -2
  17. package/lib/components/FormComponents/CustomDateItem/CustomDateField2.d.ts +18 -0
  18. package/lib/components/FormComponents/CustomDateItem/CustomDateField2.js +31 -0
  19. package/lib/components/FormComponents/CustomDateItem/CustomDateField2.js.map +1 -0
  20. package/lib/components/FormComponents/CustomDateItem/CustomDateItem.d.ts +9 -0
  21. package/lib/components/FormComponents/CustomDateItem/CustomDateItem.js +68 -0
  22. package/lib/components/FormComponents/CustomDateItem/CustomDateItem.js.map +1 -0
  23. package/lib/components/FormComponents/CustomDateItem/CustomDateTimeField.d.ts +9 -0
  24. package/lib/components/FormComponents/CustomDateItem/CustomDateTimeField.js +75 -0
  25. package/lib/components/FormComponents/CustomDateItem/CustomDateTimeField.js.map +1 -0
  26. package/lib/components/FormComponents/CustomDateItem/CustomDateTimePickerText2.d.ts +9 -0
  27. package/lib/components/FormComponents/CustomDateItem/CustomDateTimePickerText2.js +75 -0
  28. package/lib/components/FormComponents/CustomDateItem/CustomDateTimePickerText2.js.map +1 -0
  29. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.d.ts +18 -0
  30. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.js +33 -0
  31. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.js.map +1 -0
  32. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.d.ts +11 -0
  33. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.js +55 -0
  34. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.js.map +1 -0
  35. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.d.ts +9 -0
  36. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.js +13 -0
  37. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.js.map +1 -0
  38. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.d.ts +5 -0
  39. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.js +20 -0
  40. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.js.map +1 -0
  41. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.d.ts +5 -0
  42. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.js +27 -0
  43. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.js.map +1 -0
  44. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/index.d.ts +1 -0
  45. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/index.js +18 -0
  46. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/index.js.map +1 -0
  47. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.d.ts +1 -0
  48. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.js +18 -0
  49. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.js.map +1 -0
  50. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.d.ts +9 -0
  51. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.js +121 -0
  52. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.js.map +1 -0
  53. package/lib/components/FormComponents/CustomDateItem/customDateTimePickerText.d.ts +9 -0
  54. package/lib/components/FormComponents/CustomDateItem/customDateTimePickerText.js +71 -0
  55. package/lib/components/FormComponents/CustomDateItem/customDateTimePickerText.js.map +1 -0
  56. package/lib/components/FormComponents/CustomDateItem/index.d.ts +1 -0
  57. package/lib/components/FormComponents/CustomDateItem/index.js +18 -0
  58. package/lib/components/FormComponents/CustomDateItem/index.js.map +1 -0
  59. package/lib/components/FormComponents/DateItem/DateItem.d.ts +3 -4
  60. package/lib/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +2 -2
  61. package/lib/components/FormComponents/DecimalItem/DecimalItem.d.ts +2 -2
  62. package/lib/components/FormComponents/DecimalItem/DecimalItem.js +2 -3
  63. package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
  64. package/lib/components/FormComponents/DisplayItem/DisplayBox.d.ts +0 -0
  65. package/lib/components/FormComponents/DisplayItem/DisplayBox.js +2 -0
  66. package/lib/components/FormComponents/DisplayItem/DisplayBox.js.map +1 -0
  67. package/lib/components/FormComponents/DisplayItem/DisplayBox.styles.d.ts +4 -0
  68. package/lib/components/FormComponents/DisplayItem/DisplayBox.styles.js +35 -0
  69. package/lib/components/FormComponents/DisplayItem/DisplayBox.styles.js.map +1 -0
  70. package/lib/components/FormComponents/DisplayItem/DisplayInstructions.d.ts +2 -1
  71. package/lib/components/FormComponents/DisplayItem/DisplayInstructions.js.map +1 -1
  72. package/lib/components/FormComponents/DisplayItem/DisplayInstructions.styles.js +0 -1
  73. package/lib/components/FormComponents/DisplayItem/DisplayInstructions.styles.js.map +1 -1
  74. package/lib/components/FormComponents/GridGroup/GridGroup.d.ts +3 -3
  75. package/lib/components/FormComponents/GridGroup/GridGroup.js +13 -8
  76. package/lib/components/FormComponents/GridGroup/GridGroup.js.map +1 -1
  77. package/lib/components/FormComponents/GridGroup/GridRow.d.ts +3 -4
  78. package/lib/components/FormComponents/GridGroup/GridRow.js +3 -3
  79. package/lib/components/FormComponents/GridGroup/GridRow.js.map +1 -1
  80. package/lib/components/FormComponents/GridGroup/GridTable.d.ts +3 -3
  81. package/lib/components/FormComponents/GridGroup/GridTable.js +9 -4
  82. package/lib/components/FormComponents/GridGroup/GridTable.js.map +1 -1
  83. package/lib/components/FormComponents/GridGroup/index.d.ts +1 -0
  84. package/lib/components/FormComponents/GridGroup/index.js +18 -0
  85. package/lib/components/FormComponents/GridGroup/index.js.map +1 -0
  86. package/lib/components/FormComponents/GroupItem/GroupItem.d.ts +2 -2
  87. package/lib/components/FormComponents/GroupItem/GroupItem.js +2 -2
  88. package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
  89. package/lib/components/FormComponents/GroupItem/GroupItem.styles.d.ts +1 -1
  90. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.d.ts +2 -2
  91. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +5 -6
  92. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
  93. package/lib/components/FormComponents/IntegerItem/IntegerItem.d.ts +2 -2
  94. package/lib/components/FormComponents/IntegerItem/IntegerItem.js +2 -3
  95. package/lib/components/FormComponents/IntegerItem/IntegerItem.js.map +1 -1
  96. package/lib/components/FormComponents/IntegerItem/SliderItem.d.ts +9 -0
  97. package/lib/components/FormComponents/IntegerItem/SliderItem.js +75 -0
  98. package/lib/components/FormComponents/IntegerItem/SliderItem.js.map +1 -0
  99. package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js +2 -2
  100. package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js.map +1 -1
  101. package/lib/components/FormComponents/ItemParts/ItemFieldGrid.d.ts +2 -2
  102. package/lib/components/FormComponents/Lists.styles.d.ts +1 -1
  103. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.d.ts +2 -2
  104. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.d.ts +3 -3
  105. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +12 -12
  106. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
  107. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.d.ts +3 -3
  108. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +2 -2
  109. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
  110. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.d.ts +2 -2
  111. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.d.ts +2 -2
  112. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.d.ts +2 -2
  113. package/lib/components/FormComponents/RepeatGroup/RepeatGroup.d.ts +2 -2
  114. package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +15 -4
  115. package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js.map +1 -1
  116. package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.d.ts +2 -2
  117. package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js +2 -2
  118. package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js.map +1 -1
  119. package/lib/components/FormComponents/RepeatItem/RepeatField.d.ts +3 -3
  120. package/lib/components/FormComponents/RepeatItem/RepeatField.js +3 -3
  121. package/lib/components/FormComponents/RepeatItem/RepeatField.js.map +1 -1
  122. package/lib/components/FormComponents/RepeatItem/RepeatItem.d.ts +3 -2
  123. package/lib/components/FormComponents/RepeatItem/RepeatItem.js +11 -2
  124. package/lib/components/FormComponents/RepeatItem/RepeatItem.js.map +1 -1
  125. package/lib/components/FormComponents/RepeatItem/index.d.ts +1 -0
  126. package/lib/components/FormComponents/RepeatItem/index.js +18 -0
  127. package/lib/components/FormComponents/RepeatItem/index.js.map +1 -0
  128. package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +3 -3
  129. package/lib/components/FormComponents/SingleItem/SingleItem.js +2 -2
  130. package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
  131. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.d.ts +3 -3
  132. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +12 -7
  133. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
  134. package/lib/components/FormComponents/SliderItem/DisplayBox.styles.d.ts +4 -0
  135. package/lib/components/FormComponents/SliderItem/DisplayBox.styles.js +35 -0
  136. package/lib/components/FormComponents/SliderItem/DisplayBox.styles.js.map +1 -0
  137. package/lib/components/FormComponents/SliderItem/Slider.styles.d.ts +6 -0
  138. package/lib/components/FormComponents/SliderItem/Slider.styles.js +33 -0
  139. package/lib/components/FormComponents/SliderItem/Slider.styles.js.map +1 -0
  140. package/lib/components/FormComponents/SliderItem/SliderDisplayValue.d.ts +8 -0
  141. package/lib/components/FormComponents/SliderItem/SliderDisplayValue.js +28 -0
  142. package/lib/components/FormComponents/SliderItem/SliderDisplayValue.js.map +1 -0
  143. package/lib/components/FormComponents/SliderItem/SliderField.d.ts +16 -0
  144. package/lib/components/FormComponents/SliderItem/SliderField.js +41 -0
  145. package/lib/components/FormComponents/SliderItem/SliderField.js.map +1 -0
  146. package/lib/components/FormComponents/SliderItem/SliderItem.d.ts +9 -0
  147. package/lib/components/FormComponents/SliderItem/SliderItem.js +56 -0
  148. package/lib/components/FormComponents/SliderItem/SliderItem.js.map +1 -0
  149. package/lib/components/FormComponents/SliderItem/SliderLabels.d.ts +7 -0
  150. package/lib/components/FormComponents/SliderItem/SliderLabels.js +32 -0
  151. package/lib/components/FormComponents/SliderItem/SliderLabels.js.map +1 -0
  152. package/lib/components/FormComponents/StringItem/StringItem.d.ts +2 -2
  153. package/lib/components/FormComponents/Tables/GroupTable.d.ts +3 -2
  154. package/lib/components/FormComponents/Tables/GroupTable.js +18 -1
  155. package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -1
  156. package/lib/components/FormComponents/Tables/GroupTableRow.d.ts +3 -4
  157. package/lib/components/FormComponents/Tables/GroupTableRow.js +3 -3
  158. package/lib/components/FormComponents/Tables/GroupTableRow.js.map +1 -1
  159. package/lib/components/FormComponents/TextItem/TextItem.d.ts +2 -2
  160. package/lib/components/FormComponents/TimeItem/TimeItem.d.ts +2 -2
  161. package/lib/components/FormComponents/UrlItem/UrlItem.d.ts +2 -2
  162. package/lib/components/FormComponents/index.d.ts +3 -0
  163. package/lib/components/FormComponents/index.js +3 -0
  164. package/lib/components/FormComponents/index.js.map +1 -1
  165. package/lib/components/Lists.styles.d.ts +1 -1
  166. package/lib/components/Renderer/BaseRenderer.js +3 -5
  167. package/lib/components/Renderer/BaseRenderer.js.map +1 -1
  168. package/lib/components/Renderer/FormBodyCollapsible.d.ts +2 -2
  169. package/lib/components/Renderer/FormBodyCollapsible.js +6 -5
  170. package/lib/components/Renderer/FormBodyCollapsible.js.map +1 -1
  171. package/lib/components/Renderer/FormBodySingleCollapsibleWrapper.d.ts +2 -2
  172. package/lib/components/Renderer/FormBodySingleCollapsibleWrapper.js.map +1 -1
  173. package/lib/components/Renderer/FormBodyTabbed.d.ts +2 -2
  174. package/lib/components/Renderer/FormBodyTabbed.js +6 -5
  175. package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
  176. package/lib/components/Renderer/FormTopLevelItem.d.ts +2 -2
  177. package/lib/components/Renderer/FormTopLevelItem.js +3 -1
  178. package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
  179. package/lib/components/Renderer/SmartFormsRenderer.js +1 -1
  180. package/lib/components/Renderer/SmartFormsRenderer.js.map +1 -1
  181. package/lib/hooks/useDateSeparatorValidation.d.ts +2 -0
  182. package/lib/hooks/useDateSeparatorValidation.js +25 -0
  183. package/lib/hooks/useDateSeparatorValidation.js.map +1 -0
  184. package/lib/hooks/useDateValidation.d.ts +2 -0
  185. package/lib/hooks/useDateValidation.js +61 -0
  186. package/lib/hooks/useDateValidation.js.map +1 -0
  187. package/lib/hooks/useDecimalCalculatedExpression.d.ts +0 -1
  188. package/lib/hooks/useDecimalCalculatedExpression.js +3 -3
  189. package/lib/hooks/useDecimalCalculatedExpression.js.map +1 -1
  190. package/lib/hooks/useInitialiseRepeatAnswers.d.ts +1 -1
  191. package/lib/hooks/useInitialiseRepeatAnswers.js.map +1 -1
  192. package/lib/hooks/useIntegerCalculatedExpression.d.ts +0 -1
  193. package/lib/hooks/useIntegerCalculatedExpression.js +3 -3
  194. package/lib/hooks/useIntegerCalculatedExpression.js.map +1 -1
  195. package/lib/hooks/useSliderExtensions.d.ts +10 -0
  196. package/lib/hooks/useSliderExtensions.js +37 -0
  197. package/lib/hooks/useSliderExtensions.js.map +1 -0
  198. package/lib/hooks/useTerminologyServerQuery.js +0 -1
  199. package/lib/hooks/useTerminologyServerQuery.js.map +1 -1
  200. package/lib/index.d.ts +3 -3
  201. package/lib/index.js +15 -6
  202. package/lib/index.js.map +1 -1
  203. package/lib/interfaces/index.d.ts +2 -0
  204. package/lib/interfaces/index.js +18 -0
  205. package/lib/interfaces/index.js.map +1 -0
  206. package/lib/interfaces/questionnaireStore.interface.d.ts +1 -0
  207. package/lib/interfaces/renderProps.interface.d.ts +4 -3
  208. package/lib/stores/useQuestionnaireStore.d.ts +1 -0
  209. package/lib/stores/useQuestionnaireStore.js +28 -12
  210. package/lib/stores/useQuestionnaireStore.js.map +1 -1
  211. package/lib/test.d.ts +4 -0
  212. package/lib/test.js +18 -0
  213. package/lib/test.js.map +1 -0
  214. package/lib/theme/customGlobalStyles.js +2 -5
  215. package/lib/theme/customGlobalStyles.js.map +1 -1
  216. package/lib/theme/typography.js +9 -9
  217. package/lib/theme/typography.js.map +1 -1
  218. package/lib/utils/calculatedExpression.d.ts +5 -1
  219. package/lib/utils/calculatedExpression.js +21 -16
  220. package/lib/utils/calculatedExpression.js.map +1 -1
  221. package/lib/utils/dayjsExtend.d.ts +1 -0
  222. package/lib/utils/dayjsExtend.js +22 -0
  223. package/lib/utils/dayjsExtend.js.map +1 -0
  224. package/lib/utils/enableWhenExpression.d.ts +5 -1
  225. package/lib/utils/enableWhenExpression.js +26 -21
  226. package/lib/utils/enableWhenExpression.js.map +1 -1
  227. package/lib/utils/fhirpath.d.ts +3 -1
  228. package/lib/utils/fhirpath.js +25 -15
  229. package/lib/utils/fhirpath.js.map +1 -1
  230. package/lib/utils/index.d.ts +1 -0
  231. package/lib/utils/index.js +1 -0
  232. package/lib/utils/index.js.map +1 -1
  233. package/lib/utils/initialiseForm.d.ts +2 -0
  234. package/lib/utils/initialiseForm.js +13 -5
  235. package/lib/utils/initialiseForm.js.map +1 -1
  236. package/lib/utils/itemControl.d.ts +12 -0
  237. package/lib/utils/itemControl.js +30 -0
  238. package/lib/utils/itemControl.js.map +1 -1
  239. package/lib/utils/launchContext.d.ts +0 -0
  240. package/lib/utils/launchContext.js +2 -0
  241. package/lib/utils/launchContext.js.map +1 -0
  242. package/lib/utils/mapItem.d.ts +1 -1
  243. package/lib/utils/populateContexts.d.ts +2 -12
  244. package/lib/utils/populateContexts.js +0 -36
  245. package/lib/utils/populateContexts.js.map +1 -1
  246. package/lib/utils/qrItem.d.ts +1 -7
  247. package/lib/utils/qrItem.js +1 -12
  248. package/lib/utils/qrItem.js.map +1 -1
  249. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +4 -2
  250. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
  251. package/lib/utils/removeHidden.js +2 -1
  252. package/lib/utils/removeHidden.js.map +1 -1
  253. package/lib/utils/repopulateIntoResponse.js +90 -29
  254. package/lib/utils/repopulateIntoResponse.js.map +1 -1
  255. package/lib/utils/repopulateItems.d.ts +14 -1
  256. package/lib/utils/repopulateItems.js +251 -70
  257. package/lib/utils/repopulateItems.js.map +1 -1
  258. package/lib/utils/repopulateRepeatGroup.js +9 -1
  259. package/lib/utils/repopulateRepeatGroup.js.map +1 -1
  260. package/lib/utils/slider.d.ts +28 -0
  261. package/lib/utils/slider.js +89 -0
  262. package/lib/utils/slider.js.map +1 -0
  263. package/package.json +18 -15
  264. package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +2 -2
  265. package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +2 -2
  266. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +33 -33
  267. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +35 -35
  268. package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +8 -8
  269. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +2 -2
  270. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +2 -2
  271. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +2 -2
  272. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +2 -2
  273. package/src/components/FormComponents/CustomDateItem/CustomDateItem.tsx +140 -0
  274. package/src/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.tsx +96 -0
  275. package/src/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.tsx +81 -0
  276. package/src/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.tsx +33 -0
  277. package/src/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.ts +22 -0
  278. package/src/components/FormComponents/CustomDateItem/customDateTimePicker/index.ts +18 -0
  279. package/src/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.ts +18 -0
  280. package/src/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.ts +154 -0
  281. package/src/components/FormComponents/CustomDateItem/index.ts +18 -0
  282. package/src/components/FormComponents/DateItem/DateItem.tsx +3 -3
  283. package/src/components/FormComponents/DateTimeItem/DateTimeItem.tsx +2 -2
  284. package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +4 -5
  285. package/src/components/FormComponents/DisplayItem/DisplayInstructions.styles.ts +0 -1
  286. package/src/components/FormComponents/DisplayItem/DisplayInstructions.tsx +2 -1
  287. package/src/components/FormComponents/GridGroup/GridGroup.tsx +41 -15
  288. package/src/components/FormComponents/GridGroup/GridRow.tsx +10 -9
  289. package/src/components/FormComponents/GridGroup/GridTable.tsx +29 -9
  290. package/src/components/FormComponents/GridGroup/index.ts +18 -0
  291. package/src/components/FormComponents/GroupItem/GroupItem.tsx +5 -6
  292. package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +7 -8
  293. package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +4 -5
  294. package/src/components/FormComponents/ItemParts/FadingCheckIcon.tsx +2 -2
  295. package/src/components/FormComponents/ItemParts/ItemFieldGrid.tsx +2 -2
  296. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +2 -2
  297. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +43 -43
  298. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +6 -6
  299. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +2 -2
  300. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +2 -2
  301. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +2 -2
  302. package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +49 -6
  303. package/src/components/FormComponents/RepeatGroup/RepeatGroupItem.tsx +13 -8
  304. package/src/components/FormComponents/RepeatItem/RepeatField.tsx +15 -9
  305. package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +33 -3
  306. package/src/components/FormComponents/RepeatItem/index.ts +18 -0
  307. package/src/components/FormComponents/SingleItem/SingleItem.tsx +6 -6
  308. package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +27 -11
  309. package/src/components/FormComponents/SliderItem/Slider.styles.ts +34 -0
  310. package/src/components/FormComponents/SliderItem/SliderDisplayValue.tsx +43 -0
  311. package/src/components/FormComponents/SliderItem/SliderField.tsx +88 -0
  312. package/src/components/FormComponents/SliderItem/SliderItem.tsx +115 -0
  313. package/src/components/FormComponents/SliderItem/SliderLabels.tsx +53 -0
  314. package/src/components/FormComponents/StringItem/StringItem.tsx +2 -2
  315. package/src/components/FormComponents/Tables/GroupTable.tsx +55 -3
  316. package/src/components/FormComponents/Tables/GroupTableRow.tsx +10 -9
  317. package/src/components/FormComponents/TextItem/TextItem.tsx +2 -2
  318. package/src/components/FormComponents/TimeItem/TimeItem.tsx +2 -2
  319. package/src/components/FormComponents/UrlItem/UrlItem.tsx +2 -2
  320. package/src/components/FormComponents/index.ts +3 -0
  321. package/src/components/Renderer/BaseRenderer.tsx +5 -12
  322. package/src/components/Renderer/FormBodyCollapsible.tsx +9 -7
  323. package/src/components/Renderer/FormBodySingleCollapsibleWrapper.tsx +2 -3
  324. package/src/components/Renderer/FormBodyTabbed.tsx +9 -7
  325. package/src/components/Renderer/FormTopLevelItem.tsx +14 -11
  326. package/src/components/Renderer/SmartFormsRenderer.tsx +2 -1
  327. package/src/hooks/useDateValidation.tsx +79 -0
  328. package/src/hooks/useDecimalCalculatedExpression.ts +3 -4
  329. package/src/hooks/useInitialiseRepeatAnswers.ts +1 -1
  330. package/src/hooks/useIntegerCalculatedExpression.ts +3 -4
  331. package/src/hooks/useSliderExtensions.ts +50 -0
  332. package/src/hooks/useTerminologyServerQuery.ts +0 -2
  333. package/src/index.ts +12 -9
  334. package/src/interfaces/questionnaireStore.interface.ts +1 -0
  335. package/src/interfaces/renderProps.interface.ts +4 -3
  336. package/src/stores/useQuestionnaireStore.ts +39 -16
  337. package/src/theme/customGlobalStyles.tsx +2 -5
  338. package/src/theme/typography.ts +9 -9
  339. package/src/utils/calculatedExpression.ts +41 -28
  340. package/src/utils/dayjsExtend.ts +23 -0
  341. package/src/utils/enableWhenExpression.ts +49 -34
  342. package/src/utils/fhirpath.ts +50 -31
  343. package/src/utils/index.ts +1 -0
  344. package/src/utils/initialiseForm.ts +15 -5
  345. package/src/utils/itemControl.ts +32 -0
  346. package/src/utils/mapItem.ts +1 -1
  347. package/src/utils/populateContexts.ts +2 -61
  348. package/src/utils/qrItem.ts +1 -16
  349. package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +4 -2
  350. package/src/utils/removeHidden.ts +2 -1
  351. package/src/utils/repopulateIntoResponse.ts +134 -43
  352. package/src/utils/repopulateItems.ts +379 -101
  353. package/src/utils/slider.ts +112 -0
  354. package/src/utils/populateInputParams.ts +0 -242
  355. package/src/utils/repopulateRepeatGroup.ts +0 -68
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Smart Forms Renderer
2
2
  This React-based package acts as the rendering engine for the [Smart Forms app](https://github.com/aehrc/smart-forms).
3
3
 
4
- Try out a minimal demo here: https://www.smartforms.io/standalone.
4
+ Try out a minimal demo here: https://smartforms.csiro.au/standalone.
5
5
 
6
6
  ## Installation
7
7
  ```bash
@@ -27,8 +27,10 @@ export default function App () {
27
27
  </div>
28
28
  )
29
29
  }
30
-
31
30
  ```
31
+ Note: The SmartFormsRenderer component is extremely basic and experimental, do not use it in production!
32
+
33
+
32
34
  ### SmartFormsRenderer Props
33
35
 
34
36
 
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
3
3
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
- interface BooleanItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
4
+ interface BooleanItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
5
5
  qItem: QuestionnaireItem;
6
- qrItem: QuestionnaireResponseItem;
6
+ qrItem: QuestionnaireResponseItem | null;
7
7
  }
8
8
  declare function BooleanItem(props: BooleanItemProps): React.JSX.Element;
9
9
  export default BooleanItem;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
3
3
  import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
4
- interface ChoiceAutocompleteItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
4
+ interface ChoiceAutocompleteItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
5
5
  qItem: QuestionnaireItem;
6
- qrItem: QuestionnaireResponseItem;
6
+ qrItem: QuestionnaireResponseItem | null;
7
7
  }
8
8
  declare function ChoiceAutocompleteItem(props: ChoiceAutocompleteItemProps): React.JSX.Element | null;
9
9
  export default ChoiceAutocompleteItem;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
3
3
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
- import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler, PropsWithTextShownAttribute } from '../../../interfaces/renderProps.interface';
5
- interface ChoiceCheckboxAnswerOptionItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithTextShownAttribute, PropsWithParentIsReadOnlyAttribute {
4
+ import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler, PropsWithShowMinimalViewAttribute } from '../../../interfaces/renderProps.interface';
5
+ interface ChoiceCheckboxAnswerOptionItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithShowMinimalViewAttribute, PropsWithParentIsReadOnlyAttribute {
6
6
  qItem: QuestionnaireItem;
7
- qrItem: QuestionnaireResponseItem;
7
+ qrItem: QuestionnaireResponseItem | null;
8
8
  orientation: ChoiceItemOrientation;
9
9
  }
10
10
  declare function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemProps): React.JSX.Element;
@@ -25,7 +25,7 @@ import LabelWrapper from '../ItemParts/ItemLabelWrapper';
25
25
  import ChoiceCheckboxAnswerValueSetFields from './ChoiceCheckboxAnswerOptionFields';
26
26
  import useReadOnly from '../../../hooks/useReadOnly';
27
27
  function ChoiceCheckboxAnswerOptionItem(props) {
28
- const { qItem, qrItem, orientation, isRepeated, textShown = true, parentIsReadOnly, onQrItemChange } = props;
28
+ const { qItem, qrItem, orientation, isRepeated, showMinimalView = false, parentIsReadOnly, onQrItemChange } = props;
29
29
  // Init input value
30
30
  const qrChoiceCheckbox = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
31
31
  const answers = qrChoiceCheckbox.answer ? qrChoiceCheckbox.answer : [];
@@ -41,18 +41,18 @@ function ChoiceCheckboxAnswerOptionItem(props) {
41
41
  onQrItemChange(updatedQrChoiceCheckbox);
42
42
  }
43
43
  }
44
- if (textShown) {
45
- return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-checkbox-answer-option-box" },
46
- React.createElement(Grid, { container: true, columnSpacing: 6 },
47
- React.createElement(Grid, { item: true, xs: 5 },
48
- React.createElement(LabelWrapper, { qItem: qItem, readOnly: readOnly })),
49
- React.createElement(Grid, { item: true, xs: 7 },
50
- React.createElement(ChoiceCheckboxAnswerValueSetFields, { qItem: qItem, answers: answers, orientation: orientation, readOnly: readOnly, onCheckedChange: handleCheckedChange }),
51
- React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })))));
44
+ if (showMinimalView) {
45
+ return (React.createElement(React.Fragment, null,
46
+ React.createElement(ChoiceCheckboxAnswerValueSetFields, { qItem: qItem, answers: answers, orientation: orientation, readOnly: readOnly, onCheckedChange: handleCheckedChange }),
47
+ React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })));
52
48
  }
53
- return (React.createElement(React.Fragment, null,
54
- React.createElement(ChoiceCheckboxAnswerValueSetFields, { qItem: qItem, answers: answers, orientation: orientation, readOnly: readOnly, onCheckedChange: handleCheckedChange }),
55
- React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })));
49
+ return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-checkbox-answer-option-box" },
50
+ React.createElement(Grid, { container: true, columnSpacing: 6 },
51
+ React.createElement(Grid, { item: true, xs: 5 },
52
+ React.createElement(LabelWrapper, { qItem: qItem, readOnly: readOnly })),
53
+ React.createElement(Grid, { item: true, xs: 7 },
54
+ React.createElement(ChoiceCheckboxAnswerValueSetFields, { qItem: qItem, answers: answers, orientation: orientation, readOnly: readOnly, onCheckedChange: handleCheckedChange }),
55
+ React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })))));
56
56
  }
57
57
  export default ChoiceCheckboxAnswerOptionItem;
58
58
  //# sourceMappingURL=ChoiceCheckboxAnswerOptionItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceCheckboxAnswerOptionItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAGtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAO3E,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,kCAAkC,MAAM,oCAAoC,CAAC;AACpF,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAYrD,SAAS,8BAA8B,CAAC,KAA0C;IAChF,MAAM,EACJ,KAAK,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,GAAG,IAAI,EAChB,gBAAgB,EAChB,cAAc,EACf,GAAG,KAAK,CAAC;IAEV,mBAAmB;IACnB,MAAM,gBAAgB,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAEvE,MAAM,QAA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C,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,GAAI,CACpF,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,8BAA8B,CAAC"}
1
+ {"version":3,"file":"ChoiceCheckboxAnswerOptionItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAGtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAO3E,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,kCAAkC,MAAM,oCAAoC,CAAC;AACpF,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAYrD,SAAS,8BAA8B,CAAC,KAA0C;IAChF,MAAM,EACJ,KAAK,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,GAAG,KAAK,EACvB,gBAAgB,EAChB,cAAc,EACf,GAAG,KAAK,CAAC;IAEV,mBAAmB;IACnB,MAAM,gBAAgB,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAEvE,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACtD,MAAM,EAAE,mBAAmB,EAAE,GAAG,sBAAsB,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AAED,eAAe,8BAA8B,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
3
3
  import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
4
- import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler, PropsWithTextShownAttribute } from '../../../interfaces/renderProps.interface';
5
- interface ChoiceCheckboxAnswerValueSetItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithTextShownAttribute, PropsWithParentIsReadOnlyAttribute {
4
+ import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler, PropsWithShowMinimalViewAttribute } from '../../../interfaces/renderProps.interface';
5
+ interface ChoiceCheckboxAnswerValueSetItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithShowMinimalViewAttribute, PropsWithParentIsReadOnlyAttribute {
6
6
  qItem: QuestionnaireItem;
7
- qrItem: QuestionnaireResponseItem;
7
+ qrItem: QuestionnaireResponseItem | null;
8
8
  orientation: ChoiceItemOrientation;
9
9
  showText?: boolean;
10
10
  }
@@ -26,7 +26,7 @@ import LabelWrapper from '../ItemParts/ItemLabelWrapper';
26
26
  import ChoiceCheckboxAnswerValueSetFields from './ChoiceCheckboxAnswerValueSetFields';
27
27
  import useReadOnly from '../../../hooks/useReadOnly';
28
28
  function ChoiceCheckboxAnswerValueSetItem(props) {
29
- const { qItem, qrItem, orientation, isRepeated, textShown = true, parentIsReadOnly, onQrItemChange } = props;
29
+ const { qItem, qrItem, orientation, isRepeated, showMinimalView = false, parentIsReadOnly, onQrItemChange } = props;
30
30
  // Init input value
31
31
  const qrChoiceCheckbox = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
32
32
  const answers = qrChoiceCheckbox.answer ? qrChoiceCheckbox.answer : [];
@@ -43,18 +43,18 @@ function ChoiceCheckboxAnswerValueSetItem(props) {
43
43
  onQrItemChange(updatedQrChoiceCheckbox);
44
44
  }
45
45
  }
46
- if (textShown) {
47
- return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-checkbox-answer-value-set-box" },
48
- React.createElement(Grid, { container: true, columnSpacing: 6 },
49
- React.createElement(Grid, { item: true, xs: 5 },
50
- React.createElement(LabelWrapper, { qItem: qItem, readOnly: readOnly })),
51
- React.createElement(Grid, { item: true, xs: 7 },
52
- React.createElement(ChoiceCheckboxAnswerValueSetFields, { codings: codings, answers: answers, orientation: orientation, readOnly: readOnly, serverError: serverError, onCheckedChange: handleCheckedChange }),
53
- React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })))));
46
+ if (showMinimalView) {
47
+ return (React.createElement(React.Fragment, null,
48
+ React.createElement(ChoiceCheckboxAnswerValueSetFields, { codings: codings, answers: answers, orientation: orientation, readOnly: readOnly, serverError: serverError, onCheckedChange: handleCheckedChange }),
49
+ React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })));
54
50
  }
55
- return (React.createElement(React.Fragment, null,
56
- React.createElement(ChoiceCheckboxAnswerValueSetFields, { codings: codings, answers: answers, orientation: orientation, readOnly: readOnly, serverError: serverError, onCheckedChange: handleCheckedChange }),
57
- React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })));
51
+ return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-checkbox-answer-value-set-box" },
52
+ React.createElement(Grid, { container: true, columnSpacing: 6 },
53
+ React.createElement(Grid, { item: true, xs: 5 },
54
+ React.createElement(LabelWrapper, { qItem: qItem, readOnly: readOnly })),
55
+ React.createElement(Grid, { item: true, xs: 7 },
56
+ React.createElement(ChoiceCheckboxAnswerValueSetFields, { codings: codings, answers: answers, orientation: orientation, readOnly: readOnly, serverError: serverError, onCheckedChange: handleCheckedChange }),
57
+ React.createElement(DisplayInstructions, { displayInstructions: displayInstructions, readOnly: readOnly })))));
58
58
  }
59
59
  export default ChoiceCheckboxAnswerValueSetItem;
60
60
  //# sourceMappingURL=ChoiceCheckboxAnswerValueSetItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceCheckboxAnswerValueSetItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAO3E,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAarD,SAAS,gCAAgC,CAAC,KAA4C;IACpF,MAAM,EACJ,KAAK,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,GAAG,IAAI,EAChB,gBAAgB,EAChB,cAAc,EACf,GAAG,KAAK,CAAC;IAEV,mBAAmB;IACnB,MAAM,gBAAgB,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAEvE,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB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W,EACxB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,mBAAmB,GACpC;QACF,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,GAAI,CACpF,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,gCAAgC,CAAC"}
1
+ {"version":3,"file":"ChoiceCheckboxAnswerValueSetItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAO3E,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAarD,SAAS,gCAAgC,CAAC,KAA4C;IACpF,MAAM,EACJ,KAAK,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,GAAG,KAAK,EACvB,gBAAgB,EAChB,cAAc,EACf,GAAG,KAAK,CAAC;IAEV,mBAAmB;IACnB,MAAM,gBAAgB,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,M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kCAAkC,IACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,mBAAmB,GACpC;gBACF,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAChF,CACF,CACmB,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,gCAAgC,CAAC"}
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
3
- import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithQrItemChangeHandler, PropsWithTextShownAttribute } from '../../../interfaces/renderProps.interface';
4
- import type { PropsWithParentIsReadOnlyAttribute } from '../../../interfaces/renderProps.interface';
5
- interface ChoiceItemSwitcherProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithTextShownAttribute, PropsWithParentIsReadOnlyAttribute {
3
+ import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler, PropsWithShowMinimalViewAttribute } from '../../../interfaces/renderProps.interface';
4
+ interface ChoiceItemSwitcherProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithShowMinimalViewAttribute, PropsWithParentIsReadOnlyAttribute {
6
5
  qItem: QuestionnaireItem;
7
- qrItem: QuestionnaireResponseItem;
6
+ qrItem: QuestionnaireResponseItem | null;
8
7
  }
9
8
  declare function ChoiceItemSwitcher(props: ChoiceItemSwitcherProps): React.JSX.Element | null;
10
9
  export default ChoiceItemSwitcher;
@@ -26,7 +26,7 @@ import ChoiceRadioAnswerValueSetItem from './ChoiceRadioAnswerValueSetItem';
26
26
  import ChoiceCheckboxAnswerValueSetItem from './ChoiceCheckboxAnswerValueSetItem';
27
27
  function ChoiceItemSwitcher(props) {
28
28
  var _a, _b;
29
- const { qItem, qrItem, isRepeated, isTabled, textShown, parentIsReadOnly, onQrItemChange } = props;
29
+ const { qItem, qrItem, isRepeated, isTabled, showMinimalView, parentIsReadOnly, onQrItemChange } = props;
30
30
  const orientation = getChoiceOrientation(qItem);
31
31
  const choiceControlType = getChoiceControlType(qItem);
32
32
  switch (choiceControlType) {
@@ -39,10 +39,10 @@ function ChoiceItemSwitcher(props) {
39
39
  }
40
40
  case ChoiceItemControl.Checkbox:
41
41
  if (qItem.answerOption) {
42
- return (React.createElement(ChoiceCheckboxAnswerOptionItem, { qItem: qItem, qrItem: qrItem, orientation: orientation, isRepeated: (_a = qItem.repeats) !== null && _a !== void 0 ? _a : false, textShown: textShown, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
42
+ return (React.createElement(ChoiceCheckboxAnswerOptionItem, { qItem: qItem, qrItem: qrItem, orientation: orientation, isRepeated: (_a = qItem.repeats) !== null && _a !== void 0 ? _a : false, showMinimalView: showMinimalView, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
43
43
  }
44
44
  else {
45
- return (React.createElement(ChoiceCheckboxAnswerValueSetItem, { qItem: qItem, qrItem: qrItem, isRepeated: (_b = qItem.repeats) !== null && _b !== void 0 ? _b : false, orientation: orientation, textShown: textShown, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
45
+ return (React.createElement(ChoiceCheckboxAnswerValueSetItem, { qItem: qItem, qrItem: qrItem, isRepeated: (_b = qItem.repeats) !== null && _b !== void 0 ? _b : false, orientation: orientation, showMinimalView: showMinimalView, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
46
46
  }
47
47
  case ChoiceItemControl.Autocomplete:
48
48
  return (React.createElement(ChoiceAutocompleteItem, { qItem: qItem, qrItem: qrItem, isRepeated: isRepeated, isTabled: isTabled, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,2BAA2B,MAAM,+BAA+B,CAAC;AACxE,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;AAC5E,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAmBlF,SAAS,kBAAkB,CAAC,KAA8B;;IACxD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,GACxF,KAAK,CAAC;IAER,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAEtD,QAAQ,iBAAiB,EAAE;QACzB,KAAK,iBAAiB,CAAC,KAAK;YAC1B,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,OAAO,CACL,oBAAC,2BAA2B,IAC1B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;iBAAM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AAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;iBAAM;gBACL,OAAO,CACL,oBAAC,8BAA8B,IAC7B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;QACH;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"ChoiceItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,2BAA2B,MAAM,+BAA+B,CAAC;AACxE,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;AAC5E,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAmBlF,SAAS,kBAAkB,CAAC,KAA8B;;IACxD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAC9F,KAAK,CAAC;IAER,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,KAAK,CAAC,CA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d,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;QACJ,KAAK,iBAAiB,CAAC,MAAM;YAC3B,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,OAAO,CACL,oBAAC,4BAA4B,IAC3B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;iBAAM;gBACL,OAAO,CACL,oBAAC,8BAA8B,IAC7B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;QACH;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC;AAED,eAAe,kBAAkB,CAAC"}
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
3
3
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
4
  import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
5
- interface ChoiceRadioAnswerOptionItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute {
5
+ interface ChoiceRadioAnswerOptionItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute {
6
6
  qItem: QuestionnaireItem;
7
- qrItem: QuestionnaireResponseItem;
7
+ qrItem: QuestionnaireResponseItem | null;
8
8
  orientation: ChoiceItemOrientation;
9
9
  }
10
10
  declare function ChoiceRadioAnswerOptionItem(props: ChoiceRadioAnswerOptionItemProps): React.JSX.Element;
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
3
3
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
4
  import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
5
- interface ChoiceRadioAnswerValueSetItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute {
5
+ interface ChoiceRadioAnswerValueSetItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute {
6
6
  qItem: QuestionnaireItem;
7
- qrItem: QuestionnaireResponseItem;
7
+ qrItem: QuestionnaireResponseItem | null;
8
8
  orientation: ChoiceItemOrientation;
9
9
  }
10
10
  declare function ChoiceRadioAnswerValueSetItem(props: ChoiceRadioAnswerValueSetItemProps): React.JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
3
3
  import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
4
- interface ChoiceSelectAnswerOptionItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
4
+ interface ChoiceSelectAnswerOptionItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
5
5
  qItem: QuestionnaireItem;
6
- qrItem: QuestionnaireResponseItem;
6
+ qrItem: QuestionnaireResponseItem | null;
7
7
  }
8
8
  declare function ChoiceSelectAnswerOptionItem(props: ChoiceSelectAnswerOptionItemProps): React.JSX.Element;
9
9
  export default ChoiceSelectAnswerOptionItem;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
3
3
  import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
4
- interface ChoiceSelectAnswerValueSetItemProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
4
+ interface ChoiceSelectAnswerValueSetItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
5
5
  qItem: QuestionnaireItem;
6
- qrItem: QuestionnaireResponseItem;
6
+ qrItem: QuestionnaireResponseItem | null;
7
7
  }
8
8
  declare function ChoiceSelectAnswerValueSetItem(props: ChoiceSelectAnswerValueSetItemProps): React.JSX.Element;
9
9
  export default ChoiceSelectAnswerValueSetItem;
@@ -0,0 +1,18 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import React from 'react';
3
+ import { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface';
4
+ interface CustomDateField2Props extends PropsWithIsTabledAttribute {
5
+ linkId: string;
6
+ valueDate: string;
7
+ input: string;
8
+ feedback: string;
9
+ isFocused: boolean;
10
+ displayPrompt: string;
11
+ entryFormat: string;
12
+ readOnly: boolean;
13
+ setFocused: Dispatch<SetStateAction<boolean>>;
14
+ onInputChange: (newInput: string) => void;
15
+ onSelectDate: (newDateValue: string) => void;
16
+ }
17
+ declare function CustomDateField2(props: CustomDateField2Props): React.JSX.Element;
18
+ export default CustomDateField2;
@@ -0,0 +1,31 @@
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, { useRef } from 'react';
18
+ import { StandardTextField } from '../Textfield.styles';
19
+ import DatePicker from './customDateTimePicker/DatePicker';
20
+ function CustomDateField2(props) {
21
+ const { linkId, valueDate, input, feedback, isFocused, displayPrompt, entryFormat, readOnly, isTabled, setFocused, onInputChange, onSelectDate } = props;
22
+ const anchorRef = useRef(null);
23
+ return (React.createElement(StandardTextField, { id: linkId, ref: anchorRef, fullWidth: true, isTabled: isTabled, value: input, error: !!feedback, onChange: (e) => onInputChange(e.target.value), label: displayPrompt, placeholder: entryFormat !== '' ? entryFormat : 'DD/MM/YYYY', disabled: readOnly, size: "small", focused: isFocused, onFocus: () => setFocused(true), onBlur: () => setFocused(false), InputProps: {
24
+ endAdornment: (React.createElement(React.Fragment, null,
25
+ React.createElement(DatePicker, { valueString: valueDate, anchorEl: anchorRef.current, onSelectDate: (valueDayjs) => {
26
+ onSelectDate(valueDayjs.format('DD/MM/YYYY'));
27
+ }, onFocus: (focus) => setFocused(focus) })))
28
+ }, helperText: feedback }));
29
+ }
30
+ export default CustomDateField2;
31
+ //# sourceMappingURL=CustomDateField2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomDateField2.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/CustomDateItem/CustomDateField2.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,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AC,KAAK,CAAC,GACrC,CACD,CACJ;SACF,EACD,UAAU,EAAE,QAAQ,GACpB,CACH,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
3
+ import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
+ interface CustomDateItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
5
+ qItem: QuestionnaireItem;
6
+ qrItem: QuestionnaireResponseItem | null;
7
+ }
8
+ declare function CustomDateItem(props: CustomDateItemProps): React.JSX.Element;
9
+ export default CustomDateItem;
@@ -0,0 +1,68 @@
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, { useState } from 'react';
18
+ import useReadOnly from '../../../hooks/useReadOnly';
19
+ import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
20
+ import { FullWidthFormComponentBox } from '../../Box.styles';
21
+ import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
22
+ import { parseFhirDateToDisplayDate, parseInputDateToFhirDate, validateInput } from './customDateTimePicker/utils/parseDates';
23
+ import { createEmptyQrItem } from '../../../utils/qrItem';
24
+ import useDateValidation from '../../../hooks/useDateValidation';
25
+ import CustomDateField from './customDateTimePicker/CustomDateField';
26
+ function CustomDateItem(props) {
27
+ const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
28
+ const readOnly = useReadOnly(qItem, parentIsReadOnly);
29
+ const { displayPrompt, displayInstructions, entryFormat } = useRenderingExtensions(qItem);
30
+ const qrDate = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
31
+ // Init input value
32
+ let valueDate = '';
33
+ if (qrDate.answer) {
34
+ if (qrDate.answer[0].valueDate) {
35
+ valueDate = qrDate.answer[0].valueDate;
36
+ }
37
+ else if (qrDate.answer[0].valueDateTime) {
38
+ valueDate = qrDate.answer[0].valueDateTime;
39
+ }
40
+ }
41
+ const { displayDate, parseFail } = parseFhirDateToDisplayDate(valueDate);
42
+ const [input, setInput] = useState(displayDate);
43
+ const [focused, setFocused] = useState(false);
44
+ // Perform validation checks
45
+ const errorFeedback = useDateValidation(input, parseFail);
46
+ function handleSelectDate(selectedDate) {
47
+ setInput(selectedDate);
48
+ onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueDate: parseInputDateToFhirDate(selectedDate) }] }));
49
+ }
50
+ function handleInputChange(newInput) {
51
+ setInput(newInput);
52
+ if (newInput === '') {
53
+ onQrItemChange(createEmptyQrItem(qItem));
54
+ }
55
+ if (!validateInput(newInput)) {
56
+ return;
57
+ }
58
+ onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueDate: parseInputDateToFhirDate(newInput) }] }));
59
+ }
60
+ if (isRepeated) {
61
+ return (React.createElement(CustomDateField, { linkId: qItem.linkId, valueDate: displayDate, input: input, feedback: errorFeedback !== null && errorFeedback !== void 0 ? errorFeedback : '', isFocused: focused, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, isTabled: isTabled, setFocused: setFocused, onInputChange: handleInputChange, onSelectDate: handleSelectDate }));
62
+ }
63
+ return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-date-box" },
64
+ React.createElement(ItemFieldGrid, { qItem: qItem, displayInstructions: displayInstructions, readOnly: readOnly },
65
+ React.createElement(CustomDateField, { linkId: qItem.linkId, valueDate: displayDate, input: input, feedback: errorFeedback !== null && errorFeedback !== void 0 ? errorFeedback : '', isFocused: focused, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, isTabled: isTabled, setFocused: setFocused, onInputChange: handleInputChange, onSelectDate: handleSelectDate }))));
66
+ }
67
+ export default CustomDateItem;
68
+ //# sourceMappingURL=CustomDateItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomDateItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/CustomDateItem/CustomDateItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQxC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,aAAa,EACd,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,eAAe,MAAM,wCAAwC,CAAC;AAWrE,SAAS,cAAc,CAAC,KAA0B;IAChD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAExF,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACtD,MAAM,EAAE,aAAa,EAAE,mBAAmB,EA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Ac,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
3
+ import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
+ interface CustomDateTimePickerTextProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
5
+ qItem: QuestionnaireItem;
6
+ qrItem: QuestionnaireResponseItem;
7
+ }
8
+ declare function CustomDateTimePickerText(props: CustomDateTimePickerTextProps): React.JSX.Element;
9
+ export default CustomDateTimePickerText;
@@ -0,0 +1,75 @@
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, { useState } from 'react';
18
+ import useReadOnly from '../../../hooks/useReadOnly';
19
+ import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
20
+ import { FullWidthFormComponentBox } from '../../Box.styles';
21
+ import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
22
+ import useParseDates from './customDateTimePicker/hooks/useParseDates';
23
+ import CustomDateField from './customDateTimePicker/CustomDateField';
24
+ import { parseDisplayDateToFhirDate, parseFhirDateToDisplayDate, replaceMonthNameWithNumber } from './customDateTimePicker/utils/parseDates';
25
+ import { createEmptyQrItem } from '../../../utils/qrItem';
26
+ function CustomDateTimePickerText(props) {
27
+ const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
28
+ const readOnly = useReadOnly(qItem, parentIsReadOnly);
29
+ const { displayPrompt, displayInstructions, entryFormat } = useRenderingExtensions(qItem);
30
+ const qrDate = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
31
+ // Init input value
32
+ let valueDate = '';
33
+ if (qrDate.answer) {
34
+ if (qrDate.answer[0].valueDate) {
35
+ valueDate = qrDate.answer[0].valueDate;
36
+ }
37
+ else if (qrDate.answer[0].valueDateTime) {
38
+ valueDate = qrDate.answer[0].valueDateTime;
39
+ }
40
+ }
41
+ valueDate = parseFhirDateToDisplayDate(valueDate);
42
+ const selectedDateToDisplay = valueDate.length === 0 ? 'N/A' : valueDate;
43
+ const [input, setInput] = useState(valueDate);
44
+ const [focused, setFocused] = useState(false);
45
+ let options = [];
46
+ const { dateOptions, seperator } = useParseDates(input);
47
+ if (dateOptions) {
48
+ options = dateOptions;
49
+ }
50
+ function handleValueChange(newDateString) {
51
+ onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueDate: parseDisplayDateToFhirDate(newDateString, seperator) }] }));
52
+ }
53
+ function handleUnfocus() {
54
+ // set answer to current input when text field is unfocused
55
+ if (!valueDate && input !== '') {
56
+ const replacedInput = replaceMonthNameWithNumber(input);
57
+ const matchedOption = options.find((option) => replacedInput === option);
58
+ if (matchedOption) {
59
+ const newDateString = matchedOption.split(seperator).join('/');
60
+ onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueDate: parseDisplayDateToFhirDate(newDateString, seperator) }] }));
61
+ }
62
+ }
63
+ setFocused(false);
64
+ }
65
+ if (isRepeated) {
66
+ return (React.createElement(CustomDateField, { valueDate: valueDate, input: input, isFocused: focused, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, isTabled: isTabled, setFocused: setFocused, onInputChange: (newInput) => setInput(newInput), onValueChange: handleValueChange, onUnfocus: handleUnfocus }));
67
+ }
68
+ return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-date-box" },
69
+ React.createElement(ItemFieldGrid, { qItem: qItem, displayInstructions: displayInstructions.length > 0 ? (displayInstructions) : (React.createElement(React.Fragment, null,
70
+ "Selected date: ",
71
+ React.createElement("b", null, selectedDateToDisplay))), readOnly: readOnly },
72
+ React.createElement(CustomDateField, { valueDate: valueDate, input: input, isFocused: focused, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, isTabled: isTabled, setFocused: setFocused, onInputChange: (newInput) => setInput(newInput), onValueChange: handleValueChange, onUnfocus: handleUnfocus }))));
73
+ }
74
+ export default CustomDateTimePickerText;
75
+ //# sourceMappingURL=CustomDateTimeField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomDateTimeField.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/CustomDateItem/CustomDateTimeField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQxC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,eAAe,MAAM,wCAAwC,CAAC;AACrE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAW1D,SAAS,wBAAwB,CAAC,KAAoC;IACpE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EA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AC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC/B,mBAAmB,CACpB,CAAC,CAAC,CAAC,CACF;;gBACiB,+BAAI,qBAAqB,CAAK,CAC5C,CACJ,EAEH,QAAQ,EAAE,QAAQ;YAClB,oBAAC,eAAe,IACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAC/C,aAAa,EAAE,iBAAiB,EAChC,SAAS,EAAE,aAAa,GACxB,CACY,CACU,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
3
+ import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
4
+ interface CustomDateTimePickerTextProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
5
+ qItem: QuestionnaireItem;
6
+ qrItem: QuestionnaireResponseItem;
7
+ }
8
+ declare function CustomDateTimePickerText(props: CustomDateTimePickerTextProps): React.JSX.Element;
9
+ export default CustomDateTimePickerText;