@medplum/react 2.0.24 → 2.0.25

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 (331) hide show
  1. package/dist/cjs/index.cjs +11 -7714
  2. package/dist/cjs/index.cjs.map +7 -1
  3. package/dist/esm/index.mjs +67 -92
  4. package/dist/esm/index.mjs.map +7 -1
  5. package/package.json +5 -8
  6. package/dist/cjs/index.min.cjs +0 -1
  7. package/dist/esm/AddressDisplay/AddressDisplay.mjs +0 -13
  8. package/dist/esm/AddressDisplay/AddressDisplay.mjs.map +0 -1
  9. package/dist/esm/AddressInput/AddressInput.mjs +0 -57
  10. package/dist/esm/AddressInput/AddressInput.mjs.map +0 -1
  11. package/dist/esm/AnnotationInput/AnnotationInput.mjs +0 -28
  12. package/dist/esm/AnnotationInput/AnnotationInput.mjs.map +0 -1
  13. package/dist/esm/AppShell/AppShell.mjs +0 -37
  14. package/dist/esm/AppShell/AppShell.mjs.map +0 -1
  15. package/dist/esm/AppShell/Header.mjs +0 -88
  16. package/dist/esm/AppShell/Header.mjs.map +0 -1
  17. package/dist/esm/AppShell/HeaderSearchInput.mjs +0 -230
  18. package/dist/esm/AppShell/HeaderSearchInput.mjs.map +0 -1
  19. package/dist/esm/AppShell/Navbar.mjs +0 -169
  20. package/dist/esm/AppShell/Navbar.mjs.map +0 -1
  21. package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +0 -121
  22. package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +0 -1
  23. package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs +0 -10
  24. package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +0 -1
  25. package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs +0 -45
  26. package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs.map +0 -1
  27. package/dist/esm/AttachmentButton/AttachmentButton.mjs +0 -55
  28. package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +0 -1
  29. package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs +0 -21
  30. package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs.map +0 -1
  31. package/dist/esm/AttachmentInput/AttachmentInput.mjs +0 -27
  32. package/dist/esm/AttachmentInput/AttachmentInput.mjs.map +0 -1
  33. package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs +0 -49
  34. package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +0 -1
  35. package/dist/esm/BackboneElementInput/BackboneElementInput.mjs +0 -52
  36. package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +0 -1
  37. package/dist/esm/BookmarkDialog/BookmarkDialog.mjs +0 -47
  38. package/dist/esm/BookmarkDialog/BookmarkDialog.mjs.map +0 -1
  39. package/dist/esm/CalendarInput/CalendarInput.mjs +0 -133
  40. package/dist/esm/CalendarInput/CalendarInput.mjs.map +0 -1
  41. package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs +0 -12
  42. package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +0 -1
  43. package/dist/esm/CodeInput/CodeInput.mjs +0 -24
  44. package/dist/esm/CodeInput/CodeInput.mjs.map +0 -1
  45. package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs +0 -9
  46. package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs.map +0 -1
  47. package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs +0 -36
  48. package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs.map +0 -1
  49. package/dist/esm/CodingDisplay/CodingDisplay.mjs +0 -9
  50. package/dist/esm/CodingDisplay/CodingDisplay.mjs.map +0 -1
  51. package/dist/esm/CodingInput/CodingInput.mjs +0 -32
  52. package/dist/esm/CodingInput/CodingInput.mjs.map +0 -1
  53. package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs +0 -16
  54. package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs.map +0 -1
  55. package/dist/esm/ContactDetailInput/ContactDetailInput.mjs +0 -35
  56. package/dist/esm/ContactDetailInput/ContactDetailInput.mjs.map +0 -1
  57. package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs +0 -29
  58. package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs.map +0 -1
  59. package/dist/esm/ContactPointInput/ContactPointInput.mjs +0 -45
  60. package/dist/esm/ContactPointInput/ContactPointInput.mjs.map +0 -1
  61. package/dist/esm/Container/Container.mjs +0 -19
  62. package/dist/esm/Container/Container.mjs.map +0 -1
  63. package/dist/esm/DateTimeInput/DateTimeInput.mjs +0 -71
  64. package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +0 -1
  65. package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs +0 -16
  66. package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs.map +0 -1
  67. package/dist/esm/DescriptionList/DescriptionList.mjs +0 -35
  68. package/dist/esm/DescriptionList/DescriptionList.mjs.map +0 -1
  69. package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs +0 -172
  70. package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +0 -1
  71. package/dist/esm/Document/Document.mjs +0 -12
  72. package/dist/esm/Document/Document.mjs.map +0 -1
  73. package/dist/esm/EncounterTimeline/EncounterTimeline.mjs +0 -32
  74. package/dist/esm/EncounterTimeline/EncounterTimeline.mjs.map +0 -1
  75. package/dist/esm/ErrorBoundary/ErrorBoundary.mjs +0 -30
  76. package/dist/esm/ErrorBoundary/ErrorBoundary.mjs.map +0 -1
  77. package/dist/esm/ExtensionInput/ExtensionInput.mjs +0 -14
  78. package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +0 -1
  79. package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs +0 -23
  80. package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs.map +0 -1
  81. package/dist/esm/FhirPathTable/FhirPathTable.mjs +0 -122
  82. package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +0 -1
  83. package/dist/esm/Form/Form.mjs +0 -15
  84. package/dist/esm/Form/Form.mjs.map +0 -1
  85. package/dist/esm/Form/FormUtils.mjs +0 -50
  86. package/dist/esm/Form/FormUtils.mjs.map +0 -1
  87. package/dist/esm/FormSection/FormSection.mjs +0 -10
  88. package/dist/esm/FormSection/FormSection.mjs.map +0 -1
  89. package/dist/esm/GoogleButton/GoogleButton.mjs +0 -49
  90. package/dist/esm/GoogleButton/GoogleButton.mjs.map +0 -1
  91. package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs +0 -13
  92. package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs.map +0 -1
  93. package/dist/esm/HumanNameInput/HumanNameInput.mjs +0 -50
  94. package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +0 -1
  95. package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs +0 -11
  96. package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs.map +0 -1
  97. package/dist/esm/IdentifierInput/IdentifierInput.mjs +0 -18
  98. package/dist/esm/IdentifierInput/IdentifierInput.mjs.map +0 -1
  99. package/dist/esm/Loading/Loading.mjs +0 -10
  100. package/dist/esm/Loading/Loading.mjs.map +0 -1
  101. package/dist/esm/Logo/Logo.mjs +0 -14
  102. package/dist/esm/Logo/Logo.mjs.map +0 -1
  103. package/dist/esm/MedplumLink/MedplumLink.mjs +0 -52
  104. package/dist/esm/MedplumLink/MedplumLink.mjs.map +0 -1
  105. package/dist/esm/MedplumProvider/MedplumProvider.mjs +0 -84
  106. package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +0 -1
  107. package/dist/esm/MoneyDisplay/MoneyDisplay.mjs +0 -9
  108. package/dist/esm/MoneyDisplay/MoneyDisplay.mjs.map +0 -1
  109. package/dist/esm/MoneyInput/MoneyInput.mjs +0 -53
  110. package/dist/esm/MoneyInput/MoneyInput.mjs.map +0 -1
  111. package/dist/esm/NoteDisplay/NoteDisplay.mjs +0 -18
  112. package/dist/esm/NoteDisplay/NoteDisplay.mjs.map +0 -1
  113. package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs +0 -14
  114. package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs.map +0 -1
  115. package/dist/esm/Panel/Panel.mjs +0 -34
  116. package/dist/esm/Panel/Panel.mjs.map +0 -1
  117. package/dist/esm/PatientTimeline/PatientTimeline.mjs +0 -38
  118. package/dist/esm/PatientTimeline/PatientTimeline.mjs.map +0 -1
  119. package/dist/esm/PeriodInput/PeriodInput.mjs +0 -19
  120. package/dist/esm/PeriodInput/PeriodInput.mjs.map +0 -1
  121. package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs +0 -258
  122. package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +0 -1
  123. package/dist/esm/QuantityDisplay/QuantityDisplay.mjs +0 -9
  124. package/dist/esm/QuantityDisplay/QuantityDisplay.mjs.map +0 -1
  125. package/dist/esm/QuantityInput/QuantityInput.mjs +0 -40
  126. package/dist/esm/QuantityInput/QuantityInput.mjs.map +0 -1
  127. package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs +0 -288
  128. package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +0 -1
  129. package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs +0 -276
  130. package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +0 -1
  131. package/dist/esm/RangeDisplay/RangeDisplay.mjs +0 -9
  132. package/dist/esm/RangeDisplay/RangeDisplay.mjs.map +0 -1
  133. package/dist/esm/RangeInput/RangeInput.mjs +0 -31
  134. package/dist/esm/RangeInput/RangeInput.mjs.map +0 -1
  135. package/dist/esm/RatioDisplay/RatioDisplay.mjs +0 -16
  136. package/dist/esm/RatioDisplay/RatioDisplay.mjs.map +0 -1
  137. package/dist/esm/RatioInput/RatioInput.mjs +0 -31
  138. package/dist/esm/RatioInput/RatioInput.mjs.map +0 -1
  139. package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs +0 -21
  140. package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs.map +0 -1
  141. package/dist/esm/ReferenceInput/ReferenceInput.mjs +0 -45
  142. package/dist/esm/ReferenceInput/ReferenceInput.mjs.map +0 -1
  143. package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs +0 -286
  144. package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +0 -1
  145. package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs +0 -72
  146. package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs.map +0 -1
  147. package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs +0 -13
  148. package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs.map +0 -1
  149. package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs +0 -51
  150. package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs.map +0 -1
  151. package/dist/esm/ResourceAvatar/ResourceAvatar.mjs +0 -23
  152. package/dist/esm/ResourceAvatar/ResourceAvatar.mjs.map +0 -1
  153. package/dist/esm/ResourceBadge/ResourceBadge.mjs +0 -13
  154. package/dist/esm/ResourceBadge/ResourceBadge.mjs.map +0 -1
  155. package/dist/esm/ResourceBlame/ResourceBlame.mjs +0 -113
  156. package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +0 -1
  157. package/dist/esm/ResourceDiff/ResourceDiff.mjs +0 -39
  158. package/dist/esm/ResourceDiff/ResourceDiff.mjs.map +0 -1
  159. package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs +0 -80
  160. package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +0 -1
  161. package/dist/esm/ResourceForm/ResourceForm.mjs +0 -56
  162. package/dist/esm/ResourceForm/ResourceForm.mjs.map +0 -1
  163. package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs +0 -50
  164. package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs.map +0 -1
  165. package/dist/esm/ResourceInput/ResourceInput.mjs +0 -70
  166. package/dist/esm/ResourceInput/ResourceInput.mjs.map +0 -1
  167. package/dist/esm/ResourceName/ResourceName.mjs +0 -25
  168. package/dist/esm/ResourceName/ResourceName.mjs.map +0 -1
  169. package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +0 -119
  170. package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +0 -1
  171. package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +0 -171
  172. package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +0 -1
  173. package/dist/esm/ResourceTable/ResourceTable.mjs +0 -25
  174. package/dist/esm/ResourceTable/ResourceTable.mjs.map +0 -1
  175. package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +0 -309
  176. package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +0 -1
  177. package/dist/esm/Scheduler/Scheduler.mjs +0 -98
  178. package/dist/esm/Scheduler/Scheduler.mjs.map +0 -1
  179. package/dist/esm/SearchControl/SearchControl.mjs +0 -337
  180. package/dist/esm/SearchControl/SearchControl.mjs.map +0 -1
  181. package/dist/esm/SearchControl/SearchControlField.mjs +0 -95
  182. package/dist/esm/SearchControl/SearchControlField.mjs.map +0 -1
  183. package/dist/esm/SearchControl/SearchUtils.mjs +0 -497
  184. package/dist/esm/SearchControl/SearchUtils.mjs.map +0 -1
  185. package/dist/esm/SearchExportDialog/SearchExportDialog.mjs +0 -19
  186. package/dist/esm/SearchExportDialog/SearchExportDialog.mjs.map +0 -1
  187. package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +0 -196
  188. package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +0 -1
  189. package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs +0 -97
  190. package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +0 -1
  191. package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs +0 -22
  192. package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs.map +0 -1
  193. package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs +0 -22
  194. package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +0 -1
  195. package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs +0 -57
  196. package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +0 -1
  197. package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs +0 -134
  198. package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs.map +0 -1
  199. package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs +0 -36
  200. package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs.map +0 -1
  201. package/dist/esm/StatusBadge/StatusBadge.mjs +0 -63
  202. package/dist/esm/StatusBadge/StatusBadge.mjs.map +0 -1
  203. package/dist/esm/Timeline/Timeline.mjs +0 -40
  204. package/dist/esm/Timeline/Timeline.mjs.map +0 -1
  205. package/dist/esm/TimingInput/TimingInput.mjs +0 -76
  206. package/dist/esm/TimingInput/TimingInput.mjs.map +0 -1
  207. package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +0 -58
  208. package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +0 -1
  209. package/dist/esm/auth/AuthenticationForm.mjs +0 -89
  210. package/dist/esm/auth/AuthenticationForm.mjs.map +0 -1
  211. package/dist/esm/auth/ChooseProfileForm.mjs +0 -33
  212. package/dist/esm/auth/ChooseProfileForm.mjs.map +0 -1
  213. package/dist/esm/auth/ChooseScopeForm.mjs +0 -28
  214. package/dist/esm/auth/ChooseScopeForm.mjs.map +0 -1
  215. package/dist/esm/auth/MfaForm.mjs +0 -34
  216. package/dist/esm/auth/MfaForm.mjs.map +0 -1
  217. package/dist/esm/auth/NewProjectForm.mjs +0 -39
  218. package/dist/esm/auth/NewProjectForm.mjs.map +0 -1
  219. package/dist/esm/auth/NewUserForm.mjs +0 -84
  220. package/dist/esm/auth/NewUserForm.mjs.map +0 -1
  221. package/dist/esm/auth/RegisterForm.mjs +0 -39
  222. package/dist/esm/auth/RegisterForm.mjs.map +0 -1
  223. package/dist/esm/auth/SignInForm.mjs +0 -100
  224. package/dist/esm/auth/SignInForm.mjs.map +0 -1
  225. package/dist/esm/constants.mjs +0 -12
  226. package/dist/esm/constants.mjs.map +0 -1
  227. package/dist/esm/index.min.mjs +0 -1
  228. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs +0 -70
  229. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs.map +0 -1
  230. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs +0 -18
  231. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs.map +0 -1
  232. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs +0 -25
  233. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs.map +0 -1
  234. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs +0 -15
  235. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs.map +0 -1
  236. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs +0 -19
  237. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs.map +0 -1
  238. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs +0 -20
  239. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs.map +0 -1
  240. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs +0 -26
  241. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs.map +0 -1
  242. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs +0 -17
  243. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs.map +0 -1
  244. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs +0 -20
  245. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs.map +0 -1
  246. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs +0 -27
  247. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs.map +0 -1
  248. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs +0 -24
  249. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs.map +0 -1
  250. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs +0 -13
  251. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs.map +0 -1
  252. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs +0 -20
  253. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs.map +0 -1
  254. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.mjs +0 -13
  255. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.mjs.map +0 -1
  256. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs +0 -14
  257. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs.map +0 -1
  258. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs +0 -15
  259. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs.map +0 -1
  260. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs +0 -21
  261. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs.map +0 -1
  262. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs +0 -20
  263. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs.map +0 -1
  264. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs +0 -20
  265. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs.map +0 -1
  266. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs +0 -15
  267. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs.map +0 -1
  268. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs +0 -27
  269. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs.map +0 -1
  270. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs +0 -14
  271. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs.map +0 -1
  272. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs +0 -15
  273. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs.map +0 -1
  274. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs +0 -22
  275. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs.map +0 -1
  276. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs +0 -22
  277. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs.map +0 -1
  278. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs +0 -19
  279. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs.map +0 -1
  280. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs +0 -30
  281. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs.map +0 -1
  282. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconLogout.mjs +0 -21
  283. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconLogout.mjs.map +0 -1
  284. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs +0 -13
  285. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs.map +0 -1
  286. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs +0 -13
  287. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs.map +0 -1
  288. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs +0 -21
  289. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs.map +0 -1
  290. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs +0 -21
  291. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs.map +0 -1
  292. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs +0 -22
  293. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs.map +0 -1
  294. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.mjs +0 -14
  295. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.mjs.map +0 -1
  296. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.mjs +0 -14
  297. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.mjs.map +0 -1
  298. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs +0 -20
  299. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs.map +0 -1
  300. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs +0 -17
  301. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs.map +0 -1
  302. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs +0 -17
  303. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs.map +0 -1
  304. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs +0 -19
  305. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs.map +0 -1
  306. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSwitchHorizontal.mjs +0 -20
  307. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSwitchHorizontal.mjs.map +0 -1
  308. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs +0 -23
  309. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs.map +0 -1
  310. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs +0 -20
  311. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs.map +0 -1
  312. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs +0 -14
  313. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs.map +0 -1
  314. package/dist/esm/useResource/useResource.mjs +0 -68
  315. package/dist/esm/useResource/useResource.mjs.map +0 -1
  316. package/dist/esm/utils/blame.mjs +0 -72
  317. package/dist/esm/utils/blame.mjs.map +0 -1
  318. package/dist/esm/utils/date.mjs +0 -56
  319. package/dist/esm/utils/date.mjs.map +0 -1
  320. package/dist/esm/utils/diff.mjs +0 -118
  321. package/dist/esm/utils/diff.mjs.map +0 -1
  322. package/dist/esm/utils/dom.mjs +0 -34
  323. package/dist/esm/utils/dom.mjs.map +0 -1
  324. package/dist/esm/utils/outcomes.mjs +0 -30
  325. package/dist/esm/utils/outcomes.mjs.map +0 -1
  326. package/dist/esm/utils/questionnaire.mjs +0 -26
  327. package/dist/esm/utils/questionnaire.mjs.map +0 -1
  328. package/dist/esm/utils/recaptcha.mjs +0 -32
  329. package/dist/esm/utils/recaptcha.mjs.map +0 -1
  330. package/dist/esm/utils/script.mjs +0 -16
  331. package/dist/esm/utils/script.mjs.map +0 -1
@@ -1,309 +0,0 @@
1
- import { createStyles, Center, Loader, Group, TextInput, ActionIcon, ScrollArea, Menu } from '@mantine/core';
2
- import { updateNotification, showNotification } from '@mantine/notifications';
3
- import { normalizeErrorString, getReferenceString } from '@medplum/core';
4
- import React, { useRef, useState, useCallback, useEffect } from 'react';
5
- import { AttachmentButton } from '../AttachmentButton/AttachmentButton.mjs';
6
- import { AttachmentDisplay } from '../AttachmentDisplay/AttachmentDisplay.mjs';
7
- import { DiagnosticReportDisplay } from '../DiagnosticReportDisplay/DiagnosticReportDisplay.mjs';
8
- import { Form } from '../Form/Form.mjs';
9
- import { useMedplum, useMedplumNavigate } from '../MedplumProvider/MedplumProvider.mjs';
10
- import { Panel } from '../Panel/Panel.mjs';
11
- import { ResourceAvatar } from '../ResourceAvatar/ResourceAvatar.mjs';
12
- import { ResourceDiffTable } from '../ResourceDiffTable/ResourceDiffTable.mjs';
13
- import { ResourceTable } from '../ResourceTable/ResourceTable.mjs';
14
- import { Timeline, TimelineItem } from '../Timeline/Timeline.mjs';
15
- import { useResource } from '../useResource/useResource.mjs';
16
- import { sortByDateAndPriority } from '../utils/date.mjs';
17
- import IconMessage from '../node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs';
18
- import IconCloudUpload from '../node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs';
19
- import IconCheck from '../node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs';
20
- import IconFileAlert from '../node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs';
21
- import IconPin from '../node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs';
22
- import IconPinnedOff from '../node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs';
23
- import IconListDetails from '../node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs';
24
- import IconEdit from '../node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs';
25
- import IconTrash from '../node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs';
26
-
27
- const useStyles = createStyles((theme) => ({
28
- pinnedComment: {
29
- backgroundColor: theme.colors.blue[0],
30
- },
31
- }));
32
- function ResourceTimeline(props) {
33
- const medplum = useMedplum();
34
- const navigate = useMedplumNavigate();
35
- const sender = medplum.getProfile();
36
- const inputRef = useRef(null);
37
- const resource = useResource(props.value);
38
- const [history, setHistory] = useState();
39
- const [items, setItems] = useState([]);
40
- const loadTimelineResources = props.loadTimelineResources;
41
- const itemsRef = useRef(items);
42
- itemsRef.current = items;
43
- /**
44
- * Sorts and sets the items.
45
- *
46
- * Sorting is primarily a function of meta.lastUpdated, but there are special cases.
47
- * When displaying connected resources, for example a Communication in the context of an Encounter,
48
- * the Communication.sent time is used rather than Communication.meta.lastUpdated.
49
- *
50
- * Other examples of special cases:
51
- * - DiagnosticReport.issued
52
- * - Media.issued
53
- * - Observation.issued
54
- * - DocumentReference.date
55
- *
56
- * See "sortByDateAndPriority()" for more details.
57
- */
58
- const sortAndSetItems = useCallback((newItmes) => {
59
- sortByDateAndPriority(newItmes, resource);
60
- newItmes.reverse();
61
- setItems(newItmes);
62
- }, [resource]);
63
- /**
64
- * Handles a batch request response.
65
- * @param batchResponse The batch response.
66
- */
67
- const handleBatchResponse = useCallback((batchResponse) => {
68
- const newItems = [];
69
- for (const settledResult of batchResponse) {
70
- if (settledResult.status !== 'fulfilled') {
71
- // User may not have access to all resource types
72
- continue;
73
- }
74
- const bundle = settledResult.value;
75
- if (bundle.type === 'history') {
76
- setHistory(bundle);
77
- }
78
- if (bundle.entry) {
79
- for (const entry of bundle.entry) {
80
- newItems.push(entry.resource);
81
- }
82
- }
83
- }
84
- sortAndSetItems(newItems);
85
- }, [sortAndSetItems]);
86
- /**
87
- * Adds an array of resources to the timeline.
88
- * @param resource Resource to add.
89
- */
90
- const addResource = useCallback((resource) => sortAndSetItems([...itemsRef.current, resource]), [sortAndSetItems]);
91
- /**
92
- * Loads the timeline.
93
- */
94
- const loadTimeline = useCallback(() => {
95
- let resourceType;
96
- let id;
97
- if ('resourceType' in props.value) {
98
- resourceType = props.value.resourceType;
99
- id = props.value.id;
100
- }
101
- else {
102
- [resourceType, id] = props.value.reference?.split('/');
103
- }
104
- loadTimelineResources(medplum, resourceType, id).then(handleBatchResponse).catch(console.log);
105
- }, [medplum, props.value, loadTimelineResources, handleBatchResponse]);
106
- useEffect(() => loadTimeline(), [loadTimeline]);
107
- /**
108
- * Adds a Communication resource to the timeline.
109
- * @param contentString The comment content.
110
- */
111
- function createComment(contentString) {
112
- if (!resource || !props.createCommunication) {
113
- // Encounter not loaded yet
114
- return;
115
- }
116
- medplum
117
- .createResource(props.createCommunication(resource, sender, contentString))
118
- .then((result) => addResource(result))
119
- .catch(console.log);
120
- }
121
- /**
122
- * Adds a Media resource to the timeline.
123
- * @param attachment The media attachment.
124
- */
125
- function createMedia(attachment) {
126
- if (!resource || !props.createMedia) {
127
- // Encounter not loaded yet
128
- return;
129
- }
130
- medplum
131
- .createResource(props.createMedia(resource, sender, attachment))
132
- .then((result) => addResource(result))
133
- .then(() => updateNotification({
134
- id: 'upload-notification',
135
- color: 'teal',
136
- title: 'Upload complete',
137
- message: '',
138
- icon: React.createElement(IconCheck, { size: 16 }),
139
- autoClose: 2000,
140
- }))
141
- .catch((reason) => updateNotification({
142
- id: 'upload-notification',
143
- color: 'red',
144
- title: 'Upload error',
145
- message: normalizeErrorString(reason),
146
- icon: React.createElement(IconFileAlert, { size: 16 }),
147
- autoClose: 2000,
148
- }));
149
- }
150
- function setPriority(communication, priority) {
151
- return medplum.updateResource({ ...communication, priority });
152
- }
153
- function onPin(communication) {
154
- setPriority(communication, 'stat').then(loadTimeline).catch(console.log);
155
- }
156
- function onUnpin(communication) {
157
- setPriority(communication, 'routine').then(loadTimeline).catch(console.log);
158
- }
159
- function onDetails(timelineItem) {
160
- navigate(`/${timelineItem.resourceType}/${timelineItem.id}`);
161
- }
162
- function onEdit(timelineItem) {
163
- navigate(`/${timelineItem.resourceType}/${timelineItem.id}/edit`);
164
- }
165
- function onDelete(timelineItem) {
166
- navigate(`/${timelineItem.resourceType}/${timelineItem.id}/delete`);
167
- }
168
- function onVersionDetails(version) {
169
- navigate(`/${version.resourceType}/${version.id}/_history/${version.meta?.versionId}`);
170
- }
171
- function onUploadStart() {
172
- showNotification({
173
- id: 'upload-notification',
174
- loading: true,
175
- title: 'Initializing upload...',
176
- message: 'Please wait...',
177
- autoClose: false,
178
- withCloseButton: false,
179
- });
180
- }
181
- function onUploadProgress(e) {
182
- updateNotification({
183
- id: 'upload-notification',
184
- loading: true,
185
- title: 'Uploading...',
186
- message: getProgressMessage(e),
187
- autoClose: false,
188
- withCloseButton: false,
189
- });
190
- }
191
- if (!resource) {
192
- return (React.createElement(Center, { style: { width: '100%', height: '100%' } },
193
- React.createElement(Loader, null)));
194
- }
195
- return (React.createElement(Timeline, null,
196
- props.createCommunication && (React.createElement(Panel, null,
197
- React.createElement(Form, { testid: "timeline-form", onSubmit: (formData) => {
198
- createComment(formData.text);
199
- const input = inputRef.current;
200
- if (input) {
201
- input.value = '';
202
- input.focus();
203
- }
204
- } },
205
- React.createElement(Group, { spacing: "xs", noWrap: true, style: { width: '100%' } },
206
- React.createElement(ResourceAvatar, { value: sender }),
207
- React.createElement(TextInput, { name: "text", ref: inputRef, placeholder: "Add comment", style: { width: '100%', maxWidth: 300 } }),
208
- React.createElement(ActionIcon, { type: "submit", radius: "xl", color: "blue", variant: "filled" },
209
- React.createElement(IconMessage, { size: 16 })),
210
- React.createElement(AttachmentButton, { onUpload: createMedia, onUploadStart: onUploadStart, onUploadProgress: onUploadProgress }, (props) => (React.createElement(ActionIcon, { ...props, radius: "xl", color: "blue", variant: "filled" },
211
- React.createElement(IconCloudUpload, { size: 16 })))))))),
212
- items.map((item) => {
213
- if (!item) {
214
- // TODO: Handle null history items for deleted versions.
215
- return null;
216
- }
217
- const key = `${item.resourceType}/${item.id}/${item.meta?.versionId}`;
218
- if (item.resourceType === resource.resourceType && item.id === resource.id) {
219
- return (React.createElement(HistoryTimelineItem, { key: key, history: history, resource: item, onDetails: onVersionDetails }));
220
- }
221
- switch (item.resourceType) {
222
- case 'AuditEvent':
223
- return React.createElement(AuditEventTimelineItem, { key: key, resource: item, onDetails: onDetails });
224
- case 'Communication':
225
- return (React.createElement(CommunicationTimelineItem, { key: key, resource: item, onPin: item.priority !== 'stat' ? onPin : undefined, onUnpin: item.priority === 'stat' ? onUnpin : undefined, onDetails: onDetails, onEdit: onEdit, onDelete: onDelete }));
226
- case 'DiagnosticReport':
227
- return (React.createElement(DiagnosticReportTimelineItem, { key: key, resource: item, onDetails: onDetails, onEdit: onEdit, onDelete: onDelete }));
228
- case 'Media':
229
- return (React.createElement(MediaTimelineItem, { key: key, resource: item, onDetails: onDetails, onEdit: onEdit, onDelete: onDelete }));
230
- default:
231
- return (React.createElement(TimelineItem, { key: key, resource: item, padding: true },
232
- React.createElement(ResourceTable, { value: item, ignoreMissingValues: true })));
233
- }
234
- })));
235
- }
236
- function TimelineItemPopupMenu(props) {
237
- return (React.createElement(Menu.Dropdown, null,
238
- React.createElement(Menu.Label, null, "Resource"),
239
- props.onPin && (React.createElement(Menu.Item, { icon: React.createElement(IconPin, { size: 14 }), onClick: () => props.onPin(props.resource), "aria-label": `Pin ${getReferenceString(props.resource)}` }, "Pin")),
240
- props.onUnpin && (React.createElement(Menu.Item, { icon: React.createElement(IconPinnedOff, { size: 14 }), onClick: () => props.onUnpin(props.resource), "aria-label": `Unpin ${getReferenceString(props.resource)}` }, "Unpin")),
241
- props.onDetails && (React.createElement(Menu.Item, { icon: React.createElement(IconListDetails, { size: 14 }), onClick: () => props.onDetails(props.resource), "aria-label": `Details ${getReferenceString(props.resource)}` }, "Details")),
242
- props.onEdit && (React.createElement(Menu.Item, { icon: React.createElement(IconEdit, { size: 14 }), onClick: () => props.onEdit(props.resource), "aria-label": `Edit ${getReferenceString(props.resource)}` }, "Edit")),
243
- props.onDelete && (React.createElement(React.Fragment, null,
244
- React.createElement(Menu.Divider, null),
245
- React.createElement(Menu.Label, null, "Danger zone"),
246
- React.createElement(Menu.Item, { color: "red", icon: React.createElement(IconTrash, { size: 14 }), onClick: () => props.onDelete(props.resource), "aria-label": `Delete ${getReferenceString(props.resource)}` }, "Delete")))));
247
- }
248
- function HistoryTimelineItem(props) {
249
- const previous = getPrevious(props.history, props.resource);
250
- if (previous) {
251
- return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
252
- React.createElement(ResourceDiffTable, { original: previous, revised: props.resource })));
253
- }
254
- else {
255
- return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
256
- React.createElement("h3", null, "Created"),
257
- React.createElement(ResourceTable, { value: props.resource, ignoreMissingValues: true, forceUseInput: true })));
258
- }
259
- }
260
- function getPrevious(history, version) {
261
- const entries = history.entry;
262
- const index = entries.findIndex((entry) => entry.resource?.meta?.versionId === version.meta?.versionId);
263
- if (index >= entries.length - 1) {
264
- return undefined;
265
- }
266
- return entries[index + 1].resource;
267
- }
268
- function CommunicationTimelineItem(props) {
269
- const { classes } = useStyles();
270
- const routine = !props.resource.priority || props.resource.priority === 'routine';
271
- const className = routine ? undefined : classes.pinnedComment;
272
- return (React.createElement(TimelineItem, { resource: props.resource, profile: props.resource.sender, dateTime: props.resource.sent, padding: true, className: className, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
273
- React.createElement("p", null, props.resource.payload?.[0]?.contentString)));
274
- }
275
- function MediaTimelineItem(props) {
276
- const contentType = props.resource.content?.contentType;
277
- const padding = contentType &&
278
- !contentType.startsWith('image/') &&
279
- !contentType.startsWith('video/') &&
280
- contentType !== 'application/pdf';
281
- return (React.createElement(TimelineItem, { resource: props.resource, padding: !!padding, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
282
- React.createElement(AttachmentDisplay, { value: props.resource.content })));
283
- }
284
- function AuditEventTimelineItem(props) {
285
- return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
286
- React.createElement(ScrollArea, null,
287
- React.createElement("pre", null, props.resource.outcomeDesc))));
288
- }
289
- function DiagnosticReportTimelineItem(props) {
290
- return (React.createElement(TimelineItem, { resource: props.resource, padding: true, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
291
- React.createElement(DiagnosticReportDisplay, { value: props.resource })));
292
- }
293
- function getProgressMessage(e) {
294
- if (e.lengthComputable) {
295
- const percent = (100 * e.loaded) / e.total;
296
- return `Uploaded: ${formatFileSize(e.loaded)} / ${formatFileSize(e.total)} ${percent.toFixed(2)}%`;
297
- }
298
- return `Uploaded: ${formatFileSize(e.loaded)}`;
299
- }
300
- function formatFileSize(bytes) {
301
- if (bytes === 0) {
302
- return '0.00 B';
303
- }
304
- const e = Math.floor(Math.log(bytes) / Math.log(1024));
305
- return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B';
306
- }
307
-
308
- export { ResourceTimeline };
309
- //# sourceMappingURL=ResourceTimeline.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResourceTimeline.mjs","sources":["../../../src/ResourceTimeline/ResourceTimeline.tsx"],"sourcesContent":["import { ActionIcon, Center, createStyles, Group, Loader, Menu, ScrollArea, TextInput } from '@mantine/core';\nimport { showNotification, updateNotification } from '@mantine/notifications';\nimport { getReferenceString, MedplumClient, normalizeErrorString, ProfileResource } from '@medplum/core';\nimport {\n Attachment,\n AuditEvent,\n Bundle,\n BundleEntry,\n Communication,\n DiagnosticReport,\n Media,\n Reference,\n Resource,\n ResourceType,\n} from '@medplum/fhirtypes';\nimport {\n IconCheck,\n IconCloudUpload,\n IconEdit,\n IconFileAlert,\n IconListDetails,\n IconMessage,\n IconPin,\n IconPinnedOff,\n IconTrash,\n} from '@tabler/icons-react';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { AttachmentButton } from '../AttachmentButton/AttachmentButton';\nimport { AttachmentDisplay } from '../AttachmentDisplay/AttachmentDisplay';\nimport { DiagnosticReportDisplay } from '../DiagnosticReportDisplay/DiagnosticReportDisplay';\nimport { Form } from '../Form/Form';\nimport { useMedplum, useMedplumNavigate } from '../MedplumProvider/MedplumProvider';\nimport { Panel } from '../Panel/Panel';\nimport { ResourceAvatar } from '../ResourceAvatar/ResourceAvatar';\nimport { ResourceDiffTable } from '../ResourceDiffTable/ResourceDiffTable';\nimport { ResourceTable } from '../ResourceTable/ResourceTable';\nimport { Timeline, TimelineItem } from '../Timeline/Timeline';\nimport { useResource } from '../useResource/useResource';\nimport { sortByDateAndPriority } from '../utils/date';\n\nconst useStyles = createStyles((theme) => ({\n pinnedComment: {\n backgroundColor: theme.colors.blue[0],\n },\n}));\n\nexport interface ResourceTimelineProps<T extends Resource> {\n value: T | Reference<T>;\n loadTimelineResources: (\n medplum: MedplumClient,\n resourceType: ResourceType,\n id: string\n ) => Promise<PromiseSettledResult<Bundle>[]>;\n createCommunication?: (resource: T, sender: ProfileResource, text: string) => Communication;\n createMedia?: (resource: T, operator: ProfileResource, attachment: Attachment) => Media;\n}\n\nexport function ResourceTimeline<T extends Resource>(props: ResourceTimelineProps<T>): JSX.Element {\n const medplum = useMedplum();\n const navigate = useMedplumNavigate();\n const sender = medplum.getProfile() as ProfileResource;\n const inputRef = useRef<HTMLInputElement>(null);\n const resource = useResource(props.value);\n const [history, setHistory] = useState<Bundle>();\n const [items, setItems] = useState<Resource[]>([]);\n const loadTimelineResources = props.loadTimelineResources;\n\n const itemsRef = useRef<Resource[]>(items);\n itemsRef.current = items;\n\n /**\n * Sorts and sets the items.\n *\n * Sorting is primarily a function of meta.lastUpdated, but there are special cases.\n * When displaying connected resources, for example a Communication in the context of an Encounter,\n * the Communication.sent time is used rather than Communication.meta.lastUpdated.\n *\n * Other examples of special cases:\n * - DiagnosticReport.issued\n * - Media.issued\n * - Observation.issued\n * - DocumentReference.date\n *\n * See \"sortByDateAndPriority()\" for more details.\n */\n const sortAndSetItems = useCallback(\n (newItmes: Resource[]): void => {\n sortByDateAndPriority(newItmes, resource);\n newItmes.reverse();\n setItems(newItmes);\n },\n [resource]\n );\n\n /**\n * Handles a batch request response.\n * @param batchResponse The batch response.\n */\n const handleBatchResponse = useCallback(\n (batchResponse: PromiseSettledResult<Bundle>[]): void => {\n const newItems = [];\n\n for (const settledResult of batchResponse) {\n if (settledResult.status !== 'fulfilled') {\n // User may not have access to all resource types\n continue;\n }\n\n const bundle = settledResult.value;\n if (bundle.type === 'history') {\n setHistory(bundle);\n }\n\n if (bundle.entry) {\n for (const entry of bundle.entry) {\n newItems.push(entry.resource as Resource);\n }\n }\n }\n\n sortAndSetItems(newItems);\n },\n [sortAndSetItems]\n );\n\n /**\n * Adds an array of resources to the timeline.\n * @param resource Resource to add.\n */\n const addResource = useCallback(\n (resource: Resource): void => sortAndSetItems([...itemsRef.current, resource]),\n [sortAndSetItems]\n );\n\n /**\n * Loads the timeline.\n */\n const loadTimeline = useCallback(() => {\n let resourceType: ResourceType;\n let id: string;\n if ('resourceType' in props.value) {\n resourceType = props.value.resourceType;\n id = props.value.id as string;\n } else {\n [resourceType, id] = props.value.reference?.split('/') as [ResourceType, string];\n }\n loadTimelineResources(medplum, resourceType, id).then(handleBatchResponse).catch(console.log);\n }, [medplum, props.value, loadTimelineResources, handleBatchResponse]);\n\n useEffect(() => loadTimeline(), [loadTimeline]);\n\n /**\n * Adds a Communication resource to the timeline.\n * @param contentString The comment content.\n */\n function createComment(contentString: string): void {\n if (!resource || !props.createCommunication) {\n // Encounter not loaded yet\n return;\n }\n medplum\n .createResource(props.createCommunication(resource, sender, contentString))\n .then((result) => addResource(result))\n .catch(console.log);\n }\n\n /**\n * Adds a Media resource to the timeline.\n * @param attachment The media attachment.\n */\n function createMedia(attachment: Attachment): void {\n if (!resource || !props.createMedia) {\n // Encounter not loaded yet\n return;\n }\n medplum\n .createResource(props.createMedia(resource, sender, attachment))\n .then((result) => addResource(result))\n .then(() =>\n updateNotification({\n id: 'upload-notification',\n color: 'teal',\n title: 'Upload complete',\n message: '',\n icon: <IconCheck size={16} />,\n autoClose: 2000,\n })\n )\n .catch((reason) =>\n updateNotification({\n id: 'upload-notification',\n color: 'red',\n title: 'Upload error',\n message: normalizeErrorString(reason),\n icon: <IconFileAlert size={16} />,\n autoClose: 2000,\n })\n );\n }\n\n function setPriority(\n communication: Communication,\n priority: 'routine' | 'urgent' | 'asap' | 'stat'\n ): Promise<Communication> {\n return medplum.updateResource({ ...communication, priority });\n }\n\n function onPin(communication: Communication): void {\n setPriority(communication, 'stat').then(loadTimeline).catch(console.log);\n }\n\n function onUnpin(communication: Communication): void {\n setPriority(communication, 'routine').then(loadTimeline).catch(console.log);\n }\n\n function onDetails(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}`);\n }\n\n function onEdit(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}/edit`);\n }\n\n function onDelete(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}/delete`);\n }\n\n function onVersionDetails(version: Resource): void {\n navigate(`/${version.resourceType}/${version.id}/_history/${version.meta?.versionId}`);\n }\n\n function onUploadStart(): void {\n showNotification({\n id: 'upload-notification',\n loading: true,\n title: 'Initializing upload...',\n message: 'Please wait...',\n autoClose: false,\n withCloseButton: false,\n });\n }\n\n function onUploadProgress(e: ProgressEvent): void {\n updateNotification({\n id: 'upload-notification',\n loading: true,\n title: 'Uploading...',\n message: getProgressMessage(e),\n autoClose: false,\n withCloseButton: false,\n });\n }\n\n if (!resource) {\n return (\n <Center style={{ width: '100%', height: '100%' }}>\n <Loader />\n </Center>\n );\n }\n\n return (\n <Timeline>\n {props.createCommunication && (\n <Panel>\n <Form\n testid=\"timeline-form\"\n onSubmit={(formData: Record<string, string>) => {\n createComment(formData.text);\n\n const input = inputRef.current;\n if (input) {\n input.value = '';\n input.focus();\n }\n }}\n >\n <Group spacing=\"xs\" noWrap style={{ width: '100%' }}>\n <ResourceAvatar value={sender} />\n <TextInput\n name=\"text\"\n ref={inputRef}\n placeholder=\"Add comment\"\n style={{ width: '100%', maxWidth: 300 }}\n />\n <ActionIcon type=\"submit\" radius=\"xl\" color=\"blue\" variant=\"filled\">\n <IconMessage size={16} />\n </ActionIcon>\n <AttachmentButton\n onUpload={createMedia}\n onUploadStart={onUploadStart}\n onUploadProgress={onUploadProgress}\n >\n {(props) => (\n <ActionIcon {...props} radius=\"xl\" color=\"blue\" variant=\"filled\">\n <IconCloudUpload size={16} />\n </ActionIcon>\n )}\n </AttachmentButton>\n </Group>\n </Form>\n </Panel>\n )}\n {items.map((item) => {\n if (!item) {\n // TODO: Handle null history items for deleted versions.\n return null;\n }\n const key = `${item.resourceType}/${item.id}/${item.meta?.versionId}`;\n if (item.resourceType === resource.resourceType && item.id === resource.id) {\n return (\n <HistoryTimelineItem key={key} history={history as Bundle} resource={item} onDetails={onVersionDetails} />\n );\n }\n switch (item.resourceType) {\n case 'AuditEvent':\n return <AuditEventTimelineItem key={key} resource={item} onDetails={onDetails} />;\n case 'Communication':\n return (\n <CommunicationTimelineItem\n key={key}\n resource={item}\n onPin={item.priority !== 'stat' ? onPin : undefined}\n onUnpin={item.priority === 'stat' ? onUnpin : undefined}\n onDetails={onDetails}\n onEdit={onEdit}\n onDelete={onDelete}\n />\n );\n case 'DiagnosticReport':\n return (\n <DiagnosticReportTimelineItem\n key={key}\n resource={item}\n onDetails={onDetails}\n onEdit={onEdit}\n onDelete={onDelete}\n />\n );\n case 'Media':\n return (\n <MediaTimelineItem key={key} resource={item} onDetails={onDetails} onEdit={onEdit} onDelete={onDelete} />\n );\n default:\n return (\n <TimelineItem key={key} resource={item} padding={true}>\n <ResourceTable value={item} ignoreMissingValues={true} />\n </TimelineItem>\n );\n }\n })}\n </Timeline>\n );\n}\n\ninterface BaseTimelineItemProps<T extends Resource> {\n resource: T;\n onPin?: (resource: T) => void;\n onUnpin?: (resource: T) => void;\n onDetails?: (resource: T) => void;\n onEdit?: (resource: T) => void;\n onDelete?: (resource: T) => void;\n}\n\nfunction TimelineItemPopupMenu<T extends Resource>(props: BaseTimelineItemProps<T>): JSX.Element {\n return (\n <Menu.Dropdown>\n <Menu.Label>Resource</Menu.Label>\n {props.onPin && (\n <Menu.Item\n icon={<IconPin size={14} />}\n onClick={() => (props.onPin as (resource: T) => void)(props.resource)}\n aria-label={`Pin ${getReferenceString(props.resource)}`}\n >\n Pin\n </Menu.Item>\n )}\n {props.onUnpin && (\n <Menu.Item\n icon={<IconPinnedOff size={14} />}\n onClick={() => (props.onUnpin as (resource: T) => void)(props.resource)}\n aria-label={`Unpin ${getReferenceString(props.resource)}`}\n >\n Unpin\n </Menu.Item>\n )}\n {props.onDetails && (\n <Menu.Item\n icon={<IconListDetails size={14} />}\n onClick={() => (props.onDetails as (resource: T) => void)(props.resource)}\n aria-label={`Details ${getReferenceString(props.resource)}`}\n >\n Details\n </Menu.Item>\n )}\n {props.onEdit && (\n <Menu.Item\n icon={<IconEdit size={14} />}\n onClick={() => (props.onEdit as (resource: T) => void)(props.resource)}\n aria-label={`Edit ${getReferenceString(props.resource)}`}\n >\n Edit\n </Menu.Item>\n )}\n {props.onDelete && (\n <>\n <Menu.Divider />\n <Menu.Label>Danger zone</Menu.Label>\n <Menu.Item\n color=\"red\"\n icon={<IconTrash size={14} />}\n onClick={() => (props.onDelete as (resource: T) => void)(props.resource)}\n aria-label={`Delete ${getReferenceString(props.resource)}`}\n >\n Delete\n </Menu.Item>\n </>\n )}\n </Menu.Dropdown>\n );\n}\n\ninterface HistoryTimelineItemProps extends BaseTimelineItemProps<Resource> {\n history: Bundle;\n}\n\nfunction HistoryTimelineItem(props: HistoryTimelineItemProps): JSX.Element {\n const previous = getPrevious(props.history, props.resource);\n if (previous) {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <ResourceDiffTable original={previous} revised={props.resource} />\n </TimelineItem>\n );\n } else {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <h3>Created</h3>\n <ResourceTable value={props.resource} ignoreMissingValues forceUseInput />\n </TimelineItem>\n );\n }\n}\n\nfunction getPrevious(history: Bundle, version: Resource): Resource | undefined {\n const entries = history.entry as BundleEntry[];\n const index = entries.findIndex((entry) => entry.resource?.meta?.versionId === version.meta?.versionId);\n if (index >= entries.length - 1) {\n return undefined;\n }\n return entries[index + 1].resource;\n}\n\nfunction CommunicationTimelineItem(props: BaseTimelineItemProps<Communication>): JSX.Element {\n const { classes } = useStyles();\n const routine = !props.resource.priority || props.resource.priority === 'routine';\n const className = routine ? undefined : classes.pinnedComment;\n return (\n <TimelineItem\n resource={props.resource}\n profile={props.resource.sender}\n dateTime={props.resource.sent}\n padding={true}\n className={className}\n popupMenuItems={<TimelineItemPopupMenu {...props} />}\n >\n <p>{props.resource.payload?.[0]?.contentString}</p>\n </TimelineItem>\n );\n}\n\nfunction MediaTimelineItem(props: BaseTimelineItemProps<Media>): JSX.Element {\n const contentType = props.resource.content?.contentType;\n const padding =\n contentType &&\n !contentType.startsWith('image/') &&\n !contentType.startsWith('video/') &&\n contentType !== 'application/pdf';\n return (\n <TimelineItem resource={props.resource} padding={!!padding} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <AttachmentDisplay value={props.resource.content} />\n </TimelineItem>\n );\n}\n\nfunction AuditEventTimelineItem(props: BaseTimelineItemProps<AuditEvent>): JSX.Element {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <ScrollArea>\n <pre>{props.resource.outcomeDesc}</pre>\n </ScrollArea>\n </TimelineItem>\n );\n}\n\nfunction DiagnosticReportTimelineItem(props: BaseTimelineItemProps<DiagnosticReport>): JSX.Element {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <DiagnosticReportDisplay value={props.resource} />\n </TimelineItem>\n );\n}\n\nfunction getProgressMessage(e: ProgressEvent): string {\n if (e.lengthComputable) {\n const percent = (100 * e.loaded) / e.total;\n return `Uploaded: ${formatFileSize(e.loaded)} / ${formatFileSize(e.total)} ${percent.toFixed(2)}%`;\n }\n return `Uploaded: ${formatFileSize(e.loaded)}`;\n}\n\nfunction formatFileSize(bytes: number): string {\n if (bytes === 0) {\n return '0.00 B';\n }\n const e = Math.floor(Math.log(bytes) / Math.log(1024));\n return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B';\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,aAAa,EAAE;QACb,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,KAAA;AACF,CAAA,CAAC,CAAC,CAAC;AAaE,SAAU,gBAAgB,CAAqB,KAA+B,EAAA;AAClF,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;AACtC,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAqB,CAAC;AACvD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAU,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAA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A,UAAA,EAAa,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;AACjD,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAA;IACnC,IAAI,KAAK,KAAK,CAAC,EAAE;AACf,QAAA,OAAO,QAAQ,CAAC;AACjB,KAAA;IACD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACvD,IAAA,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AACjF;;;;"}
@@ -1,98 +0,0 @@
1
- import { createStyles, Text, Stack, Button } from '@mantine/core';
2
- import { getReferenceString } from '@medplum/core';
3
- import React, { useState, useRef, useEffect } from 'react';
4
- import { getStartMonth, CalendarInput } from '../CalendarInput/CalendarInput.mjs';
5
- import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
6
- import { QuestionnaireForm } from '../QuestionnaireForm/QuestionnaireForm.mjs';
7
- import { ResourceAvatar } from '../ResourceAvatar/ResourceAvatar.mjs';
8
- import { ResourceName } from '../ResourceName/ResourceName.mjs';
9
- import { useResource } from '../useResource/useResource.mjs';
10
-
11
- const useStyles = createStyles((theme) => ({
12
- container: {
13
- display: 'flex',
14
- minHeight: 400,
15
- },
16
- info: {
17
- minWidth: 300,
18
- padding: 20,
19
- borderRight: `1px solid ${theme.colors.gray[3]}`,
20
- },
21
- selection: {
22
- minWidth: 300,
23
- padding: 20,
24
- },
25
- }));
26
- function Scheduler(props) {
27
- const { classes } = useStyles();
28
- const medplum = useMedplum();
29
- const schedule = useResource(props.schedule);
30
- const questionnaire = useResource(props.questionnaire);
31
- const [slots, setSlots] = useState();
32
- const slotsRef = useRef();
33
- slotsRef.current = slots;
34
- const [month, setMonth] = useState(getStartMonth());
35
- const [date, setDate] = useState();
36
- const [slot, setSlot] = useState();
37
- const [response, setResponse] = useState();
38
- useEffect(() => {
39
- if (schedule) {
40
- setSlots([]);
41
- medplum
42
- .searchResources('Slot', new URLSearchParams([
43
- ['_count', (30 * 24).toString()],
44
- ['schedule', getReferenceString(schedule)],
45
- ['start', 'gt' + getStart(month)],
46
- ['start', 'lt' + getEnd(month)],
47
- ]))
48
- .then(setSlots)
49
- .catch(console.log);
50
- }
51
- else {
52
- setSlots(undefined);
53
- }
54
- }, [medplum, schedule, month]);
55
- if (!schedule || !slots || !questionnaire) {
56
- return null;
57
- }
58
- const actor = schedule.actor?.[0];
59
- return (React.createElement("div", { className: classes.container, "data-testid": "scheduler" },
60
- React.createElement("div", { className: classes.info },
61
- actor && React.createElement(ResourceAvatar, { value: actor, size: "xl" }),
62
- actor && (React.createElement(Text, { size: "xl", weight: 500 },
63
- React.createElement(ResourceName, { value: actor }))),
64
- React.createElement("p", null, "1 hour"),
65
- date && React.createElement("p", null, date.toLocaleDateString()),
66
- slot && React.createElement("p", null, formatTime(new Date(slot.start)))),
67
- React.createElement("div", { className: classes.selection },
68
- !date && (React.createElement("div", null,
69
- React.createElement("h3", null, "Select date"),
70
- React.createElement(CalendarInput, { slots: slots, onChangeMonth: setMonth, onClick: setDate }))),
71
- date && !slot && (React.createElement("div", null,
72
- React.createElement("h3", null, "Select time"),
73
- React.createElement(Stack, null, slots.map((s) => {
74
- const slotStart = new Date(s.start);
75
- return (slotStart.getTime() > date.getTime() &&
76
- slotStart.getTime() < date.getTime() + 24 * 3600 * 1000 && (React.createElement("div", { key: s.id },
77
- React.createElement(Button, { variant: "outline", style: { width: 150 }, onClick: () => setSlot(s) }, formatTime(slotStart)))));
78
- })))),
79
- date && slot && !response && (React.createElement(QuestionnaireForm, { questionnaire: questionnaire, submitButtonText: 'Next', onSubmit: setResponse })),
80
- date && slot && response && (React.createElement("div", null,
81
- React.createElement("h3", null, "You're all set!"),
82
- React.createElement("p", null, "Check your email for a calendar invite."))))));
83
- }
84
- function getStart(month) {
85
- return formatSlotInstant(month.getTime());
86
- }
87
- function getEnd(month) {
88
- return formatSlotInstant(month.getTime() + 31 * 24 * 60 * 60 * 1000);
89
- }
90
- function formatSlotInstant(time) {
91
- return new Date(Math.max(Date.now(), time)).toISOString();
92
- }
93
- function formatTime(date) {
94
- return date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });
95
- }
96
-
97
- export { Scheduler };
98
- //# sourceMappingURL=Scheduler.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Scheduler.mjs","sources":["../../../src/Scheduler/Scheduler.tsx"],"sourcesContent":["import { Button, createStyles, Stack, Text } from '@mantine/core';\nimport { getReferenceString } from '@medplum/core';\nimport { Questionnaire, QuestionnaireResponse, Reference, Schedule, Slot } from '@medplum/fhirtypes';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { CalendarInput, getStartMonth } from '../CalendarInput/CalendarInput';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { QuestionnaireForm } from '../QuestionnaireForm/QuestionnaireForm';\nimport { ResourceAvatar } from '../ResourceAvatar/ResourceAvatar';\nimport { ResourceName } from '../ResourceName/ResourceName';\nimport { useResource } from '../useResource/useResource';\n\nconst useStyles = createStyles((theme) => ({\n container: {\n display: 'flex',\n minHeight: 400,\n },\n\n info: {\n minWidth: 300,\n padding: 20,\n borderRight: `1px solid ${theme.colors.gray[3]}`,\n },\n\n selection: {\n minWidth: 300,\n padding: 20,\n },\n}));\n\nexport interface SchedulerProps {\n schedule: Schedule | Reference<Schedule>;\n questionnaire: Questionnaire | Reference<Questionnaire>;\n}\n\nexport function Scheduler(props: SchedulerProps): JSX.Element | null {\n const { classes } = useStyles();\n const medplum = useMedplum();\n const schedule = useResource(props.schedule);\n const questionnaire = useResource(props.questionnaire);\n\n const [slots, setSlots] = useState<Slot[]>();\n const slotsRef = useRef<Slot[]>();\n slotsRef.current = slots;\n\n const [month, setMonth] = useState<Date>(getStartMonth());\n const [date, setDate] = useState<Date>();\n const [slot, setSlot] = useState<Slot>();\n const [response, setResponse] = useState<QuestionnaireResponse>();\n\n useEffect(() => {\n if (schedule) {\n setSlots([]);\n medplum\n .searchResources(\n 'Slot',\n new URLSearchParams([\n ['_count', (30 * 24).toString()],\n ['schedule', getReferenceString(schedule)],\n ['start', 'gt' + getStart(month)],\n ['start', 'lt' + getEnd(month)],\n ])\n )\n .then(setSlots)\n .catch(console.log);\n } else {\n setSlots(undefined);\n }\n }, [medplum, schedule, month]);\n\n if (!schedule || !slots || !questionnaire) {\n return null;\n }\n\n const actor = schedule.actor?.[0];\n\n return (\n <div className={classes.container} data-testid=\"scheduler\">\n <div className={classes.info}>\n {actor && <ResourceAvatar value={actor} size=\"xl\" />}\n {actor && (\n <Text size=\"xl\" weight={500}>\n <ResourceName value={actor} />\n </Text>\n )}\n <p>1 hour</p>\n {date && <p>{date.toLocaleDateString()}</p>}\n {slot && <p>{formatTime(new Date(slot.start as string))}</p>}\n </div>\n <div className={classes.selection}>\n {!date && (\n <div>\n <h3>Select date</h3>\n <CalendarInput slots={slots} onChangeMonth={setMonth} onClick={setDate} />\n </div>\n )}\n {date && !slot && (\n <div>\n <h3>Select time</h3>\n <Stack>\n {slots.map((s) => {\n const slotStart = new Date(s.start as string);\n return (\n slotStart.getTime() > date.getTime() &&\n slotStart.getTime() < date.getTime() + 24 * 3600 * 1000 && (\n <div key={s.id}>\n <Button variant=\"outline\" style={{ width: 150 }} onClick={() => setSlot(s)}>\n {formatTime(slotStart)}\n </Button>\n </div>\n )\n );\n })}\n </Stack>\n </div>\n )}\n {date && slot && !response && (\n <QuestionnaireForm questionnaire={questionnaire} submitButtonText={'Next'} onSubmit={setResponse} />\n )}\n {date && slot && response && (\n <div>\n <h3>You're all set!</h3>\n <p>Check your email for a calendar invite.</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction getStart(month: Date): string {\n return formatSlotInstant(month.getTime());\n}\n\nfunction getEnd(month: Date): string {\n return formatSlotInstant(month.getTime() + 31 * 24 * 60 * 60 * 1000);\n}\n\nfunction formatSlotInstant(time: number): string {\n return new Date(Math.max(Date.now(), time)).toISOString();\n}\n\nfunction formatTime(date: Date): string {\n return date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });\n}\n"],"names":[],"mappings":";;;;;;;;;;AAWA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,SAAS,EAAE;AACT,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,SAAS,EAAE,GAAG;AACf,KAAA;AAED,IAAA,IAAI,EAAE;AACJ,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAa,UAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AACjD,KAAA;AAED,IAAA,SAAS,EAAE;AACT,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,OAAO,EAAE,EAAE;AACZ,KAAA;AACF,CAAA,CAAC,CAAC,CAAC;AAOE,SAAU,SAAS,CAAC,KAAqB,EAAA;AAC7C,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC;AAChC,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAEvD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAU,CAAC;AAC7C,IAAA,MAAM,QAAQ,GAAG,MAAM,EAAU,CAAC;AAClC,IAAA,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;IAEzB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAO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