@medplum/react 2.0.0 → 2.0.2

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 (229) hide show
  1. package/dist/cjs/DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts +2 -0
  2. package/dist/cjs/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +1 -0
  3. package/dist/cjs/MedplumProvider/MedplumProvider.d.ts +8 -0
  4. package/dist/cjs/NoteDisplay/NoteDisplay.d.ts +6 -0
  5. package/dist/cjs/{ResourceDiffTable/ResourceDiffTable.stories.d.ts → NoteDisplay/NoteDisplay.stories.d.ts} +3 -1
  6. package/dist/cjs/QuantityInput/QuantityInput.d.ts +1 -0
  7. package/dist/cjs/QuantityInput/QuantityInput.stories.d.ts +7 -0
  8. package/dist/cjs/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +1 -2
  9. package/dist/cjs/ResourceTimeline/ResourceTimeline.d.ts +2 -2
  10. package/dist/cjs/index.cjs +1206 -1204
  11. package/dist/cjs/index.cjs.map +1 -1
  12. package/dist/cjs/index.min.cjs +1 -1
  13. package/dist/esm/AddressDisplay/AddressDisplay.mjs +2 -2
  14. package/dist/esm/AddressDisplay/AddressDisplay.mjs.map +1 -1
  15. package/dist/esm/AddressInput/AddressInput.mjs +9 -9
  16. package/dist/esm/AddressInput/AddressInput.mjs.map +1 -1
  17. package/dist/esm/AnnotationInput/AnnotationInput.mjs +2 -2
  18. package/dist/esm/AnnotationInput/AnnotationInput.mjs.map +1 -1
  19. package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +2 -2
  20. package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -1
  21. package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs +4 -4
  22. package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +1 -1
  23. package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs +19 -19
  24. package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs.map +1 -1
  25. package/dist/esm/AttachmentButton/AttachmentButton.mjs +3 -3
  26. package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +1 -1
  27. package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs +9 -9
  28. package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs.map +1 -1
  29. package/dist/esm/AttachmentInput/AttachmentInput.mjs +5 -5
  30. package/dist/esm/AttachmentInput/AttachmentInput.mjs.map +1 -1
  31. package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs +6 -6
  32. package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +1 -1
  33. package/dist/esm/BackboneElementInput/BackboneElementInput.mjs +7 -7
  34. package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +1 -1
  35. package/dist/esm/CalendarInput/CalendarInput.mjs +18 -18
  36. package/dist/esm/CalendarInput/CalendarInput.mjs.map +1 -1
  37. package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs +5 -5
  38. package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +1 -1
  39. package/dist/esm/CodeInput/CodeInput.mjs +2 -2
  40. package/dist/esm/CodeInput/CodeInput.mjs.map +1 -1
  41. package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs +2 -2
  42. package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs.map +1 -1
  43. package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs +2 -2
  44. package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs.map +1 -1
  45. package/dist/esm/CodingDisplay/CodingDisplay.mjs +2 -2
  46. package/dist/esm/CodingDisplay/CodingDisplay.mjs.map +1 -1
  47. package/dist/esm/CodingInput/CodingInput.mjs +2 -2
  48. package/dist/esm/CodingInput/CodingInput.mjs.map +1 -1
  49. package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs +3 -3
  50. package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs.map +1 -1
  51. package/dist/esm/ContactDetailInput/ContactDetailInput.mjs +4 -4
  52. package/dist/esm/ContactDetailInput/ContactDetailInput.mjs.map +1 -1
  53. package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs +2 -2
  54. package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs.map +1 -1
  55. package/dist/esm/ContactPointInput/ContactPointInput.mjs +5 -5
  56. package/dist/esm/ContactPointInput/ContactPointInput.mjs.map +1 -1
  57. package/dist/esm/Container/Container.mjs +2 -2
  58. package/dist/esm/Container/Container.mjs.map +1 -1
  59. package/dist/esm/DateTimeInput/DateTimeInput.mjs +2 -2
  60. package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +1 -1
  61. package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs +7 -19
  62. package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs.map +1 -1
  63. package/dist/esm/DescriptionList/DescriptionList.mjs +5 -5
  64. package/dist/esm/DescriptionList/DescriptionList.mjs.map +1 -1
  65. package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts +2 -0
  66. package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs +56 -52
  67. package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +1 -1
  68. package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +1 -0
  69. package/dist/esm/Document/Document.mjs +3 -3
  70. package/dist/esm/Document/Document.mjs.map +1 -1
  71. package/dist/esm/EncounterTimeline/EncounterTimeline.mjs +8 -25
  72. package/dist/esm/EncounterTimeline/EncounterTimeline.mjs.map +1 -1
  73. package/dist/esm/ErrorBoundary/ErrorBoundary.mjs +4 -4
  74. package/dist/esm/ErrorBoundary/ErrorBoundary.mjs.map +1 -1
  75. package/dist/esm/ExtensionInput/ExtensionInput.mjs +2 -2
  76. package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +1 -1
  77. package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs +2 -2
  78. package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs.map +1 -1
  79. package/dist/esm/FhirPathTable/FhirPathTable.mjs +19 -19
  80. package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +1 -1
  81. package/dist/esm/Form/Form.mjs +2 -2
  82. package/dist/esm/Form/Form.mjs.map +1 -1
  83. package/dist/esm/FormSection/FormSection.mjs +2 -2
  84. package/dist/esm/FormSection/FormSection.mjs.map +1 -1
  85. package/dist/esm/GoogleButton/GoogleButton.mjs +8 -6
  86. package/dist/esm/GoogleButton/GoogleButton.mjs.map +1 -1
  87. package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs +2 -2
  88. package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs.map +1 -1
  89. package/dist/esm/HumanNameInput/HumanNameInput.mjs +7 -7
  90. package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +1 -1
  91. package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs +2 -2
  92. package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs.map +1 -1
  93. package/dist/esm/IdentifierInput/IdentifierInput.mjs +4 -4
  94. package/dist/esm/IdentifierInput/IdentifierInput.mjs.map +1 -1
  95. package/dist/esm/Logo/Logo.mjs +8 -8
  96. package/dist/esm/Logo/Logo.mjs.map +1 -1
  97. package/dist/esm/MedplumLink/MedplumLink.mjs +4 -4
  98. package/dist/esm/MedplumLink/MedplumLink.mjs.map +1 -1
  99. package/dist/esm/MedplumProvider/MedplumProvider.d.ts +8 -0
  100. package/dist/esm/MedplumProvider/MedplumProvider.mjs +19 -3
  101. package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +1 -1
  102. package/dist/esm/MoneyDisplay/MoneyDisplay.mjs +2 -2
  103. package/dist/esm/MoneyDisplay/MoneyDisplay.mjs.map +1 -1
  104. package/dist/esm/MoneyInput/MoneyInput.mjs +4 -4
  105. package/dist/esm/MoneyInput/MoneyInput.mjs.map +1 -1
  106. package/dist/esm/NoteDisplay/NoteDisplay.d.ts +6 -0
  107. package/dist/esm/NoteDisplay/NoteDisplay.mjs +18 -0
  108. package/dist/esm/NoteDisplay/NoteDisplay.mjs.map +1 -0
  109. package/dist/esm/{ResourceDiffTable/ResourceDiffTable.stories.d.ts → NoteDisplay/NoteDisplay.stories.d.ts} +3 -1
  110. package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs +3 -3
  111. package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs.map +1 -1
  112. package/dist/esm/Panel/Panel.mjs +2 -2
  113. package/dist/esm/Panel/Panel.mjs.map +1 -1
  114. package/dist/esm/PatientTimeline/PatientTimeline.mjs +13 -20
  115. package/dist/esm/PatientTimeline/PatientTimeline.mjs.map +1 -1
  116. package/dist/esm/PeriodInput/PeriodInput.mjs +4 -4
  117. package/dist/esm/PeriodInput/PeriodInput.mjs.map +1 -1
  118. package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs +34 -34
  119. package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +1 -1
  120. package/dist/esm/QuantityDisplay/QuantityDisplay.mjs +2 -2
  121. package/dist/esm/QuantityDisplay/QuantityDisplay.mjs.map +1 -1
  122. package/dist/esm/QuantityInput/QuantityInput.d.ts +1 -0
  123. package/dist/esm/QuantityInput/QuantityInput.mjs +14 -8
  124. package/dist/esm/QuantityInput/QuantityInput.mjs.map +1 -1
  125. package/dist/esm/QuantityInput/QuantityInput.stories.d.ts +7 -0
  126. package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs +31 -31
  127. package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +1 -1
  128. package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs +33 -33
  129. package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +1 -1
  130. package/dist/esm/RangeDisplay/RangeDisplay.mjs +2 -2
  131. package/dist/esm/RangeDisplay/RangeDisplay.mjs.map +1 -1
  132. package/dist/esm/RangeInput/RangeInput.mjs +4 -4
  133. package/dist/esm/RangeInput/RangeInput.mjs.map +1 -1
  134. package/dist/esm/RatioDisplay/RatioDisplay.mjs +4 -4
  135. package/dist/esm/RatioDisplay/RatioDisplay.mjs.map +1 -1
  136. package/dist/esm/RatioInput/RatioInput.mjs +4 -4
  137. package/dist/esm/RatioInput/RatioInput.mjs.map +1 -1
  138. package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs +3 -3
  139. package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs.map +1 -1
  140. package/dist/esm/ReferenceInput/ReferenceInput.mjs +4 -4
  141. package/dist/esm/ReferenceInput/ReferenceInput.mjs.map +1 -1
  142. package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +1 -2
  143. package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs +31 -31
  144. package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +1 -1
  145. package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs +15 -15
  146. package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs.map +1 -1
  147. package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs +3 -3
  148. package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs.map +1 -1
  149. package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs +18 -18
  150. package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs.map +1 -1
  151. package/dist/esm/ResourceAvatar/ResourceAvatar.mjs +4 -4
  152. package/dist/esm/ResourceAvatar/ResourceAvatar.mjs.map +1 -1
  153. package/dist/esm/ResourceBadge/ResourceBadge.mjs +4 -4
  154. package/dist/esm/ResourceBadge/ResourceBadge.mjs.map +1 -1
  155. package/dist/esm/ResourceBlame/ResourceBlame.mjs +13 -13
  156. package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +1 -1
  157. package/dist/esm/ResourceDiff/ResourceDiff.mjs +7 -7
  158. package/dist/esm/ResourceDiff/ResourceDiff.mjs.map +1 -1
  159. package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs +18 -18
  160. package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +1 -1
  161. package/dist/esm/ResourceForm/ResourceForm.mjs +12 -12
  162. package/dist/esm/ResourceForm/ResourceForm.mjs.map +1 -1
  163. package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs +17 -17
  164. package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs.map +1 -1
  165. package/dist/esm/ResourceInput/ResourceInput.mjs +8 -8
  166. package/dist/esm/ResourceInput/ResourceInput.mjs.map +1 -1
  167. package/dist/esm/ResourceName/ResourceName.mjs +2 -2
  168. package/dist/esm/ResourceName/ResourceName.mjs.map +1 -1
  169. package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +27 -27
  170. package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -1
  171. package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +35 -35
  172. package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -1
  173. package/dist/esm/ResourceTable/ResourceTable.mjs +2 -2
  174. package/dist/esm/ResourceTable/ResourceTable.mjs.map +1 -1
  175. package/dist/esm/ResourceTimeline/ResourceTimeline.d.ts +2 -2
  176. package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +67 -73
  177. package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -1
  178. package/dist/esm/Scheduler/Scheduler.mjs +22 -22
  179. package/dist/esm/Scheduler/Scheduler.mjs.map +1 -1
  180. package/dist/esm/SearchControl/SearchControl.mjs +49 -49
  181. package/dist/esm/SearchControl/SearchControl.mjs.map +1 -1
  182. package/dist/esm/SearchControl/SearchUtils.mjs +4 -4
  183. package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -1
  184. package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +25 -25
  185. package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -1
  186. package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs +37 -37
  187. package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +1 -1
  188. package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs +6 -6
  189. package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs.map +1 -1
  190. package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs +4 -4
  191. package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +1 -1
  192. package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs +8 -8
  193. package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +1 -1
  194. package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs +62 -62
  195. package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs.map +1 -1
  196. package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs +9 -31
  197. package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs.map +1 -1
  198. package/dist/esm/StatusBadge/StatusBadge.mjs +2 -2
  199. package/dist/esm/StatusBadge/StatusBadge.mjs.map +1 -1
  200. package/dist/esm/Timeline/Timeline.mjs +20 -20
  201. package/dist/esm/Timeline/Timeline.mjs.map +1 -1
  202. package/dist/esm/TimingInput/TimingInput.mjs +19 -19
  203. package/dist/esm/TimingInput/TimingInput.mjs.map +1 -1
  204. package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +2 -2
  205. package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -1
  206. package/dist/esm/auth/AuthenticationForm.mjs +22 -22
  207. package/dist/esm/auth/AuthenticationForm.mjs.map +1 -1
  208. package/dist/esm/auth/ChooseProfileForm.mjs +11 -11
  209. package/dist/esm/auth/ChooseProfileForm.mjs.map +1 -1
  210. package/dist/esm/auth/ChooseScopeForm.mjs +9 -9
  211. package/dist/esm/auth/ChooseScopeForm.mjs.map +1 -1
  212. package/dist/esm/auth/MfaForm.mjs +12 -12
  213. package/dist/esm/auth/MfaForm.mjs.map +1 -1
  214. package/dist/esm/auth/NewProjectForm.mjs +12 -12
  215. package/dist/esm/auth/NewProjectForm.mjs.map +1 -1
  216. package/dist/esm/auth/NewUserForm.mjs +22 -22
  217. package/dist/esm/auth/NewUserForm.mjs.map +1 -1
  218. package/dist/esm/auth/RegisterForm.mjs +5 -5
  219. package/dist/esm/auth/RegisterForm.mjs.map +1 -1
  220. package/dist/esm/auth/SignInForm.mjs +8 -8
  221. package/dist/esm/auth/SignInForm.mjs.map +1 -1
  222. package/dist/esm/index.min.mjs +1 -1
  223. package/dist/esm/index.mjs +1 -1
  224. package/dist/esm/node_modules/@tabler/icons/icons-react/dist/index.esm.mjs +6 -0
  225. package/dist/esm/node_modules/@tabler/icons/icons-react/dist/index.esm.mjs.map +1 -0
  226. package/dist/esm/useResource/useResource.mjs +3 -0
  227. package/dist/esm/useResource/useResource.mjs.map +1 -1
  228. package/package.json +20 -25
  229. package/rollup.config.mjs +0 -110
@@ -1,8 +1,9 @@
1
1
  import { createStyles, Stack, Title, Group, Text } from '@mantine/core';
2
2
  import { formatDateTime, capitalize, formatObservationValue } from '@medplum/core';
3
- import React from 'react';
3
+ import e__default from 'react';
4
4
  import { CodeableConceptDisplay } from '../CodeableConceptDisplay/CodeableConceptDisplay.mjs';
5
5
  import { MedplumLink } from '../MedplumLink/MedplumLink.mjs';
6
+ import { NoteDisplay } from '../NoteDisplay/NoteDisplay.mjs';
6
7
  import { RangeDisplay } from '../RangeDisplay/RangeDisplay.mjs';
7
8
  import { ResourceBadge } from '../ResourceBadge/ResourceBadge.mjs';
8
9
  import { StatusBadge } from '../StatusBadge/StatusBadge.mjs';
@@ -26,6 +27,9 @@ const useStyles = createStyles((theme) => ({
26
27
  border: `0.1px solid ${theme.colors.red[5]}`,
27
28
  },
28
29
  },
30
+ noteBody: { fontSize: theme.fontSizes.sm },
31
+ noteCite: { fontSize: theme.fontSizes.xs, marginBlockStart: 3 },
32
+ noteRoot: { padding: 5 },
29
33
  }));
30
34
  function DiagnosticReportDisplay(props) {
31
35
  const diagnosticReport = useResource(props.value);
@@ -33,51 +37,46 @@ function DiagnosticReportDisplay(props) {
33
37
  if (!diagnosticReport) {
34
38
  return null;
35
39
  }
36
- let textContent = '';
40
+ const specimenNotes = specimen?.note || [];
37
41
  if (diagnosticReport.presentedForm && diagnosticReport.presentedForm.length > 0) {
38
42
  const pf = diagnosticReport.presentedForm[0];
39
43
  if (pf.contentType?.startsWith('text/plain') && pf.data) {
40
- textContent = window.atob(pf.data);
44
+ specimenNotes.push({ text: window.atob(pf.data) });
41
45
  }
42
46
  }
43
- if (specimen?.note) {
44
- for (const note of specimen.note) {
45
- textContent += note.text + '\n\n';
46
- }
47
- }
48
- return (React.createElement(Stack, null,
49
- React.createElement(Title, null, "Diagnostic Report"),
50
- React.createElement(Group, { mt: "md", spacing: 30 },
51
- diagnosticReport.subject && (React.createElement("div", null,
52
- React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Subject"),
53
- React.createElement(Text, null,
54
- React.createElement(ResourceBadge, { value: diagnosticReport.subject, link: true })))),
47
+ return (e__default.createElement(Stack, null,
48
+ e__default.createElement(Title, null, "Diagnostic Report"),
49
+ e__default.createElement(Group, { mt: "md", spacing: 30 },
50
+ diagnosticReport.subject && (e__default.createElement("div", null,
51
+ e__default.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Subject"),
52
+ e__default.createElement(Text, null,
53
+ e__default.createElement(ResourceBadge, { value: diagnosticReport.subject, link: true })))),
55
54
  diagnosticReport.resultsInterpreter &&
56
- diagnosticReport.resultsInterpreter.map((interpreter) => (React.createElement("div", { key: interpreter.reference },
57
- React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Interpreter"),
58
- React.createElement(Text, null,
59
- React.createElement(ResourceBadge, { value: interpreter, link: true }))))),
60
- diagnosticReport.issued && (React.createElement("div", null,
61
- React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Issued"),
62
- React.createElement(Text, null, formatDateTime(diagnosticReport.issued)))),
63
- diagnosticReport.status && (React.createElement("div", null,
64
- React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Status"),
65
- React.createElement(Text, null, capitalize(diagnosticReport.status))))),
66
- diagnosticReport.result && React.createElement(ObservationTable, { value: diagnosticReport.result }),
67
- textContent && React.createElement("pre", null, textContent.trim())));
55
+ diagnosticReport.resultsInterpreter.map((interpreter) => (e__default.createElement("div", { key: interpreter.reference },
56
+ e__default.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Interpreter"),
57
+ e__default.createElement(Text, null,
58
+ e__default.createElement(ResourceBadge, { value: interpreter, link: true }))))),
59
+ diagnosticReport.issued && (e__default.createElement("div", null,
60
+ e__default.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Issued"),
61
+ e__default.createElement(Text, null, formatDateTime(diagnosticReport.issued)))),
62
+ diagnosticReport.status && (e__default.createElement("div", null,
63
+ e__default.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Status"),
64
+ e__default.createElement(Text, null, capitalize(diagnosticReport.status))))),
65
+ diagnosticReport.result && (e__default.createElement(ObservationTable, { hideObservationNotes: props.hideObservationNotes, value: diagnosticReport.result })),
66
+ specimenNotes.length > 0 && e__default.createElement(NoteDisplay, { value: specimenNotes })));
68
67
  }
69
68
  function ObservationTable(props) {
70
69
  const { classes } = useStyles();
71
- return (React.createElement("table", { className: classes.table },
72
- React.createElement("thead", null,
73
- React.createElement("tr", null,
74
- React.createElement("th", null, "Test"),
75
- React.createElement("th", null, "Value"),
76
- React.createElement("th", null, "Reference Range"),
77
- React.createElement("th", null, "Interpretation"),
78
- React.createElement("th", null, "Category"),
79
- React.createElement("th", null, "Status"))),
80
- React.createElement("tbody", null, props.value?.map((observation, index) => (React.createElement(ObservationRow, { key: 'obs-' + index, value: observation }))))));
70
+ return (e__default.createElement("table", { className: classes.table },
71
+ e__default.createElement("thead", null,
72
+ e__default.createElement("tr", null,
73
+ e__default.createElement("th", null, "Test"),
74
+ e__default.createElement("th", null, "Value"),
75
+ e__default.createElement("th", null, "Reference Range"),
76
+ e__default.createElement("th", null, "Interpretation"),
77
+ e__default.createElement("th", null, "Category"),
78
+ e__default.createElement("th", null, "Status"))),
79
+ e__default.createElement("tbody", null, props.value?.map((observation, index) => (e__default.createElement(ObservationRow, { key: `obs-${index}-${observation.id}`, hideObservationNotes: props.hideObservationNotes, value: observation }))))));
81
80
  }
82
81
  function ObservationRow(props) {
83
82
  const { classes, cx } = useStyles();
@@ -85,23 +84,28 @@ function ObservationRow(props) {
85
84
  if (!observation) {
86
85
  return null;
87
86
  }
87
+ const displayNotes = !props.hideObservationNotes && observation?.note;
88
88
  const critical = isCritical(observation);
89
- return (React.createElement("tr", { className: cx({ [classes.criticalRow]: critical }) },
90
- React.createElement("td", null,
91
- React.createElement(MedplumLink, { to: observation },
92
- React.createElement(CodeableConceptDisplay, { value: observation.code }))),
93
- React.createElement("td", null,
94
- React.createElement(ObservationValueDisplay, { value: observation })),
95
- React.createElement("td", null,
96
- React.createElement(ReferenceRangeDisplay, { value: observation.referenceRange })),
97
- React.createElement("td", null, observation.interpretation && observation.interpretation.length > 0 && (React.createElement(CodeableConceptDisplay, { value: observation.interpretation[0] }))),
98
- React.createElement("td", null, observation.category && observation.category.length > 0 && (React.createElement("ul", null, observation.category.map((concept, index) => (React.createElement("li", { key: `category-${index}` },
99
- React.createElement(CodeableConceptDisplay, { value: concept }))))))),
100
- React.createElement("td", null, observation.status && React.createElement(StatusBadge, { status: observation.status }))));
89
+ return (e__default.createElement(e__default.Fragment, null,
90
+ e__default.createElement("tr", { className: cx({ [classes.criticalRow]: critical }) },
91
+ e__default.createElement("td", { rowSpan: displayNotes ? 2 : 1 },
92
+ e__default.createElement(MedplumLink, { to: observation },
93
+ e__default.createElement(CodeableConceptDisplay, { value: observation.code }))),
94
+ e__default.createElement("td", null,
95
+ e__default.createElement(ObservationValueDisplay, { value: observation })),
96
+ e__default.createElement("td", null,
97
+ e__default.createElement(ReferenceRangeDisplay, { value: observation.referenceRange })),
98
+ e__default.createElement("td", null, observation.interpretation && observation.interpretation.length > 0 && (e__default.createElement(CodeableConceptDisplay, { value: observation.interpretation[0] }))),
99
+ e__default.createElement("td", null, observation.category && observation.category.length > 0 && (e__default.createElement("ul", null, observation.category.map((concept, index) => (e__default.createElement("li", { key: `category-${index}` },
100
+ e__default.createElement(CodeableConceptDisplay, { value: concept }))))))),
101
+ e__default.createElement("td", null, observation.status && e__default.createElement(StatusBadge, { status: observation.status }))),
102
+ displayNotes && (e__default.createElement("tr", null,
103
+ e__default.createElement("td", { colSpan: 5 },
104
+ e__default.createElement(NoteDisplay, { value: observation.note }))))));
101
105
  }
102
106
  function ObservationValueDisplay(props) {
103
107
  const obs = props.value;
104
- return React.createElement(React.Fragment, null, formatObservationValue(obs));
108
+ return e__default.createElement(e__default.Fragment, null, formatObservationValue(obs));
105
109
  }
106
110
  function ReferenceRangeDisplay(props) {
107
111
  const range = props.value && props.value.length > 0 && props.value[0];
@@ -109,9 +113,9 @@ function ReferenceRangeDisplay(props) {
109
113
  return null;
110
114
  }
111
115
  if (range.text) {
112
- return React.createElement(React.Fragment, null, range.text);
116
+ return e__default.createElement(e__default.Fragment, null, range.text);
113
117
  }
114
- return React.createElement(RangeDisplay, { value: range });
118
+ return e__default.createElement(RangeDisplay, { value: range });
115
119
  }
116
120
  /**
117
121
  * Returns true if the observation is critical.
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticReportDisplay.mjs","sources":["../../../src/DiagnosticReportDisplay/DiagnosticReportDisplay.tsx"],"sourcesContent":["import { createStyles, Group, Stack, Text, Title } from '@mantine/core';\nimport { capitalize, formatDateTime, formatObservationValue } from '@medplum/core';\nimport {\n DiagnosticReport,\n Observation,\n ObservationComponent,\n ObservationReferenceRange,\n Reference,\n} from '@medplum/fhirtypes';\nimport React from 'react';\nimport { CodeableConceptDisplay } from '../CodeableConceptDisplay/CodeableConceptDisplay';\nimport { MedplumLink } from '../MedplumLink/MedplumLink';\nimport { RangeDisplay } from '../RangeDisplay/RangeDisplay';\nimport { ResourceBadge } from '../ResourceBadge/ResourceBadge';\nimport { StatusBadge } from '../StatusBadge/StatusBadge';\nimport { useResource } from '../useResource/useResource';\n\nconst useStyles = createStyles((theme) => ({\n table: {\n border: `0.1px solid ${theme.colors.gray[5]}`,\n borderCollapse: 'collapse',\n\n '& td, & th': {\n border: `0.1px solid ${theme.colors.gray[5]}`,\n padding: 4,\n },\n },\n\n criticalRow: {\n background: theme.colorScheme === 'dark' ? theme.colors.red[7] : theme.colors.red[1],\n border: `0.1px solid ${theme.colors.red[5]}`,\n color: theme.colors.red[5],\n fontWeight: 500,\n\n '& td': {\n border: `0.1px solid ${theme.colors.red[5]}`,\n },\n },\n}));\n\nexport interface DiagnosticReportDisplayProps {\n value?: DiagnosticReport | Reference<DiagnosticReport>;\n}\n\nexport function DiagnosticReportDisplay(props: DiagnosticReportDisplayProps): JSX.Element | null {\n const diagnosticReport = useResource(props.value);\n const specimen = useResource(diagnosticReport?.specimen?.[0]);\n\n if (!diagnosticReport) {\n return null;\n }\n\n let textContent = '';\n\n if (diagnosticReport.presentedForm && diagnosticReport.presentedForm.length > 0) {\n const pf = diagnosticReport.presentedForm[0];\n if (pf.contentType?.startsWith('text/plain') && pf.data) {\n textContent = window.atob(pf.data);\n }\n }\n\n if (specimen?.note) {\n for (const note of specimen.note) {\n textContent += note.text + '\\n\\n';\n }\n }\n\n return (\n <Stack>\n <Title>Diagnostic Report</Title>\n <Group mt=\"md\" spacing={30}>\n {diagnosticReport.subject && (\n <div>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Subject\n </Text>\n <Text>\n <ResourceBadge value={diagnosticReport.subject} link={true} />\n </Text>\n </div>\n )}\n {diagnosticReport.resultsInterpreter &&\n diagnosticReport.resultsInterpreter.map((interpreter) => (\n <div key={interpreter.reference}>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Interpreter\n </Text>\n <Text>\n <ResourceBadge value={interpreter} link={true} />\n </Text>\n </div>\n ))}\n {diagnosticReport.issued && (\n <div>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Issued\n </Text>\n <Text>{formatDateTime(diagnosticReport.issued)}</Text>\n </div>\n )}\n {diagnosticReport.status && (\n <div>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Status\n </Text>\n <Text>{capitalize(diagnosticReport.status)}</Text>\n </div>\n )}\n </Group>\n {diagnosticReport.result && <ObservationTable value={diagnosticReport.result} />}\n {textContent && <pre>{textContent.trim()}</pre>}\n </Stack>\n );\n}\n\nexport interface ObservationTableProps {\n value?: Observation[] | Reference<Observation>[];\n}\n\nexport function ObservationTable(props: ObservationTableProps): JSX.Element {\n const { classes } = useStyles();\n return (\n <table className={classes.table}>\n <thead>\n <tr>\n <th>Test</th>\n <th>Value</th>\n <th>Reference Range</th>\n <th>Interpretation</th>\n <th>Category</th>\n <th>Status</th>\n </tr>\n </thead>\n <tbody>\n {props.value?.map((observation, index) => (\n <ObservationRow key={'obs-' + index} value={observation} />\n ))}\n </tbody>\n </table>\n );\n}\n\ninterface ObservationRowProps {\n value: Observation | Reference<Observation>;\n}\n\nfunction ObservationRow(props: ObservationRowProps): JSX.Element | null {\n const { classes, cx } = useStyles();\n const observation = useResource(props.value);\n if (!observation) {\n return null;\n }\n\n const critical = isCritical(observation);\n\n return (\n <tr className={cx({ [classes.criticalRow]: critical })}>\n <td>\n <MedplumLink to={observation}>\n <CodeableConceptDisplay value={observation.code} />\n </MedplumLink>\n </td>\n <td>\n <ObservationValueDisplay value={observation} />\n </td>\n <td>\n <ReferenceRangeDisplay value={observation.referenceRange} />\n </td>\n <td>\n {observation.interpretation && observation.interpretation.length > 0 && (\n <CodeableConceptDisplay value={observation.interpretation[0]} />\n )}\n </td>\n <td>\n {observation.category && observation.category.length > 0 && (\n <ul>\n {observation.category.map((concept, index) => (\n <li key={`category-${index}`}>\n <CodeableConceptDisplay value={concept} />\n </li>\n ))}\n </ul>\n )}\n </td>\n <td>{observation.status && <StatusBadge status={observation.status} />}</td>\n </tr>\n );\n}\n\ninterface ObservationValueDisplayProps {\n value?: Observation | ObservationComponent;\n}\n\nfunction ObservationValueDisplay(props: ObservationValueDisplayProps): JSX.Element | null {\n const obs = props.value;\n return <>{formatObservationValue(obs)}</>;\n}\n\ninterface ReferenceRangeProps {\n value?: ObservationReferenceRange[];\n}\n\nfunction ReferenceRangeDisplay(props: ReferenceRangeProps): JSX.Element | null {\n const range = props.value && props.value.length > 0 && props.value[0];\n if (!range) {\n return null;\n }\n if (range.text) {\n return <>{range.text}</>;\n }\n return <RangeDisplay value={range} />;\n}\n\n/**\n * Returns true if the observation is critical.\n * See: https://www.hl7.org/fhir/valueset-observation-interpretation.html\n * @param observation The FHIR observation.\n * @returns True if the FHIR observation is a critical value.\n */\nfunction isCritical(observation: Observation): boolean {\n const code = observation.interpretation?.[0]?.coding?.[0]?.code;\n return code === 'AA' || code === 'LL' || code === 'HH' || code === 'A';\n}\n"],"names":[],"mappings":";;;;;;;;;;AAiBA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,KAAK,EAAE;QACL,MAAM,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AAC7C,QAAA,cAAc,EAAE,UAAU;AAE1B,QAAA,YAAY,EAAE;YACZ,MAAM,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AAC7C,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AACF,KAAA;AAED,IAAA,WAAW,EAAE;QACX,UAAU,EAAE,KAAK,CAAC,WAAW,KAAK,MA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AA,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC;AACxB,IAAA,OAAO,0CAAG,sBAAsB,CAAC,GAAG,CAAC,CAAI,CAAC;AAC5C,CAAC;AAMD,SAAS,qBAAqB,CAAC,KAA0B,EAAA;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;IACD,IAAI,KAAK,CAAC,IAAI,EAAE;AACd,QAAA,OAAO,KAAG,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,KAAK,CAAC,IAAI,CAAI,CAAC;AAC1B,KAAA;AACD,IAAA,OAAO,oBAAC,YAAY,EAAA,EAAC,KAAK,EAAE,KAAK,GAAI,CAAC;AACxC,CAAC;AAED;;;;;AAKG;AACH,SAAS,UAAU,CAAC,WAAwB,EAAA;AAC1C,IAAA,MAAM,IAAI,GAAG,WAAW,CAAC,cAAc,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC;AAChE,IAAA,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC;AACzE;;;;"}
1
+ {"version":3,"file":"DiagnosticReportDisplay.mjs","sources":["../../../src/DiagnosticReportDisplay/DiagnosticReportDisplay.tsx"],"sourcesContent":["import { createStyles, Group, Stack, Text, Title } from '@mantine/core';\nimport { capitalize, formatDateTime, formatObservationValue } from '@medplum/core';\nimport {\n Annotation,\n DiagnosticReport,\n Observation,\n ObservationComponent,\n ObservationReferenceRange,\n Reference,\n} from '@medplum/fhirtypes';\nimport React from 'react';\nimport { CodeableConceptDisplay } from '../CodeableConceptDisplay/CodeableConceptDisplay';\nimport { MedplumLink } from '../MedplumLink/MedplumLink';\nimport { NoteDisplay } from '../NoteDisplay/NoteDisplay';\nimport { RangeDisplay } from '../RangeDisplay/RangeDisplay';\nimport { ResourceBadge } from '../ResourceBadge/ResourceBadge';\nimport { StatusBadge } from '../StatusBadge/StatusBadge';\nimport { useResource } from '../useResource/useResource';\n\nconst useStyles = createStyles((theme) => ({\n table: {\n border: `0.1px solid ${theme.colors.gray[5]}`,\n borderCollapse: 'collapse',\n\n '& td, & th': {\n border: `0.1px solid ${theme.colors.gray[5]}`,\n padding: 4,\n },\n },\n\n criticalRow: {\n background: theme.colorScheme === 'dark' ? theme.colors.red[7] : theme.colors.red[1],\n border: `0.1px solid ${theme.colors.red[5]}`,\n color: theme.colors.red[5],\n fontWeight: 500,\n\n '& td': {\n border: `0.1px solid ${theme.colors.red[5]}`,\n },\n },\n\n noteBody: { fontSize: theme.fontSizes.sm },\n noteCite: { fontSize: theme.fontSizes.xs, marginBlockStart: 3 },\n noteRoot: { padding: 5 },\n}));\n\nexport interface DiagnosticReportDisplayProps {\n value?: DiagnosticReport | Reference<DiagnosticReport>;\n hideObservationNotes?: boolean;\n}\n\nexport function DiagnosticReportDisplay(props: DiagnosticReportDisplayProps): JSX.Element | null {\n const diagnosticReport = useResource(props.value);\n const specimen = useResource(diagnosticReport?.specimen?.[0]);\n\n if (!diagnosticReport) {\n return null;\n }\n\n const specimenNotes: Annotation[] = specimen?.note || [];\n\n if (diagnosticReport.presentedForm && diagnosticReport.presentedForm.length > 0) {\n const pf = diagnosticReport.presentedForm[0];\n if (pf.contentType?.startsWith('text/plain') && pf.data) {\n specimenNotes.push({ text: window.atob(pf.data) });\n }\n }\n\n return (\n <Stack>\n <Title>Diagnostic Report</Title>\n <Group mt=\"md\" spacing={30}>\n {diagnosticReport.subject && (\n <div>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Subject\n </Text>\n <Text>\n <ResourceBadge value={diagnosticReport.subject} link={true} />\n </Text>\n </div>\n )}\n {diagnosticReport.resultsInterpreter &&\n diagnosticReport.resultsInterpreter.map((interpreter) => (\n <div key={interpreter.reference}>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Interpreter\n </Text>\n <Text>\n <ResourceBadge value={interpreter} link={true} />\n </Text>\n </div>\n ))}\n {diagnosticReport.issued && (\n <div>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Issued\n </Text>\n <Text>{formatDateTime(diagnosticReport.issued)}</Text>\n </div>\n )}\n {diagnosticReport.status && (\n <div>\n <Text size=\"xs\" transform=\"uppercase\" color=\"dimmed\">\n Status\n </Text>\n <Text>{capitalize(diagnosticReport.status)}</Text>\n </div>\n )}\n </Group>\n {diagnosticReport.result && (\n <ObservationTable hideObservationNotes={props.hideObservationNotes} value={diagnosticReport.result} />\n )}\n {specimenNotes.length > 0 && <NoteDisplay value={specimenNotes} />}\n </Stack>\n );\n}\n\nexport interface ObservationTableProps {\n value?: Observation[] | Reference<Observation>[];\n hideObservationNotes?: boolean;\n}\n\nexport function ObservationTable(props: ObservationTableProps): JSX.Element {\n const { classes } = useStyles();\n return (\n <table className={classes.table}>\n <thead>\n <tr>\n <th>Test</th>\n <th>Value</th>\n <th>Reference Range</th>\n <th>Interpretation</th>\n <th>Category</th>\n <th>Status</th>\n </tr>\n </thead>\n <tbody>\n {props.value?.map((observation, index) => (\n <ObservationRow\n key={`obs-${index}-${observation.id}`}\n hideObservationNotes={props.hideObservationNotes}\n value={observation}\n />\n ))}\n </tbody>\n </table>\n );\n}\n\ninterface ObservationRowProps {\n value: Observation | Reference<Observation>;\n hideObservationNotes?: boolean;\n}\n\nfunction ObservationRow(props: ObservationRowProps): JSX.Element | null {\n const { classes, cx } = useStyles();\n const observation = useResource(props.value);\n\n if (!observation) {\n return null;\n }\n const displayNotes = !props.hideObservationNotes && observation?.note;\n\n const critical = isCritical(observation);\n\n return (\n <>\n <tr className={cx({ [classes.criticalRow]: critical })}>\n <td rowSpan={displayNotes ? 2 : 1}>\n <MedplumLink to={observation}>\n <CodeableConceptDisplay value={observation.code} />\n </MedplumLink>\n </td>\n <td>\n <ObservationValueDisplay value={observation} />\n </td>\n <td>\n <ReferenceRangeDisplay value={observation.referenceRange} />\n </td>\n <td>\n {observation.interpretation && observation.interpretation.length > 0 && (\n <CodeableConceptDisplay value={observation.interpretation[0]} />\n )}\n </td>\n <td>\n {observation.category && observation.category.length > 0 && (\n <ul>\n {observation.category.map((concept, index) => (\n <li key={`category-${index}`}>\n <CodeableConceptDisplay value={concept} />\n </li>\n ))}\n </ul>\n )}\n </td>\n <td>{observation.status && <StatusBadge status={observation.status} />}</td>\n </tr>\n {displayNotes && (\n <tr>\n <td colSpan={5}>\n <NoteDisplay value={observation.note} />\n </td>\n </tr>\n )}\n </>\n );\n}\n\ninterface ObservationValueDisplayProps {\n value?: Observation | ObservationComponent;\n}\n\nfunction ObservationValueDisplay(props: ObservationValueDisplayProps): JSX.Element | null {\n const obs = props.value;\n return <>{formatObservationValue(obs)}</>;\n}\n\ninterface ReferenceRangeProps {\n value?: ObservationReferenceRange[];\n}\n\nfunction ReferenceRangeDisplay(props: ReferenceRangeProps): JSX.Element | null {\n const range = props.value && props.value.length > 0 && props.value[0];\n if (!range) {\n return null;\n }\n if (range.text) {\n return <>{range.text}</>;\n }\n return <RangeDisplay value={range} />;\n}\n\n/**\n * Returns true if the observation is critical.\n * See: https://www.hl7.org/fhir/valueset-observation-interpretation.html\n * @param observation The FHIR observation.\n * @returns True if the FHIR observation is a critical value.\n */\nfunction isCritical(observation: Observation): boolean {\n const code = observation.interpretation?.[0]?.coding?.[0]?.code;\n return code === 'AA' || code === 'LL' || code === 'HH' || code === 'A';\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;AAmBA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,KAAK,EAAE;QACL,MAAM,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAA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AC;AAC5C,CAAC;AAMD,SAAS,qBAAqB,CAAC,KAA0B,EAAA;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;IACD,IAAI,KAAK,CAAC,IAAI,EAAE;AACd,QAAA,OAAOA,UAAG,CAAA,aAAA,CAAAA,UAAA,CAAA,QAAA,EAAA,IAAA,EAAA,KAAK,CAAC,IAAI,CAAI,CAAC;AAC1B,KAAA;AACD,IAAA,OAAOA,yBAAC,YAAY,EAAA,EAAC,KAAK,EAAE,KAAK,GAAI,CAAC;AACxC,CAAC;AAED;;;;;AAKG;AACH,SAAS,UAAU,CAAC,WAAwB,EAAA;AAC1C,IAAA,MAAM,IAAI,GAAG,WAAW,CAAC,cAAc,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC;AAChE,IAAA,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC;AACzE;;;;"}
@@ -4,3 +4,4 @@ declare const _default: Meta<import("@storybook/react").Args>;
4
4
  export default _default;
5
5
  export declare const Simple: () => JSX.Element;
6
6
  export declare const WithCategories: () => JSX.Element;
7
+ export declare const HideNotes: () => JSX.Element;
@@ -1,11 +1,11 @@
1
- import React from 'react';
1
+ import e__default from 'react';
2
2
  import { Container } from '../Container/Container.mjs';
3
3
  import { Panel } from '../Panel/Panel.mjs';
4
4
 
5
5
  function Document(props) {
6
6
  const { children, ...others } = props;
7
- return (React.createElement(Container, null,
8
- React.createElement(Panel, { ...others }, children)));
7
+ return (e__default.createElement(Container, null,
8
+ e__default.createElement(Panel, { ...others }, children)));
9
9
  }
10
10
 
11
11
  export { Document };
@@ -1 +1 @@
1
- {"version":3,"file":"Document.mjs","sources":["../../../src/Document/Document.tsx"],"sourcesContent":["import React from 'react';\nimport { Container } from '../Container/Container';\nimport { Panel, PanelProps } from '../Panel/Panel';\n\nexport function Document(props: PanelProps): JSX.Element {\n const { children, ...others } = props;\n return (\n <Container>\n <Panel {...others}>{children}</Panel>\n </Container>\n );\n}\n"],"names":[],"mappings":";;;;AAIM,SAAU,QAAQ,CAAC,KAAiB,EAAA;IACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;IACtC,QACE,oBAAC,SAAS,EAAA,IAAA;QACR,KAAC,CAAA,aAAA,CAAA,KAAK,OAAK,MAAM,EAAA,EAAG,QAAQ,CAAS,CAC3B,EACZ;AACJ;;;;"}
1
+ {"version":3,"file":"Document.mjs","sources":["../../../src/Document/Document.tsx"],"sourcesContent":["import React from 'react';\nimport { Container } from '../Container/Container';\nimport { Panel, PanelProps } from '../Panel/Panel';\n\nexport function Document(props: PanelProps): JSX.Element {\n const { children, ...others } = props;\n return (\n <Container>\n <Panel {...others}>{children}</Panel>\n </Container>\n );\n}\n"],"names":["React"],"mappings":";;;;AAIM,SAAU,QAAQ,CAAC,KAAiB,EAAA;IACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;IACtC,QACEA,yBAAC,SAAS,EAAA,IAAA;QACRA,UAAC,CAAA,aAAA,CAAA,KAAK,OAAK,MAAM,EAAA,EAAG,QAAQ,CAAS,CAC3B,EACZ;AACJ;;;;"}
@@ -1,32 +1,15 @@
1
1
  import { getReferenceString, createReference } from '@medplum/core';
2
- import React from 'react';
2
+ import e__default from 'react';
3
3
  import { ResourceTimeline } from '../ResourceTimeline/ResourceTimeline.mjs';
4
4
 
5
5
  function EncounterTimeline(props) {
6
- return (React.createElement(ResourceTimeline, { value: props.encounter, buildSearchRequests: (resource) => ({
7
- resourceType: 'Bundle',
8
- type: 'batch',
9
- entry: [
10
- {
11
- request: {
12
- method: 'GET',
13
- url: `${getReferenceString(resource)}/_history`,
14
- },
15
- },
16
- {
17
- request: {
18
- method: 'GET',
19
- url: `Communication?encounter=${getReferenceString(resource)}`,
20
- },
21
- },
22
- {
23
- request: {
24
- method: 'GET',
25
- url: `Media?encounter=${getReferenceString(resource)}`,
26
- },
27
- },
28
- ],
29
- }), createCommunication: (resource, sender, text) => ({
6
+ return (e__default.createElement(ResourceTimeline, { value: props.encounter, loadTimelineResources: async (medplum, resource) => {
7
+ return Promise.all([
8
+ medplum.readHistory('Encounter', resource.id),
9
+ medplum.search('Communication', 'encounter=' + getReferenceString(resource)),
10
+ medplum.search('Media', 'encounter=' + getReferenceString(resource)),
11
+ ]);
12
+ }, createCommunication: (resource, sender, text) => ({
30
13
  resourceType: 'Communication',
31
14
  status: 'completed',
32
15
  encounter: createReference(resource),
@@ -1 +1 @@
1
- {"version":3,"file":"EncounterTimeline.mjs","sources":["../../../src/EncounterTimeline/EncounterTimeline.tsx"],"sourcesContent":["import { createReference, getReferenceString, ProfileResource } from '@medplum/core';\nimport { Attachment, Encounter, Reference, Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { ResourceTimeline } from '../ResourceTimeline/ResourceTimeline';\n\nexport interface EncounterTimelineProps {\n encounter: Encounter | Reference<Encounter>;\n}\n\nexport function EncounterTimeline(props: EncounterTimelineProps): JSX.Element {\n return (\n <ResourceTimeline\n value={props.encounter}\n buildSearchRequests={(resource: Resource) => ({\n resourceType: 'Bundle',\n type: 'batch',\n entry: [\n {\n request: {\n method: 'GET',\n url: `${getReferenceString(resource)}/_history`,\n },\n },\n {\n request: {\n method: 'GET',\n url: `Communication?encounter=${getReferenceString(resource)}`,\n },\n },\n {\n request: {\n method: 'GET',\n url: `Media?encounter=${getReferenceString(resource)}`,\n },\n },\n ],\n })}\n createCommunication={(resource: Encounter, sender: ProfileResource, text: string) => ({\n resourceType: 'Communication',\n status: 'completed',\n encounter: createReference(resource),\n subject: resource.subject,\n sender: createReference(sender),\n sent: new Date().toISOString(),\n payload: [{ contentString: text }],\n })}\n createMedia={(resource: Encounter, operator: ProfileResource, content: Attachment) => ({\n resourceType: 'Media',\n status: 'completed',\n encounter: createReference(resource),\n subject: resource.subject,\n operator: createReference(operator),\n issued: new Date().toISOString(),\n content,\n })}\n />\n );\n}\n"],"names":[],"mappings":";;;;AASM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,gBAAgB,EACf,EAAA,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,mBAAmB,EAAE,CAAC,QAAkB,MAAM;AAC5C,YAAA,YAAY,EAAE,QAAQ;AACtB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,KAAK,EAAE;AACL,gBAAA;AACE,oBAAA,OAAO,EAAE;AACP,wBAAA,MAAM,EAAE,KAAK;AACb,wBAAA,GAAG,EAAE,CAAG,EAAA,kBAAkB,CAAC,QAAQ,CAAC,CAAW,SAAA,CAAA;AAChD,qBAAA;AACF,iBAAA;AACD,gBAAA;AACE,oBAAA,OAAO,EAAE;AACP,wBAAA,MAAM,EAAE,KAAK;AACb,wBAAA,GAAG,EAAE,CAA2B,wBAAA,EAAA,kBAAkB,CAAC,QAAQ,CAAC,CAAE,CAAA;AAC/D,qBAAA;AACF,iBAAA;AACD,gBAAA;AACE,oBAAA,OAAO,EAAE;AACP,wBAAA,MAAM,EAAE,KAAK;AACb,wBAAA,GAAG,EAAE,CAAmB,gBAAA,EAAA,kBAAkB,CAAC,QAAQ,CAAC,CAAE,CAAA;AACvD,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA,CAAC,EACF,mBAAmB,EAAE,CAAC,QAAmB,EAAE,MAAuB,EAAE,IAAY,MAAM;AACpF,YAAA,YAAY,EAAE,eAAe;AAC7B,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC;YACpC,OAAO,EAAE,QAAQ,CAAC,OAAO;AACzB,YAAA,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;AAC/B,YAAA,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAC9B,YAAA,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AACnC,SAAA,CAAC,EACF,WAAW,EAAE,CAAC,QAAmB,EAAE,QAAyB,EAAE,OAAmB,MAAM;AACrF,YAAA,YAAY,EAAE,OAAO;AACrB,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC;YACpC,OAAO,EAAE,QAAQ,CAAC,OAAO;AACzB,YAAA,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;AACnC,YAAA,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAChC,OAAO;SACR,CAAC,EAAA,CACF,EACF;AACJ;;;;"}
1
+ {"version":3,"file":"EncounterTimeline.mjs","sources":["../../../src/EncounterTimeline/EncounterTimeline.tsx"],"sourcesContent":["import { createReference, getReferenceString, MedplumClient, ProfileResource } from '@medplum/core';\nimport { Attachment, Encounter, Reference } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { ResourceTimeline } from '../ResourceTimeline/ResourceTimeline';\n\nexport interface EncounterTimelineProps {\n encounter: Encounter | Reference<Encounter>;\n}\n\nexport function EncounterTimeline(props: EncounterTimelineProps): JSX.Element {\n return (\n <ResourceTimeline\n value={props.encounter}\n loadTimelineResources={async (medplum: MedplumClient, resource: Encounter) => {\n return Promise.all([\n medplum.readHistory('Encounter', resource.id as string),\n medplum.search('Communication', 'encounter=' + getReferenceString(resource)),\n medplum.search('Media', 'encounter=' + getReferenceString(resource)),\n ]);\n }}\n createCommunication={(resource: Encounter, sender: ProfileResource, text: string) => ({\n resourceType: 'Communication',\n status: 'completed',\n encounter: createReference(resource),\n subject: resource.subject,\n sender: createReference(sender),\n sent: new Date().toISOString(),\n payload: [{ contentString: text }],\n })}\n createMedia={(resource: Encounter, operator: ProfileResource, content: Attachment) => ({\n resourceType: 'Media',\n status: 'completed',\n encounter: createReference(resource),\n subject: resource.subject,\n operator: createReference(operator),\n issued: new Date().toISOString(),\n content,\n })}\n />\n );\n}\n"],"names":["React"],"mappings":";;;;AASM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,gBAAgB,IACf,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,qBAAqB,EAAE,OAAO,OAAsB,EAAE,QAAmB,KAAI;YAC3E,OAAO,OAAO,CAAC,GAAG,CAAC;gBACjB,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAY,CAAC;gBACvD,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;gBAC5E,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACrE,aAAA,CAAC,CAAC;AACL,SAAC,EACD,mBAAmB,EAAE,CAAC,QAAmB,EAAE,MAAuB,EAAE,IAAY,MAAM;AACpF,YAAA,YAAY,EAAE,eAAe;AAC7B,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC;YACpC,OAAO,EAAE,QAAQ,CAAC,OAAO;AACzB,YAAA,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;AAC/B,YAAA,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAC9B,YAAA,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AACnC,SAAA,CAAC,EACF,WAAW,EAAE,CAAC,QAAmB,EAAE,QAAyB,EAAE,OAAmB,MAAM;AACrF,YAAA,YAAY,EAAE,OAAO;AACrB,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC;YACpC,OAAO,EAAE,QAAQ,CAAC,OAAO;AACzB,YAAA,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;AACnC,YAAA,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAChC,OAAO;SACR,CAAC,EAAA,CACF,EACF;AACJ;;;;"}
@@ -1,13 +1,13 @@
1
1
  import { Alert } from '@mantine/core';
2
2
  import { normalizeErrorString } from '@medplum/core';
3
- import { IconAlertCircle } from '@tabler/icons';
4
- import React from 'react';
3
+ import { IconAlertCircle as We } from '../node_modules/@tabler/icons/icons-react/dist/index.esm.mjs';
4
+ import e__default from 'react';
5
5
 
6
6
  /**
7
7
  * ErrorBoundary is a React component that handles errors in its child components.
8
8
  * See: https://reactjs.org/docs/error-boundaries.html
9
9
  */
10
- class ErrorBoundary extends React.Component {
10
+ class ErrorBoundary extends e__default.Component {
11
11
  constructor(props) {
12
12
  super(props);
13
13
  this.state = {};
@@ -20,7 +20,7 @@ class ErrorBoundary extends React.Component {
20
20
  }
21
21
  render() {
22
22
  if (this.state.error) {
23
- return (React.createElement(Alert, { icon: React.createElement(IconAlertCircle, { size: 16 }), title: "Something went wrong", color: "red" }, normalizeErrorString(this.state.error)));
23
+ return (e__default.createElement(Alert, { icon: e__default.createElement(We, { size: 16 }), title: "Something went wrong", color: "red" }, normalizeErrorString(this.state.error)));
24
24
  }
25
25
  return this.props.children;
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.mjs","sources":["../../../src/ErrorBoundary/ErrorBoundary.tsx"],"sourcesContent":["import { Alert } from '@mantine/core';\nimport { normalizeErrorString } from '@medplum/core';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React, { ErrorInfo, ReactNode } from 'react';\n\nexport interface ErrorBoundaryProps {\n children: ReactNode;\n}\n\nexport interface ErrorBoundaryState {\n error?: any;\n}\n\n/**\n * ErrorBoundary is a React component that handles errors in its child components.\n * See: https://reactjs.org/docs/error-boundaries.html\n */\nexport class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState;\n\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {};\n }\n\n static getDerivedStateFromError(error: any): ErrorBoundaryState {\n return { error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n console.error('Uncaught error:', error, errorInfo);\n }\n\n render(): ReactNode {\n if (this.state.error) {\n return (\n <Alert icon={<IconAlertCircle size={16} />} title=\"Something went wrong\" color=\"red\">\n {normalizeErrorString(this.state.error)}\n </Alert>\n );\n }\n\n return this.props.children;\n }\n}\n"],"names":[],"mappings":";;;;;AAaA;;;AAGG;AACU,MAAA,aAAc,SAAQ,KAAK,CAAC,SAAiD,CAAA;AAGxF,IAAA,WAAA,CAAY,KAAyB,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;AACb,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;KACjB;IAED,OAAO,wBAAwB,CAAC,KAAU,EAAA;QACxC,OAAO,EAAE,KAAK,EAAE,CAAC;KAClB;IAED,iBAAiB,CAAC,KAAY,EAAE,SAAoB,EAAA;QAClD,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;KACpD;IAED,MAAM,GAAA;AACJ,QAAA,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;AACpB,YAAA,QACE,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,IAAI,EAAE,KAAA,CAAA,aAAA,CAAC,eAAe,EAAA,EAAC,IAAI,EAAE,EAAE,EAAA,CAAI,EAAE,KAAK,EAAC,sBAAsB,EAAC,KAAK,EAAC,KAAK,EAAA,EACjF,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CACjC,EACR;AACH,SAAA;AAED,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;KAC5B;AACF;;;;"}
1
+ {"version":3,"file":"ErrorBoundary.mjs","sources":["../../../src/ErrorBoundary/ErrorBoundary.tsx"],"sourcesContent":["import { Alert } from '@mantine/core';\nimport { normalizeErrorString } from '@medplum/core';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React, { ErrorInfo, ReactNode } from 'react';\n\nexport interface ErrorBoundaryProps {\n children: ReactNode;\n}\n\nexport interface ErrorBoundaryState {\n error?: any;\n}\n\n/**\n * ErrorBoundary is a React component that handles errors in its child components.\n * See: https://reactjs.org/docs/error-boundaries.html\n */\nexport class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState;\n\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {};\n }\n\n static getDerivedStateFromError(error: any): ErrorBoundaryState {\n return { error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n console.error('Uncaught error:', error, errorInfo);\n }\n\n render(): ReactNode {\n if (this.state.error) {\n return (\n <Alert icon={<IconAlertCircle size={16} />} title=\"Something went wrong\" color=\"red\">\n {normalizeErrorString(this.state.error)}\n </Alert>\n );\n }\n\n return this.props.children;\n }\n}\n"],"names":["React","IconAlertCircle"],"mappings":";;;;;AAaA;;;AAGG;AACU,MAAA,aAAc,SAAQA,UAAK,CAAC,SAAiD,CAAA;AAGxF,IAAA,WAAA,CAAY,KAAyB,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;AACb,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;KACjB;IAED,OAAO,wBAAwB,CAAC,KAAU,EAAA;QACxC,OAAO,EAAE,KAAK,EAAE,CAAC;KAClB;IAED,iBAAiB,CAAC,KAAY,EAAE,SAAoB,EAAA;QAClD,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;KACpD;IAED,MAAM,GAAA;AACJ,QAAA,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;AACpB,YAAA,QACEA,UAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,IAAI,EAAEA,UAAA,CAAA,aAAA,CAACC,EAAe,EAAA,EAAC,IAAI,EAAE,EAAE,EAAA,CAAI,EAAE,KAAK,EAAC,sBAAsB,EAAC,KAAK,EAAC,KAAK,EAAA,EACjF,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CACjC,EACR;AACH,SAAA;AAED,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;KAC5B;AACF;;;;"}
@@ -1,9 +1,9 @@
1
1
  import { JsonInput } from '@mantine/core';
2
2
  import { stringify } from '@medplum/core';
3
- import React from 'react';
3
+ import e__default from 'react';
4
4
 
5
5
  function ExtensionInput(props) {
6
- return (React.createElement(JsonInput, { id: props.name, name: props.name, "data-testid": "extension-input", defaultValue: stringify(props.defaultValue), onChange: (newValue) => {
6
+ return (e__default.createElement(JsonInput, { id: props.name, name: props.name, "data-testid": "extension-input", defaultValue: stringify(props.defaultValue), onChange: (newValue) => {
7
7
  if (props.onChange) {
8
8
  props.onChange(JSON.parse(newValue));
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionInput.mjs","sources":["../../../src/ExtensionInput/ExtensionInput.tsx"],"sourcesContent":["import { JsonInput } from '@mantine/core';\nimport { stringify } from '@medplum/core';\nimport { Extension } from '@medplum/fhirtypes';\nimport React from 'react';\n\nexport interface ExtensionInputProps {\n name: string;\n defaultValue?: Extension;\n onChange?: (value: Extension) => void;\n}\n\nexport function ExtensionInput(props: ExtensionInputProps): JSX.Element {\n return (\n <JsonInput\n id={props.name}\n name={props.name}\n data-testid=\"extension-input\"\n defaultValue={stringify(props.defaultValue)}\n onChange={(newValue) => {\n if (props.onChange) {\n props.onChange(JSON.parse(newValue));\n }\n }}\n />\n );\n}\n"],"names":[],"mappings":";;;;AAWM,SAAU,cAAc,CAAC,KAA0B,EAAA;AACvD,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,IAAI,EAAE,KAAK,CAAC,IAAI,EAAA,aAAA,EACJ,iBAAiB,EAC7B,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,EAC3C,QAAQ,EAAE,CAAC,QAAQ,KAAI;YACrB,IAAI,KAAK,CAAC,QAAQ,EAAE;gBAClB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtC,aAAA;SACF,EAAA,CACD,EACF;AACJ;;;;"}
1
+ {"version":3,"file":"ExtensionInput.mjs","sources":["../../../src/ExtensionInput/ExtensionInput.tsx"],"sourcesContent":["import { JsonInput } from '@mantine/core';\nimport { stringify } from '@medplum/core';\nimport { Extension } from '@medplum/fhirtypes';\nimport React from 'react';\n\nexport interface ExtensionInputProps {\n name: string;\n defaultValue?: Extension;\n onChange?: (value: Extension) => void;\n}\n\nexport function ExtensionInput(props: ExtensionInputProps): JSX.Element {\n return (\n <JsonInput\n id={props.name}\n name={props.name}\n data-testid=\"extension-input\"\n defaultValue={stringify(props.defaultValue)}\n onChange={(newValue) => {\n if (props.onChange) {\n props.onChange(JSON.parse(newValue));\n }\n }}\n />\n );\n}\n"],"names":["React"],"mappings":";;;;AAWM,SAAU,cAAc,CAAC,KAA0B,EAAA;AACvD,IAAA,QACEA,UAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,IAAI,EAAE,KAAK,CAAC,IAAI,EAAA,aAAA,EACJ,iBAAiB,EAC7B,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,EAC3C,QAAQ,EAAE,CAAC,QAAQ,KAAI;YACrB,IAAI,KAAK,CAAC,QAAQ,EAAE;gBAClB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtC,aAAA;SACF,EAAA,CACD,EACF;AACJ;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { evalFhirPath } from '@medplum/core';
2
- import React from 'react';
2
+ import e__default from 'react';
3
3
  import { ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay.mjs';
4
4
 
5
5
  function FhirPathDisplay(props) {
@@ -16,7 +16,7 @@ function FhirPathDisplay(props) {
16
16
  Received ${value.length} elements \
17
17
  [${JSON.stringify(value, null, 2)}]`);
18
18
  }
19
- return React.createElement(ResourcePropertyDisplay, { value: value[0] || '', propertyType: props.propertyType });
19
+ return e__default.createElement(ResourcePropertyDisplay, { value: value[0] || '', propertyType: props.propertyType });
20
20
  }
21
21
 
22
22
  export { FhirPathDisplay };
@@ -1 +1 @@
1
- {"version":3,"file":"FhirPathDisplay.mjs","sources":["../../../src/FhirPathDisplay/FhirPathDisplay.tsx"],"sourcesContent":["import { evalFhirPath, PropertyType } from '@medplum/core';\nimport { Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\n\nexport interface FhirPathDisplayProps {\n resource: Resource;\n path: string;\n propertyType: PropertyType;\n}\n\nexport function FhirPathDisplay(props: FhirPathDisplayProps): JSX.Element | null {\n let value;\n\n try {\n value = evalFhirPath(props.path, props.resource);\n } catch (err) {\n console.warn('FhirPathDisplay:', err);\n return null;\n }\n\n if (value.length > 1) {\n throw new Error(\n `Component \"path\" for \"FhirPathDisplay\" must resolve to a single element. \\\n Received ${value.length} elements \\\n [${JSON.stringify(value, null, 2)}]`\n );\n }\n return <ResourcePropertyDisplay value={value[0] || ''} propertyType={props.propertyType} />;\n}\n"],"names":[],"mappings":";;;;AAWM,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,IAAI,KAAK,CAAC;IAEV,IAAI;QACF,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClD,KAAA;AAAC,IAAA,OAAO,GAAG,EAAE;AACZ,QAAA,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;AACtC,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AAED,IAAA,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,MAAM,IAAI,KAAK,CACb,CAAA;AACY,gBAAA,EAAA,KAAK,CAAC,MAAM,CAAA;UACpB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAG,CAAA,CAAA,CACtC,CAAC;AACH,KAAA;AACD,IAAA,OAAO,oBAAC,uBAAuB,EAAA,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,GAAI,CAAC;AAC9F;;;;"}
1
+ {"version":3,"file":"FhirPathDisplay.mjs","sources":["../../../src/FhirPathDisplay/FhirPathDisplay.tsx"],"sourcesContent":["import { evalFhirPath, PropertyType } from '@medplum/core';\nimport { Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\n\nexport interface FhirPathDisplayProps {\n resource: Resource;\n path: string;\n propertyType: PropertyType;\n}\n\nexport function FhirPathDisplay(props: FhirPathDisplayProps): JSX.Element | null {\n let value;\n\n try {\n value = evalFhirPath(props.path, props.resource);\n } catch (err) {\n console.warn('FhirPathDisplay:', err);\n return null;\n }\n\n if (value.length > 1) {\n throw new Error(\n `Component \"path\" for \"FhirPathDisplay\" must resolve to a single element. \\\n Received ${value.length} elements \\\n [${JSON.stringify(value, null, 2)}]`\n );\n }\n return <ResourcePropertyDisplay value={value[0] || ''} propertyType={props.propertyType} />;\n}\n"],"names":["React"],"mappings":";;;;AAWM,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,IAAI,KAAK,CAAC;IAEV,IAAI;QACF,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClD,KAAA;AAAC,IAAA,OAAO,GAAG,EAAE;AACZ,QAAA,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;AACtC,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AAED,IAAA,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,MAAM,IAAI,KAAK,CACb,CAAA;AACY,gBAAA,EAAA,KAAK,CAAC,MAAM,CAAA;UACpB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAG,CAAA,CAAA,CACtC,CAAC;AACH,KAAA;AACD,IAAA,OAAOA,yBAAC,uBAAuB,EAAA,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,GAAI,CAAC;AAC9F;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { Loader, Table, Button } from '@mantine/core';
2
- import React, { useState, useRef, useEffect } from 'react';
2
+ import e__default, { useState, useRef, useEffect } from 'react';
3
3
  import { FhirPathDisplay } from '../FhirPathDisplay/FhirPathDisplay.mjs';
4
4
  import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
5
5
  import { SearchClickEvent } from '../SearchControl/SearchControl.mjs';
@@ -88,29 +88,29 @@ function FhirPathTable(props) {
88
88
  }, [medplum, props.resourceType]);
89
89
  const typeSchema = schema?.types?.[props.resourceType];
90
90
  if (!typeSchema) {
91
- return React.createElement(Loader, null);
91
+ return e__default.createElement(Loader, null);
92
92
  }
93
93
  const checkboxColumn = props.checkboxesEnabled;
94
- return (React.createElement("div", { onContextMenu: (e) => killEvent(e), "data-testid": "search-control" },
95
- React.createElement(Table, null,
96
- React.createElement("thead", null,
97
- React.createElement("tr", null,
98
- checkboxColumn && (React.createElement("th", null,
99
- React.createElement("input", { type: "checkbox", value: "checked", "aria-label": "all-checkbox", "data-testid": "all-checkbox", checked: isAllSelected(), onChange: (e) => handleAllCheckboxClick(e) }))),
100
- fields.map((field) => (React.createElement("th", { key: field.name }, field.name))))),
101
- React.createElement("tbody", null, response?.data?.ResourceList?.map((resource) => resource && (React.createElement("tr", { key: resource.id, "data-testid": "search-control-row", onClick: (e) => handleRowClick(e, resource), onAuxClick: (e) => handleRowClick(e, resource) },
102
- checkboxColumn && (React.createElement("td", null,
103
- React.createElement("input", { type: "checkbox", value: "checked", "data-testid": "row-checkbox", "aria-label": `Checkbox for ${resource.id}`, checked: !!selected[resource.id], onChange: (e) => handleSingleCheckboxClick(e, resource.id) }))),
94
+ return (e__default.createElement("div", { onContextMenu: (e) => killEvent(e), "data-testid": "search-control" },
95
+ e__default.createElement(Table, null,
96
+ e__default.createElement("thead", null,
97
+ e__default.createElement("tr", null,
98
+ checkboxColumn && (e__default.createElement("th", null,
99
+ e__default.createElement("input", { type: "checkbox", value: "checked", "aria-label": "all-checkbox", "data-testid": "all-checkbox", checked: isAllSelected(), onChange: (e) => handleAllCheckboxClick(e) }))),
100
+ fields.map((field) => (e__default.createElement("th", { key: field.name }, field.name))))),
101
+ e__default.createElement("tbody", null, response?.data?.ResourceList?.map((resource) => resource && (e__default.createElement("tr", { key: resource.id, "data-testid": "search-control-row", onClick: (e) => handleRowClick(e, resource), onAuxClick: (e) => handleRowClick(e, resource) },
102
+ checkboxColumn && (e__default.createElement("td", null,
103
+ e__default.createElement("input", { type: "checkbox", value: "checked", "data-testid": "row-checkbox", "aria-label": `Checkbox for ${resource.id}`, checked: !!selected[resource.id], onChange: (e) => handleSingleCheckboxClick(e, resource.id) }))),
104
104
  fields.map((field) => {
105
- return (React.createElement("td", { key: field.name },
106
- React.createElement(FhirPathDisplay, { propertyType: field.propertyType, path: field.fhirPath, resource: resource })));
105
+ return (e__default.createElement("td", { key: field.name },
106
+ e__default.createElement(FhirPathDisplay, { propertyType: field.propertyType, path: field.fhirPath, resource: resource })));
107
107
  })))))),
108
- response?.data?.ResourceList?.length === 0 && React.createElement("div", { "data-testid": "empty-search" }, "No results"),
109
- outcome && (React.createElement("div", { "data-testid": "search-error" },
110
- React.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
111
- props.onBulk && (React.createElement(Button, { onClick: () => props.onBulk(Object.keys(selectedRef.current)) }, "Bulk..."))));
108
+ response?.data?.ResourceList?.length === 0 && e__default.createElement("div", { "data-testid": "empty-search" }, "No results"),
109
+ outcome && (e__default.createElement("div", { "data-testid": "search-error" },
110
+ e__default.createElement("pre", { style: { textAlign: 'left' } }, JSON.stringify(outcome, undefined, 2)))),
111
+ props.onBulk && (e__default.createElement(Button, { onClick: () => props.onBulk(Object.keys(selectedRef.current)) }, "Bulk..."))));
112
112
  }
113
- const MemoizedFhirPathTable = React.memo(FhirPathTable);
113
+ const MemoizedFhirPathTable = e__default.memo(FhirPathTable);
114
114
 
115
115
  export { FhirPathTable, MemoizedFhirPathTable };
116
116
  //# sourceMappingURL=FhirPathTable.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FhirPathTable.mjs","sources":["../../../src/FhirPathTable/FhirPathTable.tsx"],"sourcesContent":["import { Button, Loader, Table } from '@mantine/core';\nimport { IndexedStructureDefinition, PropertyType } from '@medplum/core';\nimport { OperationOutcome, Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { FhirPathDisplay } from '../FhirPathDisplay/FhirPathDisplay';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { SearchClickEvent } from '../SearchControl/SearchControl';\nimport { isCheckboxCell, killEvent } from '../utils/dom';\n\nexport interface FhirPathTableField {\n readonly propertyType: PropertyType;\n readonly name: string;\n readonly fhirPath: string;\n}\n\nexport interface FhirPathTableProps {\n resourceType: string;\n query: string;\n fields: FhirPathTableField[];\n checkboxesEnabled?: boolean;\n onClick?: (e: SearchClickEvent) => void;\n onAuxClick?: (e: SearchClickEvent) => void;\n onBulk?: (ids: string[]) => void;\n}\n\nexport interface SmartSearchResponse {\n data: {\n ResourceList: Resource[];\n };\n}\n\n/**\n * The FhirPathTable component represents the embeddable search table control.\n */\nexport function FhirPathTable(props: FhirPathTableProps): JSX.Element {\n const medplum = useMedplum();\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n const { query, fields } = props;\n const [response, setResponse] = useState<SmartSearchResponse | undefined>();\n const [selected, setSelected] = useState<{ [id: string]: boolean }>({});\n\n const responseRef = useRef<SmartSearchResponse>();\n responseRef.current = response;\n\n const selectedRef = useRef<{ [id: string]: boolean }>({});\n selectedRef.current = selected;\n\n useEffect(() => {\n setOutcome(undefined);\n medplum.graphql(query).then(setResponse).catch(setOutcome);\n }, [medplum, query]);\n\n function handleSingleCheckboxClick(e: React.ChangeEvent, id: string): void {\n e.stopPropagation();\n\n const el = e.target as HTMLInputElement;\n const checked = el.checked;\n const newSelected = { ...selectedRef.current };\n if (checked) {\n newSelected[id] = true;\n } else {\n delete newSelected[id];\n }\n setSelected(newSelected);\n }\n\n function handleAllCheckboxClick(e: React.ChangeEvent): void {\n e.stopPropagation();\n\n const el = e.target as HTMLInputElement;\n const checked = el.checked;\n const newSelected = {} as { [id: string]: boolean };\n const resources = responseRef.current?.data?.ResourceList;\n if (checked && resources) {\n resources.forEach((resource) => {\n if (resource?.id) {\n newSelected[resource.id] = true;\n }\n });\n }\n setSelected(newSelected);\n }\n\n function isAllSelected(): boolean {\n const resources = responseRef.current?.data?.ResourceList;\n if (!resources || resources.length === 0) {\n return false;\n }\n for (const resource of resources) {\n if (resource?.id && !selectedRef.current[resource.id]) {\n return false;\n }\n }\n return true;\n }\n\n function handleRowClick(e: React.MouseEvent, resource: Resource): void {\n if (isCheckboxCell(e.target as Element)) {\n // Ignore clicks on checkboxes\n return;\n }\n\n killEvent(e);\n\n if (e.button !== 1 && props.onClick) {\n props.onClick(new SearchClickEvent(resource, e));\n }\n\n if (e.button === 1 && props.onAuxClick) {\n props.onAuxClick(new SearchClickEvent(resource, e));\n }\n }\n\n useEffect(() => {\n medplum\n .requestSchema(props.resourceType)\n .then((newSchema) => {\n // The schema could have the same object identity,\n // so need to use the spread operator to kick React re-render.\n setSchema({ ...newSchema });\n })\n .catch(console.log);\n }, [medplum, props.resourceType]);\n\n const typeSchema = schema?.types?.[props.resourceType];\n if (!typeSchema) {\n return <Loader />;\n }\n\n const checkboxColumn = props.checkboxesEnabled;\n\n return (\n <div onContextMenu={(e) => killEvent(e)} data-testid=\"search-control\">\n <Table>\n <thead>\n <tr>\n {checkboxColumn && (\n <th>\n <input\n type=\"checkbox\"\n value=\"checked\"\n aria-label=\"all-checkbox\"\n data-testid=\"all-checkbox\"\n checked={isAllSelected()}\n onChange={(e) => handleAllCheckboxClick(e)}\n />\n </th>\n )}\n {fields.map((field) => (\n <th key={field.name}>{field.name}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {response?.data?.ResourceList?.map(\n (resource) =>\n resource && (\n <tr\n key={resource.id}\n data-testid=\"search-control-row\"\n onClick={(e) => handleRowClick(e, resource)}\n onAuxClick={(e) => handleRowClick(e, resource)}\n >\n {checkboxColumn && (\n <td>\n <input\n type=\"checkbox\"\n value=\"checked\"\n data-testid=\"row-checkbox\"\n aria-label={`Checkbox for ${resource.id}`}\n checked={!!selected[resource.id as string]}\n onChange={(e) => handleSingleCheckboxClick(e, resource.id as string)}\n />\n </td>\n )}\n {fields.map((field) => {\n return (\n <td key={field.name}>\n <FhirPathDisplay propertyType={field.propertyType} path={field.fhirPath} resource={resource} />\n </td>\n );\n })}\n </tr>\n )\n )}\n </tbody>\n </Table>\n {response?.data?.ResourceList?.length === 0 && <div data-testid=\"empty-search\">No results</div>}\n {outcome && (\n <div data-testid=\"search-error\">\n <pre style={{ textAlign: 'left' }}>{JSON.stringify(outcome, undefined, 2)}</pre>\n </div>\n )}\n {props.onBulk && (\n <Button onClick={() => (props.onBulk as (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AAO,CAAC,CAAC,EAAA,EAAA,SAAA,CAExF,CACV,CACG,EACN;AACJ,CAAC;AAEY,MAAA,qBAAqB,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa;;;;"}
1
+ {"version":3,"file":"FhirPathTable.mjs","sources":["../../../src/FhirPathTable/FhirPathTable.tsx"],"sourcesContent":["import { Button, Loader, Table } from '@mantine/core';\nimport { IndexedStructureDefinition, PropertyType } from '@medplum/core';\nimport { OperationOutcome, Resource } from '@medplum/fhirtypes';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { FhirPathDisplay } from '../FhirPathDisplay/FhirPathDisplay';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { SearchClickEvent } from '../SearchControl/SearchControl';\nimport { isCheckboxCell, killEvent } from '../utils/dom';\n\nexport interface FhirPathTableField {\n readonly propertyType: PropertyType;\n readonly name: string;\n readonly fhirPath: string;\n}\n\nexport interface FhirPathTableProps {\n resourceType: string;\n query: string;\n fields: FhirPathTableField[];\n checkboxesEnabled?: boolean;\n onClick?: (e: SearchClickEvent) => void;\n onAuxClick?: (e: SearchClickEvent) => void;\n onBulk?: (ids: string[]) => void;\n}\n\nexport interface SmartSearchResponse {\n data: {\n ResourceList: Resource[];\n };\n}\n\n/**\n * The FhirPathTable component represents the embeddable search table control.\n */\nexport function FhirPathTable(props: FhirPathTableProps): JSX.Element {\n const medplum = useMedplum();\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>();\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n const { query, fields } = props;\n const [response, setResponse] = useState<SmartSearchResponse | undefined>();\n const [selected, setSelected] = useState<{ [id: string]: boolean }>({});\n\n const responseRef = useRef<SmartSearchResponse>();\n responseRef.current = response;\n\n const selectedRef = useRef<{ [id: string]: boolean }>({});\n selectedRef.current = selected;\n\n useEffect(() => {\n setOutcome(undefined);\n medplum.graphql(query).then(setResponse).catch(setOutcome);\n }, [medplum, query]);\n\n function handleSingleCheckboxClick(e: React.ChangeEvent, id: string): void {\n e.stopPropagation();\n\n const el = e.target as HTMLInputElement;\n const checked = el.checked;\n const newSelected = { ...selectedRef.current };\n if (checked) {\n newSelected[id] = true;\n } else {\n delete newSelected[id];\n }\n setSelected(newSelected);\n }\n\n function handleAllCheckboxClick(e: React.ChangeEvent): void {\n e.stopPropagation();\n\n const el = e.target as HTMLInputElement;\n const checked = el.checked;\n const newSelected = {} as { [id: string]: boolean };\n const resources = responseRef.current?.data?.ResourceList;\n if (checked && resources) {\n resources.forEach((resource) => {\n if (resource?.id) {\n newSelected[resource.id] = true;\n }\n });\n }\n setSelected(newSelected);\n }\n\n function isAllSelected(): boolean {\n const resources = responseRef.current?.data?.ResourceList;\n if (!resources || resources.length === 0) {\n return false;\n }\n for (const resource of resources) {\n if (resource?.id && !selectedRef.current[resource.id]) {\n return false;\n }\n }\n return true;\n }\n\n function handleRowClick(e: React.MouseEvent, resource: Resource): void {\n if (isCheckboxCell(e.target as Element)) {\n // Ignore clicks on checkboxes\n return;\n }\n\n killEvent(e);\n\n if (e.button !== 1 && props.onClick) {\n props.onClick(new SearchClickEvent(resource, e));\n }\n\n if (e.button === 1 && props.onAuxClick) {\n props.onAuxClick(new SearchClickEvent(resource, e));\n }\n }\n\n useEffect(() => {\n medplum\n .requestSchema(props.resourceType)\n .then((newSchema) => {\n // The schema could have the same object identity,\n // so need to use the spread operator to kick React re-render.\n setSchema({ ...newSchema });\n })\n .catch(console.log);\n }, [medplum, props.resourceType]);\n\n const typeSchema = schema?.types?.[props.resourceType];\n if (!typeSchema) {\n return <Loader />;\n }\n\n const checkboxColumn = props.checkboxesEnabled;\n\n return (\n <div onContextMenu={(e) => killEvent(e)} data-testid=\"search-control\">\n <Table>\n <thead>\n <tr>\n {checkboxColumn && (\n <th>\n <input\n type=\"checkbox\"\n value=\"checked\"\n aria-label=\"all-checkbox\"\n data-testid=\"all-checkbox\"\n checked={isAllSelected()}\n onChange={(e) => handleAllCheckboxClick(e)}\n />\n </th>\n )}\n {fields.map((field) => (\n <th key={field.name}>{field.name}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {response?.data?.ResourceList?.map(\n (resource) =>\n resource && (\n <tr\n key={resource.id}\n data-testid=\"search-control-row\"\n onClick={(e) => handleRowClick(e, resource)}\n onAuxClick={(e) => handleRowClick(e, resource)}\n >\n {checkboxColumn && (\n <td>\n <input\n type=\"checkbox\"\n value=\"checked\"\n data-testid=\"row-checkbox\"\n aria-label={`Checkbox for ${resource.id}`}\n checked={!!selected[resource.id as string]}\n onChange={(e) => handleSingleCheckboxClick(e, resource.id as string)}\n />\n </td>\n )}\n {fields.map((field) => {\n return (\n <td key={field.name}>\n <FhirPathDisplay propertyType={field.propertyType} path={field.fhirPath} resource={resource} />\n </td>\n );\n })}\n </tr>\n )\n )}\n </tbody>\n </Table>\n {response?.data?.ResourceList?.length === 0 && <div data-testid=\"empty-search\">No results</div>}\n {outcome && (\n <div data-testid=\"search-error\">\n <pre style={{ textAlign: 'left' }}>{JSON.stringify(outcome, undefined, 2)}</pre>\n </div>\n )}\n {props.onBulk && (\n <Button onClick={() => (props.onBulk as (ids: string[]) => any)(Object.keys(selectedRef.current))}>\n Bulk...\n </Button>\n )}\n </div>\n );\n}\n\nexport const MemoizedFhirPathTable = React.memo(FhirPathTable);\n"],"names":["React"],"mappings":";;;;;;;AA+BA;;AAEG;AACG,SAAU,aAAa,CAAC,KAAyB,EAAA;AACrD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAA0C,CAAC;IAC/E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAgC,CAAC;AACvE,IAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAChC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,EAAmC,CAAC;IAC5E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAA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AAE,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAI,CAAA,CAC5F,EACL;AACJ,iBAAC,CAAC,CACC,CACN,CACJ,CACK,CACF;QACP,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC,IAAIA,UAAiB,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAA,cAAc,EAAiB,EAAA,YAAA,CAAA;QAC9F,OAAO,KACNA,UAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAiB,cAAc,EAAA;YAC7BA,UAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,IAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAO,CAC5E,CACP;AACA,QAAA,KAAK,CAAC,MAAM,KACXA,UAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,OAAO,EAAE,MAAO,KAAK,CAAC,MAAiC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAA,EAAA,SAAA,CAExF,CACV,CACG,EACN;AACJ,CAAC;AAEY,MAAA,qBAAqB,GAAGA,UAAK,CAAC,IAAI,CAAC,aAAa;;;;"}
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import e__default from 'react';
2
2
  import { parseForm } from './FormUtils.mjs';
3
3
 
4
4
  function Form(props) {
5
- return (React.createElement("form", { style: props.style, "data-testid": props.testid, onSubmit: (e) => {
5
+ return (e__default.createElement("form", { style: props.style, "data-testid": props.testid, onSubmit: (e) => {
6
6
  e.preventDefault();
7
7
  const formData = parseForm(e.target);
8
8
  if (props.onSubmit) {
@@ -1 +1 @@
1
- {"version":3,"file":"Form.mjs","sources":["../../../src/Form/Form.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { parseForm } from './FormUtils';\n\nexport interface FormProps {\n onSubmit?: (formData: Record<string, string>) => void;\n style?: CSSProperties;\n children?: React.ReactNode;\n testid?: string;\n}\n\nexport function Form(props: FormProps): JSX.Element {\n return (\n <form\n style={props.style}\n data-testid={props.testid}\n onSubmit={(e: React.SyntheticEvent) => {\n e.preventDefault();\n const formData = parseForm(e.target as HTMLFormElement);\n if (props.onSubmit) {\n props.onSubmit(formData);\n }\n }}\n >\n {props.children}\n </form>\n );\n}\n"],"names":[],"mappings":";;;AAUM,SAAU,IAAI,CAAC,KAAgB,EAAA;AACnC,IAAA,QACE,KACE,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAAA,aAAA,EACL,KAAK,CAAC,MAAM,EACzB,QAAQ,EAAE,CAAC,CAAuB,KAAI;YACpC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,MAAyB,CAAC,CAAC;YACxD,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,gBAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,aAAA;AACH,SAAC,IAEA,KAAK,CAAC,QAAQ,CACV,EACP;AACJ;;;;"}
1
+ {"version":3,"file":"Form.mjs","sources":["../../../src/Form/Form.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { parseForm } from './FormUtils';\n\nexport interface FormProps {\n onSubmit?: (formData: Record<string, string>) => void;\n style?: CSSProperties;\n children?: React.ReactNode;\n testid?: string;\n}\n\nexport function Form(props: FormProps): JSX.Element {\n return (\n <form\n style={props.style}\n data-testid={props.testid}\n onSubmit={(e: React.SyntheticEvent) => {\n e.preventDefault();\n const formData = parseForm(e.target as HTMLFormElement);\n if (props.onSubmit) {\n props.onSubmit(formData);\n }\n }}\n >\n {props.children}\n </form>\n );\n}\n"],"names":["React"],"mappings":";;;AAUM,SAAU,IAAI,CAAC,KAAgB,EAAA;AACnC,IAAA,QACEA,UACE,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAAA,aAAA,EACL,KAAK,CAAC,MAAM,EACzB,QAAQ,EAAE,CAAC,CAAuB,KAAI;YACpC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,MAAyB,CAAC,CAAC;YACxD,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,gBAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,aAAA;AACH,SAAC,IAEA,KAAK,CAAC,QAAQ,CACV,EACP;AACJ;;;;"}
@@ -1,9 +1,9 @@
1
1
  import { Input } from '@mantine/core';
2
- import React from 'react';
2
+ import e__default from 'react';
3
3
  import { getErrorsForInput } from '../utils/outcomes.mjs';
4
4
 
5
5
  function FormSection(props) {
6
- return (React.createElement(Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
6
+ return (e__default.createElement(Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
7
7
  }
8
8
 
9
9
  export { FormSection };
@@ -1 +1 @@
1
- {"version":3,"file":"FormSection.mjs","sources":["../../../src/FormSection/FormSection.tsx"],"sourcesContent":["import { Input } from '@mantine/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface FormSectionProps {\n title?: string;\n htmlFor?: string;\n description?: string;\n outcome?: OperationOutcome;\n children?: React.ReactNode;\n}\n\nexport function FormSection(props: FormSectionProps): JSX.Element {\n return (\n <Input.Wrapper\n id={props.htmlFor}\n label={props.title}\n description={props.description}\n error={getErrorsForInput(props.outcome, props.htmlFor)}\n >\n {props.children}\n </Input.Wrapper>\n );\n}\n"],"names":[],"mappings":";;;;AAaM,SAAU,WAAW,CAAC,KAAuB,EAAA;AACjD,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,KAAK,CAAC,OAAO,EAAA,EACZ,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAErD,EAAA,KAAK,CAAC,QAAQ,CACD,EAChB;AACJ;;;;"}
1
+ {"version":3,"file":"FormSection.mjs","sources":["../../../src/FormSection/FormSection.tsx"],"sourcesContent":["import { Input } from '@mantine/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface FormSectionProps {\n title?: string;\n htmlFor?: string;\n description?: string;\n outcome?: OperationOutcome;\n children?: React.ReactNode;\n}\n\nexport function FormSection(props: FormSectionProps): JSX.Element {\n return (\n <Input.Wrapper\n id={props.htmlFor}\n label={props.title}\n description={props.description}\n error={getErrorsForInput(props.outcome, props.htmlFor)}\n >\n {props.children}\n </Input.Wrapper>\n );\n}\n"],"names":["React"],"mappings":";;;;AAaM,SAAU,WAAW,CAAC,KAAuB,EAAA;AACjD,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,KAAK,CAAC,OAAO,EAAA,EACZ,EAAE,EAAE,KAAK,CAAC,OAAO,EACjB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAErD,EAAA,KAAK,CAAC,QAAQ,CACD,EAChB;AACJ;;;;"}