@aehrc/smart-forms-renderer 0.19.0 → 0.21.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 (514) hide show
  1. package/__mocks__/zustand.ts +1 -1
  2. package/lib/api/smartClient.js +1 -1
  3. package/lib/components/Alert.styles.js +1 -1
  4. package/lib/components/Box.styles.js +1 -1
  5. package/lib/components/FormComponents/AttachmentItem/AttachmentField.js +1 -1
  6. package/lib/components/FormComponents/AttachmentItem/AttachmentFieldWrapper.js +1 -1
  7. package/lib/components/FormComponents/AttachmentItem/AttachmentFileDropBox.js +1 -1
  8. package/lib/components/FormComponents/AttachmentItem/AttachmentItem.js +1 -1
  9. package/lib/components/FormComponents/AttachmentItem/AttachmentUrlField.js +1 -1
  10. package/lib/components/FormComponents/BooleanItem/BooleanField.js +1 -1
  11. package/lib/components/FormComponents/BooleanItem/BooleanItem.js +1 -1
  12. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js +1 -1
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +1 -1
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +1 -1
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +1 -1
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +1 -1
  17. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +1 -1
  18. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +1 -1
  19. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +1 -1
  20. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +1 -1
  21. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +1 -1
  22. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +1 -1
  23. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioSingle.js +1 -1
  24. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +1 -1
  25. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +1 -1
  26. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +1 -1
  27. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +1 -1
  28. package/lib/components/FormComponents/DateTimeItem/DateTimeField.js +1 -1
  29. package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +1 -1
  30. package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/CustomDateField.js +1 -1
  31. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateField.js.map +1 -0
  32. package/lib/components/FormComponents/{CustomDateItem → DateTimeItems/CustomDateItem}/CustomDateItem.d.ts +1 -1
  33. package/lib/components/FormComponents/{CustomDateItem → DateTimeItems/CustomDateItem}/CustomDateItem.js +13 -13
  34. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateItem.js.map +1 -0
  35. package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/DatePicker.js +1 -2
  36. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/DatePicker.js.map +1 -0
  37. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/DatePickerButton.js +29 -0
  38. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/DatePickerButton.js.map +1 -0
  39. package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/MuiDatePicker.js +1 -1
  40. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/MuiDatePicker.js.map +1 -0
  41. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.d.ts +9 -0
  42. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js +116 -0
  43. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js.map +1 -0
  44. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomTimeField.d.ts +15 -0
  45. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomTimeField.js +40 -0
  46. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomTimeField.js.map +1 -0
  47. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/DateTimeField.d.ts +22 -0
  48. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/DateTimeField.js +28 -0
  49. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/DateTimeField.js.map +1 -0
  50. package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems}/index.js +1 -1
  51. package/lib/components/FormComponents/DateTimeItems/index.js.map +1 -0
  52. package/lib/components/FormComponents/DateTimeItems/utils/index.d.ts +1 -0
  53. package/lib/components/FormComponents/{CustomDateItem → DateTimeItems/utils}/index.js +2 -2
  54. package/lib/components/FormComponents/DateTimeItems/utils/index.js.map +1 -0
  55. package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker/utils/parseDates.d.ts → DateTimeItems/utils/parseDate.d.ts} +2 -2
  56. package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker/utils/parseDates.js → DateTimeItems/utils/parseDate.js} +10 -10
  57. package/lib/components/FormComponents/DateTimeItems/utils/parseDate.js.map +1 -0
  58. package/lib/components/FormComponents/DateTimeItems/utils/parseTime.d.ts +19 -0
  59. package/lib/components/FormComponents/DateTimeItems/utils/parseTime.js +81 -0
  60. package/lib/components/FormComponents/DateTimeItems/utils/parseTime.js.map +1 -0
  61. package/lib/components/FormComponents/DecimalItem/DecimalField.js +1 -1
  62. package/lib/components/FormComponents/DecimalItem/DecimalItem.js +1 -1
  63. package/lib/components/FormComponents/DisplayItem/DisplayInstructions.js +1 -1
  64. package/lib/components/FormComponents/DisplayItem/DisplayInstructions.styles.js +1 -1
  65. package/lib/components/FormComponents/DisplayItem/DisplayItem.js +1 -1
  66. package/lib/components/FormComponents/GridGroup/GridGroup.js +1 -1
  67. package/lib/components/FormComponents/GridGroup/GridRow.js +1 -1
  68. package/lib/components/FormComponents/GridGroup/GridTable.js +1 -1
  69. package/lib/components/FormComponents/GridGroup/index.js +1 -1
  70. package/lib/components/FormComponents/GroupItem/GroupHeading.js +1 -1
  71. package/lib/components/FormComponents/GroupItem/GroupItem.js +1 -1
  72. package/lib/components/FormComponents/GroupItem/GroupItem.styles.js +1 -1
  73. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +1 -1
  74. package/lib/components/FormComponents/GroupItem/NextTabButton.js +1 -1
  75. package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.js +1 -1
  76. package/lib/components/FormComponents/IntegerItem/IntegerField.js +1 -1
  77. package/lib/components/FormComponents/IntegerItem/IntegerItem.js +1 -1
  78. package/lib/components/FormComponents/Item.styles.js +1 -1
  79. package/lib/components/FormComponents/ItemParts/CheckboxSingle.js +1 -1
  80. package/lib/components/FormComponents/ItemParts/CheckboxSingleWithOpenLabel.js +1 -1
  81. package/lib/components/FormComponents/ItemParts/ContextDisplayItem.js +1 -1
  82. package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js +1 -1
  83. package/lib/components/FormComponents/ItemParts/ItemFieldGrid.js +1 -1
  84. package/lib/components/FormComponents/ItemParts/ItemLabelText.js +1 -1
  85. package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +1 -1
  86. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js +1 -1
  87. package/lib/components/FormComponents/ItemParts/RadioButtonWithOpenLabel.js +1 -1
  88. package/lib/components/FormComponents/Lists.styles.js +1 -1
  89. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +1 -1
  90. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js +1 -1
  91. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +1 -1
  92. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +1 -1
  93. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +1 -1
  94. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +1 -1
  95. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +1 -1
  96. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js +1 -1
  97. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js +1 -1
  98. package/lib/components/FormComponents/RepeatGroup/AddItemButton.js +1 -1
  99. package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js +1 -1
  100. package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +1 -1
  101. package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js +1 -1
  102. package/lib/components/FormComponents/RepeatGroup/index.js +1 -1
  103. package/lib/components/FormComponents/RepeatItem/AddItemButton.js +1 -1
  104. package/lib/components/FormComponents/RepeatItem/RemoveItemButton.js +1 -1
  105. package/lib/components/FormComponents/RepeatItem/RepeatField.js +1 -1
  106. package/lib/components/FormComponents/RepeatItem/RepeatItem.js +1 -1
  107. package/lib/components/FormComponents/RepeatItem/RepeatItem.styles.js +1 -1
  108. package/lib/components/FormComponents/RepeatItem/index.js +1 -1
  109. package/lib/components/FormComponents/SingleItem/SingleItem.js +1 -1
  110. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +4 -4
  111. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
  112. package/lib/components/FormComponents/SingleItem/index.js +1 -1
  113. package/lib/components/FormComponents/SliderItem/Slider.styles.js +1 -1
  114. package/lib/components/FormComponents/SliderItem/SliderDisplayValue.js +1 -1
  115. package/lib/components/FormComponents/SliderItem/SliderField.js +1 -1
  116. package/lib/components/FormComponents/SliderItem/SliderItem.js +1 -1
  117. package/lib/components/FormComponents/SliderItem/SliderLabels.js +1 -1
  118. package/lib/components/FormComponents/StringItem/StringField.js +1 -1
  119. package/lib/components/FormComponents/StringItem/StringItem.js +1 -1
  120. package/lib/components/FormComponents/Tables/AddRowButton.js +1 -1
  121. package/lib/components/FormComponents/Tables/GroupTable.js +1 -1
  122. package/lib/components/FormComponents/Tables/GroupTableBody.js +1 -1
  123. package/lib/components/FormComponents/Tables/GroupTableRow.js +1 -1
  124. package/lib/components/FormComponents/Tables/GroupTableRowCells.js +1 -1
  125. package/lib/components/FormComponents/Tables/GroupTableView.js +1 -1
  126. package/lib/components/FormComponents/Tables/RemoveRowButton.js +1 -1
  127. package/lib/components/FormComponents/Tables/SelectRowButton.js +1 -1
  128. package/lib/components/FormComponents/Tables/Table.styles.js +1 -1
  129. package/lib/components/FormComponents/Tables/index.js +1 -1
  130. package/lib/components/FormComponents/TextItem/MuiTextField.js +1 -1
  131. package/lib/components/FormComponents/TextItem/TextField.js +1 -1
  132. package/lib/components/FormComponents/TextItem/TextItem.js +1 -1
  133. package/lib/components/FormComponents/Textfield.styles.js +1 -1
  134. package/lib/components/FormComponents/TimeItem/TimeField.js +1 -1
  135. package/lib/components/FormComponents/TimeItem/TimeItem.js +1 -1
  136. package/lib/components/FormComponents/UrlItem/UrlField.js +1 -1
  137. package/lib/components/FormComponents/UrlItem/UrlItem.js +1 -1
  138. package/lib/components/FormComponents/index.d.ts +1 -1
  139. package/lib/components/FormComponents/index.js +2 -2
  140. package/lib/components/FormComponents/index.js.map +1 -1
  141. package/lib/components/Iconify/Iconify.js +1 -1
  142. package/lib/components/Lists.styles.js +1 -1
  143. package/lib/components/Renderer/BaseRenderer.js +1 -1
  144. package/lib/components/Renderer/FormBodyCollapsible.js +1 -1
  145. package/lib/components/Renderer/FormBodySingleCollapsible.js +1 -1
  146. package/lib/components/Renderer/FormBodySingleCollapsibleWrapper.js +1 -1
  147. package/lib/components/Renderer/FormBodyTabbed.js +1 -1
  148. package/lib/components/Renderer/FormTitle.js +1 -1
  149. package/lib/components/Renderer/FormTopLevelItem.js +1 -1
  150. package/lib/components/Renderer/SmartFormsRenderer.js +1 -1
  151. package/lib/components/Renderer/index.js +1 -1
  152. package/lib/components/Tabs/CompleteTabButton.js +1 -1
  153. package/lib/components/Tabs/FormBodySingleTab.js +1 -1
  154. package/lib/components/Tabs/FormBodyTabList.js +1 -1
  155. package/lib/components/Tabs/FormBodyTabListWrapper.js +1 -1
  156. package/lib/components/Tabs/ShowCompletedTabsSection.js +1 -1
  157. package/lib/components/index.js +1 -1
  158. package/lib/hooks/useAttachmentUrlValidation.js +1 -1
  159. package/lib/hooks/useContextDisplayItems.js +1 -1
  160. package/lib/hooks/useDateTimeNonEmpty.d.ts +2 -0
  161. package/lib/{components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.js → hooks/useDateTimeNonEmpty.js} +9 -3
  162. package/lib/hooks/useDateTimeNonEmpty.js.map +1 -0
  163. package/lib/hooks/useDateValidation.js +3 -3
  164. package/lib/hooks/useDateValidation.js.map +1 -1
  165. package/lib/hooks/useDebounce.js +1 -1
  166. package/lib/hooks/useDecimalCalculatedExpression.js +1 -1
  167. package/lib/hooks/useGroupTableRows.js +1 -1
  168. package/lib/hooks/useHidden.js +1 -1
  169. package/lib/hooks/useInitialiseGroupTable.js +1 -1
  170. package/lib/hooks/useInitialiseRenderer.js +1 -1
  171. package/lib/hooks/useInitialiseRepeatAnswers.js +1 -1
  172. package/lib/hooks/useInitialiseRepeatGroups.js +1 -1
  173. package/lib/hooks/useIntegerCalculatedExpression.js +1 -1
  174. package/lib/hooks/useNumberInput.js +1 -1
  175. package/lib/hooks/useQueryClient.js +1 -1
  176. package/lib/hooks/useReadOnly.js +1 -1
  177. package/lib/hooks/useRenderingExtensions.js +1 -1
  178. package/lib/hooks/useResponsive.js +1 -1
  179. package/lib/hooks/useSliderExtensions.js +1 -1
  180. package/lib/hooks/useStringCalculatedExpression.js +1 -1
  181. package/lib/hooks/useStringInput.js +1 -1
  182. package/lib/hooks/useTerminologyServerQuery.js +1 -1
  183. package/lib/hooks/useTimeValidation.d.ts +5 -0
  184. package/lib/hooks/useTimeValidation.js +54 -0
  185. package/lib/hooks/useTimeValidation.js.map +1 -0
  186. package/lib/hooks/useValidationFeedback.js +1 -1
  187. package/lib/hooks/useValueSetCodings.js +1 -1
  188. package/lib/interfaces/answerExpression.interface.js +1 -1
  189. package/lib/interfaces/choice.enum.js +1 -1
  190. package/lib/interfaces/enableWhen.interface.d.ts +11 -3
  191. package/lib/interfaces/enableWhen.interface.js +1 -1
  192. package/lib/interfaces/groupTable.interface.js +1 -1
  193. package/lib/interfaces/index.d.ts +1 -1
  194. package/lib/interfaces/populate.interface.js +1 -1
  195. package/lib/interfaces/questionnaireStore.interface.d.ts +2 -2
  196. package/lib/interfaces/questionnaireStore.interface.js +1 -1
  197. package/lib/interfaces/regex.interface.js +1 -1
  198. package/lib/interfaces/renderProps.interface.js +1 -1
  199. package/lib/interfaces/repeatGroup.interface.js +1 -1
  200. package/lib/interfaces/valueSet.interface.js +1 -1
  201. package/lib/interfaces/variables.interface.js +1 -1
  202. package/lib/stores/questionnaireResponseStore.js +1 -1
  203. package/lib/stores/questionnaireStore.d.ts +3 -3
  204. package/lib/stores/questionnaireStore.js +21 -6
  205. package/lib/stores/questionnaireStore.js.map +1 -1
  206. package/lib/stores/smartConfigStore.js +1 -1
  207. package/lib/stores/terminologyServerStore.js +1 -1
  208. package/lib/stories/MedicalHistoryTable.stories.js +1 -1
  209. package/lib/stories/SmartFormsRenderer.stories.js +1 -1
  210. package/lib/theme/customGlobalStyles.js +1 -1
  211. package/lib/theme/overrides/Accordion.js +1 -1
  212. package/lib/theme/overrides/Autocomplete.js +1 -1
  213. package/lib/theme/overrides/Button.js +1 -1
  214. package/lib/theme/overrides/Card.js +1 -1
  215. package/lib/theme/overrides/Input.js +1 -1
  216. package/lib/theme/overrides/Overrides.js +1 -1
  217. package/lib/theme/overrides/Paper.js +1 -1
  218. package/lib/theme/overrides/SpeedDial.js +1 -1
  219. package/lib/theme/overrides/Table.js +1 -1
  220. package/lib/theme/palette.js +1 -1
  221. package/lib/theme/shadows.js +1 -1
  222. package/lib/theme/typography.js +1 -1
  223. package/lib/utils/calculatedExpression.js +1 -1
  224. package/lib/utils/dayjsExtend.js +1 -1
  225. package/lib/utils/debounce.js +1 -1
  226. package/lib/utils/emptyResource.js +1 -1
  227. package/lib/utils/enableWhen.js +1 -1
  228. package/lib/utils/enableWhenExpression.d.ts +22 -5
  229. package/lib/utils/enableWhenExpression.js +98 -55
  230. package/lib/utils/enableWhenExpression.js.map +1 -1
  231. package/lib/utils/fhirpath.d.ts +3 -3
  232. package/lib/utils/fhirpath.js +1 -1
  233. package/lib/utils/formChanges.js +1 -1
  234. package/lib/utils/groupTable.js +1 -1
  235. package/lib/utils/index.js +1 -1
  236. package/lib/utils/initialise.d.ts +3 -3
  237. package/lib/utils/initialise.js +1 -1
  238. package/lib/utils/itemControl.js +1 -1
  239. package/lib/utils/mapItem.js +1 -1
  240. package/lib/utils/openChoice.js +1 -1
  241. package/lib/utils/parseInputs.js +1 -1
  242. package/lib/utils/populateContexts.js +1 -1
  243. package/lib/utils/qItem.d.ts +2 -2
  244. package/lib/utils/qItem.js +9 -9
  245. package/lib/utils/qItem.js.map +1 -1
  246. package/lib/utils/qrItem.js +1 -1
  247. package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js +1 -1
  248. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +2 -2
  249. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
  250. package/lib/utils/questionnaireStoreUtils/extractContainedValueSets.js +1 -1
  251. package/lib/utils/questionnaireStoreUtils/extractOtherExtensions.d.ts +5 -5
  252. package/lib/utils/questionnaireStoreUtils/extractOtherExtensions.js +99 -35
  253. package/lib/utils/questionnaireStoreUtils/extractOtherExtensions.js.map +1 -1
  254. package/lib/utils/questionnaireStoreUtils/extractTabs.js +1 -1
  255. package/lib/utils/questionnaireStoreUtils/extractVariables.js +1 -1
  256. package/lib/utils/questionnaireStoreUtils/resolveValueSets.js +1 -1
  257. package/lib/utils/removeEmptyAnswers.d.ts +2 -2
  258. package/lib/utils/removeEmptyAnswers.js +1 -1
  259. package/lib/utils/removeEmptyAnswers.js.map +1 -1
  260. package/lib/utils/repopulateItems.d.ts +2 -2
  261. package/lib/utils/repopulateItems.js +1 -1
  262. package/lib/utils/slider.js +1 -1
  263. package/lib/utils/tabs.d.ts +6 -6
  264. package/lib/utils/tabs.js +4 -19
  265. package/lib/utils/tabs.js.map +1 -1
  266. package/lib/utils/validateQuestionnaire.d.ts +2 -2
  267. package/lib/utils/validateQuestionnaire.js +1 -8
  268. package/lib/utils/validateQuestionnaire.js.map +1 -1
  269. package/lib/utils/valueSet.js +1 -1
  270. package/package.json +3 -3
  271. package/src/api/smartClient.ts +1 -1
  272. package/src/components/Alert.styles.ts +1 -1
  273. package/src/components/Box.styles.ts +1 -1
  274. package/src/components/FormComponents/AttachmentItem/AttachmentField.tsx +1 -1
  275. package/src/components/FormComponents/AttachmentItem/AttachmentFieldWrapper.tsx +1 -1
  276. package/src/components/FormComponents/AttachmentItem/AttachmentFileDropBox.tsx +1 -1
  277. package/src/components/FormComponents/AttachmentItem/AttachmentItem.tsx +1 -1
  278. package/src/components/FormComponents/AttachmentItem/AttachmentUrlField.tsx +1 -1
  279. package/src/components/FormComponents/BooleanItem/BooleanField.tsx +1 -1
  280. package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +1 -1
  281. package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.tsx +1 -1
  282. package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +1 -1
  283. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +1 -1
  284. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +1 -1
  285. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +1 -1
  286. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +1 -1
  287. package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +1 -1
  288. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +1 -1
  289. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +1 -1
  290. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +1 -1
  291. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +1 -1
  292. package/src/components/FormComponents/ChoiceItems/ChoiceRadioSingle.tsx +1 -1
  293. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +1 -1
  294. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +1 -1
  295. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +1 -1
  296. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +1 -1
  297. package/src/components/FormComponents/DateTimeItem/DateTimeField.tsx +1 -1
  298. package/src/components/FormComponents/DateTimeItem/DateTimeItem.tsx +1 -1
  299. package/src/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/CustomDateField.tsx +1 -1
  300. package/src/components/FormComponents/{CustomDateItem → DateTimeItems/CustomDateItem}/CustomDateItem.tsx +15 -15
  301. package/src/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/DatePicker.tsx +1 -2
  302. package/src/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/DatePickerButton.tsx +18 -1
  303. package/src/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/MuiDatePicker.ts +1 -1
  304. package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.tsx +222 -0
  305. package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomTimeField.tsx +117 -0
  306. package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/DateTimeField.tsx +96 -0
  307. package/src/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems}/index.ts +1 -1
  308. package/src/components/FormComponents/{CustomDateItem → DateTimeItems/utils}/index.ts +2 -2
  309. package/src/components/FormComponents/{CustomDateItem/customDateTimePicker/utils/parseDates.ts → DateTimeItems/utils/parseDate.ts} +10 -10
  310. package/src/components/FormComponents/DateTimeItems/utils/parseTime.ts +127 -0
  311. package/src/components/FormComponents/DecimalItem/DecimalField.tsx +1 -1
  312. package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +1 -1
  313. package/src/components/FormComponents/DisplayItem/DisplayInstructions.styles.ts +1 -1
  314. package/src/components/FormComponents/DisplayItem/DisplayInstructions.tsx +1 -1
  315. package/src/components/FormComponents/DisplayItem/DisplayItem.tsx +1 -1
  316. package/src/components/FormComponents/GridGroup/GridGroup.tsx +1 -1
  317. package/src/components/FormComponents/GridGroup/GridRow.tsx +1 -1
  318. package/src/components/FormComponents/GridGroup/GridTable.tsx +1 -1
  319. package/src/components/FormComponents/GridGroup/index.ts +1 -1
  320. package/src/components/FormComponents/GroupItem/GroupHeading.tsx +1 -1
  321. package/src/components/FormComponents/GroupItem/GroupItem.styles.ts +1 -1
  322. package/src/components/FormComponents/GroupItem/GroupItem.tsx +1 -1
  323. package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +1 -1
  324. package/src/components/FormComponents/GroupItem/NextTabButton.tsx +1 -1
  325. package/src/components/FormComponents/GroupItem/NextTabButtonWrapper.tsx +1 -1
  326. package/src/components/FormComponents/IntegerItem/IntegerField.tsx +1 -1
  327. package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +1 -1
  328. package/src/components/FormComponents/Item.styles.ts +1 -1
  329. package/src/components/FormComponents/ItemParts/CheckboxSingle.tsx +1 -1
  330. package/src/components/FormComponents/ItemParts/CheckboxSingleWithOpenLabel.tsx +1 -1
  331. package/src/components/FormComponents/ItemParts/ContextDisplayItem.tsx +1 -1
  332. package/src/components/FormComponents/ItemParts/FadingCheckIcon.tsx +1 -1
  333. package/src/components/FormComponents/ItemParts/ItemFieldGrid.tsx +1 -1
  334. package/src/components/FormComponents/ItemParts/ItemLabelText.tsx +1 -1
  335. package/src/components/FormComponents/ItemParts/ItemLabelWrapper.tsx +1 -1
  336. package/src/components/FormComponents/ItemParts/RadioAnswerOptionButtons.tsx +1 -1
  337. package/src/components/FormComponents/ItemParts/RadioButtonWithOpenLabel.tsx +1 -1
  338. package/src/components/FormComponents/Lists.styles.ts +1 -1
  339. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +1 -1
  340. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +1 -1
  341. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +1 -1
  342. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +1 -1
  343. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +1 -1
  344. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +1 -1
  345. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +1 -1
  346. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +1 -1
  347. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +1 -1
  348. package/src/components/FormComponents/RepeatGroup/AddItemButton.tsx +1 -1
  349. package/src/components/FormComponents/RepeatGroup/DeleteItemButton.tsx +1 -1
  350. package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +1 -1
  351. package/src/components/FormComponents/RepeatGroup/RepeatGroupItem.tsx +1 -1
  352. package/src/components/FormComponents/RepeatGroup/index.ts +1 -1
  353. package/src/components/FormComponents/RepeatItem/AddItemButton.tsx +1 -1
  354. package/src/components/FormComponents/RepeatItem/RemoveItemButton.tsx +1 -1
  355. package/src/components/FormComponents/RepeatItem/RepeatField.tsx +1 -1
  356. package/src/components/FormComponents/RepeatItem/RepeatItem.styles.tsx +1 -1
  357. package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +1 -1
  358. package/src/components/FormComponents/RepeatItem/index.ts +1 -1
  359. package/src/components/FormComponents/SingleItem/SingleItem.tsx +1 -1
  360. package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +4 -4
  361. package/src/components/FormComponents/SingleItem/index.ts +1 -1
  362. package/src/components/FormComponents/SliderItem/Slider.styles.ts +1 -1
  363. package/src/components/FormComponents/SliderItem/SliderDisplayValue.tsx +1 -1
  364. package/src/components/FormComponents/SliderItem/SliderField.tsx +1 -1
  365. package/src/components/FormComponents/SliderItem/SliderItem.tsx +1 -1
  366. package/src/components/FormComponents/SliderItem/SliderLabels.tsx +1 -1
  367. package/src/components/FormComponents/StringItem/StringField.tsx +1 -1
  368. package/src/components/FormComponents/StringItem/StringItem.tsx +1 -1
  369. package/src/components/FormComponents/Tables/AddRowButton.tsx +1 -1
  370. package/src/components/FormComponents/Tables/GroupTable.tsx +1 -1
  371. package/src/components/FormComponents/Tables/GroupTableBody.tsx +1 -1
  372. package/src/components/FormComponents/Tables/GroupTableRow.tsx +1 -1
  373. package/src/components/FormComponents/Tables/GroupTableRowCells.tsx +1 -1
  374. package/src/components/FormComponents/Tables/GroupTableView.tsx +1 -1
  375. package/src/components/FormComponents/Tables/RemoveRowButton.tsx +1 -1
  376. package/src/components/FormComponents/Tables/SelectRowButton.tsx +1 -1
  377. package/src/components/FormComponents/Tables/Table.styles.tsx +1 -1
  378. package/src/components/FormComponents/Tables/index.ts +1 -1
  379. package/src/components/FormComponents/TextItem/MuiTextField.ts +1 -1
  380. package/src/components/FormComponents/TextItem/TextField.tsx +1 -1
  381. package/src/components/FormComponents/TextItem/TextItem.tsx +1 -1
  382. package/src/components/FormComponents/Textfield.styles.ts +1 -1
  383. package/src/components/FormComponents/TimeItem/TimeField.tsx +1 -1
  384. package/src/components/FormComponents/TimeItem/TimeItem.tsx +1 -1
  385. package/src/components/FormComponents/UrlItem/UrlField.tsx +1 -1
  386. package/src/components/FormComponents/UrlItem/UrlItem.tsx +1 -1
  387. package/src/components/FormComponents/index.ts +2 -2
  388. package/src/components/Iconify/Iconify.tsx +1 -1
  389. package/src/components/Lists.styles.ts +1 -1
  390. package/src/components/Renderer/BaseRenderer.tsx +1 -1
  391. package/src/components/Renderer/FormBodyCollapsible.tsx +1 -1
  392. package/src/components/Renderer/FormBodySingleCollapsible.tsx +1 -1
  393. package/src/components/Renderer/FormBodySingleCollapsibleWrapper.tsx +1 -1
  394. package/src/components/Renderer/FormBodyTabbed.tsx +1 -1
  395. package/src/components/Renderer/FormTitle.tsx +1 -1
  396. package/src/components/Renderer/FormTopLevelItem.tsx +1 -1
  397. package/src/components/Renderer/SmartFormsRenderer.tsx +1 -1
  398. package/src/components/Renderer/index.ts +1 -1
  399. package/src/components/Tabs/CompleteTabButton.tsx +1 -1
  400. package/src/components/Tabs/FormBodySingleTab.tsx +1 -1
  401. package/src/components/Tabs/FormBodyTabList.tsx +1 -1
  402. package/src/components/Tabs/FormBodyTabListWrapper.tsx +1 -1
  403. package/src/components/Tabs/ShowCompletedTabsSection.tsx +1 -1
  404. package/src/components/index.ts +1 -1
  405. package/src/hooks/useAttachmentUrlValidation.ts +1 -1
  406. package/src/hooks/useContextDisplayItems.ts +1 -1
  407. package/src/{components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.ts → hooks/useDateTimeNonEmpty.ts} +15 -2
  408. package/src/hooks/useDateValidation.tsx +3 -3
  409. package/src/hooks/useDebounce.ts +1 -1
  410. package/src/hooks/useDecimalCalculatedExpression.ts +1 -1
  411. package/src/hooks/useGroupTableRows.ts +1 -1
  412. package/src/hooks/useHidden.ts +1 -1
  413. package/src/hooks/useInitialiseGroupTable.ts +1 -1
  414. package/src/hooks/useInitialiseRenderer.ts +1 -1
  415. package/src/hooks/useInitialiseRepeatAnswers.ts +1 -1
  416. package/src/hooks/useInitialiseRepeatGroups.ts +1 -1
  417. package/src/hooks/useIntegerCalculatedExpression.ts +1 -1
  418. package/src/hooks/useNumberInput.ts +1 -1
  419. package/src/hooks/useQueryClient.ts +1 -1
  420. package/src/hooks/useReadOnly.ts +1 -1
  421. package/src/hooks/useRenderingExtensions.ts +1 -1
  422. package/src/hooks/useResponsive.ts +1 -1
  423. package/src/hooks/useSliderExtensions.ts +1 -1
  424. package/src/hooks/useStringCalculatedExpression.ts +1 -1
  425. package/src/hooks/useStringInput.ts +1 -1
  426. package/src/hooks/useTerminologyServerQuery.ts +1 -1
  427. package/src/hooks/useTimeValidation.tsx +70 -0
  428. package/src/hooks/useValidationFeedback.ts +1 -1
  429. package/src/hooks/useValueSetCodings.ts +1 -1
  430. package/src/interfaces/answerExpression.interface.ts +1 -1
  431. package/src/interfaces/choice.enum.ts +1 -1
  432. package/src/interfaces/enableWhen.interface.ts +14 -4
  433. package/src/interfaces/groupTable.interface.ts +1 -1
  434. package/src/interfaces/index.ts +4 -2
  435. package/src/interfaces/populate.interface.ts +1 -1
  436. package/src/interfaces/questionnaireStore.interface.ts +3 -3
  437. package/src/interfaces/regex.interface.ts +1 -1
  438. package/src/interfaces/renderProps.interface.ts +1 -1
  439. package/src/interfaces/repeatGroup.interface.ts +1 -1
  440. package/src/interfaces/tab.interface.ts +1 -1
  441. package/src/interfaces/valueSet.interface.ts +1 -1
  442. package/src/interfaces/variables.interface.ts +1 -1
  443. package/src/stores/questionnaireResponseStore.ts +1 -1
  444. package/src/stores/questionnaireStore.ts +24 -8
  445. package/src/stores/smartConfigStore.ts +1 -1
  446. package/src/stores/terminologyServerStore.ts +1 -1
  447. package/src/stories/MedicalHistoryTable.stories.tsx +1 -1
  448. package/src/stories/SmartFormsRenderer.stories.ts +1 -1
  449. package/src/theme/Theme.tsx +1 -1
  450. package/src/theme/customGlobalStyles.tsx +1 -1
  451. package/src/theme/overrides/Accordion.ts +1 -1
  452. package/src/theme/overrides/Autocomplete.ts +1 -1
  453. package/src/theme/overrides/Button.ts +1 -1
  454. package/src/theme/overrides/Card.ts +1 -1
  455. package/src/theme/overrides/Input.ts +1 -1
  456. package/src/theme/overrides/Overrides.ts +1 -1
  457. package/src/theme/overrides/Paper.ts +1 -1
  458. package/src/theme/overrides/SpeedDial.ts +1 -1
  459. package/src/theme/overrides/Table.ts +1 -1
  460. package/src/theme/palette.ts +1 -1
  461. package/src/theme/shadows.ts +1 -1
  462. package/src/theme/typography.ts +1 -1
  463. package/src/utils/calculatedExpression.ts +1 -1
  464. package/src/utils/choice.ts +1 -1
  465. package/src/utils/dayjsExtend.ts +1 -1
  466. package/src/utils/debounce.ts +1 -1
  467. package/src/utils/emptyResource.ts +1 -1
  468. package/src/utils/enableWhen.ts +1 -1
  469. package/src/utils/enableWhenExpression.ts +215 -79
  470. package/src/utils/fhirpath.ts +4 -4
  471. package/src/utils/formChanges.ts +1 -1
  472. package/src/utils/groupTable.ts +1 -1
  473. package/src/utils/index.ts +1 -1
  474. package/src/utils/initialise.ts +4 -4
  475. package/src/utils/itemControl.ts +1 -1
  476. package/src/utils/mapItem.ts +1 -1
  477. package/src/utils/openChoice.ts +1 -1
  478. package/src/utils/parseInputs.ts +1 -1
  479. package/src/utils/populateContexts.ts +1 -1
  480. package/src/utils/qItem.ts +12 -12
  481. package/src/utils/qrItem.ts +1 -1
  482. package/src/utils/questionnaireStoreUtils/addAdditionalVariables.ts +1 -1
  483. package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +2 -2
  484. package/src/utils/questionnaireStoreUtils/extractContainedValueSets.ts +1 -1
  485. package/src/utils/questionnaireStoreUtils/extractOtherExtensions.ts +160 -40
  486. package/src/utils/questionnaireStoreUtils/extractTabs.ts +1 -1
  487. package/src/utils/questionnaireStoreUtils/extractVariables.ts +1 -1
  488. package/src/utils/questionnaireStoreUtils/resolveValueSets.ts +1 -1
  489. package/src/utils/removeEmptyAnswers.ts +5 -5
  490. package/src/utils/repopulateItems.ts +5 -5
  491. package/src/utils/slider.ts +1 -1
  492. package/src/utils/tabs.ts +10 -25
  493. package/src/utils/validateQuestionnaire.ts +4 -12
  494. package/src/utils/valueSet.ts +1 -1
  495. package/lib/components/FormComponents/CustomDateItem/CustomDateItem.js.map +0 -1
  496. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.js.map +0 -1
  497. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.js.map +0 -1
  498. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.js +0 -13
  499. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.js.map +0 -1
  500. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.js.map +0 -1
  501. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/index.js.map +0 -1
  502. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.d.ts +0 -1
  503. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.js.map +0 -1
  504. package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.js.map +0 -1
  505. package/lib/components/FormComponents/CustomDateItem/index.d.ts +0 -1
  506. package/lib/components/FormComponents/CustomDateItem/index.js.map +0 -1
  507. package/lib/components/FormComponents/DateItem/DateField.d.ts +0 -12
  508. package/lib/components/FormComponents/DateItem/DateItem.d.ts +0 -9
  509. package/lib/components/FormComponents/ItemParts/ItemExtensionLabels.d.ts +0 -7
  510. /package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/CustomDateField.d.ts +0 -0
  511. /package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/DatePicker.d.ts +0 -0
  512. /package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/DatePickerButton.d.ts +0 -0
  513. /package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems/CustomDateItem}/MuiDatePicker.d.ts +0 -0
  514. /package/lib/components/FormComponents/{CustomDateItem/customDateTimePicker → DateTimeItems}/index.d.ts +0 -0
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import React, { Dispatch, SetStateAction } from 'react';
19
+ import type { PropsWithIsTabledAttribute } from '../../../../interfaces/renderProps.interface';
20
+ import CustomDateField from '../CustomDateItem/CustomDateField';
21
+ import CustomTimeField from './CustomTimeField';
22
+ import Stack from '@mui/material/Stack';
23
+
24
+ interface DateTimeFieldProps extends PropsWithIsTabledAttribute {
25
+ linkId: string;
26
+ displayDate: string;
27
+ dateInput: string;
28
+ timeInput: string;
29
+ periodInput: string;
30
+ is24HourNotation: boolean;
31
+ dateFeedback: string;
32
+ timeFeedback: string;
33
+ dateFocused: boolean;
34
+ displayPrompt: string;
35
+ entryFormat: string;
36
+ readOnly: boolean;
37
+ onDateInputChange: (newDateInput: string) => void;
38
+ onSelectDate: (selectedDate: string) => void;
39
+ setDateFocused: Dispatch<SetStateAction<boolean>>;
40
+ onTimeInputChange: (newTimeInput: string, newPeriodInput: string) => void;
41
+ }
42
+
43
+ function DateTimeField(props: DateTimeFieldProps) {
44
+ const {
45
+ linkId,
46
+ displayDate,
47
+ dateInput,
48
+ timeInput,
49
+ periodInput,
50
+ is24HourNotation,
51
+ dateFeedback,
52
+ timeFeedback,
53
+ dateFocused,
54
+ displayPrompt,
55
+ entryFormat,
56
+ readOnly,
57
+ isTabled,
58
+ onDateInputChange,
59
+ onSelectDate,
60
+ setDateFocused,
61
+ onTimeInputChange
62
+ } = props;
63
+
64
+ return (
65
+ <Stack rowGap={1}>
66
+ <CustomDateField
67
+ linkId={linkId}
68
+ valueDate={displayDate}
69
+ input={dateInput}
70
+ feedback={dateFeedback ?? ''}
71
+ isFocused={dateFocused}
72
+ displayPrompt={displayPrompt}
73
+ entryFormat={entryFormat}
74
+ readOnly={readOnly}
75
+ isTabled={isTabled}
76
+ setFocused={setDateFocused}
77
+ onInputChange={onDateInputChange}
78
+ onSelectDate={onSelectDate}
79
+ />
80
+ <CustomTimeField
81
+ linkId={linkId}
82
+ timeInput={timeInput}
83
+ periodInput={periodInput}
84
+ is24HourNotation={is24HourNotation}
85
+ feedback={timeFeedback ?? ''}
86
+ displayPrompt={displayPrompt}
87
+ readOnly={readOnly}
88
+ isTabled={isTabled}
89
+ onTimeInputChange={(newTimeInput) => onTimeInputChange(newTimeInput, periodInput)}
90
+ onPeriodChange={(newPeriodInput) => onTimeInputChange(timeInput, newPeriodInput)}
91
+ />
92
+ </Stack>
93
+ );
94
+ }
95
+
96
+ export default DateTimeField;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,4 +15,4 @@
15
15
  * limitations under the License.
16
16
  */
17
17
 
18
- export * from './customDateTimePicker';
18
+ export { parseFhirDateToDisplayDate } from './parseDate';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,31 +19,31 @@ import dayjs from 'dayjs';
19
19
 
20
20
  const inputMatchRegex = /(\d{4}|\d{3}|\d{2})/g;
21
21
 
22
- export function validateInput(input: string) {
22
+ export function validateDateInput(input: string) {
23
23
  const matches = input.match(inputMatchRegex);
24
24
 
25
25
  if (!matches) {
26
26
  return false;
27
27
  }
28
28
 
29
- const seperator = input.includes('/') ? '/' : null;
29
+ const separator = input.includes('/') ? '/' : null;
30
30
 
31
31
  if (matches.length === 1) {
32
- // seperator not supposed to be present if only one match present
33
- if (seperator) {
32
+ // separator not supposed to be present if only one match present
33
+ if (separator) {
34
34
  return false;
35
35
  }
36
36
 
37
37
  return matches[0].length === 4;
38
38
  }
39
39
 
40
- // Invalid if seperator is not present
41
- if (!seperator) {
40
+ // Invalid if separator is not present
41
+ if (!separator) {
42
42
  return false;
43
43
  }
44
44
 
45
45
  // Invalid if num of slots don't match the number of regex matches
46
- const slotsMatched = input.split(seperator);
46
+ const slotsMatched = input.split(separator);
47
47
  if (slotsMatched.length != matches.length) {
48
48
  return false;
49
49
  }
@@ -95,7 +95,7 @@ export function getNumOfSeparators(valueDate: string, seperator: string) {
95
95
 
96
96
  export function parseFhirDateToDisplayDate(fhirDate: string): {
97
97
  displayDate: string;
98
- parseFail?: boolean;
98
+ dateParseFail?: boolean;
99
99
  } {
100
100
  if (fhirDate.length === 0) {
101
101
  return { displayDate: '' };
@@ -122,7 +122,7 @@ export function parseFhirDateToDisplayDate(fhirDate: string): {
122
122
  return { displayDate: oneMatchDate.format('YYYY') };
123
123
  }
124
124
 
125
- return { displayDate: fhirDate, parseFail: true };
125
+ return { displayDate: fhirDate, dateParseFail: true };
126
126
  }
127
127
 
128
128
  export function parseInputDateToFhirDate(displayDate: string) {
@@ -0,0 +1,127 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import type { Dayjs } from 'dayjs';
19
+ import dayjs from 'dayjs';
20
+
21
+ const inputMatchRegex = /^\d{2}:\d{2}$/;
22
+
23
+ export function getTimeSegments(timeInput: string): {
24
+ hourSegment: string | null;
25
+ minuteSegment: string | null;
26
+ } {
27
+ if (!inputMatchRegex.test(timeInput)) {
28
+ return { hourSegment: null, minuteSegment: null };
29
+ }
30
+
31
+ const timeInputSegments = timeInput.split(':');
32
+ if (timeInputSegments.length !== 2) {
33
+ return { hourSegment: null, minuteSegment: null };
34
+ }
35
+
36
+ return { hourSegment: timeInputSegments[0], minuteSegment: timeInputSegments[1] };
37
+ }
38
+
39
+ export function validateTimeInput(
40
+ timeInput: string,
41
+ periodInput: string
42
+ ): {
43
+ timeIsValid: boolean;
44
+ is24HourNotation: boolean;
45
+ } {
46
+ // Test time input is valid
47
+ const { hourSegment, minuteSegment } = getTimeSegments(timeInput);
48
+
49
+ if (!hourSegment || !minuteSegment) {
50
+ return { timeIsValid: false, is24HourNotation: false };
51
+ }
52
+
53
+ const { hourSegmentValid, is24HourNotation } = validateHourSegment(hourSegment);
54
+ const minuteSegmentValid = validateMinuteSegment(minuteSegment);
55
+
56
+ if (!hourSegmentValid || !minuteSegmentValid) {
57
+ return { timeIsValid: false, is24HourNotation: false };
58
+ }
59
+
60
+ // Test period input is valid
61
+ if (!(periodInput === 'AM' || periodInput === 'PM' || is24HourNotation)) {
62
+ return { timeIsValid: false, is24HourNotation: false };
63
+ }
64
+
65
+ return { timeIsValid: true, is24HourNotation: !!is24HourNotation };
66
+ }
67
+
68
+ export function validateHourSegment(hourSegment: string): {
69
+ hourSegmentValid: boolean;
70
+ is24HourNotation: boolean | null;
71
+ } {
72
+ const hour = parseInt(hourSegment, 10);
73
+ const hourSegmentValid = hour >= 0 && hour <= 23;
74
+ const is24HourNotation = hourSegmentValid ? hour >= 13 && hour <= 23 : null;
75
+
76
+ return { hourSegmentValid, is24HourNotation };
77
+ }
78
+
79
+ function validateMinuteSegment(minuteSegment: string) {
80
+ const minutes = parseInt(minuteSegment, 10);
81
+ return minutes >= 0 && minutes <= 59;
82
+ }
83
+
84
+ export function parseDateTimeToDisplayTime(dateTime: Dayjs | null): {
85
+ displayTime: string;
86
+ displayPeriod: string;
87
+ timeParseFail?: boolean;
88
+ } {
89
+ if (!dateTime) {
90
+ return { displayTime: '', displayPeriod: '' };
91
+ }
92
+
93
+ if (!dateTime.isValid()) {
94
+ return { displayTime: '', displayPeriod: '', timeParseFail: true };
95
+ }
96
+
97
+ const displayTime = dateTime.format('HH:mm');
98
+ const displayPeriod = dateTime.format('A');
99
+
100
+ return { displayTime, displayPeriod };
101
+ }
102
+
103
+ function convertTo12HourFormat(timeInput: string) {
104
+ const timeSegments = timeInput.split(':');
105
+ const hour = parseInt(timeSegments[0], 10);
106
+ if (hour >= 12) {
107
+ timeSegments[0] = `${hour - 12}`;
108
+ }
109
+ return `${timeSegments[0]}:${timeSegments[1]}`;
110
+ }
111
+
112
+ export function parseInputDateTimeToFhirDateTime(
113
+ dateInput: string,
114
+ newTimeInput: string,
115
+ periodInput: string,
116
+ is24HourNotation: boolean
117
+ ) {
118
+ periodInput = is24HourNotation ? 'PM' : periodInput;
119
+ const new12HourTimeInput = convertTo12HourFormat(newTimeInput);
120
+
121
+ const dateTimeDayJs = dayjs(
122
+ `${dateInput} ${new12HourTimeInput} ${periodInput}`,
123
+ `YYYY-MM-DD hh:mm A`
124
+ );
125
+
126
+ return dayjs(dateTimeDayJs).format('YYYY-MM-DDTHH:mm:ssZ');
127
+ }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Commonwealth Scientific and Industrial Research
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
3
  * Organisation (CSIRO) ABN 41 687 119 230.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");