@medplum/react 0.10.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/cjs/AttachmentButton.d.ts +2 -0
  2. package/dist/cjs/CalendarInput.d.ts +0 -1
  3. package/dist/cjs/CheckboxFormSection.d.ts +0 -1
  4. package/dist/cjs/DescriptionList.d.ts +0 -1
  5. package/dist/cjs/DiagnosticReportDisplay.d.ts +0 -1
  6. package/dist/cjs/Document.d.ts +0 -1
  7. package/dist/cjs/FhirPathTable.d.ts +0 -1
  8. package/dist/cjs/FormSection.d.ts +0 -1
  9. package/dist/cjs/MedplumLink.d.ts +2 -4
  10. package/dist/cjs/QuestionnaireBuilder.d.ts +0 -1
  11. package/dist/cjs/QuestionnaireForm.d.ts +0 -1
  12. package/dist/cjs/RequestGroupDisplay.d.ts +0 -1
  13. package/dist/cjs/ResourceBadge.d.ts +0 -1
  14. package/dist/cjs/ResourceBlame.d.ts +0 -1
  15. package/dist/cjs/ResourceDiff.d.ts +0 -1
  16. package/dist/cjs/ResourceDiffTable.d.ts +0 -2
  17. package/dist/cjs/ResourceName.d.ts +2 -1
  18. package/dist/cjs/ResourceTimeline.d.ts +0 -1
  19. package/dist/cjs/Scheduler.d.ts +0 -1
  20. package/dist/cjs/SearchControl.d.ts +0 -1
  21. package/dist/cjs/SearchFilterEditor.d.ts +0 -1
  22. package/dist/cjs/Timeline.d.ts +0 -1
  23. package/dist/cjs/auth/AuthenticationForm.d.ts +1 -0
  24. package/dist/cjs/auth/RegisterForm.d.ts +0 -1
  25. package/dist/cjs/auth/SignInForm.d.ts +1 -1
  26. package/dist/cjs/index.js +1252 -907
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/index.min.js +1 -1
  29. package/dist/cjs/index.min.js.map +1 -1
  30. package/dist/cjs/stories/DescriptionList.stories.d.ts +5 -0
  31. package/dist/cjs/stories/PlanDefinitionBuilder.stories.d.ts +2 -0
  32. package/dist/cjs/stories/RequestGroupDisplay.stories.d.ts +1 -0
  33. package/dist/cjs/stories/ResourceTable.stories.d.ts +4 -0
  34. package/dist/cjs/stories/covid19.d.ts +15 -0
  35. package/dist/esm/AttachmentArrayInput.js +2 -2
  36. package/dist/esm/AttachmentArrayInput.js.map +1 -1
  37. package/dist/esm/AttachmentButton.d.ts +2 -0
  38. package/dist/esm/AttachmentButton.js +4 -1
  39. package/dist/esm/AttachmentButton.js.map +1 -1
  40. package/dist/esm/BackboneElementInput.js +2 -1
  41. package/dist/esm/BackboneElementInput.js.map +1 -1
  42. package/dist/esm/CalendarInput.d.ts +0 -1
  43. package/dist/esm/CalendarInput.js +39 -2
  44. package/dist/esm/CalendarInput.js.map +1 -1
  45. package/dist/esm/CheckboxFormSection.d.ts +0 -1
  46. package/dist/esm/CheckboxFormSection.js +5 -5
  47. package/dist/esm/CheckboxFormSection.js.map +1 -1
  48. package/dist/esm/DescriptionList.d.ts +0 -1
  49. package/dist/esm/DescriptionList.js +23 -1
  50. package/dist/esm/DescriptionList.js.map +1 -1
  51. package/dist/esm/DiagnosticReportDisplay.d.ts +0 -1
  52. package/dist/esm/DiagnosticReportDisplay.js +40 -22
  53. package/dist/esm/DiagnosticReportDisplay.js.map +1 -1
  54. package/dist/esm/Document.d.ts +0 -1
  55. package/dist/esm/Document.js +7 -2
  56. package/dist/esm/Document.js.map +1 -1
  57. package/dist/esm/ErrorBoundary.js +2 -1
  58. package/dist/esm/ErrorBoundary.js.map +1 -1
  59. package/dist/esm/FhirPathTable.d.ts +0 -1
  60. package/dist/esm/FhirPathTable.js +5 -5
  61. package/dist/esm/FhirPathTable.js.map +1 -1
  62. package/dist/esm/FormSection.d.ts +0 -1
  63. package/dist/esm/FormSection.js +3 -11
  64. package/dist/esm/FormSection.js.map +1 -1
  65. package/dist/esm/MedplumLink.d.ts +2 -4
  66. package/dist/esm/MedplumLink.js +11 -8
  67. package/dist/esm/MedplumLink.js.map +1 -1
  68. package/dist/esm/PlanDefinitionBuilder.js +41 -10
  69. package/dist/esm/PlanDefinitionBuilder.js.map +1 -1
  70. package/dist/esm/QuestionnaireBuilder.d.ts +0 -1
  71. package/dist/esm/QuestionnaireBuilder.js +78 -31
  72. package/dist/esm/QuestionnaireBuilder.js.map +1 -1
  73. package/dist/esm/QuestionnaireForm.d.ts +0 -1
  74. package/dist/esm/QuestionnaireForm.js +26 -16
  75. package/dist/esm/QuestionnaireForm.js.map +1 -1
  76. package/dist/esm/RequestGroupDisplay.d.ts +0 -1
  77. package/dist/esm/RequestGroupDisplay.js +8 -7
  78. package/dist/esm/RequestGroupDisplay.js.map +1 -1
  79. package/dist/esm/ResourceBadge.d.ts +0 -1
  80. package/dist/esm/ResourceBadge.js +2 -1
  81. package/dist/esm/ResourceBadge.js.map +1 -1
  82. package/dist/esm/ResourceBlame.d.ts +0 -1
  83. package/dist/esm/ResourceBlame.js +59 -10
  84. package/dist/esm/ResourceBlame.js.map +1 -1
  85. package/dist/esm/ResourceDiff.d.ts +0 -1
  86. package/dist/esm/ResourceDiff.js +13 -2
  87. package/dist/esm/ResourceDiff.js.map +1 -1
  88. package/dist/esm/ResourceDiffTable.d.ts +0 -2
  89. package/dist/esm/ResourceDiffTable.js +25 -3
  90. package/dist/esm/ResourceDiffTable.js.map +1 -1
  91. package/dist/esm/ResourceForm.js +6 -5
  92. package/dist/esm/ResourceForm.js.map +1 -1
  93. package/dist/esm/ResourceInput.js +28 -2
  94. package/dist/esm/ResourceInput.js.map +1 -1
  95. package/dist/esm/ResourceName.d.ts +2 -1
  96. package/dist/esm/ResourceName.js +5 -2
  97. package/dist/esm/ResourceName.js.map +1 -1
  98. package/dist/esm/ResourcePropertyDisplay.js +6 -6
  99. package/dist/esm/ResourcePropertyDisplay.js.map +1 -1
  100. package/dist/esm/ResourceTimeline.d.ts +0 -1
  101. package/dist/esm/ResourceTimeline.js +78 -25
  102. package/dist/esm/ResourceTimeline.js.map +1 -1
  103. package/dist/esm/Scheduler.d.ts +0 -1
  104. package/dist/esm/Scheduler.js +20 -4
  105. package/dist/esm/Scheduler.js.map +1 -1
  106. package/dist/esm/SearchControl.d.ts +0 -1
  107. package/dist/esm/SearchControl.js +33 -18
  108. package/dist/esm/SearchControl.js.map +1 -1
  109. package/dist/esm/SearchFilterEditor.d.ts +0 -1
  110. package/dist/esm/SearchFilterEditor.js +2 -2
  111. package/dist/esm/SearchFilterEditor.js.map +1 -1
  112. package/dist/esm/Timeline.d.ts +0 -1
  113. package/dist/esm/Timeline.js +13 -16
  114. package/dist/esm/Timeline.js.map +1 -1
  115. package/dist/esm/auth/AuthenticationForm.d.ts +1 -0
  116. package/dist/esm/auth/AuthenticationForm.js +6 -3
  117. package/dist/esm/auth/AuthenticationForm.js.map +1 -1
  118. package/dist/esm/auth/ChooseProfileForm.js +3 -3
  119. package/dist/esm/auth/ChooseProfileForm.js.map +1 -1
  120. package/dist/esm/auth/NewProjectForm.js +3 -3
  121. package/dist/esm/auth/NewProjectForm.js.map +1 -1
  122. package/dist/esm/auth/NewUserForm.js +4 -3
  123. package/dist/esm/auth/NewUserForm.js.map +1 -1
  124. package/dist/esm/auth/RegisterForm.d.ts +0 -1
  125. package/dist/esm/auth/RegisterForm.js.map +1 -1
  126. package/dist/esm/auth/SignInForm.d.ts +1 -1
  127. package/dist/esm/auth/SignInForm.js +1 -1
  128. package/dist/esm/auth/SignInForm.js.map +1 -1
  129. package/dist/esm/index.min.js +1 -1
  130. package/dist/esm/index.min.js.map +1 -1
  131. package/dist/esm/stories/DescriptionList.stories.d.ts +5 -0
  132. package/dist/esm/stories/PlanDefinitionBuilder.stories.d.ts +2 -0
  133. package/dist/esm/stories/RequestGroupDisplay.stories.d.ts +1 -0
  134. package/dist/esm/stories/ResourceTable.stories.d.ts +4 -0
  135. package/dist/esm/stories/covid19.d.ts +15 -0
  136. package/package.json +35 -23
  137. package/rollup.config.mjs +111 -0
  138. package/dist/cjs/defaulttheme.css +0 -192
  139. package/dist/cjs/styles.css +0 -528
  140. package/dist/esm/defaulttheme.css +0 -192
  141. package/dist/esm/styles.css +0 -528
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Basic: () => JSX.Element;
@@ -3,3 +3,5 @@ import { Meta } from '@storybook/react';
3
3
  declare const _default: Meta<import("@storybook/react").Args>;
4
4
  export default _default;
5
5
  export declare const Basic: () => JSX.Element;
6
+ export declare const Covid19Eval: () => JSX.Element;
7
+ export declare const Covid19PCRLabServiceStory: () => JSX.Element;
@@ -3,3 +3,4 @@ import { Meta } from '@storybook/react';
3
3
  declare const _default: Meta<import("@storybook/react").Args>;
4
4
  export default _default;
5
5
  export declare const Simple: () => JSX.Element;
6
+ export declare const Covid19: () => JSX.Element;
@@ -5,3 +5,7 @@ export default _default;
5
5
  export declare const Patient: () => JSX.Element;
6
6
  export declare const Observation: () => JSX.Element;
7
7
  export declare const ObservationIgnoreEmpty: () => JSX.Element;
8
+ export declare const Covid19PCRTestActivity: () => JSX.Element;
9
+ export declare const Covid19ReviewReportActivity: () => JSX.Element;
10
+ export declare const Covid19SpecimenRequirement: () => JSX.Element;
11
+ export declare const Covid19ObservationDefinition: () => JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { ActivityDefinition, ObservationDefinition, PlanDefinition, Questionnaire, RequestGroup, ServiceRequest, SpecimenDefinition, Task } from '@medplum/fhirtypes';
2
+ export declare const Covid19AssessmentQuestionnaire: Questionnaire;
3
+ export declare const Covid19NasalSpecimen: SpecimenDefinition;
4
+ export declare const Covid19PCRObservationDefinition: ObservationDefinition;
5
+ export declare const Covid19PCRTest: ActivityDefinition;
6
+ export declare const Covid19ReviewReport: ActivityDefinition;
7
+ export declare const Covid19CarePlanDefinition: PlanDefinition;
8
+ export declare const Covid19PCRLabService: PlanDefinition;
9
+ export declare const Covid19AssessmentTask: Task;
10
+ export declare const Covid19InitialConsultTask: Task;
11
+ export declare const Covid19PCRServiceRequest: ServiceRequest;
12
+ export declare const Covid19PCRTask: Task;
13
+ export declare const Covid19ReviewLabsTask: Task;
14
+ export declare const Covid19FollowUpConsultTask: Task;
15
+ export declare const Covid19RequestGroup: RequestGroup;
@@ -24,7 +24,7 @@ function AttachmentArrayInput(props) {
24
24
  values.map((v, index) => (React.createElement("tr", { key: `${index}-${values.length}` },
25
25
  React.createElement("td", null,
26
26
  React.createElement(AttachmentDisplay, { value: v, maxWidth: 200 })),
27
- React.createElement("td", { className: "medplum-right" },
27
+ React.createElement("td", null,
28
28
  React.createElement(ActionIcon, { title: "Remove", size: "sm", onClick: (e) => {
29
29
  killEvent(e);
30
30
  const copy = values.slice();
@@ -34,7 +34,7 @@ function AttachmentArrayInput(props) {
34
34
  React.createElement(IconCircleMinus, null)))))),
35
35
  React.createElement("tr", null,
36
36
  React.createElement("td", null),
37
- React.createElement("td", { className: "medplum-right" },
37
+ React.createElement("td", null,
38
38
  React.createElement(AttachmentButton, { onUpload: (attachment) => {
39
39
  setValuesWrapper([...valuesRef.current, attachment]);
40
40
  } }, (props) => (React.createElement(ActionIcon, Object.assign({}, props, { title: "Add", size: "sm", color: "green" }),
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentArrayInput.js","sources":["../../src/AttachmentArrayInput.tsx"],"sourcesContent":["import { ActionIcon } from '@mantine/core';\nimport { Attachment } from '@medplum/fhirtypes';\nimport { IconCircleMinus, IconCloudUpload } from '@tabler/icons';\nimport React, { useRef, useState } from 'react';\nimport { AttachmentButton } from './AttachmentButton';\nimport { AttachmentDisplay } from './AttachmentDisplay';\nimport { killEvent } from './utils/dom';\n\nexport interface AttachmentArrayInputProps {\n name: string;\n defaultValue?: Attachment[];\n arrayElement?: boolean;\n onChange?: (value: Attachment[]) => void;\n}\n\nexport function AttachmentArrayInput(props: AttachmentArrayInputProps): JSX.Element {\n const [values, setValues] = useState<Attachment[]>(props.defaultValue ?? []);\n\n const valuesRef = useRef<Attachment[]>();\n valuesRef.current = values;\n\n function setValuesWrapper(newValues: Attachment[]): void {\n setValues(newValues);\n if (props.onChange) {\n props.onChange(newValues);\n }\n }\n\n return (\n <table style={{ width: '100%' }}>\n <colgroup>\n <col width=\"97%\" />\n <col width=\"3%\" />\n </colgroup>\n <tbody>\n {values.map((v: Attachment, index: number) => (\n <tr key={`${index}-${values.length}`}>\n <td>\n <AttachmentDisplay value={v} maxWidth={200} />\n </td>\n <td className=\"medplum-right\">\n <ActionIcon\n title=\"Remove\"\n size=\"sm\"\n onClick={(e: React.MouseEvent) => {\n killEvent(e);\n const copy = values.slice();\n copy.splice(index, 1);\n setValuesWrapper(copy);\n }}\n >\n <IconCircleMinus />\n </ActionIcon>\n </td>\n </tr>\n ))}\n <tr>\n <td></td>\n <td className=\"medplum-right\">\n <AttachmentButton\n onUpload={(attachment: Attachment) => {\n setValuesWrapper([...(valuesRef.current as Attachment[]), attachment]);\n }}\n >\n {(props) => (\n <ActionIcon {...props} title=\"Add\" size=\"sm\" color=\"green\">\n <IconCloudUpload size={16} />\n </ActionIcon>\n )}\n </AttachmentButton>\n </td>\n </tr>\n </tbody>\n </table>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAeM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;;AACnE,IAAA,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAe,CAAA,EAAA,GAAA,KAAK,CAAC,YAAY,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,CAAC,CAAC;AAE7E,IAAA,MAAM,SAAS,GAAG,MAAM,EAAgB,CAAC;AACzC,IAAA,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;IAE3B,SAAS,gBAAgB,CAAC,SAAuB,EAAA;QAC/C,SAAS,CAAC,SAAS,CAAC,CAAC;QACrB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC3B,SAAA;KACF;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,EAAA,IAAA;gBACE,KAAS,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,CAAA;gBACT,KAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAC,eAAe,EAAA;AAC3B,oBAAA,KAAA,CAAA,aAAA,CAAC,gBAAgB,EACf,EAAA,QAAQ,EAAE,CAAC,UAAsB,KAAI;4BACnC,gBAAgB,CAAC,CAAC,GAAI,SAAS,CAAC,OAAwB,EAAE,UAAU,CAAC,CAAC,CAAC;yBACxE,EAAA,EAEA,CAAC,KAAK,MACL,KAAC,CAAA,aAAA,CAAA,UAAU,EAAK,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,KAAK,IAAE,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,EAAA,CAAA;AACxD,wBAAA,KAAA,CAAA,aAAA,CAAC,eAAe,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA,CAClB,CACd,CACgB,CAChB,CACF,CACC,CACF,EACR;AACJ;;;;"}
1
+ {"version":3,"file":"AttachmentArrayInput.js","sources":["../../src/AttachmentArrayInput.tsx"],"sourcesContent":["import { ActionIcon } from '@mantine/core';\nimport { Attachment } from '@medplum/fhirtypes';\nimport { IconCircleMinus, IconCloudUpload } from '@tabler/icons';\nimport React, { useRef, useState } from 'react';\nimport { AttachmentButton } from './AttachmentButton';\nimport { AttachmentDisplay } from './AttachmentDisplay';\nimport { killEvent } from './utils/dom';\n\nexport interface AttachmentArrayInputProps {\n name: string;\n defaultValue?: Attachment[];\n arrayElement?: boolean;\n onChange?: (value: Attachment[]) => void;\n}\n\nexport function AttachmentArrayInput(props: AttachmentArrayInputProps): JSX.Element {\n const [values, setValues] = useState<Attachment[]>(props.defaultValue ?? []);\n\n const valuesRef = useRef<Attachment[]>();\n valuesRef.current = values;\n\n function setValuesWrapper(newValues: Attachment[]): void {\n setValues(newValues);\n if (props.onChange) {\n props.onChange(newValues);\n }\n }\n\n return (\n <table style={{ width: '100%' }}>\n <colgroup>\n <col width=\"97%\" />\n <col width=\"3%\" />\n </colgroup>\n <tbody>\n {values.map((v: Attachment, index: number) => (\n <tr key={`${index}-${values.length}`}>\n <td>\n <AttachmentDisplay value={v} maxWidth={200} />\n </td>\n <td>\n <ActionIcon\n title=\"Remove\"\n size=\"sm\"\n onClick={(e: React.MouseEvent) => {\n killEvent(e);\n const copy = values.slice();\n copy.splice(index, 1);\n setValuesWrapper(copy);\n }}\n >\n <IconCircleMinus />\n </ActionIcon>\n </td>\n </tr>\n ))}\n <tr>\n <td></td>\n <td>\n <AttachmentButton\n onUpload={(attachment: Attachment) => {\n setValuesWrapper([...(valuesRef.current as Attachment[]), attachment]);\n }}\n >\n {(props) => (\n <ActionIcon {...props} title=\"Add\" size=\"sm\" color=\"green\">\n <IconCloudUpload size={16} />\n </ActionIcon>\n )}\n </AttachmentButton>\n </td>\n </tr>\n </tbody>\n </table>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAeM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;;AACnE,IAAA,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAe,CAAA,EAAA,GAAA,KAAK,CAAC,YAAY,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,CAAC,CAAC;AAE7E,IAAA,MAAM,SAAS,GAAG,MAAM,EAAgB,CAAC;AACzC,IAAA,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;IAE3B,SAAS,gBAAgB,CAAC,SAAuB,EAAA;QAC/C,SAAS,CAAC,SAAS,CAAC,CAAC;QACrB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC3B,SAAA;KACF;IAED,QACE,+BAAO,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAA;AAC7B,QAAA,KAAA,CAAA,aAAA,CAAA,UAAA,E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AA,KAAA,CAAA,aAAA,CAAC,gBAAgB,EACf,EAAA,QAAQ,EAAE,CAAC,UAAsB,KAAI;4BACnC,gBAAgB,CAAC,CAAC,GAAI,SAAS,CAAC,OAAwB,EAAE,UAAU,CAAC,CAAC,CAAC;yBACxE,EAAA,EAEA,CAAC,KAAK,MACL,KAAC,CAAA,aAAA,CAAA,UAAU,EAAK,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,KAAK,IAAE,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,EAAA,CAAA;AACxD,wBAAA,KAAA,CAAA,aAAA,CAAC,eAAe,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA,CAClB,CACd,CACgB,CAChB,CACF,CACC,CACF,EACR;AACJ;;;;"}
@@ -2,6 +2,8 @@ import { Attachment } from '@medplum/fhirtypes';
2
2
  import React from 'react';
3
3
  export interface AttachmentButtonProps {
4
4
  onUpload: (attachment: Attachment) => void;
5
+ onUploadStart?: () => void;
6
+ onUploadProgress?: (e: ProgressEvent) => void;
5
7
  children(props: {
6
8
  onClick(e: React.MouseEvent): void;
7
9
  }): React.ReactNode;
@@ -30,10 +30,13 @@ function AttachmentButton(props) {
30
30
  if (!fileName) {
31
31
  return;
32
32
  }
33
+ if (props.onUploadStart) {
34
+ props.onUploadStart();
35
+ }
33
36
  const filename = file.name;
34
37
  const contentType = file.type || 'application/octet-stream';
35
38
  medplum
36
- .createBinary(file, filename, contentType)
39
+ .createBinary(file, filename, contentType, props.onUploadProgress)
37
40
  .then((binary) => {
38
41
  props.onUpload({
39
42
  contentType: binary.contentType,
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentButton.js","sources":["../../src/AttachmentButton.tsx"],"sourcesContent":["import { Attachment, Binary, OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useRef } from 'react';\nimport { useMedplum } from './MedplumProvider';\nimport { killEvent } from './utils/dom';\n\nexport interface AttachmentButtonProps {\n onUpload: (attachment: Attachment) => void;\n children(props: { onClick(e: React.MouseEvent): void }): React.ReactNode;\n}\n\nexport function AttachmentButton(props: AttachmentButtonProps): JSX.Element {\n const medplum = useMedplum();\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n function onClick(e: React.MouseEvent): void {\n killEvent(e);\n fileInputRef.current?.click();\n }\n\n function onFileChange(e: React.ChangeEvent): void {\n killEvent(e);\n const files = (e.target as HTMLInputElement).files;\n if (files) {\n Array.from(files).forEach(processFile);\n }\n }\n\n /**\n * Processes a single file.\n *\n * @param {File} file The file descriptor.\n */\n function processFile(file: File): void {\n if (!file) {\n return;\n }\n\n const fileName = file.name;\n if (!fileName) {\n return;\n }\n\n const filename = file.name;\n const contentType = file.type || 'application/octet-stream';\n medplum\n .createBinary(file, filename, contentType)\n .then((binary: Binary) => {\n props.onUpload({\n contentType: binary.contentType,\n url: binary.url,\n title: filename,\n });\n })\n .catch((outcome: OperationOutcome) => {\n alert(outcome?.issue?.[0]?.details?.text);\n });\n }\n\n return (\n <>\n <input\n type=\"file\"\n data-testid=\"upload-file-input\"\n style={{ display: 'none' }}\n ref={fileInputRef}\n onChange={(e) => onFileChange(e)}\n />\n {props.children({ onClick })}\n </>\n );\n}\n"],"names":[],"mappings":";;;;AAUM,SAAU,gBAAgB,CAAC,KAA4B,EAAA;AAC3D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAEpD,SAAS,OAAO,CAAC,CAAmB,EAAA;;QAClC,SAAS,CAAC,CAAC,CAAC,CAAC;AACb,QAAA,CAAA,EAAA,GAAA,YAAY,CAAC,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAK,EAAE,CAAC;KAC/B;IAED,SAAS,YAAY,CAAC,CAAoB,EAAA;QACxC,SAAS,CAAC,CAAC,CAAC,CAAC;AACb,QAAA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KAAA,CAAA,GAAA,EAAA,CAAA,IAAI,CAAC,CAAC;AAC5C,SAAC,CAAC,CAAC;KACN;AAED,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;AACE,QAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,IAAI,EAAC,MAAM,EAAA,aAAA,EACC,mBAAmB,EAC/B,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,EAChC,CAAA;QACD,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAC3B,EACH;AACJ;;;;"}
1
+ {"version":3,"file":"AttachmentButton.js","sources":["../../src/AttachmentButton.tsx"],"sourcesContent":["import { Attachment, Binary, OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useRef } from 'react';\nimport { useMedplum } from './MedplumProvider';\nimport { killEvent } from './utils/dom';\n\nexport interface AttachmentButtonProps {\n onUpload: (attachment: Attachment) => void;\n onUploadStart?: () => void;\n onUploadProgress?: (e: ProgressEvent) => void;\n children(props: { onClick(e: React.MouseEvent): void }): React.ReactNode;\n}\n\nexport function AttachmentButton(props: AttachmentButtonProps): JSX.Element {\n const medplum = useMedplum();\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n function onClick(e: React.MouseEvent): void {\n killEvent(e);\n fileInputRef.current?.click();\n }\n\n function onFileChange(e: React.ChangeEvent): void {\n killEvent(e);\n const files = (e.target as HTMLInputElement).files;\n if (files) {\n Array.from(files).forEach(processFile);\n }\n }\n\n /**\n * Processes a single file.\n *\n * @param {File} file The file descriptor.\n */\n function processFile(file: File): void {\n if (!file) {\n return;\n }\n\n const fileName = file.name;\n if (!fileName) {\n return;\n }\n\n if (props.onUploadStart) {\n props.onUploadStart();\n }\n\n const filename = file.name;\n const contentType = file.type || 'application/octet-stream';\n medplum\n .createBinary(file, filename, contentType, props.onUploadProgress)\n .then((binary: Binary) => {\n props.onUpload({\n contentType: binary.contentType,\n url: binary.url,\n title: filename,\n });\n })\n .catch((outcome: OperationOutcome) => {\n alert(outcome?.issue?.[0]?.details?.text);\n });\n }\n\n return (\n <>\n <input\n type=\"file\"\n data-testid=\"upload-file-input\"\n style={{ display: 'none' }}\n ref={fileInputRef}\n onChange={(e) => onFileChange(e)}\n />\n {props.children({ onClick })}\n </>\n );\n}\n"],"names":[],"mappings":";;;;AAYM,SAAU,gBAAgB,CAAC,KAA4B,EAAA;AAC3D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAEpD,SAAS,OAAO,CAAC,CAAmB,EAAA;;QAClC,SAAS,CAAC,CAAC,CAAC,CAAC;AACb,QAAA,CAAA,EAAA,GAAA,YAAY,CAAC,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAK,EAAE,CAAC;KAC/B;IAED,SAAS,YAAY,CAAC,CAAoB,EAAA;QACxC,SAAS,CAAC,CAAC,CAAC,CAAC;AACb,QAAA,MAAM,KAAK,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;AACnD,QAAA,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACxC,SAAA;KACF;AAED;;;;AAIG;IACH,SAAS,WAAW,CAAC,IAAU,EAAA;QAC7B,IAAI,CAAC,IAAI,EAAE;YACT,OAAO;AACR,SAAA;AAED,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;AACR,SAAA;QAED,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,KAAK,CAAC,aAAa,EAAE,CAAC;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Y,CAAC,CAAC,CAAC,EAChC,CAAA;QACD,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAC3B,EACH;AACJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { Stack } from '@mantine/core';
1
2
  import { globalSchema, getPropertyDisplayName } from '@medplum/core';
2
3
  import React, { useState } from 'react';
3
4
  import { CheckboxFormSection } from './CheckboxFormSection.js';
@@ -24,7 +25,7 @@ function BackboneElementInput(props) {
24
25
  "\u00A0not implemented");
25
26
  }
26
27
  const typedValue = { type: typeName, value };
27
- return (React.createElement(React.Fragment, null, Object.entries(typeSchema.properties).map((entry) => {
28
+ return (React.createElement(Stack, null, Object.entries(typeSchema.properties).map((entry) => {
28
29
  const key = entry[0];
29
30
  if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {
30
31
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"BackboneElementInput.js","sources":["../../src/BackboneElementInput.tsx"],"sourcesContent":["import { getPropertyDisplayName, globalSchema } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { CheckboxFormSection } from './CheckboxFormSection';\nimport { DEFAULT_IGNORED_PROPERTIES } from './constants';\nimport { FormSection } from './FormSection';\nimport { setPropertyValue } from './ResourceForm';\nimport { getValueAndType } from './ResourcePropertyDisplay';\nimport { ResourcePropertyInput } from './ResourcePropertyInput';\n\nexport interface BackboneElementInputProps {\n typeName: string;\n defaultValue?: any;\n outcome?: OperationOutcome;\n onChange?: (value: any) => void;\n}\n\nexport function BackboneElementInput(props: BackboneElementInputProps): JSX.Element {\n const [value, setValue] = useState<any>(props.defaultValue ?? {});\n\n function setValueWrapper(newValue: any): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n const typeName = props.typeName;\n const typeSchema = globalSchema.types[typeName];\n if (!typeSchema) {\n return <div>{typeName}&nbsp;not implemented</div>;\n }\n\n const typedValue = { type: typeName, value };\n\n return (\n <>\n {Object.entries(typeSchema.properties).map((entry) => {\n const key = entry[0];\n if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {\n return null;\n }\n const property = entry[1];\n if (!property.type) {\n return null;\n }\n\n const [propertyValue, propertyType] = getValueAndType(typedValue, key);\n\n if (property.type.length === 1 && property.type[0].code === 'boolean') {\n return (\n <CheckboxFormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n htmlFor={key}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n outcome={props.outcome}\n onChange={(newValue: any, propName?: string) => {\n setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));\n }}\n />\n </CheckboxFormSection>\n );\n }\n\n return (\n <FormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n htmlFor={key}\n outcome={props.outcome}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n outcome={props.outcome}\n onChange={(newValue: any, propName?: string) => {\n setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));\n }}\n />\n </FormSection>\n );\n })}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAiBM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;;AACnE,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAM,CAAA,EAAA,GAAA,KAAK,CAAC,YAAY,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,CAAC,CAAC;IAElE,SAAS,eAAe,CAAC,QAAa,EAAA;QACpC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,SAAA;KACF;AAED,IAAA,MAAM,QAAQ,GAAG,K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stack } from '@mantine/core';\nimport { getPropertyDisplayName, globalSchema } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { CheckboxFormSection } from './CheckboxFormSection';\nimport { DEFAULT_IGNORED_PROPERTIES } from './constants';\nimport { FormSection } from './FormSection';\nimport { setPropertyValue } from './ResourceForm';\nimport { getValueAndType } from './ResourcePropertyDisplay';\nimport { ResourcePropertyInput } from './ResourcePropertyInput';\n\nexport interface BackboneElementInputProps {\n typeName: string;\n defaultValue?: any;\n outcome?: OperationOutcome;\n onChange?: (value: any) => void;\n}\n\nexport function BackboneElementInput(props: BackboneElementInputProps): JSX.Element {\n const [value, setValue] = useState<any>(props.defaultValue ?? {});\n\n function setValueWrapper(newValue: any): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n const typeName = props.typeName;\n const typeSchema = globalSchema.types[typeName];\n if (!typeSchema) {\n return <div>{typeName}&nbsp;not implemented</div>;\n }\n\n const typedValue = { type: typeName, value };\n\n return (\n <Stack>\n {Object.entries(typeSchema.properties).map((entry) => {\n const key = entry[0];\n if (key === 'id' || DEFAULT_IGNORED_PROPERTIES.indexOf(key) >= 0) {\n return null;\n }\n const property = entry[1];\n if (!property.type) {\n return null;\n }\n\n const [propertyValue, propertyType] = getValueAndType(typedValue, key);\n\n if (property.type.length === 1 && property.type[0].code === 'boolean') {\n return (\n <CheckboxFormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n htmlFor={key}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n outcome={props.outcome}\n onChange={(newValue: any, propName?: string) => {\n setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));\n }}\n />\n </CheckboxFormSection>\n );\n }\n\n return (\n <FormSection\n key={key}\n title={getPropertyDisplayName(key)}\n description={property.definition}\n htmlFor={key}\n outcome={props.outcome}\n >\n <ResourcePropertyInput\n property={property}\n name={key}\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n outcome={props.outcome}\n onChange={(newValue: any, propName?: string) => {\n setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));\n }}\n />\n </FormSection>\n );\n })}\n </Stack>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;AAkBM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;;AACnE,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAM,CAAA,EAAA,GAAA,KAAK,CAAC,YAAY,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,CAAC,CAAC;IAElE,SAAS,eAAe,CAAC,QAAa,EAAA;QACpC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,SAAA;KACF;AAED,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAChC,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;YAAM,QAAQ;oCAA4B,CAAC;AACnD,KAAA;IAED,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAE7C,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,KAAK,QACH,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAI;AACnD,QAAA,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACrB,QAAA,IAAI,GAAG,KAAK,IAAI,IAAI,0BAA0B,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AAChE,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AE,GAAG,EACZ,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA;AAEtB,YAAA,KAAA,CAAA,aAAA,CAAC,qBAAqB,EAAA,EACpB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,aAAa,EAC3B,mBAAmB,EAAE,YAAY,EACjC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,CAAC,QAAa,EAAE,QAAiB,KAAI;oBAC7C,eAAe,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAA,KAAA,CAAA,GAAR,QAAQ,GAAI,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;iBACpF,EAAA,CACD,CACU,EACd;KACH,CAAC,CACI,EACR;AACJ;;;;"}
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { Slot } from '@medplum/fhirtypes';
3
- import './CalendarInput.css';
4
3
  export interface CalendarInputProps {
5
4
  slots: Slot[];
6
5
  onChangeMonth: (date: Date) => void;
@@ -1,6 +1,42 @@
1
- import { Group, Button } from '@mantine/core';
1
+ import { createStyles, Group, Button } from '@mantine/core';
2
2
  import React, { useState, useMemo } from 'react';
3
3
 
4
+ const useStyles = createStyles((theme) => ({
5
+ table: {
6
+ width: 350,
7
+ '& th': {
8
+ fontWeight: 'normal',
9
+ fontSize: 11,
10
+ padding: 8,
11
+ textAlign: 'center',
12
+ },
13
+ '& td': {
14
+ padding: '2px 4px',
15
+ },
16
+ '& td button': {
17
+ width: 44,
18
+ height: 44,
19
+ color: theme.colors[theme.primaryColor][5],
20
+ fontSize: 16,
21
+ fontWeight: 500,
22
+ textAlign: 'center',
23
+ padding: 0,
24
+ backgroundColor: theme.colors[theme.primaryColor][0],
25
+ border: 0,
26
+ borderRadius: '50%',
27
+ cursor: 'pointer',
28
+ },
29
+ '& td button:hover': {
30
+ backgroundColor: theme.colors[theme.primaryColor][1],
31
+ },
32
+ '& td button:disabled': {
33
+ backgroundColor: 'transparent',
34
+ cursor: 'default',
35
+ color: theme.colors.gray[4],
36
+ fontWeight: 'normal',
37
+ },
38
+ },
39
+ }));
4
40
  /**
5
41
  * Returns a month display string (e.g. "January 2020").
6
42
  * @param date Any date within the month.
@@ -10,6 +46,7 @@ function getMonthString(date) {
10
46
  return date.toLocaleString('default', { month: 'long' }) + ' ' + date.getFullYear();
11
47
  }
12
48
  function CalendarInput(props) {
49
+ const { classes } = useStyles();
13
50
  const { onChangeMonth, onClick } = props;
14
51
  const [month, setMonth] = useState(getStartMonth);
15
52
  function moveMonth(delta) {
@@ -27,7 +64,7 @@ function CalendarInput(props) {
27
64
  React.createElement(Group, { position: "right", spacing: "xs" },
28
65
  React.createElement(Button, { variant: "outline", "aria-label": "Previous month", onClick: () => moveMonth(-1) }, "<"),
29
66
  React.createElement(Button, { variant: "outline", "aria-label": "Next month", onClick: () => moveMonth(1) }, ">"))),
30
- React.createElement("table", { className: "medplum-calendar-table" },
67
+ React.createElement("table", { className: classes.table },
31
68
  React.createElement("thead", null,
32
69
  React.createElement("tr", null,
33
70
  React.createElement("th", null, "SUN"),
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarInput.js","sources":["../../src/CalendarInput.tsx"],"sourcesContent":["import { Button, Group } from '@mantine/core';\nimport { Slot } from '@medplum/fhirtypes';\nimport React, { useMemo, useState } from 'react';\n\nimport './CalendarInput.css';\n\nexport interface CalendarInputProps {\n slots: Slot[];\n onChangeMonth: (date: Date) => void;\n onClick: (date: Date) => void;\n}\n\n/**\n * Returns a month display string (e.g. \"January 2020\").\n * @param date Any date within the month.\n * @returns The month display string (e.g. \"January 2020\")\n */\nexport function getMonthString(date: Date): string {\n return date.toLocaleString('default', { month: 'long' }) + ' ' + date.getFullYear();\n}\n\ninterface CalendarCell {\n date: Date;\n available: boolean;\n}\n\ntype OptionalCalendarCell = CalendarCell | undefined;\n\nexport function CalendarInput(props: CalendarInputProps): JSX.Element {\n const { onChangeMonth, onClick } = props;\n const [month, setMonth] = useState<Date>(getStartMonth);\n\n function moveMonth(delta: number): void {\n setMonth((currMonth) => {\n const newMonth = new Date(currMonth.getTime());\n newMonth.setMonth(currMonth.getMonth() + delta);\n onChangeMonth(newMonth);\n return newMonth;\n });\n }\n\n const grid = useMemo(() => buildGrid(month, props.slots), [month, props.slots]);\n\n return (\n <div>\n <Group position=\"apart\" spacing=\"xs\" grow noWrap>\n <p style={{ flex: 1 }}>{getMonthString(month)}</p>\n <Group position=\"right\" spacing=\"xs\">\n <Button variant=\"outline\" aria-label=\"Previous month\" onClick={() => moveMonth(-1)}>\n &lt;\n </Button>\n <Button variant=\"outline\" aria-label=\"Next month\" onClick={() => moveMonth(1)}>\n &gt;\n </Button>\n </Group>\n </Group>\n <table className=\"medplum-calendar-table\">\n <thead>\n <tr>\n <th>SUN</th>\n <th>MON</th>\n <th>TUE</th>\n <th>WED</th>\n <th>THU</th>\n <th>FRI</th>\n <th>SAT</th>\n </tr>\n </thead>\n <tbody>\n {grid.map((week, weekIndex) => (\n <tr key={'week-' + weekIndex}>\n {week.map((day, dayIndex) => (\n <td key={'day-' + dayIndex}>\n {day && (\n <Button disabled={!day.available} onClick={() => onClick(day.date)}>\n {day.date.getDate()}\n </Button>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nexport function getStartMonth(): Date {\n const result = new Date();\n result.setDate(1);\n result.setHours(0, 0, 0, 0);\n return result;\n}\n\nfunction buildGrid(startDate: Date, slots: Slot[]): OptionalCalendarCell[][] {\n const d = new Date(startDate.getFullYear(), startDate.getMonth());\n const grid: OptionalCalendarCell[][] = [];\n let row: OptionalCalendarCell[] = [];\n\n // Fill leading empty days\n for (let i = 0; i < d.getDay(); i++) {\n row.push(undefined);\n }\n\n while (d.getMonth() === startDate.getMonth()) {\n row.push({\n date: new Date(d.getTime()),\n available: isDayAvailable(d, slots),\n });\n\n if (d.getDay() === 6) {\n grid.push(row);\n row = [];\n }\n\n d.setDate(d.getDate() + 1);\n }\n\n // Fill trailing empty days\n if (d.getDay() !== 0) {\n for (let i = d.getDay(); i < 7; i++) {\n row.push(undefined);\n }\n grid.push(row);\n }\n\n return grid;\n}\n\n/**\n * Returns true if the given date is available for booking.\n * @param day The day to check.\n * @param slots The list of available slots.\n * @returns True if there are any available slots for the day.\n */\nfunction isDayAvailable(day: Date, slots: Slot[]): boolean {\n // Note that slot start and end time may or may not be in UTC.\n for (const slot of slots) {\n const slotStart = new Date(slot.start as string);\n if (\n slotStart.getFullYear() === day.getFullYear() &&\n slotStart.getMonth() === day.getMonth() &&\n slotStart.getDate() === day.getDate()\n ) {\n return true;\n }\n }\n\n return false;\n}\n"],"names":[],"mappings":";;;AAYA;;;;AAIG;AACG,SAAU,cAAc,CAAC,IAAU,EAAA;AACvC,IAAA,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;AACtF,CAAC;AASK,SAAU,aAAa,CAAC,KAAyB,EAAA;AACrD,IAAA,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAO,aAAa,CAAC,CAAC;IAExD,SAAS,SAAS,CAAC,KAAa,EAAA;AAC9B,QAAA,QAAQ,CAAC,CAAC,SAAS,KAAI;YACrB,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/C,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC;YAChD,aAAa,CAAC,QAAQ,CAAC,CAAC;AACxB,YAAA,OAAO,QAAQ,CAAC;AAClB,SAAC,CAAC,CAAC;KACJ;IAED,MAAM,IAAI,GAAG,O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,SAAS,cAAc,CAAC,GAAS,EAAE,KAAa,EAAA;;AAE9C,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;QACjD,IACE,SAAS,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,WAAW,EAAE;AAC7C,YAAA,SAAS,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,QAAQ,EAAE;YACvC,SAAS,CAAC,OAAO,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,EACrC;AACA,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;AACF,KAAA;AAED,IAAA,OAAO,KAAK,CAAC;AACf;;;;"}
1
+ {"version":3,"file":"CalendarInput.js","sources":["../../src/CalendarInput.tsx"],"sourcesContent":["import { Button, createStyles, Group } from '@mantine/core';\nimport { Slot } from '@medplum/fhirtypes';\nimport React, { useMemo, useState } from 'react';\n\nconst useStyles = createStyles((theme) => ({\n table: {\n width: 350,\n\n '& th': {\n fontWeight: 'normal',\n fontSize: 11,\n padding: 8,\n textAlign: 'center',\n },\n\n '& td': {\n padding: '2px 4px',\n },\n\n '& td button': {\n width: 44,\n height: 44,\n color: theme.colors[theme.primaryColor][5],\n fontSize: 16,\n fontWeight: 500,\n textAlign: 'center',\n padding: 0,\n backgroundColor: theme.colors[theme.primaryColor][0],\n border: 0,\n borderRadius: '50%',\n cursor: 'pointer',\n },\n\n '& td button:hover': {\n backgroundColor: theme.colors[theme.primaryColor][1],\n },\n\n '& td button:disabled': {\n backgroundColor: 'transparent',\n cursor: 'default',\n color: theme.colors.gray[4],\n fontWeight: 'normal',\n },\n },\n}));\n\nexport interface CalendarInputProps {\n slots: Slot[];\n onChangeMonth: (date: Date) => void;\n onClick: (date: Date) => void;\n}\n\n/**\n * Returns a month display string (e.g. \"January 2020\").\n * @param date Any date within the month.\n * @returns The month display string (e.g. \"January 2020\")\n */\nexport function getMonthString(date: Date): string {\n return date.toLocaleString('default', { month: 'long' }) + ' ' + date.getFullYear();\n}\n\ninterface CalendarCell {\n date: Date;\n available: boolean;\n}\n\ntype OptionalCalendarCell = CalendarCell | undefined;\n\nexport function CalendarInput(props: CalendarInputProps): JSX.Element {\n const { classes } = useStyles();\n const { onChangeMonth, onClick } = props;\n const [month, setMonth] = useState<Date>(getStartMonth);\n\n function moveMonth(delta: number): void {\n setMonth((currMonth) => {\n const newMonth = new Date(currMonth.getTime());\n newMonth.setMonth(currMonth.getMonth() + delta);\n onChangeMonth(newMonth);\n return newMonth;\n });\n }\n\n const grid = useMemo(() => buildGrid(month, props.slots), [month, props.slots]);\n\n return (\n <div>\n <Group position=\"apart\" spacing=\"xs\" grow noWrap>\n <p style={{ flex: 1 }}>{getMonthString(month)}</p>\n <Group position=\"right\" spacing=\"xs\">\n <Button variant=\"outline\" aria-label=\"Previous month\" onClick={() => moveMonth(-1)}>\n &lt;\n </Button>\n <Button variant=\"outline\" aria-label=\"Next month\" onClick={() => moveMonth(1)}>\n &gt;\n </Button>\n </Group>\n </Group>\n <table className={classes.table}>\n <thead>\n <tr>\n <th>SUN</th>\n <th>MON</th>\n <th>TUE</th>\n <th>WED</th>\n <th>THU</th>\n <th>FRI</th>\n <th>SAT</th>\n </tr>\n </thead>\n <tbody>\n {grid.map((week, weekIndex) => (\n <tr key={'week-' + weekIndex}>\n {week.map((day, dayIndex) => (\n <td key={'day-' + dayIndex}>\n {day && (\n <Button disabled={!day.available} onClick={() => onClick(day.date)}>\n {day.date.getDate()}\n </Button>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nexport function getStartMonth(): Date {\n const result = new Date();\n result.setDate(1);\n result.setHours(0, 0, 0, 0);\n return result;\n}\n\nfunction buildGrid(startDate: Date, slots: Slot[]): OptionalCalendarCell[][] {\n const d = new Date(startDate.getFullYear(), startDate.getMonth());\n const grid: OptionalCalendarCell[][] = [];\n let row: OptionalCalendarCell[] = [];\n\n // Fill leading empty days\n for (let i = 0; i < d.getDay(); i++) {\n row.push(undefined);\n }\n\n while (d.getMonth() === startDate.getMonth()) {\n row.push({\n date: new Date(d.getTime()),\n available: isDayAvailable(d, slots),\n });\n\n if (d.getDay() === 6) {\n grid.push(row);\n row = [];\n }\n\n d.setDate(d.getDate() + 1);\n }\n\n // Fill trailing empty days\n if (d.getDay() !== 0) {\n for (let i = d.getDay(); i < 7; i++) {\n row.push(undefined);\n }\n grid.push(row);\n }\n\n return grid;\n}\n\n/**\n * Returns true if the given date is available for booking.\n * @param day The day to check.\n * @param slots The list of available slots.\n * @returns True if there are any available slots for the day.\n */\nfunction isDayAvailable(day: Date, slots: Slot[]): boolean {\n // Note that slot start and end time may or may not be in UTC.\n for (const slot of slots) {\n const slotStart = new Date(slot.start as string);\n if (\n slotStart.getFullYear() === day.getFullYear() &&\n slotStart.getMonth() === day.getMonth() &&\n slotStart.getDate() === day.getDate()\n ) {\n return true;\n }\n }\n\n return false;\n}\n"],"names":[],"mappings":";;;AAIA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,KAAK,EAAE;AACL,QAAA,KAAK,EAAE,GAAG;AAEV,QAAA,MAAM,EAAE;AACN,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,OAAO,EAAE,CAAC;AACV,YAAA,SAAS,EAAE,QAAQ;AACpB,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AAED,QAAA,aAAa,EAAE;AACb,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAC1C,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,UAAU,EAAE,GAAG;AACf,YAAA,SAAS,EAAE,QAAQ;AACnB,YAAA,OAAO,EA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CAAC,CAAC;AACrB,SAAA;AACD,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChB,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;AAKG;AACH,SAAS,cAAc,CAAC,GAAS,EAAE,KAAa,EAAA;;AAE9C,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;QACjD,IACE,SAAS,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,WAAW,EAAE;AAC7C,YAAA,SAAS,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,QAAQ,EAAE;YACvC,SAAS,CAAC,OAAO,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,EACrC;AACA,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;AACF,KAAA;AAED,IAAA,OAAO,KAAK,CAAC;AACf;;;;"}
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './CheckboxFormSection.css';
3
2
  export interface CheckboxFormSectionProps {
4
3
  htmlFor?: string;
5
4
  title?: string;
@@ -1,11 +1,11 @@
1
+ import { Group, Input } from '@mantine/core';
1
2
  import React from 'react';
2
3
 
3
4
  function CheckboxFormSection(props) {
4
- return (React.createElement("div", { className: "medplum-checkbox-form-section" },
5
- React.createElement("div", { className: "medplum-checkbox-form-section-checkbox-container" }, props.children),
6
- React.createElement("div", { className: "medplum-checkbox-form-section-details-container" },
7
- React.createElement("label", { htmlFor: props.htmlFor }, props.title),
8
- React.createElement("p", null, props.description))));
5
+ return (React.createElement(Group, { noWrap: true },
6
+ React.createElement("div", null, props.children),
7
+ React.createElement("div", null,
8
+ React.createElement(Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description }, (() => null)()))));
9
9
  }
10
10
 
11
11
  export { CheckboxFormSection };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxFormSection.js","sources":["../../src/CheckboxFormSection.tsx"],"sourcesContent":["import React from 'react';\nimport './CheckboxFormSection.css';\n\nexport interface CheckboxFormSectionProps {\n htmlFor?: string;\n title?: string;\n description?: string;\n children?: React.ReactNode;\n}\n\nexport function CheckboxFormSection(props: CheckboxFormSectionProps): JSX.Element {\n return (\n <div className=\"medplum-checkbox-form-section\">\n <div className=\"medplum-checkbox-form-section-checkbox-container\">{props.children}</div>\n <div className=\"medplum-checkbox-form-section-details-container\">\n <label htmlFor={props.htmlFor}>{props.title}</label>\n <p>{props.description}</p>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;AAUM,SAAU,mBAAmB,CAAC,KAA+B,EAAA;AACjE,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,+BAA+B,EAAA;AAC5C,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kDAAkD,IAAE,KAAK,CAAC,QAAQ,CAAO;QACxF,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,iDAAiD,EAAA;YAC9D,KAAO,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,OAAO,EAAE,KAAK,CAAC,OAAO,EAAG,EAAA,KAAK,CAAC,KAAK,CAAS;AACpD,YAAA,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,IAAA,EAAI,KAAK,CAAC,WAAW,CAAK,CACtB,CACF,EACN;AACJ;;;;"}
1
+ {"version":3,"file":"CheckboxFormSection.js","sources":["../../src/CheckboxFormSection.tsx"],"sourcesContent":["import { Group, Input } from '@mantine/core';\nimport React from 'react';\n\nexport interface CheckboxFormSectionProps {\n htmlFor?: string;\n title?: string;\n description?: string;\n children?: React.ReactNode;\n}\n\nexport function CheckboxFormSection(props: CheckboxFormSectionProps): JSX.Element {\n return (\n <Group noWrap>\n <div>{props.children}</div>\n <div>\n <Input.Wrapper id={props.htmlFor} label={props.title} description={props.description}>\n {(() => null)()}\n </Input.Wrapper>\n </div>\n </Group>\n );\n}\n"],"names":[],"mappings":";;;AAUM,SAAU,mBAAmB,CAAC,KAA+B,EAAA;AACjE,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,MAAM,EAAA,IAAA,EAAA;QACX,KAAM,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAA,KAAK,CAAC,QAAQ,CAAO;AAC3B,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;AACE,YAAA,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAO,EAAA,EAAC,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAA,EACjF,CAAC,MAAM,IAAI,GAAG,CACD,CACZ,CACA,EACR;AACJ;;;;"}
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './DescriptionList.css';
3
2
  export interface DescriptionListProps {
4
3
  children: React.ReactNode;
5
4
  compact?: boolean;
@@ -1,7 +1,29 @@
1
+ import { createStyles } from '@mantine/core';
1
2
  import React from 'react';
2
3
 
4
+ const useStyles = createStyles((theme) => ({
5
+ root: {
6
+ display: 'grid',
7
+ gridTemplateColumns: '30% 70%',
8
+ margin: 0,
9
+ '& > dt, & > dd': {
10
+ padding: `${theme.spacing.sm}px ${theme.spacing.sm}px`,
11
+ borderTop: `0.1px solid ${theme.colors.gray[3]}`,
12
+ margin: 0,
13
+ },
14
+ },
15
+ compact: {
16
+ gridTemplateColumns: '20% 80%',
17
+ '& > dt, & > dd': {
18
+ padding: `0 ${theme.spacing.xs}px ${theme.spacing.xs}px 0`,
19
+ border: 0,
20
+ },
21
+ },
22
+ }));
3
23
  function DescriptionList(props) {
4
- return React.createElement("dl", { className: 'medplum-description-list' + (props.compact ? ' compact' : '') }, props.children);
24
+ const { children, compact } = props;
25
+ const { classes, cx } = useStyles();
26
+ return React.createElement("dl", { className: cx(classes.root, { [classes.compact]: compact }) }, children);
5
27
  }
6
28
  function DescriptionListEntry(props) {
7
29
  return (React.createElement(React.Fragment, null,
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionList.js","sources":["../../src/DescriptionList.tsx"],"sourcesContent":["import React from 'react';\nimport './DescriptionList.css';\n\nexport interface DescriptionListProps {\n children: React.ReactNode;\n compact?: boolean;\n}\n\nexport function DescriptionList(props: DescriptionListProps): JSX.Element {\n return <dl className={'medplum-description-list' + (props.compact ? ' compact' : '')}>{props.children}</dl>;\n}\n\nexport interface DescriptionListEntryProps {\n term: string;\n children: React.ReactNode;\n}\n\nexport function DescriptionListEntry(props: DescriptionListEntryProps): JSX.Element {\n return (\n <>\n <dt>{props.term}</dt>\n <dd>{props.children}</dd>\n </>\n );\n}\n"],"names":[],"mappings":";;AAQM,SAAU,eAAe,CAAC,KAA2B,EAAA;IACzD,OAAO,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,0BAA0B,IAAI,KAAK,CAAC,OAAO,GAAG,UAAU,GAAG,EAAE,CAAC,IAAG,KAAK,CAAC,QAAQ,CAAM,CAAC;AAC9G,CAAC;AAOK,SAAU,oBAAoB,CAAC,KAAgC,EAAA;AACnE,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;QACE,KAAK,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,KAAK,CAAC,IAAI,CAAM;AACrB,QAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAK,KAAK,CAAC,QAAQ,CAAM,CACxB,EACH;AACJ;;;;"}
1
+ {"version":3,"file":"DescriptionList.js","sources":["../../src/DescriptionList.tsx"],"sourcesContent":["import { createStyles } from '@mantine/core';\nimport React from 'react';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n display: 'grid',\n gridTemplateColumns: '30% 70%',\n margin: 0,\n\n '& > dt, & > dd': {\n padding: `${theme.spacing.sm}px ${theme.spacing.sm}px`,\n borderTop: `0.1px solid ${theme.colors.gray[3]}`,\n margin: 0,\n },\n },\n\n compact: {\n gridTemplateColumns: '20% 80%',\n\n '& > dt, & > dd': {\n padding: `0 ${theme.spacing.xs}px ${theme.spacing.xs}px 0`,\n border: 0,\n },\n },\n}));\n\nexport interface DescriptionListProps {\n children: React.ReactNode;\n compact?: boolean;\n}\n\nexport function DescriptionList(props: DescriptionListProps): JSX.Element {\n const { children, compact } = props;\n const { classes, cx } = useStyles();\n return <dl className={cx(classes.root, { [classes.compact]: compact })}>{children}</dl>;\n}\n\nexport interface DescriptionListEntryProps {\n term: string;\n children: React.ReactNode;\n}\n\nexport function DescriptionListEntry(props: DescriptionListEntryProps): JSX.Element {\n return (\n <>\n <dt>{props.term}</dt>\n <dd>{props.children}</dd>\n </>\n );\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,mBAAmB,EAAE,SAAS;AAC9B,QAAA,MAAM,EAAE,CAAC;AAET,QAAA,gBAAgB,EAAE;AAChB,YAAA,OAAO,EAAE,CAAA,EAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAA,GAAA,EAAM,KAAK,CAAC,OAAO,CAAC,EAAE,CAAI,EAAA,CAAA;YACtD,SAAS,EAAE,CAAe,YAAA,EAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAA;AAChD,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACF,KAAA;AAED,IAAA,OAAO,EAAE;AACP,QAAA,mBAAmB,EAAE,SAAS;AAE9B,QAAA,gBAAgB,EAAE;AAChB,YAAA,OAAO,EAAE,CAAA,EAAA,EAAK,KAAK,CAAC,OAAO,CAAC,EAAE,CAAA,GAAA,EAAM,KAAK,CAAC,OAAO,CAAC,EAAE,CAAM,IAAA,CAAA;AAC1D,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACF,KAAA;AACF,CAAA,CAAC,CAAC,CAAC;AAOE,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,SAAS,EAAE,CAAC;IACpC,OAAO,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,EAAA,EAAG,QAAQ,CAAM,CAAC;AAC1F,CAAC;AAOK,SAAU,oBAAoB,CAAC,KAAgC,EAAA;AACnE,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;QACE,KAAK,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,KAAK,CAAC,IAAI,CAAM;AACrB,QAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAK,KAAK,CAAC,QAAQ,CAAM,CACxB,EACH;AACJ;;;;"}
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { DiagnosticReport, Observation, Reference } from '@medplum/fhirtypes';
3
- import './DiagnosticReportDisplay.css';
4
3
  export interface DiagnosticReportDisplayProps {
5
4
  value?: DiagnosticReport | Reference<DiagnosticReport>;
6
5
  }
@@ -1,3 +1,4 @@
1
+ import { createStyles, Stack, Title, Group, Text } from '@mantine/core';
1
2
  import { formatDateTime, capitalize } from '@medplum/core';
2
3
  import React from 'react';
3
4
  import { CodeableConceptDisplay } from './CodeableConceptDisplay.js';
@@ -6,8 +7,26 @@ import { QuantityDisplay } from './QuantityDisplay.js';
6
7
  import { RangeDisplay } from './RangeDisplay.js';
7
8
  import { ResourceBadge } from './ResourceBadge.js';
8
9
  import { useResource } from './useResource.js';
9
- import { Table } from '@mantine/core';
10
10
 
11
+ const useStyles = createStyles((theme) => ({
12
+ table: {
13
+ border: `0.1px solid ${theme.colors.gray[5]}`,
14
+ borderCollapse: 'collapse',
15
+ '& td, & th': {
16
+ border: `0.1px solid ${theme.colors.gray[5]}`,
17
+ padding: 4,
18
+ },
19
+ },
20
+ criticalRow: {
21
+ background: theme.colorScheme === 'dark' ? theme.colors.red[7] : theme.colors.red[1],
22
+ border: `0.1px solid ${theme.colors.red[5]}`,
23
+ color: theme.colors.red[5],
24
+ fontWeight: 500,
25
+ '& td': {
26
+ border: `0.1px solid ${theme.colors.red[5]}`,
27
+ },
28
+ },
29
+ }));
11
30
  function DiagnosticReportDisplay(props) {
12
31
  var _a, _b;
13
32
  const diagnosticReport = useResource(props.value);
@@ -27,30 +46,31 @@ function DiagnosticReportDisplay(props) {
27
46
  textContent += note.text + '\n\n';
28
47
  }
29
48
  }
30
- return (React.createElement("div", { className: "medplum-diagnostic-report" },
31
- React.createElement("h1", null, "Diagnostic Report"),
32
- React.createElement("div", { className: "medplum-diagnostic-report-header" },
33
- diagnosticReport.subject && (React.createElement("dl", null,
34
- React.createElement("dt", null, "Subject"),
35
- React.createElement("dd", null,
49
+ return (React.createElement(Stack, null,
50
+ React.createElement(Title, null, "Diagnostic Report"),
51
+ React.createElement(Group, { mt: "md", spacing: 30 },
52
+ diagnosticReport.subject && (React.createElement("div", null,
53
+ React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Subject"),
54
+ React.createElement(Text, null,
36
55
  React.createElement(ResourceBadge, { value: diagnosticReport.subject, link: true })))),
37
56
  diagnosticReport.resultsInterpreter &&
38
- diagnosticReport.resultsInterpreter.map((interpreter) => (React.createElement("dl", { key: interpreter.reference },
39
- React.createElement("dt", null, "Interpreter"),
40
- React.createElement("dd", null,
57
+ diagnosticReport.resultsInterpreter.map((interpreter) => (React.createElement("div", { key: interpreter.reference },
58
+ React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Interpreter"),
59
+ React.createElement(Text, null,
41
60
  React.createElement(ResourceBadge, { value: interpreter, link: true }))))),
42
- diagnosticReport.issued && (React.createElement("dl", null,
43
- React.createElement("dt", null, "Issued"),
44
- React.createElement("dd", null, formatDateTime(diagnosticReport.issued)))),
45
- diagnosticReport.status && (React.createElement("dl", null,
46
- React.createElement("dt", null, "Status"),
47
- React.createElement("dd", null, capitalize(diagnosticReport.status))))),
61
+ diagnosticReport.issued && (React.createElement("div", null,
62
+ React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Issued"),
63
+ React.createElement(Text, null, formatDateTime(diagnosticReport.issued)))),
64
+ diagnosticReport.status && (React.createElement("div", null,
65
+ React.createElement(Text, { size: "xs", transform: "uppercase", color: "dimmed" }, "Status"),
66
+ React.createElement(Text, null, capitalize(diagnosticReport.status))))),
48
67
  diagnosticReport.result && React.createElement(ObservationTable, { value: diagnosticReport.result }),
49
68
  textContent && React.createElement("pre", null, textContent.trim())));
50
69
  }
51
70
  function ObservationTable(props) {
52
71
  var _a;
53
- return (React.createElement(Table, { withBorder: true, withColumnBorders: true },
72
+ const { classes } = useStyles();
73
+ return (React.createElement("table", { className: classes.table },
54
74
  React.createElement("thead", null,
55
75
  React.createElement("tr", null,
56
76
  React.createElement("th", null, "Test"),
@@ -60,15 +80,13 @@ function ObservationTable(props) {
60
80
  React.createElement("tbody", null, (_a = props.value) === null || _a === void 0 ? void 0 : _a.map((observation, index) => (React.createElement(ObservationRow, { key: 'obs-' + index, value: observation }))))));
61
81
  }
62
82
  function ObservationRow(props) {
83
+ const { classes, cx } = useStyles();
63
84
  const observation = useResource(props.value);
64
85
  if (!observation) {
65
86
  return null;
66
87
  }
67
- let className = undefined;
68
- if (isCritical(observation)) {
69
- className = 'medplum-critical';
70
- }
71
- return (React.createElement("tr", { className: className },
88
+ const critical = isCritical(observation);
89
+ return (React.createElement("tr", { className: cx({ [classes.criticalRow]: critical }) },
72
90
  React.createElement("td", null,
73
91
  React.createElement(MedplumLink, { to: observation },
74
92
  React.createElement(CodeableConceptDisplay, { value: observation.code }))),
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticReportDisplay.js","sources":["../../src/DiagnosticReportDisplay.tsx"],"sourcesContent":["import { capitalize, formatDateTime } 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';\nimport { MedplumLink } from './MedplumLink';\nimport { QuantityDisplay } from './QuantityDisplay';\nimport { RangeDisplay } from './RangeDisplay';\nimport { ResourceBadge } from './ResourceBadge';\nimport { useResource } from './useResource';\n\nimport { Table } from '@mantine/core';\nimport './DiagnosticReportDisplay.css';\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 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 <div className=\"medplum-diagnostic-report\">\n <h1>Diagnostic Report</h1>\n <div className=\"medplum-diagnostic-report-header\">\n {diagnosticReport.subject && (\n <dl>\n <dt>Subject</dt>\n <dd>\n <ResourceBadge value={diagnosticReport.subject} link={true} />\n </dd>\n </dl>\n )}\n {diagnosticReport.resultsInterpreter &&\n diagnosticReport.resultsInterpreter.map((interpreter) => (\n <dl key={interpreter.reference}>\n <dt>Interpreter</dt>\n <dd>\n <ResourceBadge value={interpreter} link={true} />\n </dd>\n </dl>\n ))}\n {diagnosticReport.issued && (\n <dl>\n <dt>Issued</dt>\n <dd>{formatDateTime(diagnosticReport.issued)}</dd>\n </dl>\n )}\n {diagnosticReport.status && (\n <dl>\n <dt>Status</dt>\n <dd>{capitalize(diagnosticReport.status)}</dd>\n </dl>\n )}\n </div>\n {diagnosticReport.result && <ObservationTable value={diagnosticReport.result} />}\n {textContent && <pre>{textContent.trim()}</pre>}\n </div>\n );\n}\n\nexport interface ObservationTableProps {\n value?: Observation[] | Reference<Observation>[];\n}\n\nexport function ObservationTable(props: ObservationTableProps): JSX.Element {\n return (\n <Table withBorder withColumnBorders>\n <thead>\n <tr>\n <th>Test</th>\n <th>Value</th>\n <th>Reference Range</th>\n <th>Interpretation</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 observation = useResource(props.value);\n if (!observation) {\n return null;\n }\n\n let className = undefined;\n if (isCritical(observation)) {\n className = 'medplum-critical';\n }\n\n return (\n <tr className={className}>\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 </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\n if (obs?.valueQuantity) {\n return <QuantityDisplay value={props.value?.valueQuantity} />;\n }\n\n if (obs?.valueString) {\n return <>{obs.valueString}</>;\n }\n\n if (obs && 'component' in obs && obs?.component) {\n return (\n <>\n {obs.component\n .map<React.ReactNode>((component: ObservationComponent, index: number) => (\n <ObservationValueDisplay key={`obs-${index}`} value={component} />\n ))\n .reduce((prev, curr) => [prev, ' / ', curr])}\n </>\n );\n }\n\n return null;\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 === 'RR';\n}\n"],"names":[],"mappings":";;;;;;;;;;AAuBM,SAAU,uBAAuB,CAAC,KAAmC,EAAA;;IACzE,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAA,EAAA,GAAA,gBAAgB,KAAhB,IAAA,IAAA,gBAAgB,KAAhB,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,gBAAgB,CAAE,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,gBAAgB,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;IAED,IAAI,WAAW,GAAG,EAAE,CAAC;IAErB,IAAI,gBAAgB,CAAC,aAAa,IAAI,gBAAgB,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/E,MAAM,EAAE,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC7C,QAAA,I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AAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,IAAI,CAAC;AAChE,IAAA,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC;AAC1E;;;;"}
1
+ {"version":3,"file":"DiagnosticReportDisplay.js","sources":["../../src/DiagnosticReportDisplay.tsx"],"sourcesContent":["import { createStyles, Group, Stack, Text, Title } from '@mantine/core';\nimport { capitalize, formatDateTime } 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';\nimport { MedplumLink } from './MedplumLink';\nimport { QuantityDisplay } from './QuantityDisplay';\nimport { RangeDisplay } from './RangeDisplay';\nimport { ResourceBadge } from './ResourceBadge';\nimport { useResource } from './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 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 </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 </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\n if (obs?.valueQuantity) {\n return <QuantityDisplay value={props.value?.valueQuantity} />;\n }\n\n if (obs?.valueString) {\n return <>{obs.valueString}</>;\n }\n\n if (obs && 'component' in obs && obs?.component) {\n return (\n <>\n {obs.component\n .map<React.ReactNode>((component: ObservationComponent, index: number) => (\n <ObservationValueDisplay key={`obs-${index}`} value={component} />\n ))\n .reduce((prev, curr) => [prev, ' / ', curr])}\n </>\n );\n }\n\n return null;\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 === 'RR';\n}\n"],"names":[],"mappings":";;;;;;;;;;AAiBA,MAAM,SAAS,GAAG,YAAY,C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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,CAAA,EAAA,GAAA,MAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,WAAW,CAAC,cAAc,0CAAG,CAAC,CAAC,0CAAE,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,CAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,IAAI,CAAC;AAChE,IAAA,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC;AAC1E;;;;"}
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './Document.css';
3
2
  export interface DocumentProps {
4
3
  width?: number;
5
4
  children?: React.ReactNode;
@@ -1,8 +1,13 @@
1
+ import { Container, Paper } from '@mantine/core';
1
2
  import React from 'react';
2
3
 
3
4
  function Document(props) {
4
- return (React.createElement("main", { className: "medplum-document" },
5
- React.createElement("article", { style: { maxWidth: props.width } }, props.children)));
5
+ let style = undefined;
6
+ if (props.width) {
7
+ style = { maxWidth: props.width };
8
+ }
9
+ return (React.createElement(Container, null,
10
+ React.createElement(Paper, { style: style, mx: "auto", my: "lg", p: "lg", shadow: "xs", radius: "sm", withBorder: true }, props.children)));
6
11
  }
7
12
 
8
13
  export { Document };
@@ -1 +1 @@
1
- {"version":3,"file":"Document.js","sources":["../../src/Document.tsx"],"sourcesContent":["import React from 'react';\nimport './Document.css';\n\nexport interface DocumentProps {\n width?: number;\n children?: React.ReactNode;\n}\n\nexport function Document(props: DocumentProps): JSX.Element {\n return (\n <main className=\"medplum-document\">\n <article style={{ maxWidth: props.width }}>{props.children}</article>\n </main>\n );\n}\n"],"names":[],"mappings":";;AAQM,SAAU,QAAQ,CAAC,KAAoB,EAAA;AAC3C,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,kBAAkB,EAAA;AAChC,QAAA,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAS,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,EAAA,EAAG,KAAK,CAAC,QAAQ,CAAW,CAChE,EACP;AACJ;;;;"}
1
+ {"version":3,"file":"Document.js","sources":["../../src/Document.tsx"],"sourcesContent":["import { Container, Paper } from '@mantine/core';\nimport React from 'react';\n\nexport interface DocumentProps {\n width?: number;\n children?: React.ReactNode;\n}\n\nexport function Document(props: DocumentProps): JSX.Element {\n let style: React.CSSProperties | undefined = undefined;\n if (props.width) {\n style = { maxWidth: props.width };\n }\n\n return (\n <Container>\n <Paper style={style} mx=\"auto\" my=\"lg\" p=\"lg\" shadow=\"xs\" radius=\"sm\" withBorder>\n {props.children}\n </Paper>\n </Container>\n );\n}\n"],"names":[],"mappings":";;;AAQM,SAAU,QAAQ,CAAC,KAAoB,EAAA;IAC3C,IAAI,KAAK,GAAoC,SAAS,CAAC;IACvD,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;AACnC,KAAA;IAED,QACE,oBAAC,SAAS,EAAA,IAAA;AACR,QAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAC,MAAM,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,UAAU,EAAA,IAAA,EAAA,EAC7E,KAAK,CAAC,QAAQ,CACT,CACE,EACZ;AACJ;;;;"}